diff --git a/Jenkinsfile b/Jenkinsfile index ccc6d899ae3..2ebd63f5260 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -359,7 +359,7 @@ def testJS(hrcoreFolder, java.util.LinkedHashMap extension) { // workspace, where Jenkins will read it sh """ cd $CIVICRM_EXT_ROOT/civihr/${hrcoreFolder} - gulp test --ext ${extension.folder} --reporters junit,progress || true + npx gulp test --ext ${extension.folder} --reporters junit,progress || true cd $CIVICRM_EXT_ROOT/civihr/${extension.folder} mv test-reports/*.xml $WORKSPACE/$KARMA_TESTS_REPORT_FOLDER/ || true diff --git a/bin/apply-core-fork-patch.sh b/bin/apply-core-fork-patch.sh index 17889610737..70d23373976 100755 --- a/bin/apply-core-fork-patch.sh +++ b/bin/apply-core-fork-patch.sh @@ -3,6 +3,7 @@ set -e API_URL_BASE="https://api.github.com/repos/compucorp/civicrm-core" +REPO_BASE_URL="https://github.com/compucorp/civicrm-core" LAST_COMMIT_PATCHED_FILE="core-fork-last-commit-patched.txt" PATCH_FILE="fork-patch.diff" @@ -27,7 +28,7 @@ applyPatch () { # Creates a diff patch file by sending a request to the given GitHub API url # # Globals: -# $API_URL_BASE +# $REPO_BASE_URL # $civiRoot # $PATCH_FILE # Arguments: @@ -37,7 +38,7 @@ applyPatch () { # None ####################################### createPatch () { - curl "$API_URL_BASE/compare/$1...$2" -s -H "Accept: application/vnd.github.v3.diff" > "$civiRoot/$PATCH_FILE" + curl "$REPO_BASE_URL/compare/$1...$2.diff" -s > "$civiRoot/$PATCH_FILE" } ####################################### diff --git a/bin/drush-install.sh b/bin/drush-install.sh index e1079a09a7b..356173273cb 100755 --- a/bin/drush-install.sh +++ b/bin/drush-install.sh @@ -11,7 +11,6 @@ uk.co.compucorp.civicrm.hremails ## List of extensions defining basic entity types ENTITY_EXTS=\ org.civicrm.hrbank,\ -org.civicrm.hrdemog,\ org.civicrm.hrjobcontract,\ com.civicrm.hrjobroles,\ org.civicrm.hrmed,\ diff --git a/bin/git-release.sh b/bin/git-release.sh index 8e774a84937..4cd9dfd2411 100755 --- a/bin/git-release.sh +++ b/bin/git-release.sh @@ -5,7 +5,6 @@ fileName="" ENTITY_EXTS=( hrbank \ hrcareer \ hrcase \ -hrdemog \ hrim \ hrmed \ hrprofile \ diff --git a/com.civicrm.hrjobroles/CRM/Hrjobroles/API/Query/ContactHrJobRolesSelect.php b/com.civicrm.hrjobroles/CRM/Hrjobroles/API/Query/ContactHrJobRolesSelect.php index 7c06d4d4578..b303172f6fe 100644 --- a/com.civicrm.hrjobroles/CRM/Hrjobroles/API/Query/ContactHrJobRolesSelect.php +++ b/com.civicrm.hrjobroles/CRM/Hrjobroles/API/Query/ContactHrJobRolesSelect.php @@ -126,9 +126,14 @@ private function addJoins(CRM_Utils_SQL_Select $query) { private function addWhere(CRM_Utils_SQL_Select $customQuery) { if (!empty($this->params['contact_id'])) { $conditions[] = 'jc.contact_id IN (' . implode(',' , $this->params['contact_id']) . ')'; - $customQuery->where($conditions); unset($this->params['contact_id']); } + + $today = date('Y-m-d H:i:s'); + $dateRestriction = 'a.start_date <= "' . $today . '"'; + $dateRestriction .= ' AND (a.end_date >= "' . $today . '" OR a.end_date IS NULL)'; + $conditions[] = $dateRestriction; + $customQuery->where($conditions); } /** diff --git a/com.civicrm.hrjobroles/CRM/Hrjobroles/BAO/Query.php b/com.civicrm.hrjobroles/CRM/Hrjobroles/BAO/Query.php index a7928ffa99d..4d16b43c227 100644 --- a/com.civicrm.hrjobroles/CRM/Hrjobroles/BAO/Query.php +++ b/com.civicrm.hrjobroles/CRM/Hrjobroles/BAO/Query.php @@ -70,15 +70,26 @@ public function from($name, $mode, $side) { } public function where(&$query) { - $grouping = NULL; - foreach ($query->_params as $param) { - if ($this->isAJobRoleParam($param)) { - if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) { - $query->_useDistinct = TRUE; - } - $this->whereClauseSingle($param, $query); - } + $grouping = NULL; + $filterJobRoleByDate = $filterJobRole = FALSE; + foreach ($query->_params as $param) { + if ($this->isAJobRoleParam($param)) { + $filterJobRole = TRUE; + $paramHasDate = strpos($param[0], 'date'); + if (!$filterJobRoleByDate && $paramHasDate) { + $filterJobRoleByDate = TRUE; + } + + if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) { + $query->_useDistinct = TRUE; + } + + $this->whereClauseSingle($param, $query); } + } + if (!$filterJobRoleByDate && $filterJobRole) { + $this->applyJobRoleDateFiltering($query); + } } private function isAJobRoleParam($param) { @@ -90,6 +101,18 @@ private function isAJobRoleParam($param) { return false; } + /** + * Applies date filtering for active job roles + * + * @param CRM_Contact_BAO_Query $query + */ + private function applyJobRoleDateFiltering(&$query) { + $today = date('Y-m-d H:i:s'); + $dateRestriction = 'civicrm_hrjobroles.start_date <= "' . $today . '"'; + $dateRestriction .= ' AND (civicrm_hrjobroles.end_date >= "' . $today . '" OR civicrm_hrjobroles.end_date IS NULL)'; + $query->_where[] = [$dateRestriction]; + } + private function whereClauseSingle($values, &$query) { list($name, $op, $value, $grouping, $wildcard) = $values; diff --git a/com.civicrm.hrjobroles/CRM/Hrjobroles/Test/Fabricator/HrJobRoles.php b/com.civicrm.hrjobroles/CRM/Hrjobroles/Test/Fabricator/HrJobRoles.php index 35afbfabaec..58604927e4b 100644 --- a/com.civicrm.hrjobroles/CRM/Hrjobroles/Test/Fabricator/HrJobRoles.php +++ b/com.civicrm.hrjobroles/CRM/Hrjobroles/Test/Fabricator/HrJobRoles.php @@ -16,6 +16,10 @@ class CRM_Hrjobroles_Test_Fabricator_HrJobRoles { * @throws \Exception */ public static function fabricate($params) { + if (empty($params['start_date'])) { + $params['start_date'] = date('Y-m-d H:i:s'); + } + $result = civicrm_api3( 'HrJobRoles', 'create', diff --git a/com.civicrm.hrjobroles/info.xml b/com.civicrm.hrjobroles/info.xml index 63fb7288268..bf879eb06f5 100644 --- a/com.civicrm.hrjobroles/info.xml +++ b/com.civicrm.hrjobroles/info.xml @@ -8,8 +8,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/com.civicrm.hrjobroles/tests/phpunit/api/v3/ContactHRJobRoleTest.php b/com.civicrm.hrjobroles/tests/phpunit/api/v3/ContactHRJobRoleTest.php index 950847430b5..0ea2170b8a5 100644 --- a/com.civicrm.hrjobroles/tests/phpunit/api/v3/ContactHRJobRoleTest.php +++ b/com.civicrm.hrjobroles/tests/phpunit/api/v3/ContactHRJobRoleTest.php @@ -99,9 +99,9 @@ public function testTheGetActionReturnsMultipleJobRoles() { $contact2 = ContactFabricator::fabricate(); $contract1 = HRJobContractFabricator::fabricate(['contact_id' => $contact1['id']]); $contract2 = HRJobContractFabricator::fabricate(['contact_id' => $contact2['id']]); - $jobRole1 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract1['id'],]); - $jobRole2 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract1['id'],]); - $jobRole3 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract2['id'],]); + $jobRole1 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract1['id']]); + $jobRole2 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract1['id']]); + $jobRole3 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract2['id']]); $contactJobRoles = civicrm_api3($this->entity, $this->action)['values']; diff --git a/contactaccessrights/info.xml b/contactaccessrights/info.xml index aa9488028f8..01b87a385de 100644 --- a/contactaccessrights/info.xml +++ b/contactaccessrights/info.xml @@ -8,8 +8,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/contactaccessrights/js/dist/access-rights.min.js b/contactaccessrights/js/dist/access-rights.min.js index 17f8f1760ac..1f7e61f4f19 100644 --- a/contactaccessrights/js/dist/access-rights.min.js +++ b/contactaccessrights/js/dist/access-rights.min.js @@ -1,2 +1,2 @@ -define("access-rights/apis/rights.api",[],function(){"use strict";function e(e,s,t){var n="Rights",c=t.parse(),i={contact_id:c.cid};return e.extend({getLocations:function(){return this.sendGET(n,"getlocations",i,!1)},getRegions:function(){return this.sendGET(n,"getregions",i,!1)},deleteByIds:function(e){return s.all(e.map(function(e){return this.sendPOST(n,"delete",{contact_id:c.cid,id:e})}.bind(this)))},saveRegions:function(e){return s.all(e.map(function(e){return this.sendPOST(n,"create",{contact_id:c.cid,entity_id:e,entity_type:"hrjc_region"})}.bind(this)))},saveLocations:function(e){return s.all(e.map(function(e){return this.sendPOST(n,"create",{contact_id:c.cid,entity_id:e,entity_type:"hrjc_location"})}.bind(this)))}})}return e.__name="RightsAPI",e.$inject=["api","$q","beforeHashQueryParams"],e}),define("access-rights/modules/access-rights.apis",["common/angular","common/services/api","access-rights/apis/rights.api"],function(e,s,t){"use strict";return e.module("access-rights.apis",["common.apis"]).factory(t.__name,t)}),define("access-rights/modules/access-rights.config",["common/angular"],function(e){"use strict";function s(e){e.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}e.module("access-rights.config",[]).config(s),s.$inject=["$httpProvider"]}),define("access-rights/controllers/access-rights.controller",["common/angular"],function(e){"use strict";function s(s,t){function n(){t.open({appendTo:e.element("[data-contact-actions-modals-container]"),controller:"AccessRightsModalController",controllerAs:"modalCtrl",bindToController:!0,templateUrl:CRM.vars.contactAccessRights.baseURL+"/views/access-rights-modal.html"})}var c=this;c.openModal=n}return s.__name="AccessRightsController",s.$inject=["$rootElement","$uibModal"],s}),define("access-rights/controllers/access-rights-modal.controller",["common/lodash"],function(e){"use strict";function s(s,t,n,c,i){function o(){t.dismiss("cancel")}function r(t){var n=l.originalData[t],c=l.selectedData[t],o=n.map(function(e){return e.entity_id}),r=e.difference(c,o),a=e.difference(o,c).map(function(s){return e.find(n,function(e){return e.entity_id===s}).id}),u=[];return r.length>0&&u.push(i["save"+e.capitalize(t)](r)),a.length>0&&u.push(i.deleteByIds(a)),s.all(u)}function a(){l.submitting=!0,s.all([r("regions"),r("locations")]).then(function(){t.dismiss("cancel")}).catch(function(){l.errorMsg="Error while saving data"}).finally(function(){l.submitting=!0})}var l=this;l.dataLoaded=!1,l.errorMsg="",l.submitting=!1,l.availableData={regions:[],locations:[]},l.originalData={locations:[],regions:[]},l.selectedData={locations:[],regions:[]},l.cancel=o,l.submit=a,function(){s.all([n.getAll(),c.getAll()]).then(function(e){return{regions:e[0],locations:e[1]}}).then(function(t){return s.all(e.map(t,function(s,t){return l.availableData[t]=s,i["get"+e.capitalize(t)]()}))}).then(function(e){return{regions:e[0],locations:e[1]}}).then(function(e){Object.keys(e).forEach(function(s){l.originalData[s]=e[s].values,l.selectedData[s]=e[s].values.map(function(e){return e.entity_id})})}).then(function(){l.dataLoaded=!0})}()}return s.__name="AccessRightsModalController",s.$inject=["$q","$uibModalInstance","Region","Location","Right"],s}),define("access-rights/modules/access-rights.controllers",["common/angular","access-rights/controllers/access-rights.controller","access-rights/controllers/access-rights-modal.controller"],function(e,s,t){"use strict";return e.module("access-rights.controllers",[]).controller(s.__name,s).controller(t.__name,t)}),define("access-rights/modules/access-rights.core",["common/angular","common/ui-select","common/angularBootstrap","common/modules/xeditable-civi","common/directives/loading","common/services/before-hash-query-params.service"],function(e){"use strict";e.module("access-rights.core",["ngAnimate","ui.bootstrap","ui.select","xeditable-civi","common.directives","common.services"])}),define("access-rights/models/location.model",["common/services/api/option-group"],function(){"use strict";function e(e,s){return e.extend({getAll:function(){return s.valuesOf("hrjc_location")}})}return e.__name="Location",e.$inject=["Model","api.optionGroup"],e}),define("access-rights/models/region.model",["common/services/api/option-group"],function(){"use strict";function e(e,s){return e.extend({getAll:function(){return s.valuesOf("hrjc_region")}})}return e.__name="Region",e.$inject=["Model","api.optionGroup"],e}),define("access-rights/models/right.model",[],function(){"use strict";function e(e,s){return e.extend({getLocations:s.getLocations.bind(s),getRegions:s.getRegions.bind(s),deleteByIds:s.deleteByIds.bind(s),saveRegions:s.saveRegions.bind(s),saveLocations:s.saveLocations.bind(s)})}return e.__name="Right",e.$inject=["Model","RightsAPI"],e}),define("access-rights/modules/access-rights.models",["common/angular","access-rights/models/location.model","access-rights/models/region.model","access-rights/models/right.model","common/models/model","access-rights/modules/access-rights.apis"],function(e,s,t,n){"use strict";return e.module("access-rights.models",["common.models","access-rights.apis"]).factory(s.__name,s).factory(t.__name,t).factory(n.__name,n)}),define("access-rights/modules/access-rights.run",["common/angular"],function(e){"use strict";function s(e,s,t){e.debug("app.run"),s.theme="bs3"}e.module("access-rights.run",[]).run(s),s.$inject=["$log","editableOptions","editableThemes"]}),define("access-rights/modules/access-rights.module",["common/angular","access-rights/modules/access-rights.apis","access-rights/modules/access-rights.config","access-rights/modules/access-rights.controllers","access-rights/modules/access-rights.core","access-rights/modules/access-rights.models","access-rights/modules/access-rights.run"],function(e){"use strict";return e.module("access-rights",["access-rights.core","access-rights.config","access-rights.run","access-rights.apis","access-rights.controllers","access-rights.models"]),e}),function(){"use strict";var e=CRM.vars.contactAccessRights.baseURL+"/js/src/access-rights";require.config({urlArgs:"bust="+(new Date).getTime(),paths:{"access-rights":e}}),require(["access-rights/modules/access-rights.module"],function(e){document.dispatchEvent(new Event("accessRightsReady"))})}(require); +define("access-rights/apis/rights.api",[],function(){"use strict";function e(e,s,t){var n=t.parse(),c={contact_id:n.cid};return e.extend({getLocations:function(){return this.sendGET("Rights","getlocations",c,!1)},getRegions:function(){return this.sendGET("Rights","getregions",c,!1)},deleteByIds:function(e){return s.all(e.map(function(e){return this.sendPOST("Rights","delete",{contact_id:n.cid,id:e})}.bind(this)))},saveRegions:function(e){return s.all(e.map(function(e){return this.sendPOST("Rights","create",{contact_id:n.cid,entity_id:e,entity_type:"hrjc_region"})}.bind(this)))},saveLocations:function(e){return s.all(e.map(function(e){return this.sendPOST("Rights","create",{contact_id:n.cid,entity_id:e,entity_type:"hrjc_location"})}.bind(this)))}})}return e.__name="RightsAPI",e.$inject=["api","$q","beforeHashQueryParams"],e}),define("access-rights/modules/access-rights.apis",["common/angular","common/services/api","access-rights/apis/rights.api"],function(e,s,t){"use strict";return e.module("access-rights.apis",["common.apis"]).factory(t.__name,t)}),define("access-rights/modules/access-rights.config",["common/angular"],function(e){"use strict";function s(e){e.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}e.module("access-rights.config",[]).config(s),s.$inject=["$httpProvider"]}),define("access-rights/controllers/access-rights.controller",["common/angular"],function(e){"use strict";function s(s,t){function n(){t.open({appendTo:e.element("[data-contact-actions-modals-container]"),controller:"AccessRightsModalController",controllerAs:"modalCtrl",bindToController:!0,templateUrl:CRM.vars.contactAccessRights.baseURL+"/views/access-rights-modal.html"})}this.openModal=n}return s.__name="AccessRightsController",s.$inject=["$rootElement","$uibModal"],s}),define("access-rights/controllers/access-rights-modal.controller",["common/lodash"],function(e){"use strict";function s(s,t,n,c,i){function o(){t.dismiss("cancel")}function r(t){var n=l.originalData[t],c=l.selectedData[t],o=n.map(function(e){return e.entity_id}),r=e.difference(c,o),a=e.difference(o,c).map(function(s){return e.find(n,function(e){return e.entity_id===s}).id}),u=[];return r.length>0&&u.push(i["save"+e.capitalize(t)](r)),a.length>0&&u.push(i.deleteByIds(a)),s.all(u)}function a(){l.submitting=!0,s.all([r("regions"),r("locations")]).then(function(){t.dismiss("cancel")}).catch(function(){l.errorMsg="Error while saving data"}).finally(function(){l.submitting=!0})}var l=this;l.dataLoaded=!1,l.errorMsg="",l.submitting=!1,l.availableData={regions:[],locations:[]},l.originalData={locations:[],regions:[]},l.selectedData={locations:[],regions:[]},l.cancel=o,l.submit=a,function(){s.all([n.getAll(),c.getAll()]).then(function(e){return{regions:e[0],locations:e[1]}}).then(function(t){return s.all(e.map(t,function(s,t){return l.availableData[t]=s,i["get"+e.capitalize(t)]()}))}).then(function(e){return{regions:e[0],locations:e[1]}}).then(function(e){Object.keys(e).forEach(function(s){l.originalData[s]=e[s].values,l.selectedData[s]=e[s].values.map(function(e){return e.entity_id})})}).then(function(){l.dataLoaded=!0})}()}return s.__name="AccessRightsModalController",s.$inject=["$q","$uibModalInstance","Region","Location","Right"],s}),define("access-rights/modules/access-rights.controllers",["common/angular","access-rights/controllers/access-rights.controller","access-rights/controllers/access-rights-modal.controller"],function(e,s,t){"use strict";return e.module("access-rights.controllers",[]).controller(s.__name,s).controller(t.__name,t)}),define("access-rights/modules/access-rights.core",["common/angular","common/ui-select","common/angularBootstrap","common/modules/xeditable-civi","common/directives/loading","common/services/before-hash-query-params.service"],function(e){"use strict";e.module("access-rights.core",["ngAnimate","ui.bootstrap","ui.select","xeditable-civi","common.directives","common.services"])}),define("access-rights/models/location.model",["common/services/api/option-group"],function(){"use strict";function e(e,s){return e.extend({getAll:function(){return s.valuesOf("hrjc_location")}})}return e.__name="Location",e.$inject=["Model","api.optionGroup"],e}),define("access-rights/models/region.model",["common/services/api/option-group"],function(){"use strict";function e(e,s){return e.extend({getAll:function(){return s.valuesOf("hrjc_region")}})}return e.__name="Region",e.$inject=["Model","api.optionGroup"],e}),define("access-rights/models/right.model",[],function(){"use strict";function e(e,s){return e.extend({getLocations:s.getLocations.bind(s),getRegions:s.getRegions.bind(s),deleteByIds:s.deleteByIds.bind(s),saveRegions:s.saveRegions.bind(s),saveLocations:s.saveLocations.bind(s)})}return e.__name="Right",e.$inject=["Model","RightsAPI"],e}),define("access-rights/modules/access-rights.models",["common/angular","access-rights/models/location.model","access-rights/models/region.model","access-rights/models/right.model","common/models/model","access-rights/modules/access-rights.apis"],function(e,s,t,n){"use strict";return e.module("access-rights.models",["common.models","access-rights.apis"]).factory(s.__name,s).factory(t.__name,t).factory(n.__name,n)}),define("access-rights/modules/access-rights.run",["common/angular"],function(e){"use strict";function s(e,s,t){e.debug("app.run"),s.theme="bs3"}e.module("access-rights.run",[]).run(s),s.$inject=["$log","editableOptions","editableThemes"]}),define("access-rights/modules/access-rights.module",["common/angular","access-rights/modules/access-rights.apis","access-rights/modules/access-rights.config","access-rights/modules/access-rights.controllers","access-rights/modules/access-rights.core","access-rights/modules/access-rights.models","access-rights/modules/access-rights.run"],function(e){"use strict";return e.module("access-rights",["access-rights.core","access-rights.config","access-rights.run","access-rights.apis","access-rights.controllers","access-rights.models"]),e}),function(){"use strict";var e=CRM.vars.contactAccessRights.baseURL+"/js/src/access-rights";require.config({urlArgs:"bust="+(new Date).getTime(),paths:{"access-rights":e}}),require(["access-rights/modules/access-rights.module"],function(e){document.dispatchEvent(new Event("accessRightsReady"))})}(require); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/contactaccessrights/js/dist/access-rights.min.js.map \ No newline at end of file diff --git a/contactsummary/info.xml b/contactsummary/info.xml index 5f0379216af..04a41cb7ed6 100644 --- a/contactsummary/info.xml +++ b/contactsummary/info.xml @@ -8,8 +8,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/contactsummary/js/dist/contact-summary.min.js b/contactsummary/js/dist/contact-summary.min.js index 913b798751e..a2d4fcbc753 100644 --- a/contactsummary/js/dist/contact-summary.min.js +++ b/contactsummary/js/dist/contact-summary.min.js @@ -1,3 +1,3 @@ -define("contact-summary/modules/contact-summary.config",["common/angular"],function(e){"use strict";function t(e,t,n,a,s){s.debugEnabled(e.debug),t.when("/",{controller:"ContactSummaryController",controllerAs:"ContactSummaryCtrl",templateUrl:e.pathBaseUrl+e.pathTpl+"mainTemplate.html",resolve:{}}).otherwise({redirectTo:"/"}),n.defaults.stripTrailingSlashes=!1,a.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}e.module("contactsummary.config",["contactsummary.constants"]).config(t),t.$inject=["settings","$routeProvider","$resourceProvider","$httpProvider","$logProvider"]}),define("contact-summary/modules/contact-summary.constants",["common/angular"],function(e){"use strict";e.module("contactsummary.constants",[]).constant("settings",{classNamePrefix:"contactSummary-",contactId:decodeURIComponent((new RegExp("[?|&]cid=([^&;]+?)(&|#|;|$)").exec(location.search)||[null,""])[1].replace(/\+/g,"%20"))||null,debug:!0,pathApp:"",pathRest:CRM.url("civicrm/ajax/rest"),pathBaseUrl:CRM.vars.contactsummary.baseURL+"/",pathTpl:"views/",CRM:{options:CRM.FieldOptions||{}}})}),define("contact-summary/controllers/contact-summary.controller",[],function(){"use strict";function e(e,t){e.debug("Controller: ContactSummaryController");var n=t.pathBaseUrl+t.pathTpl,a=this;a.contactId=t.contactId,a.ready=!1,a.partials={keyDetails:n+"/include/keyDetails.html",keyDates:n+"/include/keyDates.html"}}return e.__name="ContactSummaryController",e.$inject=["$log","settings"],e}),define("contact-summary/controllers/key-dates.controller",["common/angular","common/lodash","common/moment"],function(e,t,n){"use strict";function a(a,s,r,o){function i(e){m.dates.push({title:e.title+" (Start)",date:e.start_date,future:u(e.start_date)}),e.end_date&&m.dates.push({title:e.title+" (End)",date:e.end_date,future:u(e.end_date)})}function c(){l(),s.get().then(function(n){return t.isEmpty(n)||e.forEach(n,function(e){i(e),"1"===e.is_current&&m.activeContracts++}),r.get()}).then(function(t){e.forEach(t,function(e){var t=n(e.end_date);(void 0===e.end_date||t.isValid()&&u(t))&&m.activeRoles++})}).finally(function(){m.ready=!0})}function u(e){return n().diff(e,"days")<=0}function l(){m.activeContracts=0,m.activeRoles=0,m.dates=[]}function d(){a.debug("Subcsribers initialiazed!"),["Contract::created","Contract::updated","JobRole::created","JobRole::updated","JobRole::deleted"].forEach(function(e){o.subscribe(e,c)}),o.subscribe("Contract::deleted",function(e){s.removeContract(e),c()})}a.debug("Controller: KeyDatesController");var m=this;m.dates=[],m.activeContracts=0,m.activeRoles=0,m.ready=!1,function(){c(),d()}()}return a.__name="KeyDatesController",a.$inject=["$log","contractService","jobRoleService","pubSub"],a}),define("contact-summary/controllers/key-details.controller",["common/lodash","common/moment"],function(e,t){"use strict";function n(t,n,a,s){function r(){n.get().then(function(e){return u.contactDetails=e,a.getCurrent()}).then(function(t){if(e.isEmpty(t))return void(u.primaryContract=null);u.primaryContract=t}).then(function(e){return a.getLengthOfService()}).then(function(e){u.lengthOfService=e}).finally(function(){u.ready=!0})}function o(){u.options=a.getOptions()}function i(){s.subscribe("Contract::deleted",c)}function c(){a.resetContracts(),n.data.item={},r()}t.debug("Controller: KeyDetailsController");var u=this;u.ready=!1,u.options={},function(){o(),r(),i()}()}return n.__name="KeyDetailsController",n.$inject=["$log","contactDetailsService","contractService","pubSub"],n}),define("contact-summary/modules/contact-summary.controllers",["common/angular","contact-summary/controllers/contact-summary.controller","contact-summary/controllers/key-dates.controller","contact-summary/controllers/key-details.controller"],function(e,t,n,a){"use strict";e.module("contactsummary.controllers",[]).controller(t.__name,t).controller(n.__name,n).controller(a.__name,a)}),define("contact-summary/modules/contact-summary.core",["common/angular","common/services/pub-sub"],function(e){"use strict";e.module("contactsummary.core",["ngRoute","ngResource","ui.bootstrap","common.services"])}),define("contact-summary/directives/donut-chart.directive",["common/angular","common/d3"],function(e,t){"use strict";function n(e){this.height=this.width=e[0].clientWidth,this.radius=this.width/2||60,this.thickness=this.thickness||15}function a(){return t.svg.arc().innerRadius(this.radius-this.thickness).outerRadius(this.radius)}function s(e,n,a){var s=t.scale.category20();return e.selectAll("path").data(a).enter().append("path").attr("fill",function(e,t){return s(t)}).attr("class",function(e,t){return"chart-color-"+t}).attr("d",n)}function r(){return t.layout.pie().sort(null).value(function(e){return e.value[this.itemKey]}.bind(this))(t.entries(this.items))}function o(e){return t.select(e).append("svg").attr("width",this.width).attr("height",this.height).append("g").attr("transform","translate("+this.width/2+","+this.height/2+")")}function i(t){return t.debug("Directive: csDonutChart"),{controllerAs:"CsDonutChartCtrl",restrict:"AE",scope:{radius:"@",thickness:"@",items:"=",itemKey:"@",ready:"="},controller:["$scope","$element",function(t,i){this.drawChart=function(){n.call(e.extend(this,t),i),s(o.call(this,i[0]),a.call(this),r.call(this))}}],link:function(e,t,n,a){var s=e.$watch(function(){return e.ready},function(e,t){!0===e&&(a.drawChart(),s())})}}}return i.__name="csDonutChart",i.$inject=["$log"],i}),define("contact-summary/modules/contact-summary.directives",["common/angular","contact-summary/directives/donut-chart.directive"],function(e,t){"use strict";e.module("contactsummary.directives",[]).directive(t.__name,t)}),define("contact-summary/modules/contact-summary.run",["common/angular"],function(e){"use strict";function t(e,t,n,a){a.debug("app.run"),t.pathTpl=e.pathTpl,t.prefix=e.classNamePrefix}e.module("contactsummary.run",["contactsummary.constants"]).run(t),t.$inject=["settings","$rootScope","$q","$log"]}),function(e){define("contact-summary/services/api.service",["common/angular"],function(t){"use strict";function n(n,a){function s(n,a,s,r){if(!t.isDefined(n))throw new Error("Entity name not provided");if(!t.isDefined(s))throw new Error("Action not provided");return a=t.extend({entity:n,action:s,sequential:1,json:1,rowCount:0},a),r?e.param(a):a}function r(e,t,n){return i("get",s(e,t,"get"),n)}function o(e,n,a,r){return r=t.extend({headers:{"Content-Type":"application/x-www-form-urlencoded"}},r),i("post",s(e,n,a,!0),r)}function i(e,s,r){return r=t.extend({method:e,url:"/civicrm/ajax/rest"},"post"===e?{data:s}:{params:s},r),n(r).then(function(e){return e.is_error?a.reject(e):e.data}).catch(function(e){return e})}return{get:r,post:o}}return n.__name="apiService",n.$inject=["$http","$q"],n})}(CRM.$),define("contact-summary/services/contact-details.service",["common/lodash","common/moment"],function(e,t){"use strict";function n(n,a,s,r,o){function i(){var e=n.defer();return u().then(function(){e.resolve(l.getData())}),e.promise}function c(e){return t().diff(t(e,"YYYY-MM-DD"),"years")}function u(){var a=n.defer();if(e.isEmpty(l.getData())){var r=o.contactId;s.get("Contact",{contact_id:r,return:"birth_date"}).then(function(e){if(0===e.values.length)throw new Error("Contact with ID "+r+" not found");var n=e.values[0].birth_date,s=t(n,"YYYY-MM-DD").isValid()?c(n):"";l.setDataKey("id",r),l.setDataKey("dateOfBirth",n),l.setDataKey("age",s),a.resolve()}).catch(function(e){a.reject(e)})}else a.resolve();return a.promise}a.debug("Service: contactDetailsService");var l=r.createInstance();return l.get=i,l}return n.__name="contactDetailsService",n.$inject=["$q","$log","apiService","modelService","settings"],n}),define("contact-summary/services/contact.service",["common/lodash"],function(e){"use strict";function t(t,n,a,s,r){function o(){return i().then(function(){return l.getData()})}function i(){var t=n.defer();return e.isEmpty(l.getData())?c().then(u).then(function(){t.resolve()}):t.resolve(),t.promise}function c(){return s.get().then(function(e){l.setDataKey("id",e.id),l.setDataKey("dateOfBirth",e.dateOfBirth),l.setDataKey("age",e.age)})}function u(){return r.get().then(function(e){l.setDataKey("contract",e)})}t.debug("Service: contactService");var l=a.createInstance();return l.get=o,l}return t.__name="contactService",t.$inject=["$log","$q","modelService","contactDetailsService","contractService"],t}),define("contact-summary/services/contract.service",["common/angular","common/lodash"],function(e,t){"use strict";function n(n,s,r,o,i,c){function u(){return c.get().then(function(e){var t={contact_id:e.id,"api.HRJobContractRevision.getcurrentrevision":{jobcontract_id:"$value.id"}};return o.get("HRJobContract",t)})}function l(e){return e.values.filter(function(e){return 0===parseInt(e.deleted)})}function d(){var t=[];return e.forEach(q,function(e){var n=A.getContractDetails(e.id).then(function(t){var n=e.api_HRJobContractRevision_getcurrentrevision;return{id:e.id,is_primary:e.is_primary,is_current:e.is_current,revision_id:n?n.values.id:null,title:t.title,start_date:t.period_start_date,end_date:t.period_end_date,type:t.contract_type,pay:t.pay,hours:t.hours}}).then(function(t){A.collection.insertItem(e.id,t)});t.push(n)}),n.all(t).catch(function(e){s.error("Something went wrong",e)})}function m(){return y().then(function(){return A.getCollection()})}function f(){return A.collection.get()}function v(){return t.isEmpty(q)?u().then(function(e){return q=l(e)}):n.resolve(q)}function h(e){var t=function(e){var t=e.api_HRJobPay_get.values,n={};0!==t.length&&(n.amount=t[0].pay_amount,n.currency=t[0].pay_currency),e.pay=n},s=function(e){var t=e.api_HRJobHour_get.values,n={};0!==t.length&&(n.amount=t[0].hours_amount,n.unit=t[0].hours_unit),e.hours=n},r="getContractDetails_"+e,i={jobcontract_id:e,"api.HRJobPay.get":{jobcontract_id:e},"api.HRJobHour.get":{jobcontract_id:e}};return a[r]||(a[r]=o.post("HRJobDetails",i,"get").then(function(a){if(0===a.values.length)return n.reject("No details found for contract revision with ID "+e);var r=a.values[0];return t(r),s(r),r})),a[r]}function p(){var e=n.defer();return c.get().then(function(e){return o.post("HRJobContract",{sequential:0,contact_id:e.id},"getlengthofserviceymd")}).then(function(t){t.is_error?e.reject(t):e.resolve(t.values)}).catch(function(t){e.reject(t)}),e.promise}function g(e){var t=r.CRM.options.HRJobDetails||{};return"string"==typeof e&&(t=t[e]),{details:t}}function b(){return A.get().then(function(e){var n=t.sortBy(e,function(e){return[e.is_current]});return t.last(n)||{}})}function y(){return A.getContracts().then(d)}function _(){A.collection={items:{},insertItem:function(e,t){this.items[e]=t},getItem:function(e){return this.items[e]},set:function(e){this.items=e},get:function(){return this.items},remove:function(e){delete this.items[e]}}}function R(){q=[],a={},_()}function C(e){t.remove(q,{id:e.contractId}),A.collection.remove(e.contractId)}s.debug("Service: Contract Service");var q=[],A={};return A.get=m,A.getCollection=f,A.getContracts=v,A.removeContract=C,A.getContractDetails=h,A.getLengthOfService=p,A.getOptions=g,A.getCurrent=b,A.resetContracts=R,_(),A}var a={};return n.__name="contractService",n.$inject=["$q","$log","settings","apiService","modelService","contactDetailsService"],n}),define("contact-summary/services/item.service",["common/angular","common/lodash","common/moment"],function(e,t,n){"use strict";function a(){function t(){var e=Object.create(r);return e.item={},e}function n(){return this.item}function a(t){if(!e.isObject(t))throw new TypeError("Data must be of type Object");this.item=t}function s(e,t){this.item[e]=t}var r={};return r.createInstance=t,r.get=n,r.set=a,r.setKey=s,r}return a.__name="itemService",a}),define("contact-summary/services/job-role.service",["common/angular","common/lodash"],function(e,t){"use strict";function n(t,n,a,s,r){function o(){return c().then(function(){return u.getCollection()})}function i(){return u.collection.get()}function c(){var n=t.defer();return r.get().then(function(s){var r=[];if(e.forEach(s,function(e){r.push(e.id)}),0===r.length)return t.reject("No job roles found for contracts");a.post("HrJobRoles",{job_contract_id:{IN:r}},"get").then(function(e){var t=e.values.map(function(e){return{id:e.id,title:e.title,department:e.department,status:e.status,start_date:e.start_date,end_date:e.end_date}});u.collection.set(t)}).finally(function(){n.resolve()})}),n.promise}n.debug("Service: jobRoleService");var u={};return u.collection={items:{},insertItem:function(e,t){this.items[e]=t},getItem:function(e){return this.items[e]},set:function(e){this.items=e},get:function(){return this.items}},u.get=o,u.getCollection=i,u}return n.__name="jobRoleService",n.$inject=["$q","$log","apiService","modelService","contractService"],n}),define("contact-summary/services/leave.service",["common/angular","common/lodash","common/moment"],function(e,t,n){"use strict";function a(a,r,o,i,c,u){function l(t){var n=S.collection.getItem(t)||{};e.forEach(D,function(e){if("1"===e.is_active){var t=e.id;n.hasOwnProperty(t)||(n[t]={}),n[t].type_id=t,n[t].title=e.title,n[t].credit_activity_type_id=e.credit_activity_type_id?e.credit_activity_type_id:null,n[t].debit_activity_type_id=e.debit_activity_type_id?e.debit_activity_type_id:null,n[t].entitled=0,n[t].taken=0}}),S.collection.insertItem(t,n)}function d(t){var n=S.collection.getItem(t),a={};e.forEach(D,function(e){e.credit_activity_type_id&&(a[e.credit_activity_type_id]=e.id),e.debit_activity_type_id&&(a[e.debit_activity_type_id]=e.id)}),e.forEach(P,function(e){var t;if(a.hasOwnProperty(e.activity_type_id)&&(t=a[e.activity_type_id]),t){if(!n.hasOwnProperty(t))return;var s=Math.ceil(e.absence_range.approved_duration/60),r=+(s/8).toFixed(1);"toil"===n[t].title.toLowerCase()&&e.activity_type_id===n[t].credit_activity_type_id?n[t].entitled+=r:n[t].taken+=r}}),S.collection.insertItem(t,n)}function m(t){var n=S.collection.getItem(t);e.forEach(L,function(e){var t=e.type_id;n.hasOwnProperty(t)&&"toil"!==n[t].title.toLowerCase()&&(n[t].entitled=+e.amount)}),S.collection.insertItem(t,n)}function f(e){l(e),m(e),d(e)}function v(){return w(void 0).then(function(){return S.getData()})}function h(){var e=a.defer();return t.isEmpty(D)?i.get("HRAbsenceType").then(function(t){if(0===t.values.length)throw new Error("No absence type not found");D=t.values,e.resolve(D)}):e.resolve(D),e.promise}function p(e){var n=a.defer();return u.get().then(function(t){var n={target_contact_id:t.id,period_id:[e],options:{"absence-range":1},sequential:0};return i.post("Activity",n,"getabsences")}).then(function(e){P=t.filter(e.values,function(e){return"2"===e.status_id}),n.resolve(P)}),n.promise}function g(){return S.collection.get()}function b(){var e,t=a.defer();return s.getCurrent||(S.getCurrentPeriod().then(function(n){n.hasOwnProperty("id")?(e=n.id,w(e).then(function(){t.resolve(S.collection.getItem(e))})):t.resolve({})}),s.getCurrent=t.promise),s.getCurrent}function y(){return C().then(function(e){for(var t={},a=n(),s=0;s=0&&a.diff(o)<=0&&(t=e[s])}return t})}function _(){}function R(e){var t=a.defer();return u.get().then(function(t){var n={contact_id:t.id,period_id:e,options:{"absence-range":1}};return i.get("HRAbsenceEntitlement",n)}).then(function(e){L=e.values,t.resolve(L)}),t.promise}function C(){var e=a.defer();return t.isEmpty(T)?i.get("HRAbsencePeriod").then(function(t){if(0===t.values.length)return e.reject("No absence periods found");T=t.values,T=o("orderBy")(T,"start_date"),e.resolve(T)}).catch(function(t){r.debug("An error has occurred",t),e.reject(t)}):e.resolve(T),e.promise}function q(){var e,t=a.defer();return A().then(function(n){n.hasOwnProperty("id")?(e=n.id,w(e).then(function(){t.resolve(S.collection.getItem(e))})):t.resolve({})}),t.promise}function A(){var e,t={};return S.getCurrentPeriod().then(function(t){return e=t,C()}).then(function(n){var a=n.indexOf(e);return-1!==a&&a>0&&(t=n[a-1]),t})}function I(e){var t=a.defer();return S.getCurrentPeriod().then(function(n){if(n.hasOwnProperty("id")){var s=n.id;i.post("ContactSummary",{absence_types:e,period_id:s},"getabsenceaggregate").then(function(e){if(0===e.values.length)return a.reject("Staff average not returned");var n=Math.ceil(e.values[0].result/60),s=+(n/8).toFixed(1);t.resolve(s)})}else t.resolve(0)}),t.promise}function w(e){var n=a.defer();return t.isEmpty(S.collection.getItem(e))?S.getAbsenceTypes().then(function(){return S.getAbsences(e)}).then(function(){return S.getEntitlement(e)}).then(function(){return f(e)}).then(function(){n.resolve()}).catch(function(e){r.debug("An error has occurred",e),n.reject(e)}):n.resolve(),n.promise}r.debug("Service: leaveService");var P,L,T,D=[],S={};return S.collection={items:{},insertItem:function(e,t){this.items[e]=t},getItem:function(e){return this.items[e]},set:function(e){this.items=e},get:function(){return this.items}},S.get=v,S.getAbsenceTypes=h,S.getAbsences=p,S.getCollection=g,S.getCurrent=b,S.getCurrentPeriod=y,S.getDepartmentAverage=_,S.getEntitlement=R,S.getPrevious=q,S.getStaffAverage=I,S}var s={};return a.__name="leaveService",a.$inject=["$q","$log","$filter","apiService","modelService","contactDetailsService"],a}),define("contact-summary/services/model.service",["common/lodash","contact-summary/modules/contact-summary.services"],function(e,t){"use strict";function n(e){function t(){var t=Object.create(r);return t.data=e.createInstance(),t}function n(){return this.data.get()}function a(e){this.data.set(e)}function s(e,t){this.data.setKey(e,t)}var r={};return r.data={},r.createInstance=t,r.getData=n,r.setData=a,r.setDataKey=s,r}return n.__name="modelService",n.$inject=["itemService"],n}),define("contact-summary/modules/contact-summary.services",["common/angular","contact-summary/services/api.service","contact-summary/services/contact-details.service","contact-summary/services/contact.service","contact-summary/services/contract.service","contact-summary/services/item.service","contact-summary/services/job-role.service","contact-summary/services/leave.service","contact-summary/services/model.service"],function(e,t,n,a,s,r,o,i,c){"use strict";e.module("contactsummary.services",[]).factory(t.__name,t).factory(n.__name,n).factory(a.__name,a).factory(s.__name,s).factory(r.__name,r).factory(o.__name,o).factory(i.__name,i).factory(c.__name,c)}),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(t){return t.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/instances/absence-period.instance",["leave-absences/shared/modules/models-instances","common/moment","common/models/instances/instance","common/services/hr-settings"],function(e,t){"use strict";e.factory("AbsencePeriodInstance",["$log","ModelInstance","HR_settings",function(e,n,a){return e.debug("AbsencePeriodInstance"),n.extend({defaultCustomData:function(){return{current:!1}},transformAttributes:function(e){var n=t();return e.current=!1,t(e.start_date).isSameOrBefore(n,"day")&&t(e.end_date).isSameOrAfter(n,"day")&&(e.current=!0),e},isInPeriod:function(e){var n=a.DATE_FORMAT.toUpperCase(),s=t(e,n);return t(this.start_date).isSameOrBefore(s)&&t(this.end_date).isSameOrAfter(s)}})}])}),define("leave-absences/shared/apis/absence-period.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("AbsencePeriodAPI",["$log","api",function(e,t){return e.debug("AbsencePeriodAPI"),t.extend({all:function(t){return e.debug("AbsencePeriodAPI"),this.sendGET("AbsencePeriod","get",t).then(function(e){return e.values})}})}])}),define("leave-absences/shared/models/absence-period.model",["leave-absences/shared/modules/models","common/moment","leave-absences/shared/modules/shared-settings","leave-absences/shared/instances/absence-period.instance","leave-absences/shared/apis/absence-period.api","common/models/model","common/services/hr-settings"],function(e,t){"use strict";e.factory("AbsencePeriod",["$log","Model","AbsencePeriodAPI","AbsencePeriodInstance","shared-settings",function(e,n,a,s,r){return e.debug("AbsencePeriod"),n.extend({all:function(e){return a.all(e).then(function(e){return e.map(function(e){return s.init(e,!0)})})},current:function(){var e=t().format(r.serverDateFormat),n={start_date:{"<=":e},end_date:{">=":e}};return a.all(n).then(function(e){return e&&e.length?s.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,t,n){"use strict";n.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(n,a,s){return n.debug("AbsenceTypeAPI"),a.extend({all:function(t){return n.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(t||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,r,o){return n.debug("AbsenceTypeAPI.calculateToilExpiryDate"),o=e.assign({},o,{absence_type_id:a,date:t(r).format(s.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",o).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,t){return e.debug("AbsenceTypeInstance"),t.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,t){"use strict";t.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(t,n,a,s,r,o){return t.debug("AbsenceType"),a.extend({all:function(e){return r.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},calculateToilExpiryDate:function(e,t,n){return r.calculateToilExpiryDate(e,t,n)},canExpire:function(e){return r.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(t){return s.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(n){return n=e.indexBy(n,"value"),e.map(t,function(t){return e.assign(t,{calculation_unit_label:n[t.calculation_unit].label,calculation_unit_name:n[t.calculation_unit].name})})})}})}])}),define("leave-absences/shared/components/leave-requests-heatmap.component",["common/moment","common/components/heatmap.component","leave-absences/shared/modules/components"],function(e,t,n){function a(){function t(e){e.leaveRequests&&n()}function n(){s.heatmapValues={},a().forEach(function(t){var n=e(t.date).isoWeekday();s.heatmapValues[n]||(s.heatmapValues[n]=0),s.heatmapValues[n]++})}function a(){return s.leaveRequests.reduce(function(e,t){return e.concat(t.dates)},[])}var s=this;s.heatmapValues={},s.$onChanges=t}n.component("leaveRequestsHeatmap",{bindings:{leaveRequests:"<"},controller:a,controllerAs:"LeaveRequestsHeatmap",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-requests-heatmap.html"}]})}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,n,a){return e.debug("LeaveRequestAPI"),n.extend({all:function(t,n,s,r,o){e.debug("LeaveRequestAPI.all");var i=a.defer();return t&&t.contact_id&&t.contact_id.IN&&0===t.contact_id.IN.length?i.resolve({list:[],total:0,allIds:[]}):i.resolve(this.getAll("LeaveRequest",t,n,s,r,"getFull",o)),i.promise},balanceChangeByAbsenceType:function(n){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var s=a.defer();return n.contact_id&&n.period_id||s.reject("contact_id and period_id are mandatory"),n=t.defaults(n,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",n,!1).then(function(e){s.resolve(e.values)}),s.promise},calculateBalanceChange:function(n){return e.debug("LeaveRequestAPI.calculateBalanceChange",n),this.sendPOST("LeaveRequest","calculatebalancechange",n).then(function(e){return e.values.breakdown=t.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,t){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:t.toString()},!1)},create:function(t){return e.debug("LeaveRequestAPI.create",t),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,attachment_id:n}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,n){return n=t.assign({},n,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",n).then(function(e){return e.values})},find:function(t){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:t},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",n,!1).then(function(e){return e.values})},getComments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",n,!1).then(function(e){return e.values})},isManagedBy:function(t,n){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:t,contact_id:n}).then(function(e){return e.values})},isValid:function(n){e.debug("LeaveRequestAPI.isValid",n);var s=a.defer();return this.sendPOST("LeaveRequest","isValid",n).then(function(e){e.count>0?s.reject(t(e.values).map().flatten().value()):s.resolve(e.values)}),s.promise},saveComment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,text:n.text,contact_id:n.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(t){e.debug("LeaveRequestAPI.update",t);var n=a.defer();return t.id||n.reject("id is mandatory field"),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,t,n){"use strict";n.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(n,a,s,r,o,i,c){function u(e){return v(e).then(function(e){var t=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=t,n.reject(e)}.bind(this))}.bind(this))}function l(){return c.all({id:this.type_id}).then(c.loadCalculationUnits).then(function(e){return n.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return v(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var t=[];return e.forEach(this.files,function(e){e.toBeDeleted&&t.push(i.deleteAttachment(this.id,e.attachment_id))}.bind(this)),n.all(t)}function f(e){return t.duration(e.time_to).subtract(t.duration(e.time_from)).asHours()}function v(t){return s.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){return e.find(n,function(e){return e.name===t})})}function h(t){var a=e.cloneDeep(t),s=a.breakdown.length>1,r=e.first(e.values(a.breakdown)),o=e.last(e.values(a.breakdown));return n.all([this.getWorkDayForDate(r.date),s&&this.getWorkDayForDate(o.date)]).then(function(t){return r.amount=t[0].time_from?Math.min(this.from_date_amount,f(t[0])):0,s&&(o.amount=t[1].time_from?Math.min(this.to_date_amount,f(t[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,t){return e+t.amount},0),a}.bind(this))}function p(){var e=this.id,t=[];return t.push(n.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(t){return function(){return i.saveComment(e,t)}}))),t=t.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return i.deleteComment(e.comment_id)})),n.all(t)}return o.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(t){var n=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===t&&e.pull(n,"from_date_type","to_date_type"),i.calculateBalanceChange(e.pick(this,n)).then(function(e){return"hours"===t?h.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,r.statusNames.cancelled)},approve:function(){return u.call(this,r.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,r.statusNames.rejected)},sendBack:function(){return u.call(this,r.statusNames.moreInformationRequired)},update:function(){return i.update(this.toAPI()).then(function(){return n.all([p.call(this),m.call(this)])}.bind(this)) -},create:function(){return i.create(this.toAPI()).then(function(e){return this.id=e.id,n.all([p.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(t){if(t.comment_id)return void(t.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return t.created_at===e.created_at&&t.text===e.text})},delete:function(){return i.delete(this.id)},getBalanceChangeBreakdown:function(){return i.getBalanceChangeBreakdown(this.id).then(function(t){return{amount:e.reduce(t.values,function(e,t){return e+parseFloat(t.amount)},0),breakdown:t.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return i.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return n.reject(e)})},isValid:function(){return i.isValid(this.toAPI())},isApproved:function(){return d.call(this,r.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,r.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,r.statusNames.cancelled)},isRejected:function(){return d.call(this,r.statusNames.rejected)},isSentBack:function(){return d.call(this,r.statusNames.moreInformationRequired)},loadComments:function(){return this.id?i.getComments(this.id).then(function(e){this.comments=e}.bind(this)):n.resolve()},roleOf:function(e){return this.contact_id===e?n.resolve("owner"):a(r.permissions.admin.administer).then(function(t){return t?"admin":i.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])},loadAttachments:function(){return this.id?i.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):n.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,t,n,a){return e.debug("LeaveRequest"),t.extend({all:function(e,t,s,r,o){return n.all(this.processFilters(e),t,s,r,o).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return n.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return n.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/components/leave-requests-heatmap.component","leave-absences/shared/models/leave-request.model"],function(e,t,n){function a(t,n,a){function s(){r()&&o().finally(function(){t.$emit("LeaveWidget::childIsReady",l)})}function r(){return d.absenceTypes&&d.absenceTypes.length&&d.contactId&&d.absencePeriod&&d.leaveRequestStatuses&&d.leaveRequestStatuses.length}function o(){var e=i(),t=c();return n.all({contact_id:d.contactId,from_date:{">=":d.absencePeriod.start_date},to_date:{"<=":d.absencePeriod.end_date},status_id:{IN:t},type_id:{IN:e}},null,null,null,!1).then(function(e){d.leaveRequests=e.list}).then(u)}function i(){return d.absenceTypes.map(function(e){return e.id})}function c(){return d.leaveRequestStatuses.map(function(e){return e.value})}function u(){d.absenceTypes=d.absenceTypes.map(function(t){var n;return n=d.leaveRequests.filter(function(e){return+e.type_id==+t.id}).reduce(function(e,t){return e+t.balance_change},0),e.assign({balance:Math.abs(n)},t)})}var l="leave-widget-absence-types-amount-taken",d=this;d.leaveRequests=[],d.$onChanges=s,function(){t.$emit("LeaveWidget::childIsLoading",l)}()}n.component("leaveWidgetAbsenceTypesAmountTaken",{bindings:{title:"@",leaveName:"@?",absenceTypes:"<",contactId:"<",absencePeriod:"<",leaveRequestStatuses:"<"},controller:a,controllerAs:"absenceTypesTaken",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-widget/leave-widget-absence-types-amount-taken.html"}]}),a.$inject=["$scope","LeaveRequest","OptionGroup"]}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,n){function a(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(n.remainder=a[0].remainder),delete n["api.LeavePeriodEntitlement.getremainder"],n}function s(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return n.value=a,delete n["api.LeavePeriodEntitlement.getentitlement"],n}return e.debug("EntitlementAPI"),n.extend({all:function(t,n){return e.debug("EntitlementAPI.all"),t["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},n&&(t["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",t,!1).then(function(e){return e.values}).then(function(e){return e=e.map(s),n&&(e=e.map(a)),e})},breakdown:function(t){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",t).then(function(e){return e.values})},getLeaveBalances:function(t,n,a,s,r){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",t,n,a,s,"getLeaveBalances",r)}})}])}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,t){return e.debug("EntitlementLogAPI"),t.extend({all:function(t){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",t,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,t,n){return e.debug("EntitlementInstance"),t.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return n.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,t){"use strict";t.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(t,n,a,s,r){return t.debug("Entitlement"),n.extend({all:function(e,t){return a.all(this.processFilters(e),t).then(function(e){return e.map(function(e){return s.init(e,!0)})})},breakdown:function(t,n){return a.breakdown(t).then(function(t){return n?(n.map(function(n){var a=e.find(t,function(e){return e.id===n.id});return a&&(n.breakdown=a.breakdown),n}),n):t.map(function(e){return s.init(e,!0)})})},logs:function(t){return t=e.cloneDeep(t||{}),t.contact_id&&(t["entitlement_id.contact_id"]=t.contact_id,delete t.contact_id),t.period_id&&(t["entitlement_id.period_id"]=t.period_id,delete t.period_id),t.return=t.return||[],t.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),r.all(t)}})}])}),define("leave-absences/shared/components/leave-widget/leave-widget-absence-types-available-balance.component",["common/lodash","leave-absences/shared/modules/components","leave-absences/shared/models/entitlement.model"],function(e,t){function n(t,n){function a(){s()&&o().then(function(t){return e.indexBy(t,"type_id")}).then(i).then(r).then(function(e){u.absenceTypes=e}).then(function(){t.$emit("LeaveWidget::childIsReady",c)})}function s(){return u.absenceTypes&&u.absencePeriod&&u.contactId}function r(e){return e.filter(function(e){var t=e.entitlement&&e.entitlement.value>0,n="1"===e.allow_overuse,a="1"===e.allow_accruals_request;return t||n||a})}function o(){return n.all({contact_id:u.contactId,period_id:u.absencePeriod.id,"type_id.is_active":!0},!0)}function i(t){return u.absenceTypes.map(function(n){return e.assign({entitlement:t[n.id]},n)})}var c="leave-widget-absence-types-available-balance",u=this;u.$onChanges=a,function(){t.$emit("LeaveWidget::childIsLoading",c)}()}t.component("leaveWidgetAbsenceTypesAvailableBalance",{bindings:{absencePeriod:"<",absenceTypes:"<",contactId:"<"},controller:n,controllerAs:"leaveWidgetBalance",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-widget/leave-widget-absence-types-available-balance.html"}]}),n.$inject=["$scope","Entitlement"]}),define("leave-absences/shared/components/leave-widget/leave-widget-next-leave.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/models/leave-request.model"],function(e,t,n){function a(n,a,s,r,o){function i(){c()&&n.all([m(),f()]).then(function(){b.nextLeaveRequest&&(u(),h(),v(),p())}).finally(function(){a.$emit("LeaveWidget::childIsReady",g)})}function c(){return b.absenceTypes&&b.absenceTypes.length&&b.contactId&&b.leaveRequestStatuses&&b.leaveRequestStatuses.length}function u(){b.nextLeaveRequest.from_date=b.nextLeaveRequest.from_date&&t(b.nextLeaveRequest.from_date),b.nextLeaveRequest.to_date=b.nextLeaveRequest.to_date&&t(b.nextLeaveRequest.to_date)}function l(){return e.pluck(b.absenceTypes,"id")}function d(){return e.pluck(b.leaveRequestStatuses,"value")}function m(){return r.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(t){b.dayTypes=e.indexBy(t,"value")})}function f(){var e=t().format(o.serverDateFormat);return s.all({contact_id:b.contactId,from_date:{">=":e},request_type:"leave",status_id:{IN:d()},type_id:{IN:l()},options:{limit:1}},null,"from_date ASC",null,!1).then(function(e){b.nextLeaveRequest=e.list[0]||null})}function v(){b.nextLeaveRequest.balance_change=Math.abs(b.nextLeaveRequest.balance_change)}function h(){var t=e.find(b.absenceTypes,function(e){return+e.id==+b.nextLeaveRequest.type_id})||{};b.nextLeaveRequest["type_id.title"]=t.title,b.nextLeaveRequest["type_id.calculation_unit_name"]=t.calculation_unit_name}function p(){b.requestStatus=e.find(b.leaveRequestStatuses,function(e){return+e.value==+b.nextLeaveRequest.status_id})}var g="leave-widget-next-leave",b=this;b.dayTypes={},b.balanceDeduction=0,b.nextLeaveRequest=null,b.requestStatus={},b.$onChanges=i,function(){a.$emit("LeaveWidget::childIsLoading",g)}()}n.component("leaveWidgetNextLeave",{bindings:{absenceTypes:"<",contactId:"<",leaveRequestStatuses:"<"},controller:a,controllerAs:"nextLeave",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-widget/leave-widget-next-leave.html"}]}),a.$inject=["$q","$scope","LeaveRequest","OptionGroup","shared-settings"]}),define("leave-absences/shared/components/leave-widget/leave-widget.component",["common/angular","common/lodash","common/moment","common/directives/loading","common/directives/help-text.directive","common/filters/time-unit-applier.filter","common/models/contract","common/services/pub-sub","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/components","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component","leave-absences/shared/components/leave-widget/leave-widget-absence-types-available-balance.component","leave-absences/shared/components/leave-widget/leave-widget-next-leave.component"],function(e,t,n){function a(e,a,s,r,o,i,c,u){function l(){q++,A.loading.childComponents=!0}function d(){--q<=0&&(q=0,A.loading.childComponents=!1)}function m(e){return t.find(e,function(e){return e.current})}function f(e){return m(e)||v(e)}function v(e){return t.chain(e).sort(function(e,t){return n(e.end_date).diff(t)}).last().value()}function h(){s.$on("LeaveWidget::childIsLoading",l),s.$on("LeaveWidget::childIsReady",d),p()}function p(){["LeaveRequest::new","LeaveRequest::edit","LeaveRequest::delete","LeaveRequest::updatedByManager","LeaveRequest::edit","contract:created","contract:deleted","contract-refresh"].forEach(function(e){u.subscribe(e,g)})}function g(){y().then(function(){return a.all([b(),R(),_()])}).finally(function(){A.loading.component=!1})}function b(){return o.all().then(o.loadCalculationUnits).then(function(e){A.absenceTypes=e,A.sicknessAbsenceTypes=e.filter(function(e){return+e.is_sick})})}function y(){return i.all({contact_id:A.contactId,deleted:!1}).then(function(e){A.jobContract=t.find(e,function(e){return+e.is_current})}).then(function(){if(!A.jobContract)return a.reject()})}function _(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){A.leaveRequestStatuses=e.filter(function(e){return t.includes(C,e.name)})})}function R(){return r.all().then(f).then(function(e){A.absencePeriod=e})}var C=["approved","admin_approved","awaiting_approval","more_information_required"],q=0,A=this;A.absenceTypes=[],A.absencePeriod=null,A.jobContract=null,A.loading={childComponents:!1,component:!0},A.leaveRequestStatuses=[],A.sicknessAbsenceTypes=[],function(){e.debug("Controller: leaveWidgetController"),h(),g()}()}e.module("leave-absences.components.leave-widget",["common.components","common.directives","common.filters","common.models","common.services","leave-absences.components","leave-absences.models","leave-absences.settings"]).component("leaveWidget",{bindings:{contactId:"<"},controller:a,controllerAs:"leaveWidget",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-widget/leave-widget.html"}]}),a.$inject=["$log","$q","$scope","AbsencePeriod","AbsenceType","Contract","OptionGroup","pubSub"]}),define("contact-summary/modules/contact-summary.module",["common/angular","contact-summary/modules/contact-summary.config","contact-summary/modules/contact-summary.constants","contact-summary/modules/contact-summary.controllers","contact-summary/modules/contact-summary.core","contact-summary/modules/contact-summary.directives","contact-summary/modules/contact-summary.run","contact-summary/modules/contact-summary.services","leave-absences/shared/components/leave-widget/leave-widget.component"],function(e){e.module("contactsummary",["contactsummary.core","contactsummary.config","contactsummary.run","contactsummary.constants","contactsummary.controllers","contactsummary.directives","contactsummary.services","leave-absences.components.leave-widget"])}),function(e,t){t.config({urlArgs:"bust="+(new Date).getTime(),paths:{"contact-summary":e.vars.contactsummary.baseURL+"/js/src/contact-summary"}}),t(["contact-summary/modules/contact-summary.module"],function(){"use strict";document.dispatchEvent("function"==typeof window.CustomEvent?new window.CustomEvent("contactsummaryReady"):function(){var e=document.createEvent("Event");return e.initEvent("contactsummaryReady",!0,!0),e}())})}(CRM,require); +define("contact-summary/modules/contact-summary.config",["common/angular"],function(e){"use strict";function t(e,t,n,a,s){s.debugEnabled(e.debug),t.when("/",{controller:"ContactSummaryController",controllerAs:"ContactSummaryCtrl",templateUrl:e.pathBaseUrl+e.pathTpl+"mainTemplate.html",resolve:{}}).otherwise({redirectTo:"/"}),n.defaults.stripTrailingSlashes=!1,a.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}e.module("contactsummary.config",["contactsummary.constants"]).config(t),t.$inject=["settings","$routeProvider","$resourceProvider","$httpProvider","$logProvider"]}),define("contact-summary/modules/contact-summary.constants",["common/angular"],function(e){"use strict";e.module("contactsummary.constants",[]).constant("settings",{classNamePrefix:"contactSummary-",contactId:decodeURIComponent((new RegExp("[?|&]cid=([^&;]+?)(&|#|;|$)").exec(location.search)||[null,""])[1].replace(/\+/g,"%20"))||null,debug:!0,pathApp:"",pathRest:CRM.url("civicrm/ajax/rest"),pathBaseUrl:CRM.vars.contactsummary.baseURL+"/",pathTpl:"views/",CRM:{options:CRM.FieldOptions||{}}})}),define("contact-summary/controllers/contact-summary.controller",[],function(){"use strict";function e(e,t){e.debug("Controller: ContactSummaryController");var n=t.pathBaseUrl+t.pathTpl,a=this;a.contactId=t.contactId,a.ready=!1,a.partials={keyDetails:n+"/include/keyDetails.html",keyDates:n+"/include/keyDates.html"}}return e.__name="ContactSummaryController",e.$inject=["$log","settings"],e}),define("contact-summary/controllers/key-dates.controller",["common/angular","common/lodash","common/moment"],function(e,t,n){"use strict";function a(a,s,r,o){function i(e){m.dates.push({title:e.title+" (Start)",date:e.start_date,future:u(e.start_date)}),e.end_date&&m.dates.push({title:e.title+" (End)",date:e.end_date,future:u(e.end_date)})}function c(){l(),s.get().then(function(n){return t.isEmpty(n)||e.forEach(n,function(e){i(e),"1"===e.is_current&&m.activeContracts++}),r.get()}).then(function(t){e.forEach(t,function(e){var t=n(e.end_date);(void 0===e.end_date||t.isValid()&&u(t))&&m.activeRoles++})}).finally(function(){m.ready=!0})}function u(e){return n().diff(e,"days")<=0}function l(){m.activeContracts=0,m.activeRoles=0,m.dates=[]}function d(){a.debug("Subcsribers initialiazed!"),["Contract::created","Contract::updated","JobRole::created","JobRole::updated","JobRole::deleted"].forEach(function(e){o.subscribe(e,c)}),o.subscribe("Contract::deleted",function(e){s.removeContract(e),c()})}a.debug("Controller: KeyDatesController");var m=this;m.dates=[],m.activeContracts=0,m.activeRoles=0,m.ready=!1,function(){c(),d()}()}return a.__name="KeyDatesController",a.$inject=["$log","contractService","jobRoleService","pubSub"],a}),define("contact-summary/controllers/key-details.controller",["common/lodash","common/moment"],function(e,t){"use strict";function n(t,n,a,s){function r(){n.get().then(function(e){return u.contactDetails=e,a.getCurrent()}).then(function(t){if(e.isEmpty(t))return void(u.primaryContract=null);u.primaryContract=t}).then(function(e){return a.getLengthOfService()}).then(function(e){u.lengthOfService=e}).finally(function(){u.ready=!0})}function o(){u.options=a.getOptions()}function i(){s.subscribe("Contract::deleted",c)}function c(){a.resetContracts(),n.data.item={},r()}t.debug("Controller: KeyDetailsController");var u=this;u.ready=!1,u.options={},function(){o(),r(),i()}()}return n.__name="KeyDetailsController",n.$inject=["$log","contactDetailsService","contractService","pubSub"],n}),define("contact-summary/modules/contact-summary.controllers",["common/angular","contact-summary/controllers/contact-summary.controller","contact-summary/controllers/key-dates.controller","contact-summary/controllers/key-details.controller"],function(e,t,n,a){"use strict";e.module("contactsummary.controllers",[]).controller(t.__name,t).controller(n.__name,n).controller(a.__name,a)}),define("contact-summary/modules/contact-summary.core",["common/angular","common/services/pub-sub"],function(e){"use strict";e.module("contactsummary.core",["ngRoute","ngResource","ui.bootstrap","common.services"])}),define("contact-summary/directives/donut-chart.directive",["common/angular","common/d3"],function(e,t){"use strict";function n(e){this.height=this.width=e[0].clientWidth,this.radius=this.width/2||60,this.thickness=this.thickness||15}function a(){return t.svg.arc().innerRadius(this.radius-this.thickness).outerRadius(this.radius)}function s(e,n,a){var s=t.scale.category20();return e.selectAll("path").data(a).enter().append("path").attr("fill",function(e,t){return s(t)}).attr("class",function(e,t){return"chart-color-"+t}).attr("d",n)}function r(){return t.layout.pie().sort(null).value(function(e){return e.value[this.itemKey]}.bind(this))(t.entries(this.items))}function o(e){return t.select(e).append("svg").attr("width",this.width).attr("height",this.height).append("g").attr("transform","translate("+this.width/2+","+this.height/2+")")}function i(t){return t.debug("Directive: csDonutChart"),{controllerAs:"CsDonutChartCtrl",restrict:"AE",scope:{radius:"@",thickness:"@",items:"=",itemKey:"@",ready:"="},controller:["$scope","$element",function(t,i){this.drawChart=function(){n.call(e.extend(this,t),i),s(o.call(this,i[0]),a.call(this),r.call(this))}}],link:function(e,t,n,a){var s=e.$watch(function(){return e.ready},function(e,t){!0===e&&(a.drawChart(),s())})}}}return i.__name="csDonutChart",i.$inject=["$log"],i}),define("contact-summary/modules/contact-summary.directives",["common/angular","contact-summary/directives/donut-chart.directive"],function(e,t){"use strict";e.module("contactsummary.directives",[]).directive(t.__name,t)}),define("contact-summary/modules/contact-summary.run",["common/angular"],function(e){"use strict";function t(e,t,n,a){a.debug("app.run"),t.pathTpl=e.pathTpl,t.prefix=e.classNamePrefix}e.module("contactsummary.run",["contactsummary.constants"]).run(t),t.$inject=["settings","$rootScope","$q","$log"]}),function(e){define("contact-summary/services/api.service",["common/angular"],function(t){"use strict";function n(n,a){function s(n,a,s,r){if(!t.isDefined(n))throw new Error("Entity name not provided");if(!t.isDefined(s))throw new Error("Action not provided");return a=t.extend({entity:n,action:s,sequential:1,json:1,rowCount:0},a),r?e.param(a):a}function r(e,t,n){return i("get",s(e,t,"get"),n)}function o(e,n,a,r){return r=t.extend({headers:{"Content-Type":"application/x-www-form-urlencoded"}},r),i("post",s(e,n,a,!0),r)}function i(e,s,r){return r=t.extend({method:e,url:"/civicrm/ajax/rest"},"post"===e?{data:s}:{params:s},r),n(r).then(function(e){return e.is_error?a.reject(e):e.data}).catch(function(e){return e})}return{get:r,post:o}}return n.__name="apiService",n.$inject=["$http","$q"],n})}(CRM.$),define("contact-summary/services/contact-details.service",["common/lodash","common/moment"],function(e,t){"use strict";function n(n,a,s,r,o){function i(){var e=n.defer();return u().then(function(){e.resolve(l.getData())}),e.promise}function c(e){return t().diff(t(e,"YYYY-MM-DD"),"years")}function u(){var a=n.defer();if(e.isEmpty(l.getData())){var r=o.contactId;s.get("Contact",{contact_id:r,return:"birth_date"}).then(function(e){if(0===e.values.length)throw new Error("Contact with ID "+r+" not found");var n=e.values[0].birth_date,s=t(n,"YYYY-MM-DD").isValid()?c(n):"";l.setDataKey("id",r),l.setDataKey("dateOfBirth",n),l.setDataKey("age",s),a.resolve()}).catch(function(e){a.reject(e)})}else a.resolve();return a.promise}a.debug("Service: contactDetailsService");var l=r.createInstance();return l.get=i,l}return n.__name="contactDetailsService",n.$inject=["$q","$log","apiService","modelService","settings"],n}),define("contact-summary/services/contact.service",["common/lodash"],function(e){"use strict";function t(t,n,a,s,r){function o(){return i().then(function(){return l.getData()})}function i(){var t=n.defer();return e.isEmpty(l.getData())?c().then(u).then(function(){t.resolve()}):t.resolve(),t.promise}function c(){return s.get().then(function(e){l.setDataKey("id",e.id),l.setDataKey("dateOfBirth",e.dateOfBirth),l.setDataKey("age",e.age)})}function u(){return r.get().then(function(e){l.setDataKey("contract",e)})}t.debug("Service: contactService");var l=a.createInstance();return l.get=o,l}return t.__name="contactService",t.$inject=["$log","$q","modelService","contactDetailsService","contractService"],t}),define("contact-summary/services/contract.service",["common/angular","common/lodash"],function(e,t){"use strict";function n(n,s,r,o,i,c){function u(){return c.get().then(function(e){var t={contact_id:e.id,"api.HRJobContractRevision.getcurrentrevision":{jobcontract_id:"$value.id"}};return o.get("HRJobContract",t)})}function l(e){return e.values.filter(function(e){return 0===parseInt(e.deleted)})}function d(){var t=[];return e.forEach(q,function(e){var n=A.getContractDetails(e.id).then(function(t){var n=e.api_HRJobContractRevision_getcurrentrevision;return{id:e.id,is_primary:e.is_primary,is_current:e.is_current,revision_id:n?n.values.id:null,title:t.title,start_date:t.period_start_date,end_date:t.period_end_date,type:t.contract_type,pay:t.pay,hours:t.hours}}).then(function(t){A.collection.insertItem(e.id,t)});t.push(n)}),n.all(t).catch(function(e){s.error("Something went wrong",e)})}function m(){return y().then(function(){return A.getCollection()})}function f(){return A.collection.get()}function v(){return t.isEmpty(q)?u().then(function(e){return q=l(e)}):n.resolve(q)}function h(e){var t=function(e){var t=e.api_HRJobPay_get.values,n={};0!==t.length&&(n.amount=t[0].pay_amount,n.currency=t[0].pay_currency),e.pay=n},s=function(e){var t=e.api_HRJobHour_get.values,n={};0!==t.length&&(n.amount=t[0].hours_amount,n.unit=t[0].hours_unit),e.hours=n},r="getContractDetails_"+e,i={jobcontract_id:e,"api.HRJobPay.get":{jobcontract_id:e},"api.HRJobHour.get":{jobcontract_id:e}};return a[r]||(a[r]=o.post("HRJobDetails",i,"get").then(function(a){if(0===a.values.length)return n.reject("No details found for contract revision with ID "+e);var r=a.values[0];return t(r),s(r),r})),a[r]}function p(){var e=n.defer();return c.get().then(function(e){return o.post("HRJobContract",{sequential:0,contact_id:e.id},"getlengthofserviceymd")}).then(function(t){t.is_error?e.reject(t):e.resolve(t.values)}).catch(function(t){e.reject(t)}),e.promise}function g(e){var t=r.CRM.options.HRJobDetails||{};return"string"==typeof e&&(t=t[e]),{details:t}}function b(){return A.get().then(function(e){var n=t.sortBy(e,function(e){return[e.is_current]});return t.last(n)||{}})}function y(){return A.getContracts().then(d)}function _(){A.collection={items:{},insertItem:function(e,t){this.items[e]=t},getItem:function(e){return this.items[e]},set:function(e){this.items=e},get:function(){return this.items},remove:function(e){delete this.items[e]}}}function R(){q=[],a={},_()}function C(e){t.remove(q,{id:e.contractId}),A.collection.remove(e.contractId)}s.debug("Service: Contract Service");var q=[],A={};return A.get=m,A.getCollection=f,A.getContracts=v,A.removeContract=C,A.getContractDetails=h,A.getLengthOfService=p,A.getOptions=g,A.getCurrent=b,A.resetContracts=R,_(),A}var a={};return n.__name="contractService",n.$inject=["$q","$log","settings","apiService","modelService","contactDetailsService"],n}),define("contact-summary/services/item.service",["common/angular","common/lodash","common/moment"],function(e,t,n){"use strict";function a(){function t(){var e=Object.create(r);return e.item={},e}function n(){return this.item}function a(t){if(!e.isObject(t))throw new TypeError("Data must be of type Object");this.item=t}function s(e,t){this.item[e]=t}var r={};return r.createInstance=t,r.get=n,r.set=a,r.setKey=s,r}return a.__name="itemService",a}),define("contact-summary/services/job-role.service",["common/angular","common/lodash"],function(e,t){"use strict";function n(t,n,a,s,r){function o(){return c().then(function(){return u.getCollection()})}function i(){return u.collection.get()}function c(){var n=t.defer();return r.get().then(function(s){var r=[];if(e.forEach(s,function(e){r.push(e.id)}),0===r.length)return t.reject("No job roles found for contracts");a.post("HrJobRoles",{job_contract_id:{IN:r}},"get").then(function(e){var t=e.values.map(function(e){return{id:e.id,title:e.title,department:e.department,status:e.status,start_date:e.start_date,end_date:e.end_date}});u.collection.set(t)}).finally(function(){n.resolve()})}),n.promise}n.debug("Service: jobRoleService");var u={};return u.collection={items:{},insertItem:function(e,t){this.items[e]=t},getItem:function(e){return this.items[e]},set:function(e){this.items=e},get:function(){return this.items}},u.get=o,u.getCollection=i,u}return n.__name="jobRoleService",n.$inject=["$q","$log","apiService","modelService","contractService"],n}),define("contact-summary/services/leave.service",["common/angular","common/lodash","common/moment"],function(e,t,n){"use strict";function a(a,r,o,i,c,u){function l(t){var n=S.collection.getItem(t)||{};e.forEach(D,function(e){if("1"===e.is_active){var t=e.id;n.hasOwnProperty(t)||(n[t]={}),n[t].type_id=t,n[t].title=e.title,n[t].credit_activity_type_id=e.credit_activity_type_id?e.credit_activity_type_id:null,n[t].debit_activity_type_id=e.debit_activity_type_id?e.debit_activity_type_id:null,n[t].entitled=0,n[t].taken=0}}),S.collection.insertItem(t,n)}function d(t){var n=S.collection.getItem(t),a={};e.forEach(D,function(e){e.credit_activity_type_id&&(a[e.credit_activity_type_id]=e.id),e.debit_activity_type_id&&(a[e.debit_activity_type_id]=e.id)}),e.forEach(P,function(e){var t;if(a.hasOwnProperty(e.activity_type_id)&&(t=a[e.activity_type_id]),t){if(!n.hasOwnProperty(t))return;var s=Math.ceil(e.absence_range.approved_duration/60),r=+(s/8).toFixed(1);"toil"===n[t].title.toLowerCase()&&e.activity_type_id===n[t].credit_activity_type_id?n[t].entitled+=r:n[t].taken+=r}}),S.collection.insertItem(t,n)}function m(t){var n=S.collection.getItem(t);e.forEach(L,function(e){var t=e.type_id;n.hasOwnProperty(t)&&"toil"!==n[t].title.toLowerCase()&&(n[t].entitled=+e.amount)}),S.collection.insertItem(t,n)}function f(e){l(e),m(e),d(e)}function v(){return w(void 0).then(function(){return S.getData()})}function h(){var e=a.defer();return t.isEmpty(D)?i.get("HRAbsenceType").then(function(t){if(0===t.values.length)throw new Error("No absence type not found");D=t.values,e.resolve(D)}):e.resolve(D),e.promise}function p(e){var n=a.defer();return u.get().then(function(t){var n={target_contact_id:t.id,period_id:[e],options:{"absence-range":1},sequential:0};return i.post("Activity",n,"getabsences")}).then(function(e){P=t.filter(e.values,function(e){return"2"===e.status_id}),n.resolve(P)}),n.promise}function g(){return S.collection.get()}function b(){var e,t=a.defer();return s.getCurrent||(S.getCurrentPeriod().then(function(n){n.hasOwnProperty("id")?(e=n.id,w(e).then(function(){t.resolve(S.collection.getItem(e))})):t.resolve({})}),s.getCurrent=t.promise),s.getCurrent}function y(){return C().then(function(e){for(var t={},a=n(),s=0;s=0&&a.diff(o)<=0&&(t=e[s])}return t})}function _(){}function R(e){var t=a.defer();return u.get().then(function(t){var n={contact_id:t.id,period_id:e,options:{"absence-range":1}};return i.get("HRAbsenceEntitlement",n)}).then(function(e){L=e.values,t.resolve(L)}),t.promise}function C(){var e=a.defer();return t.isEmpty(T)?i.get("HRAbsencePeriod").then(function(t){if(0===t.values.length)return e.reject("No absence periods found");T=t.values,T=o("orderBy")(T,"start_date"),e.resolve(T)}).catch(function(t){r.debug("An error has occurred",t),e.reject(t)}):e.resolve(T),e.promise}function q(){var e,t=a.defer();return A().then(function(n){n.hasOwnProperty("id")?(e=n.id,w(e).then(function(){t.resolve(S.collection.getItem(e))})):t.resolve({})}),t.promise}function A(){var e,t={};return S.getCurrentPeriod().then(function(t){return e=t,C()}).then(function(n){var a=n.indexOf(e);return-1!==a&&a>0&&(t=n[a-1]),t})}function I(e){var t=a.defer();return S.getCurrentPeriod().then(function(n){if(n.hasOwnProperty("id")){var s=n.id;i.post("ContactSummary",{absence_types:e,period_id:s},"getabsenceaggregate").then(function(e){if(0===e.values.length)return a.reject("Staff average not returned");var n=Math.ceil(e.values[0].result/60),s=+(n/8).toFixed(1);t.resolve(s)})}else t.resolve(0)}),t.promise}function w(e){var n=a.defer();return t.isEmpty(S.collection.getItem(e))?S.getAbsenceTypes().then(function(){return S.getAbsences(e)}).then(function(){return S.getEntitlement(e)}).then(function(){return f(e)}).then(function(){n.resolve()}).catch(function(e){r.debug("An error has occurred",e),n.reject(e)}):n.resolve(),n.promise}r.debug("Service: leaveService");var P,L,T,D=[],S={};return S.collection={items:{},insertItem:function(e,t){this.items[e]=t},getItem:function(e){return this.items[e]},set:function(e){this.items=e},get:function(){return this.items}},S.get=v,S.getAbsenceTypes=h,S.getAbsences=p,S.getCollection=g,S.getCurrent=b,S.getCurrentPeriod=y,S.getDepartmentAverage=_,S.getEntitlement=R,S.getPrevious=q,S.getStaffAverage=I,S}var s={};return a.__name="leaveService",a.$inject=["$q","$log","$filter","apiService","modelService","contactDetailsService"],a}),define("contact-summary/services/model.service",["common/lodash","contact-summary/modules/contact-summary.services"],function(e,t){"use strict";function n(e){function t(){var t=Object.create(r);return t.data=e.createInstance(),t}function n(){return this.data.get()}function a(e){this.data.set(e)}function s(e,t){this.data.setKey(e,t)}var r={};return r.data={},r.createInstance=t,r.getData=n,r.setData=a,r.setDataKey=s,r}return n.__name="modelService",n.$inject=["itemService"],n}),define("contact-summary/modules/contact-summary.services",["common/angular","contact-summary/services/api.service","contact-summary/services/contact-details.service","contact-summary/services/contact.service","contact-summary/services/contract.service","contact-summary/services/item.service","contact-summary/services/job-role.service","contact-summary/services/leave.service","contact-summary/services/model.service"],function(e,t,n,a,s,r,o,i,c){"use strict";e.module("contactsummary.services",[]).factory(t.__name,t).factory(n.__name,n).factory(a.__name,a).factory(s.__name,s).factory(r.__name,r).factory(o.__name,o).factory(i.__name,i).factory(c.__name,c)}),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(t){return t.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/instances/absence-period.instance",["leave-absences/shared/modules/models-instances","common/moment","common/models/instances/instance","common/services/hr-settings"],function(e,t){"use strict";e.factory("AbsencePeriodInstance",["$log","ModelInstance","HR_settings",function(e,n,a){return e.debug("AbsencePeriodInstance"),n.extend({defaultCustomData:function(){return{current:!1}},transformAttributes:function(e){var n=t();return e.current=!1,t(e.start_date).isSameOrBefore(n,"day")&&t(e.end_date).isSameOrAfter(n,"day")&&(e.current=!0),e},isInPeriod:function(e){var n=a.DATE_FORMAT.toUpperCase(),s=t(e,n);return t(this.start_date).isSameOrBefore(s)&&t(this.end_date).isSameOrAfter(s)}})}])}),define("leave-absences/shared/apis/absence-period.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("AbsencePeriodAPI",["$log","api",function(e,t){return e.debug("AbsencePeriodAPI"),t.extend({all:function(t){return e.debug("AbsencePeriodAPI"),this.sendGET("AbsencePeriod","get",t).then(function(e){return e.values})}})}])}),define("leave-absences/shared/models/absence-period.model",["leave-absences/shared/modules/models","common/moment","leave-absences/shared/modules/shared-settings","leave-absences/shared/instances/absence-period.instance","leave-absences/shared/apis/absence-period.api","common/models/model","common/services/hr-settings"],function(e,t){"use strict";e.factory("AbsencePeriod",["$log","Model","AbsencePeriodAPI","AbsencePeriodInstance","shared-settings",function(e,n,a,s,r){return e.debug("AbsencePeriod"),n.extend({all:function(e){return a.all(e).then(function(e){return e.map(function(e){return s.init(e,!0)})})},current:function(){var e=t().format(r.serverDateFormat),n={start_date:{"<=":e},end_date:{">=":e}};return a.all(n).then(function(e){return e&&e.length?s.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,t,n){"use strict";n.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(n,a,s){return n.debug("AbsenceTypeAPI"),a.extend({all:function(t){return n.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(t||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,r,o){return n.debug("AbsenceTypeAPI.calculateToilExpiryDate"),o=e.assign({},o,{absence_type_id:a,date:t(r).format(s.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",o).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,t){return e.debug("AbsenceTypeInstance"),t.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,t){"use strict";t.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(t,n,a,s,r,o){return t.debug("AbsenceType"),a.extend({all:function(e){return r.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},calculateToilExpiryDate:function(e,t,n){return r.calculateToilExpiryDate(e,t,n)},canExpire:function(e){return r.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(t){return s.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(n){return n=e.indexBy(n,"value"),e.map(t,function(t){return e.assign(t,{calculation_unit_label:n[t.calculation_unit].label,calculation_unit_name:n[t.calculation_unit].name})})})}})}])}),define("leave-absences/shared/components/leave-requests-heatmap.component",["common/moment","common/components/heatmap.component","leave-absences/shared/modules/components"],function(e,t,n){function a(){function t(e){e.leaveRequests&&n()}function n(){s.heatmapValues={},a().forEach(function(t){var n=e(t.date).isoWeekday();s.heatmapValues[n]||(s.heatmapValues[n]=0),s.heatmapValues[n]++})}function a(){return s.leaveRequests.reduce(function(e,t){return e.concat(t.dates)},[])}var s=this;s.heatmapValues={},s.$onChanges=t}n.component("leaveRequestsHeatmap",{bindings:{leaveRequests:"<"},controller:a,controllerAs:"LeaveRequestsHeatmap",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-requests-heatmap.html"}]})}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,n,a){return e.debug("LeaveRequestAPI"),n.extend({all:function(t,n,s,r,o){e.debug("LeaveRequestAPI.all");var i=a.defer();return t&&t.contact_id&&t.contact_id.IN&&0===t.contact_id.IN.length?i.resolve({list:[],total:0,allIds:[]}):i.resolve(this.getAll("LeaveRequest",t,n,s,r,"getFull",o)),i.promise},balanceChangeByAbsenceType:function(n){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var s=a.defer();return n.contact_id&&n.period_id||s.reject("contact_id and period_id are mandatory"),n=t.defaults(n,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",n,!1).then(function(e){s.resolve(e.values)}),s.promise},calculateBalanceChange:function(n){return e.debug("LeaveRequestAPI.calculateBalanceChange",n),this.sendPOST("LeaveRequest","calculatebalancechange",n).then(function(e){return e.values.breakdown=t.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,t){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:t.toString()},!1)},create:function(t){return e.debug("LeaveRequestAPI.create",t),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,attachment_id:n}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,n){return n=t.assign({},n,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",n).then(function(e){return e.values})},find:function(t){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:t},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",n,!1).then(function(e){return e.values})},getComments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",n,!1).then(function(e){return e.values})},isManagedBy:function(t,n){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:t,contact_id:n}).then(function(e){return e.values})},isValid:function(n){e.debug("LeaveRequestAPI.isValid",n);var s=a.defer();return this.sendPOST("LeaveRequest","isValid",n).then(function(e){e.count>0?s.reject(t(e.values).map().flatten().value()):s.resolve(e.values)}),s.promise},saveComment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,text:n.text,contact_id:n.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(t){return e.debug("LeaveRequestAPI.update",t),t.id?this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]}):a.reject("id is mandatory field")}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,t,n){"use strict";n.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(n,a,s,r,o,i,c){function u(e){return v(e).then(function(e){var t=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=t,n.reject(e)}.bind(this))}.bind(this))}function l(){return c.all({id:this.type_id}).then(c.loadCalculationUnits).then(function(e){return n.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return v(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var t=[];return e.forEach(this.files,function(e){e.toBeDeleted&&t.push(i.deleteAttachment(this.id,e.attachment_id))}.bind(this)),n.all(t)}function f(e){return t.duration(e.time_to).subtract(t.duration(e.time_from)).asHours()}function v(t){return s.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){return e.find(n,function(e){return e.name===t})})}function h(t){var a=e.cloneDeep(t),s=a.breakdown.length>1,r=e.first(e.values(a.breakdown)),o=e.last(e.values(a.breakdown));return n.all([this.getWorkDayForDate(r.date),s&&this.getWorkDayForDate(o.date)]).then(function(t){return r.amount=t[0].time_from?Math.min(this.from_date_amount,f(t[0])):0,s&&(o.amount=t[1].time_from?Math.min(this.to_date_amount,f(t[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,t){return e+t.amount},0),a}.bind(this))}function p(){var e=this.id,t=[];return t.push(n.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(t){return function(){return i.saveComment(e,t)}}))),t=t.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return i.deleteComment(e.comment_id)})),n.all(t)}return o.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(t){var n=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===t&&e.pull(n,"from_date_type","to_date_type"),i.calculateBalanceChange(e.pick(this,n)).then(function(e){return"hours"===t?h.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,r.statusNames.cancelled)},approve:function(){return u.call(this,r.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,r.statusNames.rejected)},sendBack:function(){return u.call(this,r.statusNames.moreInformationRequired)},update:function(){return i.update(this.toAPI()).then(function(){return n.all([p.call(this),m.call(this)])}.bind(this))}, +create:function(){return i.create(this.toAPI()).then(function(e){return this.id=e.id,n.all([p.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(t){if(t.comment_id)return void(t.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return t.created_at===e.created_at&&t.text===e.text})},delete:function(){return i.delete(this.id)},getBalanceChangeBreakdown:function(){return i.getBalanceChangeBreakdown(this.id).then(function(t){return{amount:e.reduce(t.values,function(e,t){return e+parseFloat(t.amount)},0),breakdown:t.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return i.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return n.reject(e)})},isValid:function(){return i.isValid(this.toAPI())},isApproved:function(){return d.call(this,r.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,r.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,r.statusNames.cancelled)},isRejected:function(){return d.call(this,r.statusNames.rejected)},isSentBack:function(){return d.call(this,r.statusNames.moreInformationRequired)},loadComments:function(){return this.id?i.getComments(this.id).then(function(e){this.comments=e}.bind(this)):n.resolve()},roleOf:function(e){return this.contact_id===e?n.resolve("owner"):a(r.permissions.admin.administer).then(function(t){return t?"admin":i.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])},loadAttachments:function(){return this.id?i.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):n.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,t,n,a){return e.debug("LeaveRequest"),t.extend({all:function(e,t,s,r,o){return n.all(this.processFilters(e),t,s,r,o).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return n.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return n.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/components/leave-requests-heatmap.component","leave-absences/shared/models/leave-request.model"],function(e,t,n){function a(t,n,a){function s(){t.$emit("LeaveWidget::childIsLoading",d)}function r(){o()&&i().finally(function(){t.$emit("LeaveWidget::childIsReady",d)})}function o(){return m.absenceTypes&&m.absenceTypes.length&&m.contactId&&m.absencePeriod&&m.leaveRequestStatuses&&m.leaveRequestStatuses.length}function i(){var e=c(),t=u();return n.all({contact_id:m.contactId,from_date:{">=":m.absencePeriod.start_date},to_date:{"<=":m.absencePeriod.end_date},status_id:{IN:t},type_id:{IN:e}},null,null,null,!1).then(function(e){m.leaveRequests=e.list}).then(l)}function c(){return m.absenceTypes.map(function(e){return e.id})}function u(){return m.leaveRequestStatuses.map(function(e){return e.value})}function l(){m.absenceTypes=m.absenceTypes.map(function(t){var n;return n=m.leaveRequests.filter(function(e){return+e.type_id==+t.id}).reduce(function(e,t){return e+t.balance_change},0),e.assign({balance:Math.abs(n)},t)})}var d="leave-widget-absence-types-amount-taken",m=this;m.leaveRequests=[],m.$onChanges=r,m.$onInit=s}n.component("leaveWidgetAbsenceTypesAmountTaken",{bindings:{title:"@",leaveName:"@?",absenceTypes:"<",contactId:"<",absencePeriod:"<",leaveRequestStatuses:"<"},controller:a,controllerAs:"absenceTypesTaken",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-widget/leave-widget-absence-types-amount-taken.html"}]}),a.$inject=["$scope","LeaveRequest","OptionGroup"]}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,n){function a(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(n.remainder=a[0].remainder),delete n["api.LeavePeriodEntitlement.getremainder"],n}function s(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return n.value=a,delete n["api.LeavePeriodEntitlement.getentitlement"],n}return e.debug("EntitlementAPI"),n.extend({all:function(t,n){return e.debug("EntitlementAPI.all"),t["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},n&&(t["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",t,!1).then(function(e){return e.values}).then(function(e){return e=e.map(s),n&&(e=e.map(a)),e})},breakdown:function(t){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",t).then(function(e){return e.values})},getLeaveBalances:function(t,n,a,s,r){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",t,n,a,s,"getLeaveBalances",r)}})}])}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,t){return e.debug("EntitlementLogAPI"),t.extend({all:function(t){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",t,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,t,n){return e.debug("EntitlementInstance"),t.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return n.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,t){"use strict";t.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(t,n,a,s,r){return t.debug("Entitlement"),n.extend({all:function(e,t){return a.all(this.processFilters(e),t).then(function(e){return e.map(function(e){return s.init(e,!0)})})},breakdown:function(t,n){return a.breakdown(t).then(function(t){return n?(n.map(function(n){var a=e.find(t,function(e){return e.id===n.id});return a&&(n.breakdown=a.breakdown),n}),n):t.map(function(e){return s.init(e,!0)})})},logs:function(t){return t=e.cloneDeep(t||{}),t.contact_id&&(t["entitlement_id.contact_id"]=t.contact_id,delete t.contact_id),t.period_id&&(t["entitlement_id.period_id"]=t.period_id,delete t.period_id),t.return=t.return||[],t.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),r.all(t)}})}])}),define("leave-absences/shared/components/leave-widget/leave-widget-absence-types-available-balance.component",["common/lodash","leave-absences/shared/modules/components","leave-absences/shared/models/entitlement.model"],function(e,t){function n(t,n){function a(){t.$emit("LeaveWidget::childIsLoading",u)}function s(){r()&&i().then(function(t){return e.indexBy(t,"type_id")}).then(c).then(o).then(function(e){l.absenceTypes=e}).then(function(){t.$emit("LeaveWidget::childIsReady",u)})}function r(){return l.absenceTypes&&l.absencePeriod&&l.contactId}function o(e){return e.filter(function(e){var t=e.entitlement&&e.entitlement.value>0,n="1"===e.allow_overuse,a="1"===e.allow_accruals_request;return t||n||a})}function i(){return n.all({contact_id:l.contactId,period_id:l.absencePeriod.id,"type_id.is_active":!0},!0)}function c(t){return l.absenceTypes.map(function(n){return e.assign({entitlement:t[n.id]},n)})}var u="leave-widget-absence-types-available-balance",l=this;l.$onChanges=s,l.$onInit=a}t.component("leaveWidgetAbsenceTypesAvailableBalance",{bindings:{absencePeriod:"<",absenceTypes:"<",contactId:"<"},controller:n,controllerAs:"leaveWidgetBalance",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-widget/leave-widget-absence-types-available-balance.html"}]}),n.$inject=["$scope","Entitlement"]}),define("leave-absences/shared/components/leave-widget/leave-widget-next-leave.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/models/leave-request.model"],function(e,t,n){function a(n,a,s,r,o){function i(){a.$emit("LeaveWidget::childIsLoading",b)}function c(){u()&&n.all([f(),v()]).then(function(){y.nextLeaveRequest&&(l(),p(),h(),g())}).finally(function(){a.$emit("LeaveWidget::childIsReady",b)})}function u(){return y.absenceTypes&&y.absenceTypes.length&&y.contactId&&y.leaveRequestStatuses&&y.leaveRequestStatuses.length}function l(){y.nextLeaveRequest.from_date=y.nextLeaveRequest.from_date&&t(y.nextLeaveRequest.from_date),y.nextLeaveRequest.to_date=y.nextLeaveRequest.to_date&&t(y.nextLeaveRequest.to_date)}function d(){return e.pluck(y.absenceTypes,"id")}function m(){return e.pluck(y.leaveRequestStatuses,"value")}function f(){return r.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(t){y.dayTypes=e.indexBy(t,"value")})}function v(){var e=t().format(o.serverDateFormat);return s.all({contact_id:y.contactId,from_date:{">=":e},request_type:"leave",status_id:{IN:m()},type_id:{IN:d()},options:{limit:1}},null,"from_date ASC",null,!1).then(function(e){y.nextLeaveRequest=e.list[0]||null})}function h(){y.nextLeaveRequest.balance_change=Math.abs(y.nextLeaveRequest.balance_change)}function p(){var t=e.find(y.absenceTypes,function(e){return+e.id==+y.nextLeaveRequest.type_id})||{};y.nextLeaveRequest["type_id.title"]=t.title,y.nextLeaveRequest["type_id.calculation_unit_name"]=t.calculation_unit_name}function g(){y.requestStatus=e.find(y.leaveRequestStatuses,function(e){return+e.value==+y.nextLeaveRequest.status_id})}var b="leave-widget-next-leave",y=this;y.dayTypes={},y.balanceDeduction=0,y.nextLeaveRequest=null,y.requestStatus={},y.$onChanges=c,y.$onInit=i}n.component("leaveWidgetNextLeave",{bindings:{absenceTypes:"<",contactId:"<",leaveRequestStatuses:"<"},controller:a,controllerAs:"nextLeave",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-widget/leave-widget-next-leave.html"}]}),a.$inject=["$q","$scope","LeaveRequest","OptionGroup","shared-settings"]}),define("leave-absences/shared/components/leave-widget/leave-widget.component",["common/angular","common/lodash","common/moment","common/directives/loading","common/directives/help-text.directive","common/filters/time-unit-applier.filter","common/models/contract","common/services/pub-sub","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/components","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component","leave-absences/shared/components/leave-widget/leave-widget-absence-types-available-balance.component","leave-absences/shared/components/leave-widget/leave-widget-next-leave.component"],function(e,t,n){function a(e,a,s,r,o,i,c,u){function l(){e.debug("Controller: leaveWidgetController"),p(),b()}function d(){A++,I.loading.childComponents=!0}function m(){--A<=0&&(A=0,I.loading.childComponents=!1)}function f(e){return t.find(e,function(e){return e.current})}function v(e){return f(e)||h(e)}function h(e){return t.chain(e).sort(function(e,t){return n(e.end_date).diff(t)}).last().value()}function p(){s.$on("LeaveWidget::childIsLoading",d),s.$on("LeaveWidget::childIsReady",m),g()}function g(){["LeaveRequest::new","LeaveRequest::edit","LeaveRequest::delete","LeaveRequest::updatedByManager","LeaveRequest::edit","contract:created","contract:deleted","contract-refresh"].forEach(function(e){u.subscribe(e,b)})}function b(){_().then(function(){return a.all([y(),C(),R()])}).finally(function(){I.loading.component=!1})}function y(){return o.all().then(o.loadCalculationUnits).then(function(e){I.absenceTypes=e,I.sicknessAbsenceTypes=e.filter(function(e){return+e.is_sick})})}function _(){return i.all({contact_id:I.contactId,deleted:!1}).then(function(e){I.jobContract=t.find(e,function(e){return+e.is_current})}).then(function(){if(!I.jobContract)return a.reject()})}function R(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){I.leaveRequestStatuses=e.filter(function(e){return t.includes(q,e.name)})})}function C(){return r.all().then(v).then(function(e){I.absencePeriod=e})}var q=["approved","admin_approved","awaiting_approval","more_information_required"],A=0,I=this;I.absenceTypes=[],I.absencePeriod=null,I.jobContract=null,I.loading={childComponents:!1,component:!0},I.leaveRequestStatuses=[],I.sicknessAbsenceTypes=[],I.$onInit=l}e.module("leave-absences.components.leave-widget",["common.components","common.directives","common.filters","common.models","common.services","leave-absences.components","leave-absences.models","leave-absences.settings"]).component("leaveWidget",{bindings:{contactId:"<"},controller:a,controllerAs:"leaveWidget",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-widget/leave-widget.html"}]}),a.$inject=["$log","$q","$scope","AbsencePeriod","AbsenceType","Contract","OptionGroup","pubSub"]}),define("contact-summary/modules/contact-summary.module",["common/angular","contact-summary/modules/contact-summary.config","contact-summary/modules/contact-summary.constants","contact-summary/modules/contact-summary.controllers","contact-summary/modules/contact-summary.core","contact-summary/modules/contact-summary.directives","contact-summary/modules/contact-summary.run","contact-summary/modules/contact-summary.services","leave-absences/shared/components/leave-widget/leave-widget.component"],function(e){e.module("contactsummary",["contactsummary.core","contactsummary.config","contactsummary.run","contactsummary.constants","contactsummary.controllers","contactsummary.directives","contactsummary.services","leave-absences.components.leave-widget"])}),function(e,t){t.config({urlArgs:"bust="+(new Date).getTime(),paths:{"contact-summary":e.vars.contactsummary.baseURL+"/js/src/contact-summary"}}),t(["contact-summary/modules/contact-summary.module"],function(){"use strict";document.dispatchEvent("function"==typeof window.CustomEvent?new window.CustomEvent("contactsummaryReady"):function(){var e=document.createEvent("Event");return e.initEvent("contactsummaryReady",!0,!0),e}())})}(CRM,require); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/contactsummary/js/dist/contact-summary.min.js.map \ No newline at end of file diff --git a/contactsummary/js/test/controllers/key-dates.controller.spec.js b/contactsummary/js/test/controllers/key-dates.controller.spec.js index c6b11cfda45..2ed19010c4e 100644 --- a/contactsummary/js/test/controllers/key-dates.controller.spec.js +++ b/contactsummary/js/test/controllers/key-dates.controller.spec.js @@ -14,7 +14,7 @@ define([ var $httpBackend, $rootScope, $q, contractServiceMock, controller, ctrlConstructor, jobRoleServiceMock, pubSub; - beforeEach(module('contactsummary', 'contactsummary.mocks')); + beforeEach(module('contactsummary', 'contactsummary.mocks', 'contact-summary.templates')); beforeEach(module(function ($provide) { $provide.factory('contractService', function () { diff --git a/hrbank/info.xml b/hrbank/info.xml index dea6d631375..0b93463f2e3 100644 --- a/hrbank/info.xml +++ b/hrbank/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrcareer/hrcareer.php b/hrcareer/hrcareer.php index b394863c98d..b4ccc91b659 100644 --- a/hrcareer/hrcareer.php +++ b/hrcareer/hrcareer.php @@ -189,6 +189,6 @@ function hrcareer_civicrm_pageRun($page) { ->addScriptFile('civicrm', 'js/jquery/jquery.crmRevisionLink.js', CRM_Core_Resources::DEFAULT_WEIGHT, 'html-header'); CRM_Core_Resources::singleton() - ->addScriptFile('org.civicrm.hrcareer', 'js/hrcareer.js'); + ->addScriptFile('org.civicrm.hrcareer', 'js/dist/hrcareer.min.js', 1010); } } diff --git a/hrcareer/info.xml b/hrcareer/info.xml index c7da46ba2eb..5aade21ea7b 100644 --- a/hrcareer/info.xml +++ b/hrcareer/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrcareer/js/build.js b/hrcareer/js/build.js new file mode 100644 index 00000000000..ea3d3bdc228 --- /dev/null +++ b/hrcareer/js/build.js @@ -0,0 +1,12 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/hrcareer.min.js', + name: 'hrcareer', + skipModuleInsertion: true, + generateSourceMaps: true, + paths: { + 'hrcore': 'empty:' + } +}) diff --git a/hrcareer/js/dist/hrcareer.min.js b/hrcareer/js/dist/hrcareer.min.js new file mode 100644 index 00000000000..a7b4e51a178 --- /dev/null +++ b/hrcareer/js/dist/hrcareer.min.js @@ -0,0 +1,2 @@ +!function(e){define("hrcareer/app",["hrcore/helpers"],function(r){"use strict";e("body").on("crmFormLoad",function(){var e=r.getCiviCRMFormLabel("custom-group-Career","Career:End_Date");e.length&&!e.find(".helpicon").length&&(e.append(" "),r.appendHelpIcon(e,"End Date Help","hrcareer-enddate","CRM/HRCareer/Page/helptext"))})})}(CRM.$),function(e){e(["hrcareer/app"])}(require); +//# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/hrcareer/js/dist/hrcareer.min.js.map \ No newline at end of file diff --git a/hrcareer/js/hrcareer.js b/hrcareer/js/hrcareer.js deleted file mode 100644 index a75e544bcdc..00000000000 --- a/hrcareer/js/hrcareer.js +++ /dev/null @@ -1,12 +0,0 @@ -// http://civicrm.org/licensing -CRM.$(function($) { - $('body').on('crmFormLoad', function(event) { - if (event.profileName == 'hrcareer_tab') { - var accessName = $('[data-crm-custom="Career:End_Date"]').attr('name'); - if($('div#editrow-' + accessName + ' a.helpicon').length == 0) { - var helpIcon = $( "" ); - $('div#editrow-' + accessName +' div label').append(helpIcon); - } - } - }); -}); diff --git a/hrcareer/js/src/hrcareer.js b/hrcareer/js/src/hrcareer.js new file mode 100644 index 00000000000..7fcb96229b0 --- /dev/null +++ b/hrcareer/js/src/hrcareer.js @@ -0,0 +1,5 @@ +/* eslint-env amd */ + +(function (require) { + require(['hrcareer/app']); +})(require); diff --git a/hrcareer/js/src/hrcareer/app.js b/hrcareer/js/src/hrcareer/app.js new file mode 100644 index 00000000000..219c387c5a1 --- /dev/null +++ b/hrcareer/js/src/hrcareer/app.js @@ -0,0 +1,25 @@ +/* eslint-env amd */ + +(function ($) { + define([ + 'hrcore/helpers' + ], function (helpers) { + 'use strict'; + + $('body').on('crmFormLoad', function () { + var $label = helpers.getCiviCRMFormLabel( + 'custom-group-Career', 'Career:End_Date'); + + if (!$label.length || $label.find('.helpicon').length) { + return; + } + + $label.append(' '); // Populates a space before the icon + helpers.appendHelpIcon( + $label, + 'End Date Help', + 'hrcareer-enddate', + 'CRM/HRCareer/Page/helptext'); + }); + }); +}(CRM.$)); diff --git a/hrcase/hrcase.php b/hrcase/hrcase.php index 6d12bdbb823..61869c4f0e7 100644 --- a/hrcase/hrcase.php +++ b/hrcase/hrcase.php @@ -137,7 +137,6 @@ function hrcase_civicrm_buildForm($formName, &$form) { ), )); } - CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrcase', 'js/hrcase.js'); } } diff --git a/hrcase/info.xml b/hrcase/info.xml index bd25206b872..f40bd7314c6 100644 --- a/hrcase/info.xml +++ b/hrcase/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrcase/js/hrcase.js b/hrcase/js/hrcase.js deleted file mode 100644 index 756593f9f61..00000000000 --- a/hrcase/js/hrcase.js +++ /dev/null @@ -1,97 +0,0 @@ -// http://civicrm.org/licensing -(function ($, _) { - // js to hide medium and location on case activity and case screen - $(document).on('crmLoad', function() { - $('#crm-activity-view-table .crm-case-activity-view-Client .label').html('Contact'); - $('.crm-case-activity-form-block-medium_id, .crm-case-form-block-medium_id').hide(); - $('.crm-case-other-relationships-block').hide(); - $('.crm-case_activities-accordion').insertAfter($('.case-control-panel')); - $('.crm-case-roles-block').click(function(){ - $(".crm-case-roles-block .crm-accordion-body .dataTables_wrapper .report-layout tbody tr td:contains('Client')").html('Contact'); - }); - if($('.DataTables_sort_wrapper').html()){ - $('.crm-case-activities-type .DataTables_sort_wrapper').html('Activity'); - $('.crm-case-activities-assignee .DataTables_sort_wrapper').html('Assignee'); - }else{ - $('.crm-case-activities-type').html('Activity'); - $('.crm-case-activities-assignee').html('Assignee'); - } - }); - - // js to update date-time while completing case activity status on edit screen - $(document).on('change', '.crm-case-activity-form-block-status_id #status_id', updateActivityDate); - - function updateActivityDate() { - var statusval = $(this).val(), - status = CRM.hrcase.statusID; - if (statusval == status) { - var prevDate = $('#activity_date_time').val(), - prevTime = $("input#activity_date_time_time").val(), - newDate = new Date(), - newTime = newDate.getHours()+':' + newDate.getMinutes(), - date_format = $('input#activity_date_time').attr('format'), - displayDateValue = $.datepicker.formatDate(date_format, newDate); - $('input#activity_date_time, input#activity_date_time_display').val( displayDateValue ); - var displayTimeValue = $('input#activity_date_time_time').val(newTime).trigger( 'focus' ).val(); - status = 'Changed from "'+prevDate+' '+prevTime+'" to "'+displayDateValue+' '+displayTimeValue+'". Undo '; - CRM.alert(status, 'Updated Completion Time ', 'notice'); - $('#revert-link a').on('click', function() { - $('input#activity_date_time, input#activity_date_time_display').val( prevDate ); - $('input#activity_date_time_time').val( prevTime ); - $('input#activity_date_time_time').trigger( 'focus' ); - }); - } - } - -// js to update date-time while completing case activity status on Case manage screen - var manageScreen = CRM.hrcase.manageScreen; - if( manageScreen ) { - $(document).ajaxSuccess(function(event, xhr, settings) { - var statusUrl = settings.url, - status = CRM.hrcase.statusID, - searchUrl = CRM.url("civicrm/ajax/rest"), - params = {sequential: "1"}; - if (statusUrl == searchUrl) { - var data = settings.data, - hash, - hashes = data.split('&'); - for(var i = 0; i < hashes.length; i++) { - hash = hashes[i].split('='); - params[hash[0]] = hash[1]; - } - if( (params['entity'] == "Activity") && (params['status_id'] == status) && (params['action'] == "update") ) { - var response = $.parseJSON(xhr.responseText); - var link = $('a.crm-activity-change-status'), - activityId = response.id, - caseId = params['case_id']; - var date = new Date(); - var dateValue = date.toJSON(); - var dataUrl = CRM.url('civicrm/ajax/rest'); - var data = 'json=1&version=3&entity=Activity&action=update&id=' + activityId + '&activity_date_time=' + dateValue + '&case_id=' + caseId; - $.ajax({ - type : 'POST', - dataType : 'json', - url : dataUrl, - data : data, - success : function(values) { - if( values.is_error ) { - CRM.alert(values.error_message, ts('Unable to change activity date time to current date time'), 'error'); - return false; - } - else { - // reload the table on success - if (window.buildCaseActivities) { - buildCaseActivities(true); - } - } - }, - error : function(jqXHR) { - CRM.alert(jqXHR.responseText, jqXHR.statusText, 'error'); - return false; - } - }); - } - } - }); - } -}(CRM.$, CRM._)); diff --git a/hrdemog/CRM/HRDemog/Upgrader.php b/hrdemog/CRM/HRDemog/Upgrader.php deleted file mode 100644 index e32e54c4e78..00000000000 --- a/hrdemog/CRM/HRDemog/Upgrader.php +++ /dev/null @@ -1,185 +0,0 @@ -executeSqlFile('sql/myinstall.sql'); - } - - /** - * Example: Run an external SQL script when the module is uninstalled - * - public function uninstall() { - $this->executeSqlFile('sql/myuninstall.sql'); - } - - /** - * Example: Run a simple query when a module is enabled - * - public function enable() { - CRM_Core_DAO::executeQuery('UPDATE foo SET is_active = 1 WHERE bar = "whiz"'); - } - - /** - * Example: Run a simple query when a module is disabled - * - public function disable() { - CRM_Core_DAO::executeQuery('UPDATE foo SET is_active = 0 WHERE bar = "whiz"'); - } - - /** - * Example: Run a couple simple queries - * - * @return TRUE on success - * @throws Exception - * - public function upgrade_4200() { - $this->ctx->log->info('Applying update 4200'); - CRM_Core_DAO::executeQuery('UPDATE foo SET bar = "whiz"'); - CRM_Core_DAO::executeQuery('DELETE FROM bang WHERE willy = wonka(2)'); - return TRUE; - } // */ - - - /** - * Example: Run an external SQL script - * - * @return TRUE on success - * @throws Exception - public function upgrade_4201() { - $this->ctx->log->info('Applying update 4201'); - // this path is relative to the extension base dir - $this->executeSqlFile('sql/upgrade_4201.sql'); - return TRUE; - } // */ - - - /** - * Example: Run a slow upgrade process by breaking it up into smaller chunk - * - * @return TRUE on success - * @throws Exception - public function upgrade_4202() { - $this->ctx->log->info('Planning update 4202'); // PEAR Log interface - - $this->addTask(ts('Process first step'), 'processPart1', $arg1, $arg2); - $this->addTask(ts('Process second step'), 'processPart2', $arg3, $arg4); - $this->addTask(ts('Process second step'), 'processPart3', $arg5); - return TRUE; - } - public function processPart1($arg1, $arg2) { sleep(10); return TRUE; } - public function processPart2($arg3, $arg4) { sleep(10); return TRUE; } - public function processPart3($arg5) { sleep(10); return TRUE; } - // */ - - - /** - * Example: Run an upgrade with a query that touches many (potentially - * millions) of records by breaking it up into smaller chunks. - * - * @return TRUE on success - * @throws Exception - public function upgrade_4203() { - $this->ctx->log->info('Planning update 4203'); // PEAR Log interface - - $minId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(min(id),0) FROM civicrm_contribution'); - $maxId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(max(id),0) FROM civicrm_contribution'); - for ($startId = $minId; $startId <= $maxId; $startId += self::BATCH_SIZE) { - $endId = $startId + self::BATCH_SIZE - 1; - $title = ts('Upgrade Batch (%1 => %2)', array( - 1 => $startId, - 2 => $endId, - )); - $sql = ' - UPDATE civicrm_contribution SET foobar = whiz(wonky()+wanker) - WHERE id BETWEEN %1 and %2 - '; - $params = array( - 1 => array($startId, 'Integer'), - 2 => array($endId, 'Integer'), - ); - $this->addTask($title, 'executeSql', $sql, $params); - } - return TRUE; - } // */ - - public function upgrade_1400() { - $this->ctx->log->info('Planning update 1400'); // PEAR Log interface - foreach (array('ethnicity_20130725123943', 'religion_20130725124132', 'sexual_orientation_20130725124348', 'marital_status_20130913084916') as $key => $value) { - $optParams = array( - 'option_group_id' => $value, - 'label' => 'Prefer Not to Say', - 'value' => 'Prefer Not to Say', - 'name' => 'Prefer_Not_to_Say', - ); - civicrm_api3('OptionValue', 'create', $optParams); - $optParam = array( - 'option_group_id' => $value, - 'label' => 'Not Applicable', - 'value' => 'Not Applicable', - 'name' => 'Not_Applicable', - ); - civicrm_api3('OptionValue', 'create', $optParam); - } - - $sql = "UPDATE civicrm_custom_field JOIN civicrm_custom_group ON civicrm_custom_group.id = civicrm_custom_field.custom_group_id SET civicrm_custom_field.default_value = CASE WHEN civicrm_custom_field.name = 'Ethnicity' THEN ' Not Applicable ' ELSE 'Not Applicable' END WHERE civicrm_custom_field.name IN ('Ethnicity','Religion', 'Sexual_Orientation', 'Marital_Status') AND civicrm_custom_group.name = 'Extended_Demographics'"; - CRM_Core_DAO::executeQuery($sql); - CRM_Core_DAO::executeQuery("UPDATE civicrm_custom_group SET is_reserved = 0, collapse_display = 1 where name = 'Extended_Demographics'"); - return TRUE; - } - - /** - * Upgrade CustomGroup, setting Extended_Demographics is_reserved value to YES - * - * @return bool - */ - public function upgrade_1401() { - $result = civicrm_api3('CustomGroup', 'get', [ - 'sequential' => 1, - 'return' => ['id'], - 'name' => 'Extended_Demographics', - ]); - - civicrm_api3('CustomGroup', 'create', [ - 'id' => $result['id'], - 'is_reserved' => 1, - ]); - - return TRUE; - } - -} diff --git a/hrdemog/CRM/HRDemog/Upgrader/Base.php b/hrdemog/CRM/HRDemog/Upgrader/Base.php deleted file mode 100644 index 6e2a3fb9267..00000000000 --- a/hrdemog/CRM/HRDemog/Upgrader/Base.php +++ /dev/null @@ -1,298 +0,0 @@ -ctx = array_shift($args); - $instance->queue = $instance->ctx->queue; - $method = array_shift($args); - return call_user_func_array(array($instance, $method), $args); - } - - public function __construct($extensionName, $extensionDir) { - $this->extensionName = $extensionName; - $this->extensionDir = $extensionDir; - } - - // ******** Task helpers ******** - - /** - * Run a CustomData file - * - * @param string $relativePath the CustomData XML file path (relative to this extension's dir) - * @return bool - */ - public function executeCustomDataFile($relativePath) { - $xml_file = $this->extensionDir . '/' . $relativePath; - return $this->executeCustomDataFileByAbsPath($xml_file); - } - - /** - * Run a CustomData file - * - * @param string $xml_file the CustomData XML file path (absolute path) - * @return bool - */ - protected static function executeCustomDataFileByAbsPath($xml_file) { - require_once 'CRM/Utils/Migrate/Import.php'; - $import = new CRM_Utils_Migrate_Import(); - $import->run($xml_file); - return TRUE; - } - - /** - * Run a SQL file - * - * @param string $relativePath the SQL file path (relative to this extension's dir) - * @return bool - */ - public function executeSqlFile($relativePath) { - CRM_Utils_File::sourceSQLFile( - CIVICRM_DSN, - $this->extensionDir . '/' . $relativePath - ); - return TRUE; - } - - /** - * Run one SQL query - * - * This is just a wrapper for CRM_Core_DAO::executeSql, but it - * provides syntatic sugar for queueing several tasks that - * run different queries - */ - public function executeSql($query, $params = array()) { - // FIXME verify that we raise an exception on error - CRM_Core_DAO::executeSql($query, $params); - return TRUE; - } - - /** - * Syntatic sugar for enqueuing a task which calls a function - * in this class. The task is weighted so that it is processed - * as part of the currently-pending revision. - * - * After passing the $funcName, you can also pass parameters that will go to - * the function. Note that all params must be serializable. - */ - public function addTask($title) { - $args = func_get_args(); - $title = array_shift($args); - $task = new CRM_Queue_Task( - array(get_class($this), '_queueAdapter'), - $args, - $title - ); - return $this->queue->createItem($task, array('weight' => -1)); - } - - // ******** Revision-tracking helpers ******** - - /** - * Determine if there are any pending revisions - * - * @return bool - */ - public function hasPendingRevisions() { - $revisions = $this->getRevisions(); - $currentRevision = $this->getCurrentRevision(); - - if (empty($revisions)) { - return FALSE; - } - if (empty($currentRevision)) { - return TRUE; - } - - return ($currentRevision < max($revisions)); - } - - /** - * Add any pending revisions to the queue - */ - public function enqueuePendingRevisions(CRM_Queue_Queue $queue) { - $this->queue = $queue; - - $currentRevision = $this->getCurrentRevision(); - foreach ($this->getRevisions() as $revision) { - if ($revision > $currentRevision) { - $title = ts('Upgrade %1 to revision %2', array( - 1 => $this->extensionName, - 2 => $revision, - )); - - // note: don't use addTask() because it sets weight=-1 - - $task = new CRM_Queue_Task( - array(get_class($this), '_queueAdapter'), - array('upgrade_' . $revision), - $title - ); - $this->queue->createItem($task); - - $task = new CRM_Queue_Task( - array(get_class($this), '_queueAdapter'), - array('setCurrentRevision', $revision), - $title - ); - $this->queue->createItem($task); - } - } - } - - /** - * Get a list of revisions - * - * @return array(revisionNumbers) sorted numerically - */ - public function getRevisions() { - if (! is_array($this->revisions)) { - $this->revisions = array(); - - $clazz = new ReflectionClass(get_class($this)); - $methods = $clazz->getMethods(); - foreach ($methods as $method) { - if (preg_match('/^upgrade_(.*)/', $method->name, $matches)) { - $this->revisions[] = $matches[1]; - } - } - sort($this->revisions, SORT_NUMERIC); - } - - return $this->revisions; - } - - public function getCurrentRevision() { - // return CRM_Core_BAO_Extension::getSchemaVersion($this->extensionName); - $key = $this->extensionName . ':version'; - return CRM_Core_BAO_Setting::getItem('Extension', $key); - } - - public function setCurrentRevision($revision) { - // We call this during hook_civicrm_install, but the underlying SQL - // UPDATE fails because the extension record hasn't been INSERTed yet. - // Instead, track revisions in our own namespace. - // CRM_Core_BAO_Extension::setSchemaVersion($this->extensionName, $revision); - - $key = $this->extensionName . ':version'; - CRM_Core_BAO_Setting::setItem($revision, 'Extension', $key); - return TRUE; - } - - // ******** Hook delegates ******** - - public function onInstall() { - $files = glob($this->extensionDir . '/sql/*_install.sql'); - if (is_array($files)) { - foreach ($files as $file) { - CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $file); - } - } - $files = glob($this->extensionDir . '/xml/*_install.xml'); - if (is_array($files)) { - foreach ($files as $file) { - $this->executeCustomDataFileByAbsPath($file); - } - } - if (is_callable(array($this, 'install'))) { - $this->install(); - } - $revisions = $this->getRevisions(); - if (!empty($revisions)) { - $this->setCurrentRevision(max($revisions)); - } - } - - public function onUninstall() { - if (is_callable(array($this, 'uninstall'))) { - $this->uninstall(); - } - $files = glob($this->extensionDir . '/sql/*_uninstall.sql'); - if (is_array($files)) { - foreach ($files as $file) { - CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $file); - } - } - $this->setCurrentRevision(NULL); - } - - public function onEnable() { - // stub for possible future use - if (is_callable(array($this, 'enable'))) { - $this->enable(); - } - } - - public function onDisable() { - // stub for possible future use - if (is_callable(array($this, 'disable'))) { - $this->disable(); - } - } - - public function onUpgrade($op, CRM_Queue_Queue $queue = NULL) { - switch($op) { - case 'check': - return array($this->hasPendingRevisions()); - case 'enqueue': - return $this->enqueuePendingRevisions($queue); - default: - } - } -} diff --git a/hrdemog/hrdemog.civix.php b/hrdemog/hrdemog.civix.php deleted file mode 100644 index 6b646c8cd27..00000000000 --- a/hrdemog/hrdemog.civix.php +++ /dev/null @@ -1,215 +0,0 @@ -template_dir ) ) { - array_unshift( $template->template_dir, $extDir ); - } else { - $template->template_dir = array( $extDir, $template->template_dir ); - } - - $include_path = $extRoot . PATH_SEPARATOR . get_include_path( ); - set_include_path( $include_path ); -} - -/** - * (Delegated) Implementation of hook_civicrm_xmlMenu - * - * @param $files array(string) - */ -function _hrdemog_civix_civicrm_xmlMenu(&$files) { - foreach (_hrdemog_civix_glob(__DIR__ . '/xml/Menu/*.xml') as $file) { - $files[] = $file; - } -} - -/** - * Implementation of hook_civicrm_install - */ -function _hrdemog_civix_civicrm_install() { - _hrdemog_civix_civicrm_config(); - if ($upgrader = _hrdemog_civix_upgrader()) { - return $upgrader->onInstall(); - } -} - -/** - * Implementation of hook_civicrm_uninstall - */ -function _hrdemog_civix_civicrm_uninstall() { - _hrdemog_civix_civicrm_config(); - if ($upgrader = _hrdemog_civix_upgrader()) { - return $upgrader->onUninstall(); - } -} - -/** - * (Delegated) Implementation of hook_civicrm_enable - */ -function _hrdemog_civix_civicrm_enable() { - _hrdemog_civix_civicrm_config(); - if ($upgrader = _hrdemog_civix_upgrader()) { - if (is_callable(array($upgrader, 'onEnable'))) { - return $upgrader->onEnable(); - } - } -} - -/** - * (Delegated) Implementation of hook_civicrm_disable - */ -function _hrdemog_civix_civicrm_disable() { - _hrdemog_civix_civicrm_config(); - if ($upgrader = _hrdemog_civix_upgrader()) { - if (is_callable(array($upgrader, 'onDisable'))) { - return $upgrader->onDisable(); - } - } -} - -/** - * (Delegated) Implementation of hook_civicrm_upgrade - * - * @param $op string, the type of operation being performed; 'check' or 'enqueue' - * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks - * - * @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending) - * for 'enqueue', returns void - */ -function _hrdemog_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { - if ($upgrader = _hrdemog_civix_upgrader()) { - return $upgrader->onUpgrade($op, $queue); - } -} - -function _hrdemog_civix_upgrader() { - if (!file_exists(__DIR__.'/CRM/HRDemog/Upgrader.php')) { - return NULL; - } else { - return CRM_HRDemog_Upgrader_Base::instance(); - } -} - -/** - * Search directory tree for files which match a glob pattern - * - * Note: Dot-directories (like "..", ".git", or ".svn") will be ignored. - * Note: In Civi 4.3+, delegate to CRM_Utils_File::findFiles() - * - * @param $dir string, base dir - * @param $pattern string, glob pattern, eg "*.txt" - * @return array(string) - */ -function _hrdemog_civix_find_files($dir, $pattern) { - if (is_callable(array('CRM_Utils_File', 'findFiles'))) { - return CRM_Utils_File::findFiles($dir, $pattern); - } - - $todos = array($dir); - $result = array(); - while (!empty($todos)) { - $subdir = array_shift($todos); - foreach (_hrdemog_civix_glob("$subdir/$pattern") as $match) { - if (!is_dir($match)) { - $result[] = $match; - } - } - if ($dh = opendir($subdir)) { - while (FALSE !== ($entry = readdir($dh))) { - $path = $subdir . DIRECTORY_SEPARATOR . $entry; - if ($entry{0} == '.') { - } elseif (is_dir($path)) { - $todos[] = $path; - } - } - closedir($dh); - } - } - return $result; -} -/** - * (Delegated) Implementation of hook_civicrm_managed - * - * Find any *.mgd.php files, merge their content, and return. - */ -function _hrdemog_civix_civicrm_managed(&$entities) { - $mgdFiles = _hrdemog_civix_find_files(__DIR__, '*.mgd.php'); - foreach ($mgdFiles as $file) { - $es = include $file; - foreach ($es as $e) { - if (empty($e['module'])) { - $e['module'] = 'org.civicrm.hrdemog'; - } - $entities[] = $e; - } - } -} - -/** - * Glob wrapper which is guaranteed to return an array. - * - * The documentation for glob() says, "On some systems it is impossible to - * distinguish between empty match and an error." Anecdotally, the return - * result for an empty match is sometimes array() and sometimes FALSE. - * This wrapper provides consistency. - * - * @see http://php.net/glob - * @param string $pattern - * @return array, possibly empty - */ -function _hrdemog_civix_glob($pattern) { - $result = glob($pattern); - return is_array($result) ? $result : array(); -} - -/** - * Inserts a navigation menu item at a given place in the hierarchy - * - * $menu - menu hierarchy - * $path - path where insertion should happen (ie. Administer/System Settings) - * $item - menu you need to insert (parent/child attributes will be filled for you) - * $parentId - used internally to recurse in the menu structure - */ -function _hrdemog_civix_insert_navigation_menu(&$menu, $path, $item, $parentId = NULL) { - static $navId; - - // If we are done going down the path, insert menu - if (empty($path)) { - if (!$navId) $navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation"); - $navId ++; - $menu[$navId] = array ( - 'attributes' => array_merge($item, array( - 'label' => CRM_Utils_Array::value('name', $item), - 'active' => 1, - 'parentID' => $parentId, - 'navID' => $navId, - )) - ); - return true; - } else { - // Find an recurse into the next level down - $found = false; - $path = explode('/', $path); - $first = array_shift($path); - foreach ($menu as $key => &$entry) { - if ($entry['attributes']['name'] == $first) { - if (!$entry['child']) $entry['child'] = array(); - $found = _hrdemog_civix_insert_navigation_menu($entry['child'], implode('/', $path), $item, $key); - } - } - return $found; - } -} diff --git a/hrdemog/hrdemog.php b/hrdemog/hrdemog.php deleted file mode 100644 index fdff6261f3f..00000000000 --- a/hrdemog/hrdemog.php +++ /dev/null @@ -1,116 +0,0 @@ - "id",'name' => "Extended_Demographics",)); - civicrm_api3('CustomGroup', 'delete', array('id' => $customGroup['id'])); - //delete optionGroup - if ($visaGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'is_visa_required_20130702051150', 'id', 'name')) { - CRM_Core_BAO_OptionGroup::del($visaGroupID); - } - return _hrdemog_civix_civicrm_uninstall(); -} - -/** - * Implementation of hook_civicrm_enable - */ -function hrdemog_civicrm_enable() { - _hrdemog_setActiveFields(1); - return _hrdemog_civix_civicrm_enable(); -} - -/** - * Implementation of hook_civicrm_disable - */ -function hrdemog_civicrm_disable() { - _hrdemog_setActiveFields(0); - return _hrdemog_civix_civicrm_disable(); -} - -function _hrdemog_setActiveFields($setActive) { - //disable/enable customgroup and customvalue - $sql = "UPDATE civicrm_custom_field JOIN civicrm_custom_group on civicrm_custom_group.id = civicrm_custom_field.custom_group_id SET civicrm_custom_field.is_active = {$setActive} WHERE civicrm_custom_group.name = 'Extended_Demographics'"; - CRM_Core_DAO::executeQuery($sql); - CRM_Core_DAO::executeQuery("UPDATE civicrm_custom_group SET is_active = {$setActive} WHERE name = 'Extended_Demographics'"); - - //disable/enable optionGroup and optionValue - $query = "UPDATE civicrm_option_value JOIN civicrm_option_group on civicrm_option_group.id = civicrm_option_value.option_group_id SET civicrm_option_value.is_active = {$setActive} WHERE civicrm_option_group.name IN ('ethnicity_20130725123943','religion_20130725124132','sexual_orientation_20130725124348','marital_status_20130913084916','is_visa_required_20130702051150')"; - CRM_Core_DAO::executeQuery($query); - CRM_Core_DAO::executeQuery("UPDATE civicrm_option_group SET is_active = {$setActive} WHERE name IN ('ethnicity_20130725123943','religion_20130725124132','sexual_orientation_20130725124348','marital_status_20130913084916','is_visa_required_20130702051150')"); -} - - -/** - * Implementation of hook_civicrm_upgrade - * - * @param $op string, the type of operation being performed; 'check' or 'enqueue' - * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks - * - * @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending) - * for 'enqueue', returns void - */ -function hrdemog_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { - return _hrdemog_civix_civicrm_upgrade($op, $queue); -} - -/** - * Implementation of hook_civicrm_managed - * - * Generate a list of entities to create/deactivate/delete when this module - * is installed, disabled, uninstalled. - */ -function hrdemog_civicrm_managed(&$entities) { - return _hrdemog_civix_civicrm_managed($entities); -} diff --git a/hrdemog/info.xml b/hrdemog/info.xml deleted file mode 100644 index ef26b9c3653..00000000000 --- a/hrdemog/info.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - hrdemog - Extended Demographics - Add extended demographic fields for the contact - AGPL-3.0 - - CiviCRM LLC - info@civicrm.org - - 2018-07-24 - 1.7.9 - stable - - 4.7 - - - CRM/HRDemog - - diff --git a/hrdemog/xml/auto_install.xml b/hrdemog/xml/auto_install.xml deleted file mode 100755 index 7dde14fbb55..00000000000 --- a/hrdemog/xml/auto_install.xml +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - Extended_Demographics - Extended Demographics - Individual - - 1 - - - 11 - 1 - civicrm_value_extended_demographics_8 - 0 - 0 - 0 - - - - - Nationality - - Country - Select Country - 0 - 0 - 0 - 1 - 1 - 0 - 255 - 60 - 4 - nationality_44 - Extended_Demographics - - - Ethnicity - - String - Multi-Select - :;:;:;Not Applicable:;:;:; - 0 - 1 - 0 - 3 - 1 - 0 - 255 - 60 - 4 - ethnicity_45 - ethnicity_20130725123943 - Extended_Demographics - - - Religion - - String - Select - Not Applicable - 0 - 1 - 0 - 4 - 1 - 0 - 255 - 60 - 4 - religion_46 - religion_20130725124132 - Extended_Demographics - - - Sexual_Orientation - - String - Select - Not Applicable - 0 - 0 - 0 - 5 - 1 - 0 - 255 - 60 - 4 - sexual_orientation_47 - sexual_orientation_20130725124348 - Extended_Demographics - - - Marital_Status - - String - Select - Not Applicable - 0 - 1 - 0 - 6 - 1 - 0 - 255 - 60 - 4 - marital_status_58 - marital_status_20130913084916 - Extended_Demographics - - - Is_Visa_Required - - Boolean - Radio - 0 - 0 - 0 - 2 - 1 - 0 - 255 - 60 - 4 - is_visa_required_64 - is_visa_required_20130702051150 - Extended_Demographics - - - - - ethnicity_20130725123943 - Ethnicity - 1 - 1 - - - religion_20130725124132 - Religion - 1 - 1 - - - sexual_orientation_20130725124348 - Sexual Orientation - 1 - 1 - - - marital_status_20130913084916 - Marital Status - 1 - 1 - - - is_visa_required_20130702051150 - Is Visa Required - 1 - 1 - - - - - - Prefer Not to Say - Prefer_Not_to_Say - 0 - 6 - 0 - 0 - 1 - ethnicity_20130725123943 - - - - Not Applicable - Not_Applicable - 0 - 7 - 0 - 0 - 1 - ethnicity_20130725123943 - - - - Buddhist - Buddhist - 0 - 1 - 0 - 0 - 1 - religion_20130725124132 - - - - Christian - Christian - 0 - 2 - 0 - 0 - 1 - religion_20130725124132 - - - - Hindu - Hindu - 0 - 3 - 0 - 0 - 1 - religion_20130725124132 - - - - Jewish - Jewish - 0 - 4 - 0 - 0 - 1 - religion_20130725124132 - - - - Muslim - Muslim - 0 - 5 - 0 - 0 - 1 - religion_20130725124132 - - - - Unaffiliated - Unaffiliated - 0 - 6 - 0 - 0 - 1 - religion_20130725124132 - - - - Other - Other - 0 - 7 - 0 - 0 - 1 - religion_20130725124132 - - - - Prefer Not to Say - Prefer_Not_to_Say - 0 - 8 - 0 - 0 - 1 - religion_20130725124132 - - - - Not Applicable - Not_Applicable - 0 - 9 - 0 - 0 - 1 - religion_20130725124132 - - - - Asexual - Asexual - 0 - 1 - 0 - 0 - 1 - sexual_orientation_20130725124348 - - - - Bisexual - Bisexual - 0 - 2 - 0 - 0 - 1 - sexual_orientation_20130725124348 - - - - Heterosexual - Heterosexual - 0 - 3 - 0 - 0 - 1 - sexual_orientation_20130725124348 - - - - Homosexual - Homosexual - 0 - 4 - 0 - 0 - 1 - sexual_orientation_20130725124348 - - - - Prefer Not to Say - Prefer_Not_to_Say - 0 - 5 - 0 - 0 - 1 - sexual_orientation_20130725124348 - - - - Not Applicable - Not_Applicable - 0 - 6 - 0 - 0 - 1 - sexual_orientation_20130725124348 - - - - Single - Single - 0 - 1 - 0 - 0 - 1 - marital_status_20130913084916 - - - - Married - Married - 0 - 2 - 0 - 0 - 1 - marital_status_20130913084916 - - - - Divorced - Divorced - 0 - 3 - 0 - 0 - 1 - marital_status_20130913084916 - - - - Widowed - Widowed - 0 - 4 - 0 - 0 - 1 - marital_status_20130913084916 - - - - Prefer Not to Say - Prefer_Not_to_Say - 0 - 5 - 0 - 0 - 1 - marital_status_20130913084916 - - - - Not Applicable - Not_Applicable - 0 - 6 - 0 - 0 - 1 - marital_status_20130913084916 - - - - 1 - is_visa_required - 0 - 1 - 0 - 0 - 1 - is_visa_required_20130702051150 - - - diff --git a/hrim/hrim.php b/hrim/hrim.php index c1fff1d3d5d..18be1fb8139 100644 --- a/hrim/hrim.php +++ b/hrim/hrim.php @@ -67,10 +67,10 @@ function hrim_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { */ function hrim_civicrm_managed(&$entities) { return _hrim_civix_civicrm_managed($entities); -} +} function hrim_civicrm_pageRun($page) { if ($page instanceof CRM_Contact_Page_View_Summary) { - CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrim', 'js/hrim.js'); - + CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrim', 'js/dist/hrim.min.js', 1010); + } -} \ No newline at end of file +} diff --git a/hrim/info.xml b/hrim/info.xml index f7225b4e22f..79c14a0f19b 100644 --- a/hrim/info.xml +++ b/hrim/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrim/js/build.js b/hrim/js/build.js new file mode 100644 index 00000000000..80cf519674c --- /dev/null +++ b/hrim/js/build.js @@ -0,0 +1,9 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/hrim.min.js', + name: 'hrim', + skipModuleInsertion: true, + generateSourceMaps: true +}) diff --git a/hrim/js/dist/hrim.min.js b/hrim/js/dist/hrim.min.js new file mode 100644 index 00000000000..381ef51621e --- /dev/null +++ b/hrim/js/dist/hrim.min.js @@ -0,0 +1,2 @@ +!function(t,n){define("hrim/app",[],function(){"use strict";function n(){var n={Yahoo:"ymsgr:sendIM?",Skype:"skype:",AIM:"aim:goim?screenname=",Jabber:"xmpp:",MSN:"skype:"};t("#crm-im-content .crm-summary-row").each(function(){if(this){var i=t(this).find(".crm-label").text(),c=t(this).find(".crm-contact_im").text();if(c){var e=i.substr(0,i.match(/\s[(]/).index);if(n[e]){var a=''+c+"";t(this).find(".crm-contact_im").html(a)}}}}),t(".crm-contact_im a").on("click",function(){CRM.alert("Having trouble? Click here to discuss","Experimental: Instant Messaging","notice")})}t(document).ready(function(){n()}),t(document).ajaxSuccess(function(t,i,c){c.url.search("class_name=CRM_Contact_Page_Inline_IM")>0&&n()})})}(CRM.$,CRM._),function(t){t(["hrim/app"])}(require); +//# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/hrim/js/dist/hrim.min.js.map \ No newline at end of file diff --git a/hrim/js/hrim.js b/hrim/js/hrim.js deleted file mode 100644 index d6fc200bb4d..00000000000 --- a/hrim/js/hrim.js +++ /dev/null @@ -1,46 +0,0 @@ -// for contact edit screen -(function ($, _) { - $(document).ready(function() { - // Call contactImLink function on page load - contactImLink(); - }); - - // for inline edit - $(document).ajaxSuccess(function(event, xhr, settings) { - // Call contactImLink function if url has class name CRM_Contact_Page_Inline_IM - if(settings.url.search('class_name=CRM_Contact_Page_Inline_IM')>0) { - contactImLink(); - } - }); - - function contactImLink() { - // build array for IM and its protocol - var params = { - 'Yahoo':'ymsgr:sendIM?', - 'Skype':'skype:', - //'GTalk':'gtalk:chat?jid=', // error message doesn't work in FF/OSX - 'AIM':'aim:goim?screenname=', - 'Jabber':'xmpp:', - 'MSN':'skype:' - }; - $("#crm-im-content .crm-summary-row").each(function() { - if (this) { - // get providerlabels - var providerLabel = $(this).find('.crm-label').text(); - // get IM address - var imName = $(this).find('.crm-contact_im').text(); - if(imName) { - var providerName = providerLabel.substr(0,providerLabel.match(/\s[(]/).index); - if(params[providerName]) { - // build links of IM address - clickableIM = ''+ imName + ''; - $(this).find('.crm-contact_im').html(clickableIM); - } - } - } - }); - $('.crm-contact_im a').on('click',function() { - CRM.alert("Having trouble? Click here to discuss", 'Experimental: Instant Messaging', 'notice'); - }); - } -}(CRM.$, CRM._)); diff --git a/hrim/js/src/hrim.js b/hrim/js/src/hrim.js new file mode 100644 index 00000000000..aec963ca766 --- /dev/null +++ b/hrim/js/src/hrim.js @@ -0,0 +1,5 @@ +/* eslint-env amd */ + +(function (require) { + require(['hrim/app']); +})(require); diff --git a/hrim/js/src/hrim/app.js b/hrim/js/src/hrim/app.js new file mode 100644 index 00000000000..5e1c7dfcaea --- /dev/null +++ b/hrim/js/src/hrim/app.js @@ -0,0 +1,52 @@ +/* eslint-env amd */ + +(function ($, _) { + define(function () { + 'use strict'; + + // for contact edit screen + $(document).ready(function () { + // Call contactImLink function on page load + contactImLink(); + }); + + // for inline edit + $(document).ajaxSuccess(function (event, xhr, settings) { + // Call contactImLink function if url has class name CRM_Contact_Page_Inline_IM + if (settings.url.search('class_name=CRM_Contact_Page_Inline_IM') > 0) { + contactImLink(); + } + }); + + function contactImLink () { + // build array for IM and its protocol + var params = { + 'Yahoo': 'ymsgr:sendIM?', + 'Skype': 'skype:', + // 'GTalk':'gtalk:chat?jid=', // error message doesn't work in FF/OSX + 'AIM': 'aim:goim?screenname=', + 'Jabber': 'xmpp:', + 'MSN': 'skype:' + }; + $('#crm-im-content .crm-summary-row').each(function () { + if (this) { + // get providerlabels + var providerLabel = $(this).find('.crm-label').text(); + // get IM address + var imName = $(this).find('.crm-contact_im').text(); + if (imName) { + var providerName = providerLabel.substr(0, providerLabel.match(/\s[(]/).index); + if (params[providerName]) { + // build links of IM address + var clickableIM = '' + imName + ''; + $(this).find('.crm-contact_im').html(clickableIM); + } + } + } + }); + $('.crm-contact_im a').on('click', function () { + CRM.alert("Having trouble? Click here to discuss", 'Experimental: Instant Messaging', 'notice'); + }); + } + }); +}(CRM.$, CRM._)); diff --git a/hrjobcontract/CRM/Hrjobcontract/Upgrader.php b/hrjobcontract/CRM/Hrjobcontract/Upgrader.php index 4f0d40ed128..202d06d21da 100755 --- a/hrjobcontract/CRM/Hrjobcontract/Upgrader.php +++ b/hrjobcontract/CRM/Hrjobcontract/Upgrader.php @@ -511,6 +511,7 @@ public function upgradeBundle() { $this->upgrade_1039(); $this->upgrade_1040(); $this->upgrade_1041(); + $this->upgrade_1042(); } function upgrade_1001() { @@ -1188,7 +1189,7 @@ public function upgrade_1035() { 'HRJob_Summary', 'HRJobContract_Summary' ]; - + $result = civicrm_api3('CustomGroup', 'get', [ 'return' => ['id', 'name'], 'name' => ['IN' => $customGroups], @@ -1256,7 +1257,7 @@ public function upgrade_1036() { return TRUE; } - + /** * Changes the url of Standard Full Time Hours * @@ -1270,10 +1271,10 @@ public function upgrade_1037() { 'url' => 'civicrm/standard_full_time_hours' ], ]); - + return TRUE; } - + /** * Renames page title from job contract benefit name to benefits * @@ -1288,10 +1289,10 @@ public function upgrade_1038() { 'is_active' => 1 ], ]); - + return TRUE; } - + /** * Renames page title from job contract deduction name to deductions * @@ -1306,10 +1307,10 @@ public function upgrade_1039() { 'is_active' => 1 ], ]); - + return TRUE; } - + /** * Renames option group title from job contract revision change reason to * contract revision reasons @@ -1325,10 +1326,10 @@ public function upgrade_1040() { 'is_active' => 1 ] ]); - + return TRUE; } - + /** * Renames option group title from job contract end reason * to contract end reasons @@ -1344,10 +1345,29 @@ public function upgrade_1041() { 'is_active' => 1 ], ]); - + + return TRUE; + } + + /** + * Updates the custom field to view only and disables the custom group + * + * @return bool + */ + public function upgrade_1042() { + civicrm_api3('CustomField', 'get', [ + 'name' => 'Length_Of_Service', + 'api.CustomField.create' => ['id' => '$value.id', 'is_view' => 1], + ]); + + civicrm_api3('CustomGroup', 'get', [ + 'name' => 'Contact_Length_Of_Service', + 'api.CustomGroup.create' => ['id' => '$value.id', 'is_active' => 0], + ]); + return TRUE; } - + /** * Creates a navigation menu item using the API * diff --git a/hrjobcontract/css/hrjc.css b/hrjobcontract/css/hrjc.css index 27e6c0f1c11..522acb3ebb6 100644 --- a/hrjobcontract/css/hrjc.css +++ b/hrjobcontract/css/hrjc.css @@ -139,26 +139,36 @@ #hrjob-contract th, #hrjob-contract td { background: initial; + border: initial; margin: initial; padding: initial; - border: initial; vertical-align: initial; } +#hrjob-contract h3 { + border: 0; + border: initial; + border-radius: 0; + border-radius: initial; + box-shadow: none; + box-shadow: initial; +} #hrjob-contract ol, #hrjob-contract ul { - padding-start: 40px; + list-style: initial; + /* stylelint-disable property-no-vendor-prefix, property-no-unknown */ -moz-padding-start: 40px; -webkit-padding-start: 40px; - list-style: initial; + padding-start: 40px; + /* stylelint-enable */ } #hrjob-contract blockquote, #hrjob-contract q { quotes: initial; } -#hrjob-contract blockquote:before, -#hrjob-contract blockquote:after, -#hrjob-contract q:before, -#hrjob-contract q:after { +#hrjob-contract blockquote::before, +#hrjob-contract blockquote::after, +#hrjob-contract q::before, +#hrjob-contract q::after { content: initial; } #hrjob-contract ins { @@ -171,7 +181,8 @@ border-collapse: initial; border-spacing: initial; } -#hrjob-contract table td, #hrjob-contract table th { +#hrjob-contract table td, +#hrjob-contract table th { color: inherit; font-size: inherit; } diff --git a/hrjobcontract/info.xml b/hrjobcontract/info.xml index 440d0765cc3..bd580dbd2d5 100644 --- a/hrjobcontract/info.xml +++ b/hrjobcontract/info.xml @@ -8,8 +8,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrjobcontract/js/test/controllers/form/form-general.controller.spec.js b/hrjobcontract/js/test/controllers/form/form-general.controller.spec.js index 4191c54d02a..9fe8e3e7513 100644 --- a/hrjobcontract/js/test/controllers/form/form-general.controller.spec.js +++ b/hrjobcontract/js/test/controllers/form/form-general.controller.spec.js @@ -10,10 +10,10 @@ define([ 'use strict'; describe('FormGeneralController', function () { - var $controller, $provide, $rootScope, $scope; + var $controller, $httpBackend, $provide, $rootScope, $scope; beforeEach(function () { - module('job-contract', 'common.mocks', function (_$provide_) { + module('job-contract', 'job-contract.templates', 'common.mocks', function (_$provide_) { $provide = _$provide_; }); inject(['HR_settingsMock', function (hrSettingsMock) { @@ -21,9 +21,12 @@ define([ }]); }); - beforeEach(inject(function (_$controller_, _$rootScope_) { + beforeEach(inject(function (_$controller_, _$httpBackend_, _$rootScope_) { $controller = _$controller_; + $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; + + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); })); describe('Min and max allowed dates', function () { diff --git a/hrjobcontract/js/test/controllers/form/form-hour.controller.spec.js b/hrjobcontract/js/test/controllers/form/form-hour.controller.spec.js index 9fd2feeb058..4c03a1b6222 100644 --- a/hrjobcontract/js/test/controllers/form/form-hour.controller.spec.js +++ b/hrjobcontract/js/test/controllers/form/form-hour.controller.spec.js @@ -8,7 +8,7 @@ define([ 'use strict'; describe('FormHourController', function () { - var $controller, $rootScope, $scope; + var $controller, $httpBackend, $rootScope, $scope; var entityData = { 'hour': { 'id': '1', @@ -23,13 +23,14 @@ define([ } }; - beforeEach(module('job-contract')); - beforeEach(function () { - inject(function (_$controller_, _$rootScope_) { - $controller = _$controller_; - $rootScope = _$rootScope_; - }); - }); + beforeEach(module('job-contract', 'job-contract.templates')); + beforeEach(inject(function (_$controller_, _$httpBackend_, _$rootScope_) { + $controller = _$controller_; + $httpBackend = _$httpBackend_; + $rootScope = _$rootScope_; + + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); + })); describe('init', function () { describe('when no existing data is passed to the form', function () { diff --git a/hrjobcontract/js/test/controllers/form/form-leave.controller.spec.js b/hrjobcontract/js/test/controllers/form/form-leave.controller.spec.js index 5709517f9c1..fd25423686a 100644 --- a/hrjobcontract/js/test/controllers/form/form-leave.controller.spec.js +++ b/hrjobcontract/js/test/controllers/form/form-leave.controller.spec.js @@ -6,12 +6,13 @@ define([ 'use strict'; describe('FormLeaveController', function () { - var ctrl, $controller, $rootScope, $scope, utilsService; + var ctrl, $controller, $httpBackend, $rootScope, $scope, utilsService; - beforeEach(module('job-contract')); + beforeEach(module('job-contract', 'job-contract.templates')); - beforeEach(inject(function (_$controller_, _$rootScope_, _utilsService_, $q) { + beforeEach(inject(function (_$controller_, _$httpBackend_, _$rootScope_, _utilsService_, $q) { $controller = _$controller_; + $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; utilsService = _utilsService_; @@ -23,6 +24,7 @@ define([ return deferred.promise; }); + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); initController(); })); diff --git a/hrjobcontract/js/test/controllers/form/form-pension.controller.spec.js b/hrjobcontract/js/test/controllers/form/form-pension.controller.spec.js index ac1adb5466d..2ca3880fe76 100644 --- a/hrjobcontract/js/test/controllers/form/form-pension.controller.spec.js +++ b/hrjobcontract/js/test/controllers/form/form-pension.controller.spec.js @@ -7,13 +7,14 @@ define([ 'use strict'; describe('FormPensionController', function () { - var $controller, $rootScope, $scope, $q, contactService, response, params; + var $controller, $httpBackend, $rootScope, $scope, $q, contactService, response, params; - beforeEach(module('job-contract')); + beforeEach(module('job-contract', 'job-contract.templates')); beforeEach(function () { - inject(function (_$controller_, _$rootScope_, _$q_, _contactService_) { + inject(function (_$controller_, _$httpBackend_, _$rootScope_, _$q_, _contactService_) { $controller = _$controller_; + $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; contactService = _contactService_; $q = _$q_; @@ -21,6 +22,8 @@ define([ contact_type: 'Organization', contact_sub_type: 'Life_Insurance_Provider' }; + + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); contactServiceSpy(); }); }); diff --git a/hrjobcontract/js/test/services/contract-details.service.spec.js b/hrjobcontract/js/test/services/contract-details.service.spec.js index 49ea082ba05..56155567ccb 100644 --- a/hrjobcontract/js/test/services/contract-details.service.spec.js +++ b/hrjobcontract/js/test/services/contract-details.service.spec.js @@ -15,6 +15,7 @@ define([ $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); $httpBackend.whenGET(/action=get&entity=HRJobDetails/).respond(MockContract.contract); $httpBackend.whenGET(/views.*/).respond({}); })); diff --git a/hrjobcontract/js/test/services/contract-health.service.spec.js b/hrjobcontract/js/test/services/contract-health.service.spec.js index 2375c47f78d..a979a3af64d 100644 --- a/hrjobcontract/js/test/services/contract-health.service.spec.js +++ b/hrjobcontract/js/test/services/contract-health.service.spec.js @@ -12,13 +12,14 @@ define([ beforeEach(module('job-contract')); beforeEach(inject(function (_contractHealthService_, _$httpBackend_, - _$rootScope_) { + _$rootScope_) { contractHealthService = _contractHealthService_; $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; })); beforeEach(function () { + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); $httpBackend.whenGET(/action=get&entity=HRJobHealth/).respond(ContractMock.contractRevision); $httpBackend.whenGET(/action=getoptions&entity=HRJobHealth/).respond(InsuranceMock); $httpBackend.whenGET(/views.*/).respond({}); diff --git a/hrjobcontract/js/test/services/contract-hour.service.spec.js b/hrjobcontract/js/test/services/contract-hour.service.spec.js index 760bd23615b..3aa01960493 100644 --- a/hrjobcontract/js/test/services/contract-hour.service.spec.js +++ b/hrjobcontract/js/test/services/contract-hour.service.spec.js @@ -15,6 +15,7 @@ define([ $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); $httpBackend.whenGET(/action=get&entity=HRJobHour/).respond(MockContract.contractHour); $httpBackend.whenGET(/views.*/).respond({}); })); diff --git a/hrjobcontract/js/test/services/contract-leave.service.spec.js b/hrjobcontract/js/test/services/contract-leave.service.spec.js index 6f2a1c4b040..90389394ca9 100644 --- a/hrjobcontract/js/test/services/contract-leave.service.spec.js +++ b/hrjobcontract/js/test/services/contract-leave.service.spec.js @@ -78,6 +78,7 @@ define([ * Mocks back-end API calls */ function mockBackendCalls () { + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); $httpBackend.whenGET(/action=get&entity=HRJobLeave/).respond(MockContract.contractLeaves); $httpBackend.whenGET(/action=getfields&entity=HRJobLeave/).respond({ values: [] }); $httpBackend.whenGET(/views.*/).respond({}); diff --git a/hrjobcontract/js/test/services/contract-pay.service.spec.js b/hrjobcontract/js/test/services/contract-pay.service.spec.js index a148d7dfb09..9f2bd5b7e62 100644 --- a/hrjobcontract/js/test/services/contract-pay.service.spec.js +++ b/hrjobcontract/js/test/services/contract-pay.service.spec.js @@ -15,8 +15,8 @@ define([ $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; - $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(MockContract.contractPayment); - $httpBackend.whenGET(/action=get&entity=HRJobPay/).respond({}); + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); + $httpBackend.whenGET(/action=get&entity=HRJobPay/).respond(MockContract.contractPayment); $httpBackend.whenGET(/views.*/).respond({}); })); diff --git a/hrjobcontract/js/test/services/contract-pension.service.spec.js b/hrjobcontract/js/test/services/contract-pension.service.spec.js index d6e3b490afe..caa4b4130b7 100644 --- a/hrjobcontract/js/test/services/contract-pension.service.spec.js +++ b/hrjobcontract/js/test/services/contract-pension.service.spec.js @@ -16,6 +16,7 @@ define([ $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); $httpBackend.whenGET(/action=get&entity=HRJobPension/).respond(MockContract.contractPension); $httpBackend.whenGET(/views.*/).respond({}); })); diff --git a/hrjobcontract/js/test/services/contract-revision-list.service.spec.js b/hrjobcontract/js/test/services/contract-revision-list.service.spec.js index a5597ac1989..35a68b851e4 100644 --- a/hrjobcontract/js/test/services/contract-revision-list.service.spec.js +++ b/hrjobcontract/js/test/services/contract-revision-list.service.spec.js @@ -8,15 +8,18 @@ define([ 'use strict'; describe('contractRevisionListService', function () { - var $rootScope, $httpBackend, contractRevisionListService, promise; + var $rootScope, $httpBackend, contractFilesService, contractRevisionListService, promise; beforeEach(module('job-contract')); - beforeEach(inject(function (_$rootScope_, _$httpBackend_, _contractRevisionListService_) { + beforeEach(inject(function (_$rootScope_, _$httpBackend_, _contractFilesService_, _contractRevisionListService_) { $rootScope = _$rootScope_; $httpBackend = _$httpBackend_; + contractFilesService = _contractFilesService_; contractRevisionListService = _contractRevisionListService_; + spyOn(contractFilesService, 'get').and.returnValue([]); + $httpBackend.whenGET(/action=get&entity=HRJobContractRevision/).respond(MockContract.contractRevisionData); $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond({}); $httpBackend.whenGET(/list&entityID=159&entityTable=civicrm_hrjobcontract_details/).respond({}); diff --git a/hrjobcontract/js/test/services/utils.service.spec.js b/hrjobcontract/js/test/services/utils.service.spec.js index 93ef9b176a1..ee9f9e4014b 100644 --- a/hrjobcontract/js/test/services/utils.service.spec.js +++ b/hrjobcontract/js/test/services/utils.service.spec.js @@ -11,18 +11,21 @@ define([ 'use strict'; describe('utilsService', function () { - var $provide, $rootScope, $q, $uibModal, utilsService, apiService, AbsencePeriod, $window; + var $httpBackend, $provide, $rootScope, $q, $uibModal, utilsService, apiService, + AbsencePeriod, $window; - beforeEach(module('job-contract', 'leave-absences.models', function (_$provide_) { + beforeEach(module('job-contract', 'leave-absences.models', function (_$provide_, $qProvider) { $provide = _$provide_; $provide.value('$window', { location: { assign: jasmine.createSpy('spy') } }); + $qProvider.errorOnUnhandledRejections(false); })); - beforeEach(inject(function (_$rootScope_, _$q_, _$uibModal_, _$window_, _utilsService_, _apiService_, _AbsencePeriod_) { + beforeEach(inject(function (_$httpBackend_, _$rootScope_, _$q_, _$uibModal_, _$window_, _utilsService_, _apiService_, _AbsencePeriod_) { + $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; $q = _$q_; $uibModal = _$uibModal_; @@ -34,6 +37,9 @@ define([ beforeEach(function () { spyOn(apiService, 'resource').and.callFake(function () { return { get: function () {} }; }); + + $httpBackend.whenGET(/action=get&entity=HRJobContract/).respond(200); + $httpBackend.whenGET(/views.*/).respond({}); }); describe('getAbsenceType', function () { diff --git a/hrjobcontract/scss/civihr/modules/_unset.scss b/hrjobcontract/scss/civihr/modules/_unset.scss index e67f3a2a0e1..7051be27bd0 100755 --- a/hrjobcontract/scss/civihr/modules/_unset.scss +++ b/hrjobcontract/scss/civihr/modules/_unset.scss @@ -70,27 +70,40 @@ tr, th, td { background: initial; + border: initial; margin: initial; padding: initial; - border: initial; vertical-align: initial; } +h3 { + border: 0; + border: initial; + border-radius: 0; + border-radius: initial; + box-shadow: none; + box-shadow: initial; +} + ol, ul { - padding-start: 40px; + list-style: initial; + /* stylelint-disable property-no-vendor-prefix, property-no-unknown */ -moz-padding-start: 40px; -webkit-padding-start: 40px; - list-style: initial; + padding-start: 40px; + /* stylelint-enable */ } + blockquote, q { quotes: initial; } -blockquote:before, -blockquote:after, -q:before, -q:after { + +blockquote::before, +blockquote::after, +q::before, +q::after { content: initial; } @@ -98,6 +111,7 @@ q:after { ins { text-decoration: initial; } + del { text-decoration: initial; } @@ -107,9 +121,10 @@ table { border-collapse: initial; border-spacing: initial; - td, th { - color: inherit; - font-size: inherit; + td, + th { + color: inherit; + font-size: inherit; } } @@ -125,7 +140,8 @@ select, textarea { font-family: initial; } + textarea { font-size: initial; line-height: initial; -} \ No newline at end of file +} diff --git a/hrjobcontract/xml/length_of_service.xml b/hrjobcontract/xml/length_of_service.xml index 4209db8c033..41c12f465fd 100644 --- a/hrjobcontract/xml/length_of_service.xml +++ b/hrjobcontract/xml/length_of_service.xml @@ -29,7 +29,7 @@ 0 1 1 - 0 + 1 16 60 4 @@ -38,4 +38,4 @@ 1 - \ No newline at end of file + diff --git a/hrmed/hrmed.php b/hrmed/hrmed.php index 4949acf151c..d1633938a91 100644 --- a/hrmed/hrmed.php +++ b/hrmed/hrmed.php @@ -163,6 +163,6 @@ function hrmed_civicrm_pageRun($page) { CRM_Core_Resources::singleton() ->addScriptFile('civicrm', 'js/jquery/jquery.crmRevisionLink.js', CRM_Core_Resources::DEFAULT_WEIGHT, 'html-header'); CRM_Core_Resources::singleton() - ->addScriptFile('org.civicrm.hrmed', 'js/hrmed.js'); + ->addScriptFile('org.civicrm.hrmed', 'js/dist/hrmed.min.js', 1010); } } diff --git a/hrmed/info.xml b/hrmed/info.xml index b0491713da9..7ed8601320a 100644 --- a/hrmed/info.xml +++ b/hrmed/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrmed/js/build.js b/hrmed/js/build.js new file mode 100644 index 00000000000..338b1b67ea6 --- /dev/null +++ b/hrmed/js/build.js @@ -0,0 +1,12 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/hrmed.min.js', + name: 'hrmed', + skipModuleInsertion: true, + generateSourceMaps: true, + paths: { + 'hrcore': 'empty:' + } +}) diff --git a/hrmed/js/dist/hrmed.min.js b/hrmed/js/dist/hrmed.min.js new file mode 100644 index 00000000000..c68df7aa9e1 --- /dev/null +++ b/hrmed/js/dist/hrmed.min.js @@ -0,0 +1,2 @@ +!function(e){define("hrmed/app",["hrcore/helpers"],function(i){"use strict";e("body").on("crmFormLoad",function(){var e=i.getCiviCRMFormLabel("custom-group-Medical_Disability","Medical_Disability:Condition");e.length&&!e.find(".helpicon").length&&i.appendHelpIcon(e,"Condition Help","hrmed-med-condition","CRM/HRMed/Page/helptext")})})}(CRM.$),function(e){e(["hrmed/app"])}(require); +//# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/hrmed/js/dist/hrmed.min.js.map \ No newline at end of file diff --git a/hrmed/js/hrmed.js b/hrmed/js/hrmed.js deleted file mode 100644 index 3a70d02e5d5..00000000000 --- a/hrmed/js/hrmed.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright CiviCRM LLC 2013. See http://civicrm.org/licensing -(function($, _) { - // add helpicon for conitions - $('body').on('crmFormLoad', function(event) { - if (event.profileName == 'hrmed_tab') { - var accessName = $('[data-crm-custom="Medical_Disability:Condition"]').attr('name'); - if($('div#editrow-' + accessName + ' a.helpicon').length == 0) { - var helpIcon = $( "" ); - $('div#editrow-' + accessName +' div label').append(helpIcon); - } - } - }); -}(CRM.$, CRM._)); diff --git a/hrmed/js/src/hrmed.js b/hrmed/js/src/hrmed.js new file mode 100644 index 00000000000..6904acb7611 --- /dev/null +++ b/hrmed/js/src/hrmed.js @@ -0,0 +1,5 @@ +/* eslint-env amd */ + +(function (require) { + require(['hrmed/app']); +})(require); diff --git a/hrmed/js/src/hrmed/app.js b/hrmed/js/src/hrmed/app.js new file mode 100644 index 00000000000..f96329a2d0a --- /dev/null +++ b/hrmed/js/src/hrmed/app.js @@ -0,0 +1,24 @@ +/* eslint-env amd */ + +(function ($) { + define([ + 'hrcore/helpers' + ], function (helpers) { + 'use strict'; + + $('body').on('crmFormLoad', function () { + var $label = helpers.getCiviCRMFormLabel( + 'custom-group-Medical_Disability', 'Medical_Disability:Condition'); + + if (!$label.length || $label.find('.helpicon').length) { + return; + } + + helpers.appendHelpIcon( + $label, + 'Condition Help', + 'hrmed-med-condition', + 'CRM/HRMed/Page/helptext'); + }); + }); +}(CRM.$)); diff --git a/hrprofile/info.xml b/hrprofile/info.xml index 37ecc7d7588..435a0356a78 100644 --- a/hrprofile/info.xml +++ b/hrprofile/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrqual/hrqual.php b/hrqual/hrqual.php index 056fe432cf9..7d6d8f84ae3 100644 --- a/hrqual/hrqual.php +++ b/hrqual/hrqual.php @@ -173,7 +173,7 @@ function hrqual_civicrm_managed(&$entities) { */ function hrqual_civicrm_tabset($tabsetName, &$tabs, $context) { if ($tabsetName === 'civicrm/contact/view') { - CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrqual', 'js/hrqual.js'); + CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrqual', 'js/dist/hrqual.min.js', 1010); $optionGroups = CRM_Core_OptionGroup::values('category_of_skill_20130510015438'); foreach ($optionGroups as $name => $optionGroup) { diff --git a/hrqual/info.xml b/hrqual/info.xml index 5d9fb5442bb..0835e6ae59d 100644 --- a/hrqual/info.xml +++ b/hrqual/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrqual/js/build.js b/hrqual/js/build.js new file mode 100644 index 00000000000..6dffa3c7d94 --- /dev/null +++ b/hrqual/js/build.js @@ -0,0 +1,9 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/hrqual.min.js', + name: 'hrqual', + skipModuleInsertion: true, + generateSourceMaps: true +}) diff --git a/hrqual/js/dist/hrqual.min.js b/hrqual/js/dist/hrqual.min.js new file mode 100644 index 00000000000..f11835d730d --- /dev/null +++ b/hrqual/js/dist/hrqual.min.js @@ -0,0 +1,2 @@ +!function(t,i){define("hrqual/app",[],function(){"use strict";function i(i,a,o,e,r){if(i[o]){e.find("option").remove().end().append(t("").val("").html("-select-"));for(var n=0;n").val(i[o][n]).html(i[o][n]))}else e.find("option").remove().end().append(t("").val("").html("-select-"));e.removeAttr("name").attr("name","custom_"+a).removeAttr("style"),t("#custom_"+a).replaceWith(e),r&&e.val(r)}function a(){var i=t('[data-crm-custom="Qualifications:Name_of_Certification"]').attr("id"),a=t('[data-crm-custom="Qualifications:Certification_Authority"]').attr("id"),o=t('[data-crm-custom="Qualifications:Grade_Achieved"]').attr("id"),e=t('[data-crm-custom="Qualifications:Attain_Date"]').attr("id"),r=t('[data-crm-custom="Qualifications:Expiry_Date"]').attr("id");t("div#editrow-"+i).hide(),t("div#editrow-"+a).hide(),t("div#editrow-"+o).hide(),t("div#editrow-"+e).hide(),t("div#editrow-"+r).hide()}function o(){var i=t('[data-crm-custom="Qualifications:Name_of_Certification"]').attr("id"),a=t('[data-crm-custom="Qualifications:Certification_Authority"]').attr("id"),o=t('[data-crm-custom="Qualifications:Grade_Achieved"]').attr("id"),e=t('[data-crm-custom="Qualifications:Attain_Date"]').attr("id"),r=t('[data-crm-custom="Qualifications:Expiry_Date"]').attr("id");t("div#editrow-"+i).show(),t("div#editrow-"+a).show(),t("div#editrow-"+o).show(),t("div#editrow-"+e).show(),t("div#editrow-"+r).show()}t(document).ajaxSuccess(function(){var e=CRM.hrqual.category,r=CRM.hrqual.name,n=CRM.hrqual.optionGroups,c=t("#category_name"),d=t("#custom_"+e).val(),u=t("#custom_"+r).val();if(i(n,r,d,c,u),t(".crm-profile-name-hrqual_tab #custom_"+e).change(function(){var a=t(this).val();i(n,r,a,c)}),t(this).find("div#profile-dialog").length&&t(this).find("div#profile-dialog").html().indexOf("crm-profile-name-hrqual_tab")>-1){var m=t('[data-crm-custom="Qualifications:Certification_Acquired_"]').attr("name");1==t("input:radio[name="+m+"]:checked").val()?o():a(),t(':radio[name="'+m+'"]').change(function(){0==t(this).val()?a():1==t(this).val()&&o()})}})})}(CRM.$,CRM._),function(t){t(["hrqual/app"])}(require); +//# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/hrqual/js/dist/hrqual.min.js.map \ No newline at end of file diff --git a/hrqual/js/hrqual.js b/hrqual/js/hrqual.js deleted file mode 100644 index d06ef0a8aa8..00000000000 --- a/hrqual/js/hrqual.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright CiviCRM LLC 2013. See http://civicrm.org/licensing -(function ($, _) { - $(document).ajaxSuccess(function() { - var categoryID = CRM.hrqual.category; - var nameID = CRM.hrqual.name; - var oGroups = CRM.hrqual.optionGroups; - var select = $('#category_name'); - var categoryDefault = $('#custom_' + categoryID).val(); - var nameDefault = $('#custom_' + nameID).val(); - renderSelectBox(oGroups, nameID, categoryDefault, select, nameDefault) - - $('.crm-profile-name-hrqual_tab #custom_' + categoryID).change(function() { - var selectedVal = $(this).val(); - renderSelectBox(oGroups, nameID, selectedVal, select); - }); - //hrqual: hide/display fields based on "Certification Acquired" - if($(this).find("div#profile-dialog").length) { - if($(this).find("div#profile-dialog").html().indexOf('crm-profile-name-hrqual_tab') > -1){ - var elementNameCertificationAcquired = $('[data-crm-custom="Qualifications:Certification_Acquired_"]').attr("name"); - var elementValueCertificationAcquired= $('input:radio[name='+elementNameCertificationAcquired+']:checked').val(); - if(elementValueCertificationAcquired == 1) { - showCertificationFields(); - } else { - hideCertificationFields(); - } - $(':radio[name="'+elementNameCertificationAcquired+'"]').change(function() { - if ($(this).val()==0) { - hideCertificationFields(); - } else if($(this).val()==1) { - showCertificationFields(); - } - }); - } - } - }); - -/** -* This function is called to render a select box in -* place of a customField and to populate its options tags -* with the relevent optionGroup values. Its also used to -* assign default value to the rendered select. -* -* -* @param oGroups list of optionGroups and its values. -* @param nameID ID of the customField on which the select is to be rendered. -* @param selectedVal the value(OptionGroup name) of the selectBox which will help the change -* event to populate the relevant OptionGroup values in the rendered selectbox options. -* @param select the select field ID. eg. $('#fieldID'); -* @param nameDefault the default value to be assigned to the rendered select in EDIT mode -*/ - function renderSelectBox(oGroups, nameID, selectedVal, select, nameDefault) { - if (oGroups[selectedVal]) { - select.find('option').remove().end().append($('').val("").html("-select-")); - for (var i = 0; i < oGroups[selectedVal].length; i++) { - select.append($('').val(oGroups[selectedVal][i]).html(oGroups[selectedVal][i])); - } - } - else { - select.find('option').remove().end().append($('').val("").html("-select-")); - } - select.removeAttr('name').attr('name', 'custom_' + nameID).removeAttr('style'); - $("#custom_" + nameID).replaceWith(select); - - //assign the defaults to the "name" field in the Edit mode. - if (nameDefault) { - select.val(nameDefault); - } - } - - function hideCertificationFields() { - var nameOfCertificationId = $('[data-crm-custom="Qualifications:Name_of_Certification"]').attr("id"); - var cetificationAuthorityId = $('[data-crm-custom="Qualifications:Certification_Authority"]').attr("id"); - var gradeAchievedId = $('[data-crm-custom="Qualifications:Grade_Achieved"]').attr("id"); - var dateOfAttainmentId = $('[data-crm-custom="Qualifications:Attain_Date"]').attr("id"); - var dateOfExpiration = $('[data-crm-custom="Qualifications:Expiry_Date"]').attr("id"); - $("div#editrow-"+nameOfCertificationId).hide(); - $("div#editrow-"+cetificationAuthorityId).hide(); - $("div#editrow-"+gradeAchievedId).hide(); - $("div#editrow-"+dateOfAttainmentId).hide(); - $("div#editrow-"+dateOfExpiration).hide(); - } - - function showCertificationFields() { - var nameOfCertificationId = $('[data-crm-custom="Qualifications:Name_of_Certification"]').attr("id"); - var cetificationAuthorityId = $('[data-crm-custom="Qualifications:Certification_Authority"]').attr("id"); - var gradeAchievedId = $('[data-crm-custom="Qualifications:Grade_Achieved"]').attr("id"); - var dateOfAttainmentId = $('[data-crm-custom="Qualifications:Attain_Date"]').attr("id"); - var dateOfExpiration = $('[data-crm-custom="Qualifications:Expiry_Date"]').attr("id"); - $("div#editrow-"+nameOfCertificationId).show(); - $("div#editrow-"+cetificationAuthorityId).show(); - $("div#editrow-"+gradeAchievedId).show(); - $("div#editrow-"+dateOfAttainmentId).show(); - $("div#editrow-"+dateOfExpiration).show(); - } -}(CRM.$, CRM._)); diff --git a/hrqual/js/src/hrqual.js b/hrqual/js/src/hrqual.js new file mode 100644 index 00000000000..6562117e978 --- /dev/null +++ b/hrqual/js/src/hrqual.js @@ -0,0 +1,5 @@ +/* eslint-env amd */ + +(function (require) { + require(['hrqual/app']); +})(require); diff --git a/hrqual/js/src/hrqual/app.js b/hrqual/js/src/hrqual/app.js new file mode 100644 index 00000000000..3418ab1674b --- /dev/null +++ b/hrqual/js/src/hrqual/app.js @@ -0,0 +1,98 @@ +/* eslint-env amd */ +(function ($, _) { + define(function () { + 'use strict'; + + $(document).ajaxSuccess(function () { + var categoryID = CRM.hrqual.category; + var nameID = CRM.hrqual.name; + var oGroups = CRM.hrqual.optionGroups; + var select = $('#category_name'); + var categoryDefault = $('#custom_' + categoryID).val(); + var nameDefault = $('#custom_' + nameID).val(); + renderSelectBox(oGroups, nameID, categoryDefault, select, nameDefault); + + $('.crm-profile-name-hrqual_tab #custom_' + categoryID).change(function () { + var selectedVal = $(this).val(); + renderSelectBox(oGroups, nameID, selectedVal, select); + }); + // hrqual: hide/display fields based on "Certification Acquired" + if ($(this).find('div#profile-dialog').length) { + if ($(this).find('div#profile-dialog').html().indexOf('crm-profile-name-hrqual_tab') > -1) { + var elementNameCertificationAcquired = $('[data-crm-custom="Qualifications:Certification_Acquired_"]').attr('name'); + var elementValueCertificationAcquired = $('input:radio[name=' + elementNameCertificationAcquired + ']:checked').val(); + if (elementValueCertificationAcquired == 1) { + showCertificationFields(); + } else { + hideCertificationFields(); + } + $(':radio[name="' + elementNameCertificationAcquired + '"]').change(function () { + if ($(this).val() == 0) { + hideCertificationFields(); + } else if ($(this).val() == 1) { + showCertificationFields(); + } + }); + } + } + }); + + /** + * This function is called to render a select box in + * place of a customField and to populate its options tags + * with the relevent optionGroup values. Its also used to + * assign default value to the rendered select. + * + * + * @param oGroups list of optionGroups and its values. + * @param nameID ID of the customField on which the select is to be rendered. + * @param selectedVal the value(OptionGroup name) of the selectBox which will help the change + * event to populate the relevant OptionGroup values in the rendered selectbox options. + * @param select the select field ID. eg. $('#fieldID'); + * @param nameDefault the default value to be assigned to the rendered select in EDIT mode + */ + function renderSelectBox (oGroups, nameID, selectedVal, select, nameDefault) { + if (oGroups[selectedVal]) { + select.find('option').remove().end().append($('').val('').html('-select-')); + for (var i = 0; i < oGroups[selectedVal].length; i++) { + select.append($('').val(oGroups[selectedVal][i]).html(oGroups[selectedVal][i])); + } + } else { + select.find('option').remove().end().append($('').val('').html('-select-')); + } + select.removeAttr('name').attr('name', 'custom_' + nameID).removeAttr('style'); + $('#custom_' + nameID).replaceWith(select); + + // assign the defaults to the "name" field in the Edit mode. + if (nameDefault) { + select.val(nameDefault); + } + } + + function hideCertificationFields () { + var nameOfCertificationId = $('[data-crm-custom="Qualifications:Name_of_Certification"]').attr('id'); + var cetificationAuthorityId = $('[data-crm-custom="Qualifications:Certification_Authority"]').attr('id'); + var gradeAchievedId = $('[data-crm-custom="Qualifications:Grade_Achieved"]').attr('id'); + var dateOfAttainmentId = $('[data-crm-custom="Qualifications:Attain_Date"]').attr('id'); + var dateOfExpiration = $('[data-crm-custom="Qualifications:Expiry_Date"]').attr('id'); + $('div#editrow-' + nameOfCertificationId).hide(); + $('div#editrow-' + cetificationAuthorityId).hide(); + $('div#editrow-' + gradeAchievedId).hide(); + $('div#editrow-' + dateOfAttainmentId).hide(); + $('div#editrow-' + dateOfExpiration).hide(); + } + + function showCertificationFields () { + var nameOfCertificationId = $('[data-crm-custom="Qualifications:Name_of_Certification"]').attr('id'); + var cetificationAuthorityId = $('[data-crm-custom="Qualifications:Certification_Authority"]').attr('id'); + var gradeAchievedId = $('[data-crm-custom="Qualifications:Grade_Achieved"]').attr('id'); + var dateOfAttainmentId = $('[data-crm-custom="Qualifications:Attain_Date"]').attr('id'); + var dateOfExpiration = $('[data-crm-custom="Qualifications:Expiry_Date"]').attr('id'); + $('div#editrow-' + nameOfCertificationId).show(); + $('div#editrow-' + cetificationAuthorityId).show(); + $('div#editrow-' + gradeAchievedId).show(); + $('div#editrow-' + dateOfAttainmentId).show(); + $('div#editrow-' + dateOfExpiration).show(); + } + }); +}(CRM.$, CRM._)); diff --git a/hrrecruitment/CRM/HRRecruitment/Page/CasePipeline.php b/hrrecruitment/CRM/HRRecruitment/Page/CasePipeline.php index 2d83a3c3bc9..f821ee7b16c 100644 --- a/hrrecruitment/CRM/HRRecruitment/Page/CasePipeline.php +++ b/hrrecruitment/CRM/HRRecruitment/Page/CasePipeline.php @@ -85,8 +85,7 @@ function topTabs() { CRM_Core_Resources::singleton() ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js') ->addStyleFile('org.civicrm.hrrecruitment', 'css/casePipeline.css') - ->addScriptFile('org.civicrm.hrrecruitment', 'templates/CRM/HRRecruitment/Page/CasePipeline.js') - ->addScriptFile('org.civicrm.hrcase', 'js/hrcase.js'); + ->addScriptFile('org.civicrm.hrrecruitment', 'templates/CRM/HRRecruitment/Page/CasePipeline.js'); //Change page title to designate against which position you are viewing this page $position = CRM_Core_DAO::getFieldValue('CRM_HRRecruitment_DAO_HRVacancy', $this->_vid, 'position'); @@ -155,4 +154,3 @@ function getTemplateFileName() { return $this->_statusId ? "CRM/HRRecruitment/Page/HRVacancyStage.tpl" : "CRM/common/TabHeader.tpl"; } } - diff --git a/hrrecruitment/info.xml b/hrrecruitment/info.xml index 6998560701d..f5456ec5cec 100644 --- a/hrrecruitment/info.xml +++ b/hrrecruitment/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrreport/info.xml b/hrreport/info.xml index 34af0867eb5..b05311c26d2 100644 --- a/hrreport/info.xml +++ b/hrreport/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrstaffdir/info.xml b/hrstaffdir/info.xml index 0a5ba754df6..ceff1af7174 100644 --- a/hrstaffdir/info.xml +++ b/hrstaffdir/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrui/gulp-tasks/requirejs.js b/hrui/gulp-tasks/requirejs.js deleted file mode 100644 index 882901435ed..00000000000 --- a/hrui/gulp-tasks/requirejs.js +++ /dev/null @@ -1,31 +0,0 @@ -var concat = require('gulp-concat'); -var find = require('find'); -var gulp = require('gulp'); -var path = require('path'); -var sourcemaps = require('gulp-sourcemaps'); -var uglify = require('gulp-uglify'); - -module.exports = function () { - return { - /** - * Standard JS pipeline without requirejs: uglifies, concats and outputs - * a single minified file, while writing a sourcemap in the process - */ - main: function () { - gulp.src(path.join(__dirname, '..', 'js/src/**/*.js')) - .pipe(sourcemaps.init()) - .pipe(uglify()) - .pipe(concat('hrui.min.js')) - .pipe(sourcemaps.write()) - .pipe(gulp.dest(path.join(__dirname, '..', 'js/dist'), { mode: '0644' })); - }, - /** - * Detects if there are any js files in the js/src folder - * - * @return {Boolean} - */ - canRunCriteria: function () { - return find.fileSync(/js\/src\/[^/]+\.js$/, path.join(__dirname, '..')).length; - } - }; -}; diff --git a/hrui/hrui.php b/hrui/hrui.php index 9fa604dc266..76f4a424ec1 100644 --- a/hrui/hrui.php +++ b/hrui/hrui.php @@ -34,7 +34,7 @@ */ function hrui_civicrm_coreResourceList(&$items, $region) { if ($region == 'html-header') { - CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrui', 'js/dist/hrui.min.js'); + CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrui', 'js/dist/hrui.min.js', 1010); CRM_Core_Resources::singleton()->addStyleFile('org.civicrm.hrui', 'css/hrui.css'); } } @@ -753,10 +753,6 @@ function _hrui_contactSummaryDOMScript($data) { $script .= "CRM.$(function($) {"; $script .= "$('#contactname-block.crm-summary-block').wrap('
');"; - if (!empty($data['contact']['image_URL'])) { - $script .= "$('.crm-summary-contactname-block').prepend('');"; - } - if (empty($data['current_contract'])) { $script .= "$('.crm-summary-contactname-block').addClass('crm-summary-contactname-block-without-contract');"; } @@ -804,7 +800,7 @@ function _hrui_updateContactSummaryUI() { try { $contactDetails = civicrm_api3('Contact', 'getsingle', array( 'sequential' => 1, - 'return' => array("phone", "email", "image_URL"), + 'return' => array("phone", "email"), 'id' => $contact_id, )); diff --git a/hrui/info.xml b/hrui/info.xml index f5735ac2309..0d889d8921a 100644 --- a/hrui/info.xml +++ b/hrui/info.xml @@ -8,8 +8,8 @@ CiviCRM LLC info@civicrm.org - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/hrui/js/build.js b/hrui/js/build.js new file mode 100644 index 00000000000..55a49f55516 --- /dev/null +++ b/hrui/js/build.js @@ -0,0 +1,9 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/hrui.min.js', + name: 'hrui', + skipModuleInsertion: true, + generateSourceMaps: true +}) diff --git a/hrui/js/dist/hrui.min.js b/hrui/js/dist/hrui.min.js index 609b9715b63..218b906cd77 100644 --- a/hrui/js/dist/hrui.min.js +++ b/hrui/js/dist/hrui.min.js @@ -1,5 +1,2 @@ -!function(t,o){function n(o){o&&o.departments&&o.departments.length>0?t(".crm-contact-detail-departments").html("Department: "+o.departments.join(", ")):t(".crm-contact-detail-departments").html("")}t(document).on("crmLoad",function(o){t(".crm-inline-edit").one("DOMSubtreeModified",function(){var o=t(this).find("form");1===o.length&&o.find("label").each(function(){var o=t(this),n=o.attr("for");t("#"+n).attr("placeholder",o.text())})})}).on("updateContactHeader",function(o,c){var a;void 0!==c.contract&&((a=c.contract)?(t(".crm-summary-contactname-block").removeClass("crm-summary-contactname-block-without-contract"),a.position&&t(".crm-contact-detail-position").html("Position: "+a.position),a.location&&t(".crm-contact-detail-location").html("Normal place of work: "+a.location)):(t(".crm-summary-contactname-block").addClass("crm-summary-contactname-block-without-contract"),t(".crm-contact-detail-position").html(""),t(".crm-contact-detail-location").html(""),n(null))),void 0!==c.roles&&n(c.roles)})}(CRM.$,CRM._); -!function(e,t){function a(){var t=e(this)[0].files[0];e("#js-uploaded-file").remove(),void 0!==t&&(e(this).after(''+t.name+' Remove'),e(".uploaded-file-icon-trash").on("click",o))}function r(e){e.find("label").attr("for",e.find(".crm-form-date").attr("id"))}function o(){var t=e("#js-uploaded-file").parent().find('input[type="file"]');e("#js-uploaded-file").remove(),t.val("")}e(document).on("crmLoad",function(t){var o,i,n;1===e(o="input[type='file']").length&&e(o).on("change",a),1===e(".CRM_HRRecruitment_Form_HRVacancy").length&&(r(e('label[for="start_date"]').parents("tr")),r(e('label[for="end_date"]').parents("tr")),e('[name="entryURL"]').val().indexOf(";template=1")>-1&&e(e(".CRM_HRRecruitment_Form_HRVacancy tbody").get(0)).addClass("CRM_HRRecruitment_Form_HRVacancy_Template")),i=t,"contactForm"!==CRM.formName&&"viewSummary"!==CRM.pageName||(e(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&e(".crm-contact-tabs-list #tab_summary a",i.target).text("Personal Details"),i.target,e(".Inline_Custom_Data").length&&e(".Inline_Custom_Data").removeClass("crm-collapsible collapsed").addClass("crm-summary-block").insertAfter(".crm-summary-contactinfo-block").find(".collapsible-title").hide().end().find(".crm-summary-block").show(),e("#customFields").length<1&&e("#Inline_Custom_Data").detach().find(".label").each(function(){var t=e(this),a=t.next(),r=e("");r.append(t.find("label")),r.append(e("
")),r.append(a.html()),e("#nick_name").parent().after(r)}),n=i.target,e("div.crm-contact-current_employer, div.crm-contact-job_title",".crm-summary-contactinfo-block").parent("div.crm-summary-row").hide(),e("form#ContactInfo input#employer_id, form#ContactInfo input#job_title",n).closest("div.crm-summary-row").hide(),e("input#employer_id, input#job_title","form#Contact").parent("td").hide(),e(".HRJobContract_Summary",n).insertBefore(e(".crm-summary-contactinfo-block")),e("div.email-signature, td#Email-Bulkmail-html","form#Contact").hide(),e("#Email-Primary","form#Contact").prev("td").prev("td").hide(),e("td#Email-Bulkmail-html, #Email-Primary","form#Contact").prev("td").hide(),e(".crm-demographics-accordion","form#Contact").insertAfter(e(".crm-contactDetails-accordion")),e("tr#Phone_Block_2","form#Contact").length<1&&e("#addPhone").click()),e("#activityCustomData").attr("colspan",3),e("#crm-activity-view-table .crm-case-activity-view-Client .label").html("Contact"),e("span.crm-frozen-field",".crm-profile-name-hrident_tab").closest("div").parent("div").hide(),e(".crm-accordion-header.crm-master-accordion-header").on("click",function(){window.setTimeout(function(){Array.prototype.forEach.call(document.querySelectorAll(".listing-box"),function(e){Ps.initialize(e)})},0)}),e("INPUT#contact_source").parent("td").children("a").click(function(){e("#crm-notification-container .crm-help .notify-content").remove(),e("#crm-notification-container .crm-help p").length&&e("#crm-notification-container .crm-help p").remove(),e("#crm-notification-container .crm-help").append("

Source is a useful field where data has been migrated to CiviHR from one or a number of other legacy systems. The Source field will indicate which legacy system the contact has come from.

")})}).ready(function(){var t,a,r,o,i,n;e.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){var a,r,o;a="civihr-menu",r=e(t),(o=e("
")).attr("id",a),o.append(e("#civicrm-menu")),o.append(r),o.insertAfter("#page")}}),t=e(".crm-link-home"),a=e(".crm-logo-sm",t).addClass("chr_logo chr_logo--default-color").removeClass("crm-logo-sm").wrap('').parent(),o=a,r=e("li > a",t).first().text("Home").wrapInner('').prepend(o),i=r,t.off().find("#civicrm-home").before(i).remove(),e(".CRM_HRRecruitment_Form_Application").addClass("crm-form-block"),e(".CRM_HRRecruitment_Form_Application .crm-profile-name-application_profile").addClass("form-layout-compressed"),e("#root-menu-div .menu-item-arrow").each(function(t){var a=e(this);a.before(''),a.remove()}),n="activetarget",e(".menumain").not(".crm-Self_Service_Portal").hover(function(){e(this).addClass(n)},function(){e(this).removeClass(n)})})}(CRM.$,CRM._); -!function(t){"use strict";var n=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;t.fn.attrchange=function(t){if(n){var e={subtree:!1,attributes:!0},i=new n(function(n){n.forEach(function(n){t.call(n.target,n)})});return this.each(function(){i.observe(this,e)})}}}(CRM.$); -!function(t){"use strict";var i=t("body");i.on("click","#bootstrap-theme .btn-slide",function(){var n,a,e=t(this),o=e.children("ul.panel");function c(){t(".civihr-popup").remove(),i.removeClass("civihr-popup-open")}c(),n=o.clone(!0).appendTo(i).addClass("civihr-popup"),a=e.offset(),n.css({left:+a.left-(n.width()-e.outerWidth()),top:+a.top+e.outerHeight()}),n.show(),i.addClass("civihr-popup-open"),n.find("a").click(function(){var i=t(this).parent().index();o.find("li:nth("+i+") a").click()}),e.data("attrchange-is-on")||(e.data("attrchange-is-on",!0),e.attrchange(function(){e.hasClass("btn-slide-active")||c()}))})}(CRM.$); -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbnRhY3QuanMiLCJocnVpLmpzIiwiY2l2aWhyLXBvcHVwL2F0dHJjaGFuZ2UuanMiLCJjaXZpaHItcG9wdXAvY2l2aWhyLXBvcHVwLmpzIl0sIm5hbWVzIjpbIiQiLCJfIiwidXBkYXRlQ29udGFjdEhlYWRlclJvbGVzRGV0YWlscyIsInJvbGVzIiwiZGVwYXJ0bWVudHMiLCJsZW5ndGgiLCJodG1sIiwiam9pbiIsImRvY3VtZW50Iiwib24iLCJlIiwib25lIiwiJGZvcm0iLCJ0aGlzIiwiZmluZCIsImVhY2giLCIkbGFiZWwiLCJpZCIsImF0dHIiLCJ0ZXh0IiwiZGF0YSIsImNvbnRyYWN0IiwicmVtb3ZlQ2xhc3MiLCJwb3NpdGlvbiIsImxvY2F0aW9uIiwiYWRkQ2xhc3MiLCJDUk0iLCJpbnNlcnRGaWxlIiwiZmlsZU5hbWUiLCJmaWxlcyIsInJlbW92ZSIsInVuZGVmaW5lZCIsImFmdGVyIiwibmFtZSIsInJlbW92ZUZpbGUiLCJsaW5rTGFiZWxUb0RhdGVwaWNrZXJJbnB1dCIsIiRsaW5lIiwiJGlucHV0IiwicGFyZW50IiwidmFsIiwic2VsZWN0b3IiLCJ0YXJnZXQiLCJwYXJlbnRzIiwiaW5kZXhPZiIsImdldCIsImZvcm1OYW1lIiwicGFnZU5hbWUiLCJpbnNlcnRBZnRlciIsImhpZGUiLCJlbmQiLCJzaG93IiwiZGV0YWNoIiwiJGxhYmVsQ2VsbCIsIiRmaWVsZENlbGwiLCJuZXh0IiwiJG5ld1RkIiwiYXBwZW5kIiwiY2xvc2VzdCIsImluc2VydEJlZm9yZSIsInByZXYiLCJjbGljayIsIndpbmRvdyIsInNldFRpbWVvdXQiLCJBcnJheSIsInByb3RvdHlwZSIsImZvckVhY2giLCJjYWxsIiwicXVlcnlTZWxlY3RvckFsbCIsImVsZW1lbnQiLCJQcyIsImluaXRpYWxpemUiLCJjaGlsZHJlbiIsInJlYWR5IiwiJG1lbnVJdGVtIiwiJHdyYXBwZWRMb2dvIiwiJGN1c3RvbUhvbWVMaW5rIiwiJGFwcExvZ28iLCIkaG9tZUxpbmsiLCJjbGFzc05hbWUiLCJhamF4IiwiZGF0YVR5cGUiLCJzdWNjZXNzIiwibWVudU1hcmt1cCIsIndyYXBwZXJJZCIsIiRtZW51TWFya3VwIiwiJG1lbnVXcmFwcGVyIiwid3JhcCIsImZpcnN0Iiwid3JhcElubmVyIiwicHJlcGVuZCIsIm9mZiIsImJlZm9yZSIsIiRlbGVtZW50IiwiJGFycm93Iiwibm90IiwiaG92ZXIiLCJNdXRhdGlvbk9ic2VydmVyIiwiV2ViS2l0TXV0YXRpb25PYnNlcnZlciIsIk1vek11dGF0aW9uT2JzZXJ2ZXIiLCJmbiIsImF0dHJjaGFuZ2UiLCJjYWxsYmFjayIsIm9wdGlvbnMiLCJzdWJ0cmVlIiwiYXR0cmlidXRlcyIsIm9ic2VydmVyIiwibXV0YXRpb25zIiwib2JzZXJ2ZSIsIiRib2R5IiwiJHBvcHVwQ2xvbmUiLCJidXR0b25PZmZzZXQiLCIkYnV0dG9uIiwiJHBvcHVwIiwiY2xvc2VQb3B1cFBhbmVscyIsImNsb25lIiwiYXBwZW5kVG8iLCJvZmZzZXQiLCJjc3MiLCJsZWZ0Iiwid2lkdGgiLCJvdXRlcldpZHRoIiwidG9wIiwib3V0ZXJIZWlnaHQiLCJhY3Rpb25JbmRleCIsImluZGV4IiwiaGFzQ2xhc3MiXSwibWFwcGluZ3MiOiJDQUFDLFNBQVVBLEVBQUdDLEdBdURaLFNBQVNDLEVBQWlDQyxHQUNwQ0EsR0FBU0EsRUFBTUMsYUFBZUQsRUFBTUMsWUFBWUMsT0FBUyxFQUMzREwsRUFBRSxtQ0FBbUNNLEtBQUssZ0NBQWtDSCxFQUFNQyxZQUFZRyxLQUFLLE9BRW5HUCxFQUFFLG1DQUFtQ00sS0FBSyxJQTFEOUNOLEVBQUVRLFVBQ0NDLEdBQUcsVUFBVyxTQUFVQyxHQUN2QlYsRUFBRSxvQkFBb0JXLElBQUkscUJBQXNCLFdBQzlDLElBQUlDLEVBQVFaLEVBQUVhLE1BQU1DLEtBQUssUUFFSixJQUFqQkYsRUFBTVAsUUFDUk8sRUFBTUUsS0FBSyxTQUFTQyxLQUFLLFdBQ3ZCLElBQUlDLEVBQVNoQixFQUFFYSxNQUNYSSxFQUFLRCxFQUFPRSxLQUFLLE9BQ3JCbEIsRUFBRSxJQUFNaUIsR0FBSUMsS0FBSyxjQUFlRixFQUFPRyxjQUs5Q1YsR0FBRyxzQkFBdUIsU0FBVUMsRUFBR1UsR0FlMUMsSUFBNkNDLE9BZFosSUFBbEJELEVBQUtDLFlBY3lCQSxFQWJKRCxFQUFLQyxXQWUxQ3JCLEVBQUUsa0NBQWtDc0IsWUFBWSxrREFFNUNELEVBQVNFLFVBQ1h2QixFQUFFLGdDQUFnQ00sS0FBSyw4QkFBZ0NlLEVBQVNFLFVBRzlFRixFQUFTRyxVQUNYeEIsRUFBRSxnQ0FBZ0NNLEtBQUssMENBQTRDZSxFQUFTRyxZQUc5RnhCLEVBQUUsa0NBQWtDeUIsU0FBUyxrREFDN0N6QixFQUFFLGdDQUFnQ00sS0FBSyxJQUN2Q04sRUFBRSxnQ0FBZ0NNLEtBQUssSUFFdkNKLEVBQWdDLGFBMUJOLElBQWZrQixFQUFLakIsT0FDZEQsRUFBZ0NrQixFQUFLakIsU0FyQjdDLENBOERFdUIsSUFBSTFCLEVBQUcwQixJQUFJekI7Q0MzRFosU0FBVUQsRUFBR0MsR0FpS1osU0FBUzBCLElBQ1AsSUFBSUMsRUFBVzVCLEVBQUVhLE1BQU0sR0FBR2dCLE1BQU0sR0FFaEM3QixFQUFFLHFCQUFxQjhCLGNBQ05DLElBQWJILElBQ0Y1QixFQUFFYSxNQUFNbUIsTUFBTSxxREFBdURKLEVBQVNLLEtBQU8sdUZBRXJGakMsRUFBRSw2QkFBNkJTLEdBQUcsUUFBU3lCLElBUy9DLFNBQVNDLEVBQTRCQyxHQUNuQ0EsRUFBTXRCLEtBQUssU0FBU0ksS0FBSyxNQUFPa0IsRUFBTXRCLEtBQUssa0JBQWtCSSxLQUFLLE9BaURwRSxTQUFTZ0IsSUFDUCxJQUFJRyxFQUFTckMsRUFBRSxxQkFBcUJzQyxTQUFTeEIsS0FBSyxzQkFFbERkLEVBQUUscUJBQXFCOEIsU0FDdkJPLEVBQU9FLElBQUksSUF0T2J2QyxFQUFFUSxVQUNDQyxHQUFHLFVBQVcsU0FBVUMsR0E0QzNCLElBQWdDOEIsRUFpQkU5QixFQXVJRCtCLEVBdkpKLElBQXZCekMsRUFEMEJ3QyxFQTNDTixzQkE0Q1JuQyxRQUNkTCxFQUFFd0MsR0FBVS9CLEdBQUcsU0FBVWtCLEdBZ0MyQixJQUFsRDNCLEVBQUUscUNBQXFDSyxTQUN6QzhCLEVBQTJCbkMsRUFBRSwyQkFBMkIwQyxRQUFRLE9BQ2hFUCxFQUEyQm5DLEVBQUUseUJBQXlCMEMsUUFBUSxPQUcxRDFDLEVBQUUscUJBQXFCdUMsTUFBTUksUUFBUSxnQkFBa0IsR0FDekQzQyxFQUFFQSxFQUFFLDJDQUEyQzRDLElBQUksSUFBSW5CLFNBQVMsOENBdkJwQ2YsRUExRE5BLEVBMkRMLGdCQUFqQmdCLElBQUltQixVQUErQyxnQkFBakJuQixJQUFJb0IsV0FHcEM5QyxFQUFFLHlCQUEwQixrQ0FBa0NLLFFBQ2hFTCxFQUFFLHdDQUF5Q1UsRUFBRStCLFFBQVF0QixLQUFLLG9CQUc1QlQsRUFBRStCLE9BbUhoQ3pDLEVBQUUsdUJBQXVCSyxRQXdGN0JMLEVBQUUsdUJBQ0NzQixZQUFZLDZCQUNaRyxTQUFTLHFCQUNUc0IsWUFBWSxrQ0FDWmpDLEtBQUssc0JBQXNCa0MsT0FBT0MsTUFDbENuQyxLQUFLLHNCQUFzQm9DLE9BekYxQmxELEVBQUUsaUJBQWlCSyxPQUFTLEdBZ0VsQkwsRUFBRSx1QkFBdUJtRCxTQUUvQnJDLEtBQUssVUFBVUMsS0FBSyxXQUMxQixJQUFJcUMsRUFBYXBELEVBQUVhLE1BQ2Z3QyxFQUFhRCxFQUFXRSxPQUN4QkMsRUFBU3ZELEVBQUUsU0FFZnVELEVBQU9DLE9BQU9KLEVBQVd0QyxLQUFLLFVBQzlCeUMsRUFBT0MsT0FBT3hELEVBQUUsVUFDaEJ1RCxFQUFPQyxPQUFPSCxFQUFXL0MsUUFFekJOLEVBQUUsY0FBY3NDLFNBQVNOLE1BQU11QixLQW5FRmQsRUE5SE4vQixFQUFFK0IsT0FpSTNCekMsRUFBRSw4REFBK0Qsa0NBQWtDc0MsT0FBTyx1QkFBdUJVLE9BRWpJaEQsRUFBRSx1RUFBd0V5QyxHQUFRZ0IsUUFBUSx1QkFBdUJULE9BRWpIaEQsRUFBRSxxQ0FBc0MsZ0JBQWdCc0MsT0FBTyxNQUFNVSxPQUlyRWhELEVBQUUseUJBQTBCeUMsR0FBUWlCLGFBQWExRCxFQUFFLG1DQUVuREEsRUFBRSw4Q0FBK0MsZ0JBQWdCZ0QsT0FDakVoRCxFQUFFLGlCQUFrQixnQkFBZ0IyRCxLQUFLLE1BQU1BLEtBQUssTUFBTVgsT0FDMURoRCxFQUFFLHlDQUEwQyxnQkFBZ0IyRCxLQUFLLE1BQU1YLE9BR3ZFaEQsRUFBRSw4QkFBK0IsZ0JBQWdCK0MsWUFBWS9DLEVBQUUsa0NBRTNEQSxFQUFFLG1CQUFvQixnQkFBZ0JLLE9BQVMsR0FDakRMLEVBQUUsYUFBYTRELFNBNUhqQjVELEVBQUUsdUJBQXVCa0IsS0FBSyxVQUFXLEdBQ3pDbEIsRUFBRSxrRUFBa0VNLEtBQUssV0FDekVOLEVBQUUsd0JBQXlCLGlDQUFpQ3lELFFBQVEsT0FBT25CLE9BQU8sT0FBT1UsT0FFekZoRCxFQUFFLHFEQUFxRFMsR0FBRyxRQUFTLFdBQ2pFb0QsT0FBT0MsV0FBVyxXQUNoQkMsTUFBTUMsVUFBVUMsUUFBUUMsS0FBSzFELFNBQVMyRCxpQkFBaUIsZ0JBQWlCLFNBQVVDLEdBQ2hGQyxHQUFHQyxXQUFXRixNQUVmLEtBUUxwRSxFQUFFLHdCQUF3QnNDLE9BQU8sTUFBTWlDLFNBQVMsS0FBS1gsTUFBTSxXQUN6RDVELEVBQUUseURBQXlEOEIsU0FFdkQ5QixFQUFFLDJDQUEyQ0ssUUFDL0NMLEVBQUUsMkNBQTJDOEIsU0FHL0M5QixFQUFFLHlDQUF5Q3dELE9BQU8sME1BOUduRGdCLE1BQU0sV0FhVCxJQUNNQyxFQUNBQyxFQUNBQyxFQTBHK0NDLEVBOEdLQyxFQWtFcERDLEVBalJKOUUsRUFBRStFLEtBQUssc0NBQ0xDLFNBQVUsT0FDVkMsUUFBUyxTQUFVQyxHQStHdkIsSUFBdURDLEVBQ2pEQyxFQUNBQyxFQUZpREYsRUE5R0osY0ErRzdDQyxFQUFjcEYsRUEvR21Ca0YsSUFnSGpDRyxFQUFlckYsRUFBRSxVQUVSa0IsS0FBSyxLQUFNaUUsR0FDeEJFLEVBQWE3QixPQUFPeEQsRUFBRSxrQkFDdEJxRixFQUFhN0IsT0FBTzRCLEdBQ3BCQyxFQUFhdEMsWUFBWSxZQW5JckIwQixFQUFZekUsRUFBRSxrQkFDZDBFLEVBMFFXMUUsRUFBRSxlQTFRcUJ5RSxHQTZRbkNoRCxTQUFTLG9DQUNUSCxZQUFZLGVBQ1pnRSxLQUFLLGdDQUNMaEQsU0FyS2dEc0MsRUExR2NGLEVBQTdEQyxFQTJHWTNFLEVBQUUsU0EzR29DeUUsR0EyR2ZjLFFBR3BDcEUsS0FBSyxRQUNMcUUsVUFBVSxpQ0FDVkMsUUFBUWIsR0F3RzZDQyxFQXROUkYsRUFBWEYsRUF3TmxDaUIsTUFDQTVFLEtBQUssaUJBQ0w2RSxPQUFPZCxHQUNQL0MsU0E5TEg5QixFQUFFLHVDQUF1Q3lCLFNBQVMsa0JBQ2xEekIsRUFBRSw2RUFBNkV5QixTQUFTLDBCQXdReEZ6QixFQUFFLG1DQUFtQ2UsS0FBSyxTQUFVNkUsR0FDbEQsSUFBSUMsRUFBUzdGLEVBQUVhLE1BRWZnRixFQUFPRixPQUFPLHFEQUNkRSxFQUFPL0QsV0FsQkxnRCxFQUFZLGVBRWhCOUUsRUFBRSxhQUFhOEYsSUFBSSw0QkFBNEJDLE1BQU0sV0FDbkQvRixFQUFFYSxNQUFNWSxTQUFTcUQsSUFDaEIsV0FDRDlFLEVBQUVhLE1BQU1TLFlBQVl3RCxPQXhUMUIsQ0F3VUVwRCxJQUFJMUIsRUFBRzBCLElBQUl6QjtDQzNVYixTQUFXRCxHQUNULGFBQ0EsSUFBSWdHLEVBQW1CbkMsT0FBT21DLGtCQUFvQm5DLE9BQU9vQyx3QkFBMEJwQyxPQUFPcUMsb0JBUzFGbEcsRUFBRW1HLEdBQUdDLFdBQWEsU0FBVUMsR0FDMUIsR0FBSUwsRUFBa0IsQ0FDcEIsSUFBSU0sR0FDRkMsU0FBUyxFQUNUQyxZQUFZLEdBR1ZDLEVBQVcsSUFBSVQsRUFBaUIsU0FBVVUsR0FDNUNBLEVBQVV6QyxRQUFRLFNBQVV2RCxHQUMxQjJGLEVBQVNuQyxLQUFLeEQsRUFBRStCLE9BQVEvQixPQUk1QixPQUFPRyxLQUFLRSxLQUFLLFdBQ2YwRixFQUFTRSxRQUFROUYsS0FBTXlGLE9BekIvQixDQTZCRzVFLElBQUkxQjtDQ25CUCxTQUFXQSxHQUNULGFBQ0EsSUFBSTRHLEVBQVE1RyxFQUFFLFFBRWQ0RyxFQUFNbkcsR0FBRyxRQUFTLDhCQUErQixXQUMvQyxJQUFJb0csRUF5RUVDLEVBeEVGQyxFQUFVL0csRUFBRWEsTUFDWm1HLEVBQVNELEVBQVF4QyxTQUFTLFlBYzlCLFNBQVMwQyxJQUNQakgsRUFBRSxpQkFBaUI4QixTQUNuQjhFLEVBQU10RixZQUFZLHFCQWJsQjJGLElBcUJBSixFQUFjRyxFQUFPRSxPQUFNLEdBQ3hCQyxTQUFTUCxHQUNUbkYsU0FBUyxnQkE2Q1JxRixFQUFlQyxFQUFRSyxTQUUzQlAsRUFBWVEsS0FDVkMsTUFBT1IsRUFBYVEsTUFBUVQsRUFBWVUsUUFBVVIsRUFBUVMsY0FDMURDLEtBQU1YLEVBQWFXLElBQU1WLEVBQVFXLGdCQUVuQ2IsRUFBWTNELE9BQ1owRCxFQUFNbkYsU0FBUyxxQkFuQmZvRixFQUFZL0YsS0FBSyxLQUFLOEMsTUFBTSxXQUMxQixJQUFJK0QsRUFBYzNILEVBQUVhLE1BQU15QixTQUFTc0YsUUFFbkNaLEVBQU9sRyxLQUFLLFVBQVk2RyxFQUFjLE9BQU8vRCxVQXhCM0NtRCxFQUFRM0YsS0FBSyxzQkFJakIyRixFQUFRM0YsS0FBSyxvQkFBb0IsR0FDakMyRixFQUFRWCxXQUFXLFdBRWJXLEVBQVFjLFNBQVMscUJBSXJCWixTQXhEUixDQXdGR3ZGLElBQUkxQiIsImZpbGUiOiJocnVpLm1pbi5qcyIsInNvdXJjZXNDb250ZW50IjpbIihmdW5jdGlvbiAoJCwgXykge1xuICAkKGRvY3VtZW50KVxuICAgIC5vbignY3JtTG9hZCcsIGZ1bmN0aW9uIChlKSB7XG4gICAgICAkKCcuY3JtLWlubGluZS1lZGl0Jykub25lKCdET01TdWJ0cmVlTW9kaWZpZWQnLCBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHZhciAkZm9ybSA9ICQodGhpcykuZmluZCgnZm9ybScpO1xuXG4gICAgICAgIGlmICgkZm9ybS5sZW5ndGggPT09IDEpIHtcbiAgICAgICAgICAkZm9ybS5maW5kKCdsYWJlbCcpLmVhY2goZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyICRsYWJlbCA9ICQodGhpcyk7XG4gICAgICAgICAgICB2YXIgaWQgPSAkbGFiZWwuYXR0cignZm9yJyk7XG4gICAgICAgICAgICAkKCcjJyArIGlkKS5hdHRyKCdwbGFjZWhvbGRlcicsICRsYWJlbC50ZXh0KCkpO1xuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9KVxuICAgIC5vbigndXBkYXRlQ29udGFjdEhlYWRlcicsIGZ1bmN0aW9uIChlLCBkYXRhKSB7XG4gICAgICBpZiAodHlwZW9mIGRhdGEuY29udHJhY3QgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgIHVwZGF0ZUNvbnRhY3RIZWFkZXJDb250cmFjdERldGFpbHMoZGF0YS5jb250cmFjdCk7XG4gICAgICB9XG5cbiAgICAgIGlmICh0eXBlb2YgZGF0YS5yb2xlcyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgdXBkYXRlQ29udGFjdEhlYWRlclJvbGVzRGV0YWlscyhkYXRhLnJvbGVzKTtcbiAgICAgIH1cbiAgICB9KTtcblxuICAvKipcbiAgICogVXBkYXRlcyB0aGUgY29udGFjdCBoZWFkZXIgd2l0aCB0aGUgZ2l2ZW4gY29udHJhY3QgZGV0YWlsc1xuICAgKlxuICAgKiBAcGFyYW0gIHtvYmplY3R9IGNvbnRyYWN0XG4gICAqL1xuICBmdW5jdGlvbiB1cGRhdGVDb250YWN0SGVhZGVyQ29udHJhY3REZXRhaWxzIChjb250cmFjdCkge1xuICAgIGlmIChjb250cmFjdCkge1xuICAgICAgJCgnLmNybS1zdW1tYXJ5LWNvbnRhY3RuYW1lLWJsb2NrJykucmVtb3ZlQ2xhc3MoJ2NybS1zdW1tYXJ5LWNvbnRhY3RuYW1lLWJsb2NrLXdpdGhvdXQtY29udHJhY3QnKTtcblxuICAgICAgaWYgKGNvbnRyYWN0LnBvc2l0aW9uKSB7XG4gICAgICAgICQoJy5jcm0tY29udGFjdC1kZXRhaWwtcG9zaXRpb24nKS5odG1sKCc8c3Ryb25nPlBvc2l0aW9uOjwvc3Ryb25nPiAnICsgY29udHJhY3QucG9zaXRpb24pO1xuICAgICAgfVxuXG4gICAgICBpZiAoY29udHJhY3QubG9jYXRpb24pIHtcbiAgICAgICAgJCgnLmNybS1jb250YWN0LWRldGFpbC1sb2NhdGlvbicpLmh0bWwoJzxzdHJvbmc+Tm9ybWFsIHBsYWNlIG9mIHdvcms6PC9zdHJvbmc+ICcgKyBjb250cmFjdC5sb2NhdGlvbik7XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgICQoJy5jcm0tc3VtbWFyeS1jb250YWN0bmFtZS1ibG9jaycpLmFkZENsYXNzKCdjcm0tc3VtbWFyeS1jb250YWN0bmFtZS1ibG9jay13aXRob3V0LWNvbnRyYWN0Jyk7XG4gICAgICAkKCcuY3JtLWNvbnRhY3QtZGV0YWlsLXBvc2l0aW9uJykuaHRtbCgnJyk7XG4gICAgICAkKCcuY3JtLWNvbnRhY3QtZGV0YWlsLWxvY2F0aW9uJykuaHRtbCgnJyk7XG5cbiAgICAgIHVwZGF0ZUNvbnRhY3RIZWFkZXJSb2xlc0RldGFpbHMobnVsbCk7XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIFVwZGF0ZXMgdGhlIGNvbnRhY3QgaGVhZGVyIHdpdGggdGhlIGdpdmVuIHJvbGVzIGRldGFpbHNcbiAgICpcbiAgICogQHBhcmFtICB7b2JqZWN0fSBjb250cmFjdFxuICAgKi9cbiAgZnVuY3Rpb24gdXBkYXRlQ29udGFjdEhlYWRlclJvbGVzRGV0YWlscyAocm9sZXMpIHtcbiAgICBpZiAocm9sZXMgJiYgcm9sZXMuZGVwYXJ0bWVudHMgJiYgcm9sZXMuZGVwYXJ0bWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgJCgnLmNybS1jb250YWN0LWRldGFpbC1kZXBhcnRtZW50cycpLmh0bWwoJzxzdHJvbmc+RGVwYXJ0bWVudDo8L3N0cm9uZz4gJyArIHJvbGVzLmRlcGFydG1lbnRzLmpvaW4oJywgJykpO1xuICAgIH0gZWxzZSB7XG4gICAgICAkKCcuY3JtLWNvbnRhY3QtZGV0YWlsLWRlcGFydG1lbnRzJykuaHRtbCgnJyk7XG4gICAgfVxuICB9XG59KENSTS4kLCBDUk0uXykpO1xuIiwiLyogZ2xvYmFsIFBzICovXG5cbi8vIENvcHlyaWdodCBDaXZpQ1JNIExMQyAyMDEzLiBTZWUgaHR0cDovL2Npdmljcm0ub3JnL2xpY2Vuc2luZ1xuKGZ1bmN0aW9uICgkLCBfKSB7XG4gICQoZG9jdW1lbnQpXG4gICAgLm9uKCdjcm1Mb2FkJywgZnVuY3Rpb24gKGUpIHtcbiAgICAgIGFkZFVwbG9hZEZpbGVMaXN0ZW5lcihcImlucHV0W3R5cGU9J2ZpbGUnXVwiKTtcbiAgICAgIGFtZW5kVmFjYW5jeUZvcm0oKTtcbiAgICAgIGFtZW5kQ29udGFjdFBhZ2VBbmRGb3JtKGUpO1xuICAgICAgYXBwbHlNaXNjQ2hhbmdlcygpO1xuICAgICAgY2hhbmdlQ29udGFjdFNvdXJjZUZpZWxkSGVscFRleHQoKTtcbiAgICB9KVxuICAgIC5yZWFkeShmdW5jdGlvbiAoKSB7XG4gICAgICBhZGRVc2VyTWVudVRvTWFpbk1lbnUoKTtcbiAgICAgIGFtZW5kQXBwTG9nb01lbnVJdGVtKCk7XG4gICAgICBhbWVuZEFwcGxpY2F0aW9uRm9ybSgpO1xuICAgICAgdXNlRm9udEF3ZXNvbWVBcnJvd3NJblN1Yk1lbnVJdGVtcygpO1xuICAgICAgdG9nZ2xlQWN0aXZlQ2xhc3NPbkhvdmVyT25BbnlNYWluTWVudUl0ZW0oKTtcbiAgICB9KTtcblxuICAvKipcbiAgICogQ3VzdG9taXplcyB0aGUgYXBwIGxvZ28gbWVudSBpdGVtLCBzd2l0Y2hpbmcgZnJvbSB0aGUgQ2l2aUNSTSBsb2dvXG4gICAqIHRvIHRoZSBDaXZpSFIgbG9nbywgYW5kIG1ha2luZyB0aGUgaXRlbSBhIGRpcmVjdCBsaW5rIGluc3RlYWQgb2YgYVxuICAgKiB0b2dnbGUgZm9yIGEgc3ViIG1lbnUgZHJvcGRvd25cbiAgICovXG4gIGZ1bmN0aW9uIGFtZW5kQXBwTG9nb01lbnVJdGVtICgpIHtcbiAgICB2YXIgJG1lbnVJdGVtID0gJCgnLmNybS1saW5rLWhvbWUnKTtcbiAgICB2YXIgJHdyYXBwZWRMb2dvID0gc3dhcEFuZFdyYXBBcHBMb2dvKCRtZW51SXRlbSk7XG4gICAgdmFyICRjdXN0b21Ib21lTGluayA9IGN1c3RvbWl6ZUhvbWVMaW5rSW5Mb2dvTWVudUl0ZW0oJG1lbnVJdGVtLCAkd3JhcHBlZExvZ28pO1xuXG4gICAgcmVtb3ZlTG9nb1N1Yk1lbnVBbmRLZWVwT25seUhvbWVMaW5rKCRtZW51SXRlbSwgJGN1c3RvbUhvbWVMaW5rKTtcbiAgfVxuXG4gIC8qKlxuICAgKiBBZGRzIHRoZSB1c2VyIG1lbnUgYnkgZmV0Y2hpbmcgaXQgZnJvbSB0aGUgaHJjb3JlIGV4dGVuc2lvblxuICAgKi9cbiAgZnVuY3Rpb24gYWRkVXNlck1lbnVUb01haW5NZW51ICgpIHtcbiAgICAkLmFqYXgoJy9jaXZpY3JtL2hyY29yZS91c2VybWVudT9zbmlwcGV0PTQnLCB7XG4gICAgICBkYXRhVHlwZTogJ2h0bWwnLFxuICAgICAgc3VjY2VzczogZnVuY3Rpb24gKG1lbnVNYXJrdXApIHtcbiAgICAgICAgaW5qZWN0VXNlck1lbnVJbkFNYWluTWVudVdyYXBwZXIobWVudU1hcmt1cCwgJ2Npdmloci1tZW51Jyk7XG4gICAgICB9XG4gICAgfSk7XG4gIH1cblxuICAvKipcbiAgICogQWRkIGFuIGV2ZW50IGxpc3RlbmVyIG9uIGlucHV0W3R5cGU9XCJmaWxlXCJdXG4gICAqIEBwYXJhbSB7alF1ZXJ5IE9iamVjdH0gc2VsZWN0b3IgW3NlbGVjdG9yIGZyb20gaW5wdXQgZmlsZV1cbiAgICovXG4gIGZ1bmN0aW9uIGFkZFVwbG9hZEZpbGVMaXN0ZW5lciAoc2VsZWN0b3IpIHtcbiAgICBpZiAoJChzZWxlY3RvcikubGVuZ3RoID09PSAxKSB7XG4gICAgICAkKHNlbGVjdG9yKS5vbignY2hhbmdlJywgaW5zZXJ0RmlsZSk7XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIEFtZW5kcyB0aGUgYXBwbGljYXRpb24gZm9ybVxuICAgKi9cbiAgZnVuY3Rpb24gYW1lbmRBcHBsaWNhdGlvbkZvcm0gKCkge1xuICAgICQoJy5DUk1fSFJSZWNydWl0bWVudF9Gb3JtX0FwcGxpY2F0aW9uJykuYWRkQ2xhc3MoJ2NybS1mb3JtLWJsb2NrJyk7XG4gICAgJCgnLkNSTV9IUlJlY3J1aXRtZW50X0Zvcm1fQXBwbGljYXRpb24gLmNybS1wcm9maWxlLW5hbWUtYXBwbGljYXRpb25fcHJvZmlsZScpLmFkZENsYXNzKCdmb3JtLWxheW91dC1jb21wcmVzc2VkJyk7XG4gIH1cblxuICAvKipcbiAgICogQW1lbmRzIHRoZSBjb250YWN0IHBhZ2UgYW5kIHRoZSBjb250YWN0IGZvcm1cbiAgICovXG4gIGZ1bmN0aW9uIGFtZW5kQ29udGFjdFBhZ2VBbmRGb3JtIChlKSB7XG4gICAgaWYgKENSTS5mb3JtTmFtZSA9PT0gJ2NvbnRhY3RGb3JtJyB8fCBDUk0ucGFnZU5hbWUgPT09ICd2aWV3U3VtbWFyeScpIHtcbiAgICAgIC8vIFJlbmFtZSBcIlN1bW1hcnlcIiB0YWIgdG8gXCJQZXJzb25hbCBEZXRhaWxzXCJcbiAgICAgIC8vIEhhY2sgdG8gY2hlY2sgY29udGFjdCB0eXBlIC0gVGhpcyBmaWVsZCBvbmx5IGFwcGVhcnMgZm9yIGluZGl2aWR1YWxzXG4gICAgICBpZiAoJCgnLmNybS1jb250YWN0LWpvYl90aXRsZScsICcuY3JtLXN1bW1hcnktY29udGFjdGluZm8tYmxvY2snKS5sZW5ndGgpIHtcbiAgICAgICAgJCgnLmNybS1jb250YWN0LXRhYnMtbGlzdCAjdGFiX3N1bW1hcnkgYScsIGUudGFyZ2V0KS50ZXh0KCdQZXJzb25hbCBEZXRhaWxzJyk7XG4gICAgICB9XG5cbiAgICAgIG1hbmlwdWxhdGVET01PZklubGluZUN1c3RvbURhdGEoZS50YXJnZXQpO1xuICAgICAgbWlzY0NvbnRhY3RQYWdlQ2hhbmdlcyhlLnRhcmdldCk7XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIEFtZW5kcyB0aGUgdmFjYW5jeSBmb3JtXG4gICAqL1xuICBmdW5jdGlvbiBhbWVuZFZhY2FuY3lGb3JtICgpIHtcbiAgICBpZiAoJCgnLkNSTV9IUlJlY3J1aXRtZW50X0Zvcm1fSFJWYWNhbmN5JykubGVuZ3RoID09PSAxKSB7XG4gICAgICBsaW5rTGFiZWxUb0RhdGVwaWNrZXJJbnB1dCgkKCdsYWJlbFtmb3I9XCJzdGFydF9kYXRlXCJdJykucGFyZW50cygndHInKSk7XG4gICAgICBsaW5rTGFiZWxUb0RhdGVwaWNrZXJJbnB1dCgkKCdsYWJlbFtmb3I9XCJlbmRfZGF0ZVwiXScpLnBhcmVudHMoJ3RyJykpO1xuXG4gICAgICAvLyBBZGQgYSBjbGFzcyB0byBpZGVudGlmeSB0aGUgZm9ybSAnTmV3IFZhY2FuY3kgVGVtcGxhdGUnXG4gICAgICBpZiAoJCgnW25hbWU9XCJlbnRyeVVSTFwiXScpLnZhbCgpLmluZGV4T2YoJzt0ZW1wbGF0ZT0xJykgPiAtMSkge1xuICAgICAgICAkKCQoJy5DUk1fSFJSZWNydWl0bWVudF9Gb3JtX0hSVmFjYW5jeSB0Ym9keScpLmdldCgwKSkuYWRkQ2xhc3MoJ0NSTV9IUlJlY3J1aXRtZW50X0Zvcm1fSFJWYWNhbmN5X1RlbXBsYXRlJyk7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIEFwcGxpZXMgbWlzY2VsbGFuZW91cyBVSSBjaGFuZ2VzXG4gICAqL1xuICBmdW5jdGlvbiBhcHBseU1pc2NDaGFuZ2VzICgpIHtcbiAgICAkKCcjYWN0aXZpdHlDdXN0b21EYXRhJykuYXR0cignY29sc3BhbicsIDMpO1xuICAgICQoJyNjcm0tYWN0aXZpdHktdmlldy10YWJsZSAuY3JtLWNhc2UtYWN0aXZpdHktdmlldy1DbGllbnQgLmxhYmVsJykuaHRtbCgnQ29udGFjdCcpO1xuICAgICQoJ3NwYW4uY3JtLWZyb3plbi1maWVsZCcsICcuY3JtLXByb2ZpbGUtbmFtZS1ocmlkZW50X3RhYicpLmNsb3Nlc3QoJ2RpdicpLnBhcmVudCgnZGl2JykuaGlkZSgpO1xuXG4gICAgJCgnLmNybS1hY2NvcmRpb24taGVhZGVyLmNybS1tYXN0ZXItYWNjb3JkaW9uLWhlYWRlcicpLm9uKCdjbGljaycsIGZ1bmN0aW9uICgpIHtcbiAgICAgIHdpbmRvdy5zZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgQXJyYXkucHJvdG90eXBlLmZvckVhY2guY2FsbChkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCcubGlzdGluZy1ib3gnKSwgZnVuY3Rpb24gKGVsZW1lbnQpIHtcbiAgICAgICAgICBQcy5pbml0aWFsaXplKGVsZW1lbnQpO1xuICAgICAgICB9KTtcbiAgICAgIH0sIDApO1xuICAgIH0pO1xuICB9XG5cbiAgLyoqXG4gICAqIENoYW5nZXMgb2Ygc29yY2UgaGVscCB0ZXh0XG4gICAqL1xuICBmdW5jdGlvbiBjaGFuZ2VDb250YWN0U291cmNlRmllbGRIZWxwVGV4dCAoKSB7XG4gICAgJCgnSU5QVVQjY29udGFjdF9zb3VyY2UnKS5wYXJlbnQoJ3RkJykuY2hpbGRyZW4oJ2EnKS5jbGljayhmdW5jdGlvbiAoKSB7XG4gICAgICAkKCcjY3JtLW5vdGlmaWNhdGlvbi1jb250YWluZXIgLmNybS1oZWxwIC5ub3RpZnktY29udGVudCcpLnJlbW92ZSgpO1xuXG4gICAgICBpZiAoJCgnI2NybS1ub3RpZmljYXRpb24tY29udGFpbmVyIC5jcm0taGVscCBwJykubGVuZ3RoKSB7XG4gICAgICAgICQoJyNjcm0tbm90aWZpY2F0aW9uLWNvbnRhaW5lciAuY3JtLWhlbHAgcCcpLnJlbW92ZSgpO1xuICAgICAgfVxuXG4gICAgICAkKCcjY3JtLW5vdGlmaWNhdGlvbi1jb250YWluZXIgLmNybS1oZWxwJykuYXBwZW5kKCc8cD5Tb3VyY2UgaXMgYSB1c2VmdWwgZmllbGQgd2hlcmUgZGF0YSBoYXMgYmVlbiBtaWdyYXRlZCB0byBDaXZpSFIgZnJvbSBvbmUgb3IgYSBudW1iZXIgb2Ygb3RoZXIgbGVnYWN5IHN5c3RlbXMuIFRoZSBTb3VyY2UgZmllbGQgd2lsbCBpbmRpY2F0ZSB3aGljaCBsZWdhY3kgc3lzdGVtIHRoZSBjb250YWN0IGhhcyBjb21lIGZyb20uPC9wPicpO1xuICAgIH0pO1xuICB9XG5cbiAgLyoqXG4gICAqIEZpbmRzIHRoZSBvcmlnaW5hbCBsaW5rIHRvIHRoZSBob21lcGFnZSwgY2hhbmdlcyB0aGUgdGV4dCwgd3JhcHMgaXQgaW4gYVxuICAgKiBgbWVudW1haW4tbGFiZWxgIGVsZW1lbnQgYW5kIHByZXBlbmRzIGludGVybmFsbHkgdGhlIGdpdmVuIGFwcCBsb2dvXG4gICAqXG4gICAqIEBwYXJhbSB7b2JqZWN0fSAkbWVudUl0ZW0gVGhlIGNvbnRleHQgd2hlcmUgdG8gZmluZCB0aGUgbGlua1xuICAgKiBAcGFyYW0ge29iamVjdH0gJGFwcExvZ29cbiAgICogQHJldHVybiB0aGUgY3VzdG9taXplZCBob21lIGxpbmtcbiAgICovXG4gIGZ1bmN0aW9uIGN1c3RvbWl6ZUhvbWVMaW5rSW5Mb2dvTWVudUl0ZW0gKCRtZW51SXRlbSwgJGFwcExvZ28pIHtcbiAgICB2YXIgJGhvbWVMaW5rID0gJCgnbGkgPiBhJywgJG1lbnVJdGVtKS5maXJzdCgpO1xuXG4gICAgcmV0dXJuICRob21lTGlua1xuICAgICAgLnRleHQoJ0hvbWUnKVxuICAgICAgLndyYXBJbm5lcignPHNwYW4gY2xhc3M9XCJtZW51bWFpbi1sYWJlbFwiPicpXG4gICAgICAucHJlcGVuZCgkYXBwTG9nbyk7XG4gIH1cblxuICAvKipcbiAgICogSW5qZWN0cyB0aGUgZ2l2ZW4gbWFya3VwIGluIGEgbWVudSB3cmFwcGVyIHdpdGggdGhlIGdpdmVuIGlkXG4gICAqIGNyZWF0ZWQgdG8gY29udGFpbiBib3RoIHRoZSBvcmlnaW5hbCBtZW51IGFuZCB0aGUgdXNlciBvbmVcbiAgICpcbiAgICogQHBhcmFtIHtzdHJpbmd9IG1lbnVNYXJrdXBcbiAgICogQHBhcmFtIHtzdHJpbmd9IHdyYXBwZXJJZFxuICAgKi9cbiAgZnVuY3Rpb24gaW5qZWN0VXNlck1lbnVJbkFNYWluTWVudVdyYXBwZXIgKG1lbnVNYXJrdXAsIHdyYXBwZXJJZCkge1xuICAgIHZhciAkbWVudU1hcmt1cCA9ICQobWVudU1hcmt1cCk7XG4gICAgdmFyICRtZW51V3JhcHBlciA9ICQoJzxkaXY+Jyk7XG5cbiAgICAkbWVudVdyYXBwZXIuYXR0cignaWQnLCB3cmFwcGVySWQpO1xuICAgICRtZW51V3JhcHBlci5hcHBlbmQoJCgnI2Npdmljcm0tbWVudScpKTtcbiAgICAkbWVudVdyYXBwZXIuYXBwZW5kKCRtZW51TWFya3VwKTtcbiAgICAkbWVudVdyYXBwZXIuaW5zZXJ0QWZ0ZXIoJyNwYWdlJyk7XG4gIH1cblxuICAvKipcbiAgICogSW5zZXJ0IGEgRE9NIG5vZGUgYWZ0ZXIgaW5wdXRbdHlwZT1cImZpbGVcIl1cbiAgICogd2l0aCB0aGUgZmlsZW5hbWVcbiAgICovXG4gIGZ1bmN0aW9uIGluc2VydEZpbGUgKCkge1xuICAgIHZhciBmaWxlTmFtZSA9ICQodGhpcylbMF0uZmlsZXNbMF07XG5cbiAgICAkKCcjanMtdXBsb2FkZWQtZmlsZScpLnJlbW92ZSgpO1xuICAgIGlmIChmaWxlTmFtZSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAkKHRoaXMpLmFmdGVyKCc8c3BhbiBpZD1cImpzLXVwbG9hZGVkLWZpbGVcIiBjbGFzcz1cInVwbG9hZGVkLWZpbGVcIj4nICsgZmlsZU5hbWUubmFtZSArICcgPHNwYW4gY2xhc3M9XCJ1cGxvYWRlZC1maWxlLWljb24tdHJhc2hcIj48aSBjbGFzcz1cImZhIGZhLXRyYXNoLW9cIj48L2k+IFJlbW92ZTwvc3Bhbj4nKTtcblxuICAgICAgJCgnLnVwbG9hZGVkLWZpbGUtaWNvbi10cmFzaCcpLm9uKCdjbGljaycsIHJlbW92ZUZpbGUpO1xuICAgIH1cbiAgfVxuXG4gIC8qKlxuICAgKiBVcGRhdGUgbGFiZWwgJ2ZvcicgYXR0ciB0byB3b3JrcyB3aXRoIHRoZSBkYXRlcGlja2VyXG4gICAqXG4gICAqIEBwYXJhbSAge2pRdWVyeSBvYmplY3R9ICRsaW5lIFtkYXRlcGlja2VyJ3MgbGluZSBwYXJlbnRdXG4gICAqL1xuICBmdW5jdGlvbiBsaW5rTGFiZWxUb0RhdGVwaWNrZXJJbnB1dCAoJGxpbmUpIHtcbiAgICAkbGluZS5maW5kKCdsYWJlbCcpLmF0dHIoJ2ZvcicsICRsaW5lLmZpbmQoJy5jcm0tZm9ybS1kYXRlJykuYXR0cignaWQnKSk7XG4gIH1cblxuICAvKipcbiAgICogTWFuaXB1bGF0ZXMsIGF0IHRoZSBET00gbGV2ZWwsIHRoZSBibG9ja3MvZmllbGRzIGJlbG9uZ2luZyB0byB0aGVcbiAgICogSW5saW5lIEN1c3RvbSBEYXRhIGN1c3RvbSBmaWVsZHMgc2V0XG4gICAqL1xuICBmdW5jdGlvbiBtYW5pcHVsYXRlRE9NT2ZJbmxpbmVDdXN0b21EYXRhICgpIHtcbiAgICBpZiAoJCgnLklubGluZV9DdXN0b21fRGF0YScpLmxlbmd0aCkge1xuICAgICAgcmVwb3NpdGlvbklubGluZUN1c3RvbURhdGFCbG9ja0luUGVyc29uYWxEZXRhaWxzVGFiKCk7XG4gICAgfVxuXG4gICAgaWYgKCQoJyNjdXN0b21GaWVsZHMnKS5sZW5ndGggPCAxKSB7XG4gICAgICByZXBvc2l0aW9uSW5saW5lQ3VzdG9tRGF0YUZpZWxkc0luRWRpdENvbnRhY3RGb3JtKCk7XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIE1pc2MgY2hhbmdlcyB0byB0aGUgcGFnZSAoaGlkaW5nIGVsZW1lbnRzLCBpbnNlcnRpbmcgbmV3IG9uZXMsIGV0YylcbiAgICovXG4gIGZ1bmN0aW9uIG1pc2NDb250YWN0UGFnZUNoYW5nZXMgKHRhcmdldCkge1xuICAgIC8vIEhpZGUgY3VycmVudCBlbXBsb3llciBhbmQgam9iIHRpdGxlXG4gICAgLy8gQ29udGFjdCBzdW1tYXJ5IHNjcmVlbjpcbiAgICAkKCdkaXYuY3JtLWNvbnRhY3QtY3VycmVudF9lbXBsb3llciwgZGl2LmNybS1jb250YWN0LWpvYl90aXRsZScsICcuY3JtLXN1bW1hcnktY29udGFjdGluZm8tYmxvY2snKS5wYXJlbnQoJ2Rpdi5jcm0tc3VtbWFyeS1yb3cnKS5oaWRlKCk7XG4gICAgLy8gSW5saW5lIGVkaXQgZm9ybVxuICAgICQoJ2Zvcm0jQ29udGFjdEluZm8gaW5wdXQjZW1wbG95ZXJfaWQsIGZvcm0jQ29udGFjdEluZm8gaW5wdXQjam9iX3RpdGxlJywgdGFyZ2V0KS5jbG9zZXN0KCdkaXYuY3JtLXN1bW1hcnktcm93JykuaGlkZSgpO1xuICAgIC8vIENvbnRhY3QgZWRpdCBzY3JlZW5cbiAgICAkKCdpbnB1dCNlbXBsb3llcl9pZCwgaW5wdXQjam9iX3RpdGxlJywgJ2Zvcm0jQ29udGFjdCcpLnBhcmVudCgndGQnKS5oaWRlKCk7XG5cbiAgICAvKiBDaGFuZ2VzIG9uIEFkZCBJbmRpdmlkdWFsIHBhZ2VzIGFuZCBQZXJzb25hbCBkZXRhaWxzIHRhYiBmb3IgSFItMzU4ICovXG4gICAgLy8gTW92ZSBKb2Igc3VtbWFyeSB0byB0b3BcbiAgICAkKCcuSFJKb2JDb250cmFjdF9TdW1tYXJ5JywgdGFyZ2V0KS5pbnNlcnRCZWZvcmUoJCgnLmNybS1zdW1tYXJ5LWNvbnRhY3RpbmZvLWJsb2NrJykpO1xuICAgIC8vIGNoYW5nZXMgb2YgZW1haWwgYmxvY2ssIHJlbW92ZSBidWxrbWFpbCBhbmQgb25ob2xkXG4gICAgJCgnZGl2LmVtYWlsLXNpZ25hdHVyZSwgdGQjRW1haWwtQnVsa21haWwtaHRtbCcsICdmb3JtI0NvbnRhY3QnKS5oaWRlKCk7XG4gICAgJCgnI0VtYWlsLVByaW1hcnknLCAnZm9ybSNDb250YWN0JykucHJldigndGQnKS5wcmV2KCd0ZCcpLmhpZGUoKTtcbiAgICAkKCd0ZCNFbWFpbC1CdWxrbWFpbC1odG1sLCAjRW1haWwtUHJpbWFyeScsICdmb3JtI0NvbnRhY3QnKS5wcmV2KCd0ZCcpLmhpZGUoKTtcblxuICAgIC8vIHNoaWZ0IGRlbW9ncmFwaGljIGFib3ZlIGV4dGVuZGVkIGRlbW9ncmFwaGljXG4gICAgJCgnLmNybS1kZW1vZ3JhcGhpY3MtYWNjb3JkaW9uJywgJ2Zvcm0jQ29udGFjdCcpLmluc2VydEFmdGVyKCQoJy5jcm0tY29udGFjdERldGFpbHMtYWNjb3JkaW9uJykpO1xuXG4gICAgaWYgKCQoJ3RyI1Bob25lX0Jsb2NrXzInLCAnZm9ybSNDb250YWN0JykubGVuZ3RoIDwgMSkge1xuICAgICAgJCgnI2FkZFBob25lJykuY2xpY2soKTtcbiAgICB9XG4gIH1cblxuICAvKipcbiAgICogUmVtb3ZlIHRoZSAjanMtdXBsb2FkZWQtZmlsZSBESVYgYW5kXG4gICAqIGNsZWFuIGlucHV0W3R5cGU9XCJmaWxlXCJdIHZhbHVlXG4gICAqL1xuICBmdW5jdGlvbiByZW1vdmVGaWxlICgpIHtcbiAgICB2YXIgJGlucHV0ID0gJCgnI2pzLXVwbG9hZGVkLWZpbGUnKS5wYXJlbnQoKS5maW5kKCdpbnB1dFt0eXBlPVwiZmlsZVwiXScpO1xuXG4gICAgJCgnI2pzLXVwbG9hZGVkLWZpbGUnKS5yZW1vdmUoKTtcbiAgICAkaW5wdXQudmFsKCcnKTtcbiAgfVxuXG4gIC8qKlxuICAgKiBNb3ZlcyB0aGUgZ2l2ZW4gaG9tZSBsaW5rIHJpZ2h0IHVuZGVyIHRoZSBtZW51IGl0ZW0gYW5kIGdldHMgcmlkXG4gICAqIG9mIHRoZSBvcmlnaW5hbCBzdWIgbWVudVxuICAgKlxuICAgKiBAcGFyYW0ge29iamVjdH0gJG1lbnVJdGVtIFRoZSBjb250ZXh0IHdoZXJlIHRvIGZpbmQgdGhlIGxpbmtcbiAgICogQHBhcmFtIHtvYmplY3R9ICRob21lTGlua1xuICAgKi9cbiAgZnVuY3Rpb24gcmVtb3ZlTG9nb1N1Yk1lbnVBbmRLZWVwT25seUhvbWVMaW5rICgkbWVudUl0ZW0sICRob21lTGluaykge1xuICAgICRtZW51SXRlbVxuICAgICAgLm9mZigpIC8vIHJlbW92ZXMgYW55IGhhbmRsZXIgdGhhdCB0aGUgb3JpZ2luYWwgaXRlbSBoYWRcbiAgICAgIC5maW5kKCcjY2l2aWNybS1ob21lJylcbiAgICAgIC5iZWZvcmUoJGhvbWVMaW5rKVxuICAgICAgLnJlbW92ZSgpO1xuICB9XG5cbiAgLyoqXG4gICAqIE1vdmVzIHRoZSBcIklubGluZSBDdXN0b20gRGF0YVwiIGZpZWxkcyB0b3dhcmRzIHRoZSB0b3Agb2YgdGhlXG4gICAqIGVkaXQgY29udGFjdCBmb3JtXG4gICAqL1xuICBmdW5jdGlvbiByZXBvc2l0aW9uSW5saW5lQ3VzdG9tRGF0YUZpZWxkc0luRWRpdENvbnRhY3RGb3JtICgpIHtcbiAgICB2YXIgJGZpZWxkcyA9ICQoJyNJbmxpbmVfQ3VzdG9tX0RhdGEnKS5kZXRhY2goKTtcblxuICAgICRmaWVsZHMuZmluZCgnLmxhYmVsJykuZWFjaChmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgJGxhYmVsQ2VsbCA9ICQodGhpcyk7XG4gICAgICB2YXIgJGZpZWxkQ2VsbCA9ICRsYWJlbENlbGwubmV4dCgpO1xuICAgICAgdmFyICRuZXdUZCA9ICQoJzx0ZC8+Jyk7XG5cbiAgICAgICRuZXdUZC5hcHBlbmQoJGxhYmVsQ2VsbC5maW5kKCdsYWJlbCcpKTtcbiAgICAgICRuZXdUZC5hcHBlbmQoJCgnPGJyLz4nKSk7XG4gICAgICAkbmV3VGQuYXBwZW5kKCRmaWVsZENlbGwuaHRtbCgpKTtcblxuICAgICAgJCgnI25pY2tfbmFtZScpLnBhcmVudCgpLmFmdGVyKCRuZXdUZCk7XG4gICAgfSk7XG4gIH1cblxuICAvKipcbiAgICogTW92ZXMgdGhlIFwiSW5saW5lIEN1c3RvbSBEYXRhXCIgYmxvY2sgdG93YXJkcyB0aGUgdG9wIG9mIHRoZVxuICAgKiBwZXJzb25hbCBkZXRhaWxzIHRhYlxuICAgKi9cbiAgZnVuY3Rpb24gcmVwb3NpdGlvbklubGluZUN1c3RvbURhdGFCbG9ja0luUGVyc29uYWxEZXRhaWxzVGFiICgpIHtcbiAgICAkKCcuSW5saW5lX0N1c3RvbV9EYXRhJylcbiAgICAgIC5yZW1vdmVDbGFzcygnY3JtLWNvbGxhcHNpYmxlIGNvbGxhcHNlZCcpXG4gICAgICAuYWRkQ2xhc3MoJ2NybS1zdW1tYXJ5LWJsb2NrJylcbiAgICAgIC5pbnNlcnRBZnRlcignLmNybS1zdW1tYXJ5LWNvbnRhY3RpbmZvLWJsb2NrJylcbiAgICAgIC5maW5kKCcuY29sbGFwc2libGUtdGl0bGUnKS5oaWRlKCkuZW5kKClcbiAgICAgIC5maW5kKCcuY3JtLXN1bW1hcnktYmxvY2snKS5zaG93KCk7XG4gIH1cblxuICAvKipcbiAgICogU3dhcHMgdGhlIENpdmlDUk0gbG9nbyB3aXRoIHRoZSBDaXZpSFIgbG9nb1xuICAgKiBhbmQgd3JhcHMgaXQgaW4gYSBgbWVudW1haW4taWNvbmAgZWxlbWVudFxuICAgKlxuICAgKiBAcGFyYW0ge29iamVjdH0gJG1lbnVJdGVtIFRoZSBjb250ZXh0IHdoZXJlIHRvIGZpbmQgdGhlIGxvZ29cbiAgICogQHJldHVybiB0aGUgd3JhcHBlciBvZiB0aGUgbG9nb1xuICAgKi9cbiAgZnVuY3Rpb24gc3dhcEFuZFdyYXBBcHBMb2dvICgkbWVudUl0ZW0pIHtcbiAgICB2YXIgJGFwcExvZ28gPSAkKCcuY3JtLWxvZ28tc20nLCAkbWVudUl0ZW0pO1xuXG4gICAgcmV0dXJuICRhcHBMb2dvXG4gICAgICAuYWRkQ2xhc3MoJ2Nocl9sb2dvIGNocl9sb2dvLS1kZWZhdWx0LWNvbG9yJylcbiAgICAgIC5yZW1vdmVDbGFzcygnY3JtLWxvZ28tc20nKVxuICAgICAgLndyYXAoJzxzcGFuIGNsYXNzPVwibWVudW1haW4taWNvblwiPicpXG4gICAgICAucGFyZW50KCk7XG4gIH1cblxuICAvKipcbiAgICogQ2l2aUNSTSBieSBkZWZhdWx0IGFwcGxpZXMgb24gaG92ZXIgdGhlIC5hY3RpdmV0YXJnZXQgY2xhc3NcbiAgICogb25seSB0byBtYWluIG1lbnUgaXRlbXMgd2l0aCBhIHN1Ym1lbnVcbiAgICpcbiAgICogVGhpcyBmdW5jdGlvbnMgbWFrZXMgc3VyZSB0aGF0IGFueSBpdGVtIGdldHMgdGhlIGNsYXNzIGFwcGxpZWQsXG4gICAqIGV2ZW4gdGhvc2Ugd2l0aCBqdXN0IGEgZGlyZWN0IGxpbmtcbiAgICovXG4gIGZ1bmN0aW9uIHRvZ2dsZUFjdGl2ZUNsYXNzT25Ib3Zlck9uQW55TWFpbk1lbnVJdGVtICgpIHtcbiAgICB2YXIgY2xhc3NOYW1lID0gJ2FjdGl2ZXRhcmdldCc7XG5cbiAgICAkKCcubWVudW1haW4nKS5ub3QoJy5jcm0tU2VsZl9TZXJ2aWNlX1BvcnRhbCcpLmhvdmVyKGZ1bmN0aW9uICgpIHtcbiAgICAgICQodGhpcykuYWRkQ2xhc3MoY2xhc3NOYW1lKTtcbiAgICB9LCBmdW5jdGlvbiAoKSB7XG4gICAgICAkKHRoaXMpLnJlbW92ZUNsYXNzKGNsYXNzTmFtZSk7XG4gICAgfSk7XG4gIH1cblxuICAvKipcbiAgICogUmVtb3ZlIHRoZSBhcnJvdyBmb3IgbWVudSBpdGVtcyB3aXRoIHN1Yi1pdGVtcywgYW5kIHJlcGxhY2VzIGl0XG4gICAqIHdpdGggYSBmb250IGF3ZXNvbWUgY2FyZXRcbiAgICovXG4gIGZ1bmN0aW9uIHVzZUZvbnRBd2Vzb21lQXJyb3dzSW5TdWJNZW51SXRlbXMgKCkge1xuICAgICQoJyNyb290LW1lbnUtZGl2IC5tZW51LWl0ZW0tYXJyb3cnKS5lYWNoKGZ1bmN0aW9uICgkZWxlbWVudCkge1xuICAgICAgdmFyICRhcnJvdyA9ICQodGhpcyk7XG5cbiAgICAgICRhcnJvdy5iZWZvcmUoJzxpIGNsYXNzPVwiZmEgZmEtY2FyZXQtcmlnaHQgbWVudS1pdGVtLWFycm93XCI+PC9pPicpO1xuICAgICAgJGFycm93LnJlbW92ZSgpO1xuICAgIH0pO1xuICB9XG59KENSTS4kLCBDUk0uXykpO1xuIiwiKGZ1bmN0aW9uICgkKSB7XG4gICd1c2Ugc3RyaWN0JztcbiAgdmFyIE11dGF0aW9uT2JzZXJ2ZXIgPSB3aW5kb3cuTXV0YXRpb25PYnNlcnZlciB8fCB3aW5kb3cuV2ViS2l0TXV0YXRpb25PYnNlcnZlciB8fCB3aW5kb3cuTW96TXV0YXRpb25PYnNlcnZlcjtcblxuICAvKlxuICBUaGlzIHBsdWdpbiBjcmVhdGVzIE11dGF0aW9uT2JzZXJ2ZXIgd2hpY2ggbGlzdGVucyB0byBhbGwgY2hhbmdlcyB0byBET00gTm9kZS5cbiAgSWYgY2hhbmdlIGhhcyBiZWVuIGRvbmUgdG8gaXQncyBhdHRyaWJ1dGVzIGNhbGxiYWNrIHdpbGwgYmUgY2FsbGVkLlxuXG4gIEBwYXJhbSB7ZnVuY3Rpb259IGNhbGxiYWNrIC0gdG8gYmUgY2FsbGVkIHdoZW4gYXR0cmlidXRlcyBjaGFuZ2VcbiAgQHJldHVybnMge0FycmF5fSAtIGxpc3Qgb2YgYWxsIG9ic2VydmVkIGVsZW1lbnRzXG4gICovXG4gICQuZm4uYXR0cmNoYW5nZSA9IGZ1bmN0aW9uIChjYWxsYmFjaykge1xuICAgIGlmIChNdXRhdGlvbk9ic2VydmVyKSB7XG4gICAgICB2YXIgb3B0aW9ucyA9IHtcbiAgICAgICAgc3VidHJlZTogZmFsc2UsXG4gICAgICAgIGF0dHJpYnV0ZXM6IHRydWVcbiAgICAgIH07XG5cbiAgICAgIHZhciBvYnNlcnZlciA9IG5ldyBNdXRhdGlvbk9ic2VydmVyKGZ1bmN0aW9uIChtdXRhdGlvbnMpIHtcbiAgICAgICAgbXV0YXRpb25zLmZvckVhY2goZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICBjYWxsYmFjay5jYWxsKGUudGFyZ2V0LCBlKTtcbiAgICAgICAgfSk7XG4gICAgICB9KTtcblxuICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7XG4gICAgICAgIG9ic2VydmVyLm9ic2VydmUodGhpcywgb3B0aW9ucyk7XG4gICAgICB9KTtcbiAgICB9XG4gIH1cbn0pKENSTS4kKTtcbiIsIi8qIGdsb2JhbHMgQ1JNICovXG5cbi8qKlxuICogSGVscHMgdG8gZGlzcGxheSBwb3B1cCBtZW51cyBpbnNpZGUgI2Jvb3RzdHJhcC10aGVtZSBlbGVtZW50cywgc2luY2UgLnBhbmVsJ3NcbiAqIGFuZCBvdGhlciBCb290c3RyYXAgZWxlbWVudHMgY2xhc2ggd2l0aCBDaXZpQ1JNIHN0eWxlcyBwcm9kdWNpbmcgdW5kZXNpcmVkXG4gKiByZXN1bHRzLlxuICpcbiAqIEl0IGFsc28gaGVscHMgd2l0aCBldmVudCBiaW5kaW5ncywgaW4gY2FzZSB0aGUgb3JpZ2luYWwgcG9wdXAgYnV0dG9uIHdhc1xuICogcmVtb3ZlZCBhbmQgcmVjcmVhdGVkLCBieSBmb3J3YXJkaW5nIHRoZSBldmVudHMgdG8gdGhlIG9yaWdpbmFsIHNvdXJjZS5cbiAqL1xuKGZ1bmN0aW9uICgkKSB7XG4gICd1c2Ugc3RyaWN0JztcbiAgdmFyICRib2R5ID0gJCgnYm9keScpO1xuXG4gICRib2R5Lm9uKCdjbGljaycsICcjYm9vdHN0cmFwLXRoZW1lIC5idG4tc2xpZGUnLCBmdW5jdGlvbiAoKSB7XG4gICAgdmFyICRwb3B1cENsb25lO1xuICAgIHZhciAkYnV0dG9uID0gJCh0aGlzKTtcbiAgICB2YXIgJHBvcHVwID0gJGJ1dHRvbi5jaGlsZHJlbigndWwucGFuZWwnKTtcblxuICAgIChmdW5jdGlvbiBpbml0ICgpIHtcbiAgICAgIGNsb3NlUG9wdXBQYW5lbHMoKTtcbiAgICAgIGNyZWF0ZVBvcHVwQ2xvbmUoKTtcbiAgICAgIG9wZW5Qb3B1cENsb25lKCk7XG4gICAgICBtYXBDbG9uZUNsaWNrRXZlbnRzVG9PcmlnaW4oKTtcbiAgICAgIGxpc3RlblRvTW91c2VPdXRFdmVudCgpO1xuICAgIH0pKCk7XG5cbiAgICAvKipcbiAgICAgKiBDbG9zZXMgdGhlIGFueSBwb3B1cCBwYW5lbCB0aGF0IGlzIGN1cnJlbnRseSBvcGVuIGFuZCByZW1vdmVzIHRoZVxuICAgICAqIGAuY2l2aWhyLXBvcHVwLW9wZW5gIGNsYXNzIGZyb20gdGhlIGJvZHkuXG4gICAgICovXG4gICAgZnVuY3Rpb24gY2xvc2VQb3B1cFBhbmVscyAoKSB7XG4gICAgICAkKCcuY2l2aWhyLXBvcHVwJykucmVtb3ZlKCk7XG4gICAgICAkYm9keS5yZW1vdmVDbGFzcygnY2l2aWhyLXBvcHVwLW9wZW4nKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGEgY2xvbmUgb2YgdGhlIHBvcHVwIGVsZW1lbnQgYW5kIGFwcGVuZHMgaXQgdG8gdGhlIGRvY3VtZW50IGJvZHkuXG4gICAgICogVGhpcyBwcmV2ZW50cyB0aGUgcG9wdXAgdG8gYmUgaGlkZGVuIGJ5IGFueSBgb3ZlcmZsb3c6IGhpZGRlbjtgIHJ1bGUuXG4gICAgICovXG4gICAgZnVuY3Rpb24gY3JlYXRlUG9wdXBDbG9uZSAoKSB7XG4gICAgICAkcG9wdXBDbG9uZSA9ICRwb3B1cC5jbG9uZSh0cnVlKVxuICAgICAgICAuYXBwZW5kVG8oJGJvZHkpXG4gICAgICAgIC5hZGRDbGFzcygnY2l2aWhyLXBvcHVwJyk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogTGlzdGVucyB0byBtb3VzZSBldmVudHMgaGFwcGVuaW5nIG91dHNpZGUgdGhlIG9mIHRoZSBwYW5lbCBpbiBvcmRlciB0b1xuICAgICAqIGNsb3NlIGl0LiBUaGUgd2F5IHRvIGRldGVjdGVkIG1vdXNlIG91dCBpcyBieSBsaXN0ZW5pbmcgdG8gdGhlXG4gICAgICogLmJ0bi1zbGlkZS1hY3RpdmUgY2xhc3MgY2hhbmdlLCB3aGljaCBpcyBhZGRlZCBhbmQgcmVtb3ZlZCBieSBDaXZpQ1JNLlxuICAgICAqIHRoZSBkYXRhICphdHRyY2hhbmdlLWlzLW9uKiBpcyBzZXQgdG8gdHJ1ZSBpbiBvcmRlciB0byBhdm9pZCBhZGRpbmdcbiAgICAgKiBtdWx0aXBsZSBsaXN0ZW5lcnMgdG8gdGhlIHNhbWUgZWxlbWVudC5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBsaXN0ZW5Ub01vdXNlT3V0RXZlbnQgKCkge1xuICAgICAgLy8gSWYgQXR0ckNoYW5nZSBldmVudCBpcyBhbHJlYWR5IGxpc3RlbmVkLCB0aGVuIHNraXA6XG4gICAgICBpZiAoJGJ1dHRvbi5kYXRhKCdhdHRyY2hhbmdlLWlzLW9uJykpIHtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuXG4gICAgICAkYnV0dG9uLmRhdGEoJ2F0dHJjaGFuZ2UtaXMtb24nLCB0cnVlKTtcbiAgICAgICRidXR0b24uYXR0cmNoYW5nZShmdW5jdGlvbiAoKSB7XG4gICAgICAgIC8vIElmIGJ1dHRvbiBpcyBhbHJlYWR5IG9wZW4sIHRoZW4gc2tpcDpcbiAgICAgICAgaWYgKCRidXR0b24uaGFzQ2xhc3MoJ2J0bi1zbGlkZS1hY3RpdmUnKSkge1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGNsb3NlUG9wdXBQYW5lbHMoKTtcbiAgICAgIH0pO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIE1hcHMgY2xpY2sgZXZlbnRzIG9uIHRoZSBwb3B1cCBvcHRpb25zIGJhY2sgdG8gdGhlaXIgb3JpZ2luYWwgc291cmNlLlxuICAgICAqIFRoaXMgaXMgZG9uZSBiZWNhdXNlIHBvcHVwIGFjdGlvbnMgYXJlIGV4ZWN1dGVkIGFzIGRlbGVnYXRlZCBldmVudHMgYW5kXG4gICAgICogdGhlIGxpc3RlbmVyIGlzIG5vdCB0aGUgKmJvZHkqIGVsZW1lbnQuXG4gICAgICovXG4gICAgZnVuY3Rpb24gbWFwQ2xvbmVDbGlja0V2ZW50c1RvT3JpZ2luICgpIHtcbiAgICAgICRwb3B1cENsb25lLmZpbmQoJ2EnKS5jbGljayhmdW5jdGlvbiAoKSB7XG4gICAgICAgIHZhciBhY3Rpb25JbmRleCA9ICQodGhpcykucGFyZW50KCkuaW5kZXgoKTtcblxuICAgICAgICAkcG9wdXAuZmluZCgnbGk6bnRoKCcgKyBhY3Rpb25JbmRleCArICcpIGEnKS5jbGljaygpO1xuICAgICAgfSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogT3BlbnMgdGhlIHBvcHVwIHBhbmVsIGNsb25lXG4gICAgICogYW5kIGFkZHMgdGhlIC5jaXZpaHItcG9wdXAtb3BlbiBjbGFzcyB0byB0aGUgYm9keVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIG9wZW5Qb3B1cENsb25lICgpIHtcbiAgICAgIHZhciBidXR0b25PZmZzZXQgPSAkYnV0dG9uLm9mZnNldCgpO1xuXG4gICAgICAkcG9wdXBDbG9uZS5jc3Moe1xuICAgICAgICBsZWZ0OiArYnV0dG9uT2Zmc2V0LmxlZnQgLSAoJHBvcHVwQ2xvbmUud2lkdGgoKSAtICRidXR0b24ub3V0ZXJXaWR0aCgpKSxcbiAgICAgICAgdG9wOiArYnV0dG9uT2Zmc2V0LnRvcCArICRidXR0b24ub3V0ZXJIZWlnaHQoKVxuICAgICAgfSk7XG4gICAgICAkcG9wdXBDbG9uZS5zaG93KCk7XG4gICAgICAkYm9keS5hZGRDbGFzcygnY2l2aWhyLXBvcHVwLW9wZW4nKTtcbiAgICB9XG4gIH0pO1xufSkoQ1JNLiQpO1xuIl19 +!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,s(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){d(t,"civihr-menu")}})}function o(n){1===t(n).length&&t(n).on("change",f)}function i(){t(".CRM_HRRecruitment_Form_Application").addClass("crm-form-block"),t(".CRM_HRRecruitment_Form_Application .crm-profile-name-application_profile").addClass("form-layout-compressed")}function a(){"contactForm"===CRM.formName&&(t("input#employer_id, input#job_title","form#Contact").parent("td").hide(),t("div.email-signature, td#Email-Bulkmail-html","form#Contact").hide(),t("#Email-Primary","form#Contact").prev("td").prev("td").hide(),t("td#Email-Bulkmail-html, #Email-Primary","form#Contact").prev("td").hide(),t(".crm-demographics-accordion","form#Contact").insertAfter(t(".crm-contactDetails-accordion")),t("tr#Phone_Block_2","form#Contact").length<1&&t("#addPhone").click(),t("#customFields").length<1&&b())}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(p(t('label[for="start_date"]').parents("tr")),p(t('label[for="end_date"]').parents("tr")),t('[name="entryURL"]').val().indexOf(";template=1")>-1&&t(t(".CRM_HRRecruitment_Form_HRVacancy tbody").get(0)).addClass("CRM_HRRecruitment_Form_HRVacancy_Template"))}function r(){t("#activityCustomData").attr("colspan",3),t("#crm-activity-view-table .crm-case-activity-view-Client .label").html("Contact"),t("span.crm-frozen-field",".crm-profile-name-hrident_tab").closest("div").parent("div").hide(),t(".crm-accordion-header.crm-master-accordion-header").on("click",function(){window.setTimeout(function(){Array.prototype.forEach.call(document.querySelectorAll(".listing-box"),function(t){Ps.initialize(t)})},0)})}function l(){"viewSummary"===CRM.pageName&&(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a").text("Personal Details"),t(".Inline_Custom_Data").length&&C(".Inline_Custom_Data"),C(".Extended_Demographics"))}function m(){t("INPUT#contact_source").parent("td").children("a").click(function(){t("#crm-notification-container .crm-help .notify-content").remove(),t("#crm-notification-container .crm-help p").length&&t("#crm-notification-container .crm-help p").remove(),t("#crm-notification-container .crm-help").append("

Source is a useful field where data has been migrated to CiviHR from one or a number of other legacy systems. The Source field will indicate which legacy system the contact has come from.

")})}function s(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function u(){"viewSummary"===CRM.pageName&&(t("div.crm-contact-current_employer, div.crm-contact-job_title",".crm-summary-contactinfo-block").parent("div.crm-summary-row").hide(),t("form#ContactInfo input#employer_id, form#ContactInfo input#job_title").closest("div.crm-summary-row").hide())}function d(n,e){var o=t(n),i=t("
");i.attr("id",e),i.append(t("#civicrm-menu")),i.append(o),i.insertAfter("#page")}function f(){var n=t(this)[0].files[0];t("#js-uploaded-file").remove(),void 0!==n&&(t(this).after(''+n.name+' Remove'),t(".uploaded-file-icon-trash").on("click",h))}function p(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function h(){var n=t("#js-uploaded-file").parent().find('input[type="file"]');t("#js-uploaded-file").remove(),n.val("")}function v(t,n){t.off().find("#civicrm-home").before(n).remove()}function b(){t("#Inline_Custom_Data").detach().find(".label").each(function(){var n=t(this),e=n.next(),o=t("");o.append(n.find("label")),o.append(t("
")),o.append(e.html()),t("#nick_name").parent().after(o)})}function C(n){t(n).removeClass("crm-collapsible collapsed").addClass("crm-summary-block").appendTo(".contactTopBar .contactCardLeft").find(".collapsible-title").hide().end().find(".crm-summary-block").show()}function _(n){return t(".crm-logo-sm",n).addClass("chr_logo chr_logo--default-color").removeClass("crm-logo-sm").wrap('').parent()}function g(){t(".menumain").not(".crm-Self_Service_Portal").hover(function(){t(this).addClass("activetarget")},function(){t(this).removeClass("activetarget")})}function y(){t("#root-menu-div .menu-item-arrow").each(function(n){var e=t(this);e.before(''),e.remove()})}t(document).on("crmLoad",function(){u()}).ready(function(){o("input[type='file']"),e(),i(),n(),l(),a(),c(),r(),m(),g(),y()})})}(CRM.$,CRM._),function(t,n){define("hrui/contact",[],function(){function n(n){n?(t(".crm-summary-contactname-block").removeClass("crm-summary-contactname-block-without-contract"),n.position&&t(".crm-contact-detail-position").html("Position: "+n.position),n.location&&t(".crm-contact-detail-location").html("Normal place of work: "+n.location)):(t(".crm-summary-contactname-block").addClass("crm-summary-contactname-block-without-contract"),t(".crm-contact-detail-position").html(""),t(".crm-contact-detail-location").html(""),e(null))}function e(n){n&&n.departments&&n.departments.length>0?t(".crm-contact-detail-departments").html("Department: "+n.departments.join(", ")):t(".crm-contact-detail-departments").html("")}t(document).on("crmLoad",function(n){t(".crm-inline-edit").one("DOMSubtreeModified",function(){var n=t(this).find("form");1===n.length&&n.find("label").each(function(){var n=t(this),e=n.attr("for");t("#"+e).attr("placeholder",n.text())})})}).on("updateContactHeader",function(t,o){void 0!==o.contract&&n(o.contract),void 0!==o.roles&&e(o.roles)})})}(CRM.$,CRM._),function(t){define("hrui/civihr-popup/attrchange",[],function(){"use strict";var n=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;t.fn.attrchange=function(t){if(n){var e={subtree:!1,attributes:!0},o=new n(function(n){n.forEach(function(n){t.call(n.target,n)})});return this.each(function(){o.observe(this,e)})}}})}(CRM.$),function(t){define("hrui/civihr-popup/civihr-popup",[],function(){"use strict";var n=t("body");n.on("click","#bootstrap-theme .btn-slide",function(){function e(){t(".civihr-popup").remove(),n.removeClass("civihr-popup-open")}function o(){r=m.clone(!0).appendTo(n).addClass("civihr-popup")}function i(){l.data("attrchange-is-on")||(l.data("attrchange-is-on",!0),l.attrchange(function(){l.hasClass("btn-slide-active")||e()}))}function a(){r.find("a").click(function(){var n=t(this).parent().index();m.find("li:nth("+n+") a").click()})}function c(){var t=l.offset();r.css({left:+t.left-(r.width()-l.outerWidth()),top:+t.top+l.outerHeight()}),r.show(),n.addClass("civihr-popup-open")}var r,l=t(this),m=l.children("ul.panel");!function(){e(),o(),c(),a(),i()}()})})}(CRM.$),function(t){t(["hrui/main","hrui/contact","hrui/civihr-popup/attrchange","hrui/civihr-popup/civihr-popup"])}(require); +//# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/hrui/js/dist/hrui.min.js.map \ No newline at end of file diff --git a/hrui/js/src/civihr-popup/attrchange.js b/hrui/js/src/civihr-popup/attrchange.js deleted file mode 100644 index e08ee2efab0..00000000000 --- a/hrui/js/src/civihr-popup/attrchange.js +++ /dev/null @@ -1,30 +0,0 @@ -(function ($) { - 'use strict'; - var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; - - /* - This plugin creates MutationObserver which listens to all changes to DOM Node. - If change has been done to it's attributes callback will be called. - - @param {function} callback - to be called when attributes change - @returns {Array} - list of all observed elements - */ - $.fn.attrchange = function (callback) { - if (MutationObserver) { - var options = { - subtree: false, - attributes: true - }; - - var observer = new MutationObserver(function (mutations) { - mutations.forEach(function (e) { - callback.call(e.target, e); - }); - }); - - return this.each(function () { - observer.observe(this, options); - }); - } - } -})(CRM.$); diff --git a/hrui/js/src/civihr-popup/civihr-popup.js b/hrui/js/src/civihr-popup/civihr-popup.js deleted file mode 100644 index 47b7a81c0b6..00000000000 --- a/hrui/js/src/civihr-popup/civihr-popup.js +++ /dev/null @@ -1,99 +0,0 @@ -/* globals CRM */ - -/** - * Helps to display popup menus inside #bootstrap-theme elements, since .panel's - * and other Bootstrap elements clash with CiviCRM styles producing undesired - * results. - * - * It also helps with event bindings, in case the original popup button was - * removed and recreated, by forwarding the events to the original source. - */ -(function ($) { - 'use strict'; - var $body = $('body'); - - $body.on('click', '#bootstrap-theme .btn-slide', function () { - var $popupClone; - var $button = $(this); - var $popup = $button.children('ul.panel'); - - (function init () { - closePopupPanels(); - createPopupClone(); - openPopupClone(); - mapCloneClickEventsToOrigin(); - listenToMouseOutEvent(); - })(); - - /** - * Closes the any popup panel that is currently open and removes the - * `.civihr-popup-open` class from the body. - */ - function closePopupPanels () { - $('.civihr-popup').remove(); - $body.removeClass('civihr-popup-open'); - } - - /** - * Creates a clone of the popup element and appends it to the document body. - * This prevents the popup to be hidden by any `overflow: hidden;` rule. - */ - function createPopupClone () { - $popupClone = $popup.clone(true) - .appendTo($body) - .addClass('civihr-popup'); - } - - /** - * Listens to mouse events happening outside the of the panel in order to - * close it. The way to detected mouse out is by listening to the - * .btn-slide-active class change, which is added and removed by CiviCRM. - * the data *attrchange-is-on* is set to true in order to avoid adding - * multiple listeners to the same element. - */ - function listenToMouseOutEvent () { - // If AttrChange event is already listened, then skip: - if ($button.data('attrchange-is-on')) { - return; - } - - $button.data('attrchange-is-on', true); - $button.attrchange(function () { - // If button is already open, then skip: - if ($button.hasClass('btn-slide-active')) { - return; - } - - closePopupPanels(); - }); - } - - /** - * Maps click events on the popup options back to their original source. - * This is done because popup actions are executed as delegated events and - * the listener is not the *body* element. - */ - function mapCloneClickEventsToOrigin () { - $popupClone.find('a').click(function () { - var actionIndex = $(this).parent().index(); - - $popup.find('li:nth(' + actionIndex + ') a').click(); - }); - } - - /** - * Opens the popup panel clone - * and adds the .civihr-popup-open class to the body - */ - function openPopupClone () { - var buttonOffset = $button.offset(); - - $popupClone.css({ - left: +buttonOffset.left - ($popupClone.width() - $button.outerWidth()), - top: +buttonOffset.top + $button.outerHeight() - }); - $popupClone.show(); - $body.addClass('civihr-popup-open'); - } - }); -})(CRM.$); diff --git a/hrui/js/src/contact.js b/hrui/js/src/contact.js deleted file mode 100644 index dd4e0673072..00000000000 --- a/hrui/js/src/contact.js +++ /dev/null @@ -1,63 +0,0 @@ -(function ($, _) { - $(document) - .on('crmLoad', function (e) { - $('.crm-inline-edit').one('DOMSubtreeModified', function () { - var $form = $(this).find('form'); - - if ($form.length === 1) { - $form.find('label').each(function () { - var $label = $(this); - var id = $label.attr('for'); - $('#' + id).attr('placeholder', $label.text()); - }); - } - }); - }) - .on('updateContactHeader', function (e, data) { - if (typeof data.contract !== 'undefined') { - updateContactHeaderContractDetails(data.contract); - } - - if (typeof data.roles !== 'undefined') { - updateContactHeaderRolesDetails(data.roles); - } - }); - - /** - * Updates the contact header with the given contract details - * - * @param {object} contract - */ - function updateContactHeaderContractDetails (contract) { - if (contract) { - $('.crm-summary-contactname-block').removeClass('crm-summary-contactname-block-without-contract'); - - if (contract.position) { - $('.crm-contact-detail-position').html('Position: ' + contract.position); - } - - if (contract.location) { - $('.crm-contact-detail-location').html('Normal place of work: ' + contract.location); - } - } else { - $('.crm-summary-contactname-block').addClass('crm-summary-contactname-block-without-contract'); - $('.crm-contact-detail-position').html(''); - $('.crm-contact-detail-location').html(''); - - updateContactHeaderRolesDetails(null); - } - } - - /** - * Updates the contact header with the given roles details - * - * @param {object} contract - */ - function updateContactHeaderRolesDetails (roles) { - if (roles && roles.departments && roles.departments.length > 0) { - $('.crm-contact-detail-departments').html('Department: ' + roles.departments.join(', ')); - } else { - $('.crm-contact-detail-departments').html(''); - } - } -}(CRM.$, CRM._)); diff --git a/hrui/js/src/hrui.js b/hrui/js/src/hrui.js index 2bd80d64aae..8f51f6c8bf2 100755 --- a/hrui/js/src/hrui.js +++ b/hrui/js/src/hrui.js @@ -1,332 +1,10 @@ -/* global Ps */ - -// Copyright CiviCRM LLC 2013. See http://civicrm.org/licensing -(function ($, _) { - $(document) - .on('crmLoad', function (e) { - addUploadFileListener("input[type='file']"); - amendVacancyForm(); - amendContactPageAndForm(e); - applyMiscChanges(); - changeContactSourceFieldHelpText(); - }) - .ready(function () { - addUserMenuToMainMenu(); - amendAppLogoMenuItem(); - amendApplicationForm(); - useFontAwesomeArrowsInSubMenuItems(); - toggleActiveClassOnHoverOnAnyMainMenuItem(); - }); - - /** - * Customizes the app logo menu item, switching from the CiviCRM logo - * to the CiviHR logo, and making the item a direct link instead of a - * toggle for a sub menu dropdown - */ - function amendAppLogoMenuItem () { - var $menuItem = $('.crm-link-home'); - var $wrappedLogo = swapAndWrapAppLogo($menuItem); - var $customHomeLink = customizeHomeLinkInLogoMenuItem($menuItem, $wrappedLogo); - - removeLogoSubMenuAndKeepOnlyHomeLink($menuItem, $customHomeLink); - } - - /** - * Adds the user menu by fetching it from the hrcore extension - */ - function addUserMenuToMainMenu () { - $.ajax('/civicrm/hrcore/usermenu?snippet=4', { - dataType: 'html', - success: function (menuMarkup) { - injectUserMenuInAMainMenuWrapper(menuMarkup, 'civihr-menu'); - } - }); - } - - /** - * Add an event listener on input[type="file"] - * @param {jQuery Object} selector [selector from input file] - */ - function addUploadFileListener (selector) { - if ($(selector).length === 1) { - $(selector).on('change', insertFile); - } - } - - /** - * Amends the application form - */ - function amendApplicationForm () { - $('.CRM_HRRecruitment_Form_Application').addClass('crm-form-block'); - $('.CRM_HRRecruitment_Form_Application .crm-profile-name-application_profile').addClass('form-layout-compressed'); - } - - /** - * Amends the contact page and the contact form - */ - function amendContactPageAndForm (e) { - if (CRM.formName === 'contactForm' || CRM.pageName === 'viewSummary') { - // Rename "Summary" tab to "Personal Details" - // Hack to check contact type - This field only appears for individuals - if ($('.crm-contact-job_title', '.crm-summary-contactinfo-block').length) { - $('.crm-contact-tabs-list #tab_summary a', e.target).text('Personal Details'); - } - - manipulateDOMOfInlineCustomData(e.target); - miscContactPageChanges(e.target); - } - } - - /** - * Amends the vacancy form - */ - function amendVacancyForm () { - if ($('.CRM_HRRecruitment_Form_HRVacancy').length === 1) { - linkLabelToDatepickerInput($('label[for="start_date"]').parents('tr')); - linkLabelToDatepickerInput($('label[for="end_date"]').parents('tr')); - - // Add a class to identify the form 'New Vacancy Template' - if ($('[name="entryURL"]').val().indexOf(';template=1') > -1) { - $($('.CRM_HRRecruitment_Form_HRVacancy tbody').get(0)).addClass('CRM_HRRecruitment_Form_HRVacancy_Template'); - } - } - } - - /** - * Applies miscellaneous UI changes - */ - function applyMiscChanges () { - $('#activityCustomData').attr('colspan', 3); - $('#crm-activity-view-table .crm-case-activity-view-Client .label').html('Contact'); - $('span.crm-frozen-field', '.crm-profile-name-hrident_tab').closest('div').parent('div').hide(); - - $('.crm-accordion-header.crm-master-accordion-header').on('click', function () { - window.setTimeout(function () { - Array.prototype.forEach.call(document.querySelectorAll('.listing-box'), function (element) { - Ps.initialize(element); - }); - }, 0); - }); - } - - /** - * Changes of sorce help text - */ - function changeContactSourceFieldHelpText () { - $('INPUT#contact_source').parent('td').children('a').click(function () { - $('#crm-notification-container .crm-help .notify-content').remove(); - - if ($('#crm-notification-container .crm-help p').length) { - $('#crm-notification-container .crm-help p').remove(); - } - - $('#crm-notification-container .crm-help').append('

Source is a useful field where data has been migrated to CiviHR from one or a number of other legacy systems. The Source field will indicate which legacy system the contact has come from.

'); - }); - } - - /** - * Finds the original link to the homepage, changes the text, wraps it in a - * `menumain-label` element and prepends internally the given app logo - * - * @param {object} $menuItem The context where to find the link - * @param {object} $appLogo - * @return the customized home link - */ - function customizeHomeLinkInLogoMenuItem ($menuItem, $appLogo) { - var $homeLink = $('li > a', $menuItem).first(); - - return $homeLink - .text('Home') - .wrapInner('') - .prepend($appLogo); - } - - /** - * Injects the given markup in a menu wrapper with the given id - * created to contain both the original menu and the user one - * - * @param {string} menuMarkup - * @param {string} wrapperId - */ - function injectUserMenuInAMainMenuWrapper (menuMarkup, wrapperId) { - var $menuMarkup = $(menuMarkup); - var $menuWrapper = $('
'); - - $menuWrapper.attr('id', wrapperId); - $menuWrapper.append($('#civicrm-menu')); - $menuWrapper.append($menuMarkup); - $menuWrapper.insertAfter('#page'); - } - - /** - * Insert a DOM node after input[type="file"] - * with the filename - */ - function insertFile () { - var fileName = $(this)[0].files[0]; - - $('#js-uploaded-file').remove(); - if (fileName !== undefined) { - $(this).after('' + fileName.name + ' Remove'); - - $('.uploaded-file-icon-trash').on('click', removeFile); - } - } - - /** - * Update label 'for' attr to works with the datepicker - * - * @param {jQuery object} $line [datepicker's line parent] - */ - function linkLabelToDatepickerInput ($line) { - $line.find('label').attr('for', $line.find('.crm-form-date').attr('id')); - } - - /** - * Manipulates, at the DOM level, the blocks/fields belonging to the - * Inline Custom Data custom fields set - */ - function manipulateDOMOfInlineCustomData () { - if ($('.Inline_Custom_Data').length) { - repositionInlineCustomDataBlockInPersonalDetailsTab(); - } - - if ($('#customFields').length < 1) { - repositionInlineCustomDataFieldsInEditContactForm(); - } - } - - /** - * Misc changes to the page (hiding elements, inserting new ones, etc) - */ - function miscContactPageChanges (target) { - // Hide current employer and job title - // Contact summary screen: - $('div.crm-contact-current_employer, div.crm-contact-job_title', '.crm-summary-contactinfo-block').parent('div.crm-summary-row').hide(); - // Inline edit form - $('form#ContactInfo input#employer_id, form#ContactInfo input#job_title', target).closest('div.crm-summary-row').hide(); - // Contact edit screen - $('input#employer_id, input#job_title', 'form#Contact').parent('td').hide(); - - /* Changes on Add Individual pages and Personal details tab for HR-358 */ - // Move Job summary to top - $('.HRJobContract_Summary', target).insertBefore($('.crm-summary-contactinfo-block')); - // changes of email block, remove bulkmail and onhold - $('div.email-signature, td#Email-Bulkmail-html', 'form#Contact').hide(); - $('#Email-Primary', 'form#Contact').prev('td').prev('td').hide(); - $('td#Email-Bulkmail-html, #Email-Primary', 'form#Contact').prev('td').hide(); - - // shift demographic above extended demographic - $('.crm-demographics-accordion', 'form#Contact').insertAfter($('.crm-contactDetails-accordion')); - - if ($('tr#Phone_Block_2', 'form#Contact').length < 1) { - $('#addPhone').click(); - } - } - - /** - * Remove the #js-uploaded-file DIV and - * clean input[type="file"] value - */ - function removeFile () { - var $input = $('#js-uploaded-file').parent().find('input[type="file"]'); - - $('#js-uploaded-file').remove(); - $input.val(''); - } - - /** - * Moves the given home link right under the menu item and gets rid - * of the original sub menu - * - * @param {object} $menuItem The context where to find the link - * @param {object} $homeLink - */ - function removeLogoSubMenuAndKeepOnlyHomeLink ($menuItem, $homeLink) { - $menuItem - .off() // removes any handler that the original item had - .find('#civicrm-home') - .before($homeLink) - .remove(); - } - - /** - * Moves the "Inline Custom Data" fields towards the top of the - * edit contact form - */ - function repositionInlineCustomDataFieldsInEditContactForm () { - var $fields = $('#Inline_Custom_Data').detach(); - - $fields.find('.label').each(function () { - var $labelCell = $(this); - var $fieldCell = $labelCell.next(); - var $newTd = $(''); - - $newTd.append($labelCell.find('label')); - $newTd.append($('
')); - $newTd.append($fieldCell.html()); - - $('#nick_name').parent().after($newTd); - }); - } - - /** - * Moves the "Inline Custom Data" block towards the top of the - * personal details tab - */ - function repositionInlineCustomDataBlockInPersonalDetailsTab () { - $('.Inline_Custom_Data') - .removeClass('crm-collapsible collapsed') - .addClass('crm-summary-block') - .insertAfter('.crm-summary-contactinfo-block') - .find('.collapsible-title').hide().end() - .find('.crm-summary-block').show(); - } - - /** - * Swaps the CiviCRM logo with the CiviHR logo - * and wraps it in a `menumain-icon` element - * - * @param {object} $menuItem The context where to find the logo - * @return the wrapper of the logo - */ - function swapAndWrapAppLogo ($menuItem) { - var $appLogo = $('.crm-logo-sm', $menuItem); - - return $appLogo - .addClass('chr_logo chr_logo--default-color') - .removeClass('crm-logo-sm') - .wrap('') - .parent(); - } - - /** - * CiviCRM by default applies on hover the .activetarget class - * only to main menu items with a submenu - * - * This functions makes sure that any item gets the class applied, - * even those with just a direct link - */ - function toggleActiveClassOnHoverOnAnyMainMenuItem () { - var className = 'activetarget'; - - $('.menumain').not('.crm-Self_Service_Portal').hover(function () { - $(this).addClass(className); - }, function () { - $(this).removeClass(className); - }); - } - - /** - * Remove the arrow for menu items with sub-items, and replaces it - * with a font awesome caret - */ - function useFontAwesomeArrowsInSubMenuItems () { - $('#root-menu-div .menu-item-arrow').each(function ($element) { - var $arrow = $(this); - - $arrow.before(''); - $arrow.remove(); - }); - } -}(CRM.$, CRM._)); +/* eslint-env amd */ + +(function (require) { + require([ + 'hrui/main', + 'hrui/contact', + 'hrui/civihr-popup/attrchange', + 'hrui/civihr-popup/civihr-popup' + ]); +})(require); diff --git a/hrui/js/src/hrui/civihr-popup/attrchange.js b/hrui/js/src/hrui/civihr-popup/attrchange.js new file mode 100644 index 00000000000..c52314f0725 --- /dev/null +++ b/hrui/js/src/hrui/civihr-popup/attrchange.js @@ -0,0 +1,35 @@ +/* eslint-env amd */ + +(function ($) { + define(function () { + 'use strict'; + + var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; + + /* + This plugin creates MutationObserver which listens to all changes to DOM Node. + If change has been done to it's attributes callback will be called. + + @param {function} callback - to be called when attributes change + @returns {Array} - list of all observed elements + */ + $.fn.attrchange = function (callback) { + if (MutationObserver) { + var options = { + subtree: false, + attributes: true + }; + + var observer = new MutationObserver(function (mutations) { + mutations.forEach(function (e) { + callback.call(e.target, e); + }); + }); + + return this.each(function () { + observer.observe(this, options); + }); + } + }; + }); +})(CRM.$); diff --git a/hrui/js/src/hrui/civihr-popup/civihr-popup.js b/hrui/js/src/hrui/civihr-popup/civihr-popup.js new file mode 100644 index 00000000000..8eb38d57faa --- /dev/null +++ b/hrui/js/src/hrui/civihr-popup/civihr-popup.js @@ -0,0 +1,102 @@ +/* eslint-env amd */ + +/** + * Helps to display popup menus inside #bootstrap-theme elements, since .panel's + * and other Bootstrap elements clash with CiviCRM styles producing undesired + * results. + * + * It also helps with event bindings, in case the original popup button was + * removed and recreated, by forwarding the events to the original source. + */ +(function ($) { + define(function () { + 'use strict'; + + var $body = $('body'); + + $body.on('click', '#bootstrap-theme .btn-slide', function () { + var $popupClone; + var $button = $(this); + var $popup = $button.children('ul.panel'); + + (function init () { + closePopupPanels(); + createPopupClone(); + openPopupClone(); + mapCloneClickEventsToOrigin(); + listenToMouseOutEvent(); + })(); + + /** + * Closes the any popup panel that is currently open and removes the + * `.civihr-popup-open` class from the body. + */ + function closePopupPanels () { + $('.civihr-popup').remove(); + $body.removeClass('civihr-popup-open'); + } + + /** + * Creates a clone of the popup element and appends it to the document body. + * This prevents the popup to be hidden by any `overflow: hidden;` rule. + */ + function createPopupClone () { + $popupClone = $popup.clone(true) + .appendTo($body) + .addClass('civihr-popup'); + } + + /** + * Listens to mouse events happening outside the of the panel in order to + * close it. The way to detected mouse out is by listening to the + * .btn-slide-active class change, which is added and removed by CiviCRM. + * the data *attrchange-is-on* is set to true in order to avoid adding + * multiple listeners to the same element. + */ + function listenToMouseOutEvent () { + // If AttrChange event is already listened, then skip: + if ($button.data('attrchange-is-on')) { + return; + } + + $button.data('attrchange-is-on', true); + $button.attrchange(function () { + // If button is already open, then skip: + if ($button.hasClass('btn-slide-active')) { + return; + } + + closePopupPanels(); + }); + } + + /** + * Maps click events on the popup options back to their original source. + * This is done because popup actions are executed as delegated events and + * the listener is not the *body* element. + */ + function mapCloneClickEventsToOrigin () { + $popupClone.find('a').click(function () { + var actionIndex = $(this).parent().index(); + + $popup.find('li:nth(' + actionIndex + ') a').click(); + }); + } + + /** + * Opens the popup panel clone + * and adds the .civihr-popup-open class to the body + */ + function openPopupClone () { + var buttonOffset = $button.offset(); + + $popupClone.css({ + left: +buttonOffset.left - ($popupClone.width() - $button.outerWidth()), + top: +buttonOffset.top + $button.outerHeight() + }); + $popupClone.show(); + $body.addClass('civihr-popup-open'); + } + }); + }); +})(CRM.$); diff --git a/hrui/js/src/hrui/contact.js b/hrui/js/src/hrui/contact.js new file mode 100644 index 00000000000..b2e2e0075d4 --- /dev/null +++ b/hrui/js/src/hrui/contact.js @@ -0,0 +1,67 @@ +/* eslint-env amd */ + +(function ($, _) { + define(function () { + $(document) + .on('crmLoad', function (e) { + $('.crm-inline-edit').one('DOMSubtreeModified', function () { + var $form = $(this).find('form'); + + if ($form.length === 1) { + $form.find('label').each(function () { + var $label = $(this); + var id = $label.attr('for'); + $('#' + id).attr('placeholder', $label.text()); + }); + } + }); + }) + .on('updateContactHeader', function (e, data) { + if (typeof data.contract !== 'undefined') { + updateContactHeaderContractDetails(data.contract); + } + + if (typeof data.roles !== 'undefined') { + updateContactHeaderRolesDetails(data.roles); + } + }); + + /** + * Updates the contact header with the given contract details + * + * @param {object} contract + */ + function updateContactHeaderContractDetails (contract) { + if (contract) { + $('.crm-summary-contactname-block').removeClass('crm-summary-contactname-block-without-contract'); + + if (contract.position) { + $('.crm-contact-detail-position').html('Position: ' + contract.position); + } + + if (contract.location) { + $('.crm-contact-detail-location').html('Normal place of work: ' + contract.location); + } + } else { + $('.crm-summary-contactname-block').addClass('crm-summary-contactname-block-without-contract'); + $('.crm-contact-detail-position').html(''); + $('.crm-contact-detail-location').html(''); + + updateContactHeaderRolesDetails(null); + } + } + + /** + * Updates the contact header with the given roles details + * + * @param {object} contract + */ + function updateContactHeaderRolesDetails (roles) { + if (roles && roles.departments && roles.departments.length > 0) { + $('.crm-contact-detail-departments').html('Department: ' + roles.departments.join(', ')); + } else { + $('.crm-contact-detail-departments').html(''); + } + } + }); +}(CRM.$, CRM._)); diff --git a/hrui/js/src/hrui/main.js b/hrui/js/src/hrui/main.js new file mode 100755 index 00000000000..3c94f4204de --- /dev/null +++ b/hrui/js/src/hrui/main.js @@ -0,0 +1,340 @@ +/* global Ps */ +/* eslint-env amd */ + +(function ($, _) { + define(function () { + $(document) + .on('crmLoad', function () { + hideFieldsInPersonalDetailsTab(); + }) + .ready(function () { + addUploadFileListener("input[type='file']"); + addUserMenuToMainMenu(); + amendApplicationForm(); + amendAppLogoMenuItem(); + amendPersonalDetailsTab(); + amendContactsPage(); + amendVacancyForm(); + applyMiscChanges(); + changeContactSourceFieldHelpText(); + toggleActiveClassOnHoverOnAnyMainMenuItem(); + useFontAwesomeArrowsInSubMenuItems(); + }); + + /** + * Customizes the app logo menu item, switching from the CiviCRM logo + * to the CiviHR logo, and making the item a direct link instead of a + * toggle for a sub menu dropdown + */ + function amendAppLogoMenuItem () { + var $menuItem = $('.crm-link-home'); + var $wrappedLogo = swapAndWrapAppLogo($menuItem); + var $customHomeLink = customizeHomeLinkInLogoMenuItem($menuItem, $wrappedLogo); + + removeLogoSubMenuAndKeepOnlyHomeLink($menuItem, $customHomeLink); + } + + /** + * Adds the user menu by fetching it from the hrcore extension + */ + function addUserMenuToMainMenu () { + $.ajax('/civicrm/hrcore/usermenu?snippet=4', { + dataType: 'html', + success: function (menuMarkup) { + injectUserMenuInAMainMenuWrapper(menuMarkup, 'civihr-menu'); + } + }); + } + + /** + * Add an event listener on input[type="file"] + * @param {jQuery Object} selector [selector from input file] + */ + function addUploadFileListener (selector) { + if ($(selector).length === 1) { + $(selector).on('change', insertFile); + } + } + + /** + * Amends the application form + */ + function amendApplicationForm () { + $('.CRM_HRRecruitment_Form_Application').addClass('crm-form-block'); + $('.CRM_HRRecruitment_Form_Application .crm-profile-name-application_profile').addClass('form-layout-compressed'); + } + + /** + * Amends Contacts Page + * URL: civicrm/contact/add?reset=1&ct=Individual + */ + function amendContactsPage () { + if (CRM.formName === 'contactForm') { + // Contact edit screen + $('input#employer_id, input#job_title', 'form#Contact').parent('td').hide(); + + // changes of email block, remove bulkmail and onhold + $('div.email-signature, td#Email-Bulkmail-html', 'form#Contact').hide(); + $('#Email-Primary', 'form#Contact').prev('td').prev('td').hide(); + $('td#Email-Bulkmail-html, #Email-Primary', 'form#Contact').prev('td').hide(); + + // shift demographic above extended demographic + $('.crm-demographics-accordion', 'form#Contact').insertAfter($('.crm-contactDetails-accordion')); + + if ($('tr#Phone_Block_2', 'form#Contact').length < 1) { + $('#addPhone').click(); + } + + if ($('#customFields').length < 1) { + repositionInlineCustomDataFieldsInEditContactForm(); + } + } + } + + /** + * Amends the vacancy form + */ + function amendVacancyForm () { + if ($('.CRM_HRRecruitment_Form_HRVacancy').length === 1) { + linkLabelToDatepickerInput($('label[for="start_date"]').parents('tr')); + linkLabelToDatepickerInput($('label[for="end_date"]').parents('tr')); + + // Add a class to identify the form 'New Vacancy Template' + if ($('[name="entryURL"]').val().indexOf(';template=1') > -1) { + $($('.CRM_HRRecruitment_Form_HRVacancy tbody').get(0)).addClass('CRM_HRRecruitment_Form_HRVacancy_Template'); + } + } + } + + /** + * Applies miscellaneous UI changes + */ + function applyMiscChanges () { + $('#activityCustomData').attr('colspan', 3); + $('#crm-activity-view-table .crm-case-activity-view-Client .label').html('Contact'); + $('span.crm-frozen-field', '.crm-profile-name-hrident_tab').closest('div').parent('div').hide(); + + $('.crm-accordion-header.crm-master-accordion-header').on('click', function () { + window.setTimeout(function () { + Array.prototype.forEach.call(document.querySelectorAll('.listing-box'), function (element) { + Ps.initialize(element); + }); + }, 0); + }); + } + + /** + * Amends the personal details page + * Example : /civicrm/contact/view?reset=1&cid=#/ + */ + function amendPersonalDetailsTab () { + if (CRM.pageName === 'viewSummary') { + // Rename "Summary" tab to "Personal Details" + // Hack to check contact type - This field only appears for individuals + if ($('.crm-contact-job_title', '.crm-summary-contactinfo-block').length) { + $('.crm-contact-tabs-list #tab_summary a').text('Personal Details'); + } + + if ($('.Inline_Custom_Data').length) { + repositionPersonalDetailsBlock('.Inline_Custom_Data'); + } + + repositionPersonalDetailsBlock('.Extended_Demographics'); + } + } + + /** + * Changes of sorce help text + */ + function changeContactSourceFieldHelpText () { + $('INPUT#contact_source').parent('td').children('a').click(function () { + $('#crm-notification-container .crm-help .notify-content').remove(); + + if ($('#crm-notification-container .crm-help p').length) { + $('#crm-notification-container .crm-help p').remove(); + } + + $('#crm-notification-container .crm-help').append('

Source is a useful field where data has been migrated to CiviHR from one or a number of other legacy systems. The Source field will indicate which legacy system the contact has come from.

'); + }); + } + + /** + * Finds the original link to the homepage, changes the text, wraps it in a + * `menumain-label` element and prepends internally the given app logo + * + * @param {object} $menuItem The context where to find the link + * @param {object} $appLogo + * @return the customized home link + */ + function customizeHomeLinkInLogoMenuItem ($menuItem, $appLogo) { + var $homeLink = $('li > a', $menuItem).first(); + + return $homeLink + .text('Home') + .wrapInner('') + .prepend($appLogo); + } + + /** + * Hide fields in the personal details page + * Example : /civicrm/contact/view?reset=1&cid=#/ + */ + function hideFieldsInPersonalDetailsTab () { + if (CRM.pageName === 'viewSummary') { + // Hide current employer and job title + // Contact summary screen: + $('div.crm-contact-current_employer, div.crm-contact-job_title', '.crm-summary-contactinfo-block').parent('div.crm-summary-row').hide(); + // Inline edit form + $('form#ContactInfo input#employer_id, form#ContactInfo input#job_title').closest('div.crm-summary-row').hide(); + } + } + + /** + * Injects the given markup in a menu wrapper with the given id + * created to contain both the original menu and the user one + * + * @param {string} menuMarkup + * @param {string} wrapperId + */ + function injectUserMenuInAMainMenuWrapper (menuMarkup, wrapperId) { + var $menuMarkup = $(menuMarkup); + var $menuWrapper = $('
'); + + $menuWrapper.attr('id', wrapperId); + $menuWrapper.append($('#civicrm-menu')); + $menuWrapper.append($menuMarkup); + $menuWrapper.insertAfter('#page'); + } + + /** + * Insert a DOM node after input[type="file"] + * with the filename + */ + function insertFile () { + var fileName = $(this)[0].files[0]; + + $('#js-uploaded-file').remove(); + if (fileName !== undefined) { + $(this).after('' + fileName.name + ' Remove'); + + $('.uploaded-file-icon-trash').on('click', removeFile); + } + } + + /** + * Update label 'for' attr to works with the datepicker + * + * @param {jQuery object} $line [datepicker's line parent] + */ + function linkLabelToDatepickerInput ($line) { + $line.find('label').attr('for', $line.find('.crm-form-date').attr('id')); + } + + /** + * Remove the #js-uploaded-file DIV and + * clean input[type="file"] value + */ + function removeFile () { + var $input = $('#js-uploaded-file').parent().find('input[type="file"]'); + + $('#js-uploaded-file').remove(); + $input.val(''); + } + + /** + * Moves the given home link right under the menu item and gets rid + * of the original sub menu + * + * @param {object} $menuItem The context where to find the link + * @param {object} $homeLink + */ + function removeLogoSubMenuAndKeepOnlyHomeLink ($menuItem, $homeLink) { + $menuItem + .off() // removes any handler that the original item had + .find('#civicrm-home') + .before($homeLink) + .remove(); + } + + /** + * Moves the "Inline Custom Data" fields towards the top of the + * edit contact form + */ + function repositionInlineCustomDataFieldsInEditContactForm () { + var $fields = $('#Inline_Custom_Data').detach(); + + $fields.find('.label').each(function () { + var $labelCell = $(this); + var $fieldCell = $labelCell.next(); + var $newTd = $(''); + + $newTd.append($labelCell.find('label')); + $newTd.append($('
')); + $newTd.append($fieldCell.html()); + + $('#nick_name').parent().after($newTd); + }); + } + + /** + * Moves the specified selector element to the personal details tab + * + * @param selector + */ + function repositionPersonalDetailsBlock (selector) { + $(selector) + .removeClass('crm-collapsible collapsed') + .addClass('crm-summary-block') + .appendTo('.contactTopBar .contactCardLeft') + .find('.collapsible-title').hide().end() + .find('.crm-summary-block').show(); + } + + /** + * Swaps the CiviCRM logo with the CiviHR logo + * and wraps it in a `menumain-icon` element + * + * @param {object} $menuItem The context where to find the logo + * @return the wrapper of the logo + */ + function swapAndWrapAppLogo ($menuItem) { + var $appLogo = $('.crm-logo-sm', $menuItem); + + return $appLogo + .addClass('chr_logo chr_logo--default-color') + .removeClass('crm-logo-sm') + .wrap('') + .parent(); + } + + /** + * CiviCRM by default applies on hover the .activetarget class + * only to main menu items with a submenu + * + * This functions makes sure that any item gets the class applied, + * even those with just a direct link + */ + function toggleActiveClassOnHoverOnAnyMainMenuItem () { + var className = 'activetarget'; + + $('.menumain').not('.crm-Self_Service_Portal').hover(function () { + $(this).addClass(className); + }, function () { + $(this).removeClass(className); + }); + } + + /** + * Remove the arrow for menu items with sub-items, and replaces it + * with a font awesome caret + */ + function useFontAwesomeArrowsInSubMenuItems () { + $('#root-menu-div .menu-item-arrow').each(function ($element) { + var $arrow = $(this); + + $arrow.before(''); + $arrow.remove(); + }); + } + }); +}(CRM.$, CRM._)); diff --git a/hrui/package-lock.json b/hrui/package-lock.json deleted file mode 100644 index d2a0f7ef484..00000000000 --- a/hrui/package-lock.json +++ /dev/null @@ -1,2825 +0,0 @@ -{ - "name": "hrui", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@gulp-sourcemaps/map-sources": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@gulp-sourcemaps/map-sources/-/map-sources-1.0.0.tgz", - "integrity": "sha1-iQrnxdjId/bThIYCFazp1+yUW9o=", - "dev": true, - "requires": { - "normalize-path": "^2.0.1", - "through2": "^2.0.3" - } - }, - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true - }, - "ansi-gray": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", - "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", - "dev": true, - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", - "dev": true - }, - "archy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", - "dev": true - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-differ": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", - "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", - "dev": true - }, - "array-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", - "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", - "dev": true - }, - "array-slice": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", - "dev": true - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true - }, - "atob": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", - "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - } - }, - "beeper": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", - "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz", - "integrity": "sha512-P4O8UQRdGiMLWSizsApmXVQDBS6KCt7dSexgLKBmH5Hr1CZq7vsnscFh8oR1sP1ab1Zj0uCHCEzZeV6SfUf3rA==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - } - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - } - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "clone": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.3.tgz", - "integrity": "sha1-KY1+IjFmD0DAA8LtMUDezz9TCF8=", - "dev": true - }, - "clone-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", - "dev": true - }, - "clone-stats": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", - "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", - "dev": true - }, - "cloneable-readable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.0.0.tgz", - "integrity": "sha1-pikNQT8hemEjL5XkWP84QYz7ARc=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^1.0.6", - "through2": "^2.0.1" - } - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true - }, - "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", - "dev": true - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-with-sourcemaps": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.0.5.tgz", - "integrity": "sha512-YtnS0VEY+e2Khzsey/6mra9EoM6h/5gxaC0e3mcHpA5yfDxafhygytNmcJWodvUgyXzSiL5MSkPO6bQGgfliHw==", - "dev": true, - "requires": { - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "convert-source-map": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", - "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", - "dev": true - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "css": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css/-/css-2.2.1.tgz", - "integrity": "sha1-c6TIHehdtmTU7mdPfUcIXjstVdw=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "source-map": "^0.1.38", - "source-map-resolve": "^0.3.0", - "urix": "^0.1.0" - }, - "dependencies": { - "atob": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-1.1.3.tgz", - "integrity": "sha1-lfE2KbEsOlGl0hWr3OKqnzL4B3M=", - "dev": true - }, - "source-map": { - "version": "0.1.43", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", - "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", - "dev": true, - "requires": { - "amdefine": ">=0.0.4" - } - }, - "source-map-resolve": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.3.1.tgz", - "integrity": "sha1-YQ9hIqRFuN1RU1oqcbeD38Ekh2E=", - "dev": true, - "requires": { - "atob": "~1.1.0", - "resolve-url": "~0.2.1", - "source-map-url": "~0.3.0", - "urix": "~0.1.0" - } - }, - "source-map-url": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.3.0.tgz", - "integrity": "sha1-fsrxO1e80J2opAxdJp2zN5nUqvk=", - "dev": true - } - } - }, - "dateformat": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", - "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "debug-fabulous": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-0.0.4.tgz", - "integrity": "sha1-+gccXYdIRoVCSAdCHKSxawsaB2M=", - "dev": true, - "requires": { - "debug": "2.X", - "lazy-debug-legacy": "0.0.X", - "object-assign": "4.1.0" - }, - "dependencies": { - "object-assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", - "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", - "dev": true - } - } - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dev": true, - "requires": { - "clone": "^1.0.2" - } - }, - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "deprecated": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/deprecated/-/deprecated-0.0.1.tgz", - "integrity": "sha1-+cmvVGSvoeepcUWKi97yqpTVuxk=", - "dev": true - }, - "detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", - "dev": true - }, - "detect-newline": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", - "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", - "dev": true - }, - "duplexer2": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", - "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", - "dev": true, - "requires": { - "readable-stream": "~1.1.9" - } - }, - "end-of-stream": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz", - "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", - "dev": true, - "requires": { - "once": "~1.3.0" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", - "dev": true - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, - "fancy-log": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.2.tgz", - "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", - "dev": true, - "requires": { - "ansi-gray": "^0.1.1", - "color-support": "^1.1.3", - "time-stamp": "^1.0.0" - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - } - }, - "find": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/find/-/find-0.2.8.tgz", - "integrity": "sha512-7Z96U7PMb7ijrinFZka5N5DWtgziLKdO8EFJSK3AiPqiUkJRcGNofV0/N/Pbe6myimrn7JCpqn+Pvb+Xz9q0NQ==", - "dev": true, - "requires": { - "traverse-chain": "~0.1.0" - } - }, - "find-index": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", - "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=", - "dev": true - }, - "findup-sync": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", - "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", - "dev": true, - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^3.1.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - } - }, - "fined": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fined/-/fined-1.1.0.tgz", - "integrity": "sha1-s33IRLdqL15wgeiE98CuNE8VNHY=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^2.0.3", - "object.defaults": "^1.1.0", - "object.pick": "^1.2.0", - "parse-filepath": "^1.0.1" - } - }, - "first-chunk-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", - "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", - "dev": true - }, - "flagged-respawn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz", - "integrity": "sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c=", - "dev": true - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "gaze": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", - "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", - "dev": true, - "requires": { - "globule": "~0.1.0" - } - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "glob": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", - "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^2.0.1", - "once": "^1.3.0" - } - }, - "glob-stream": { - "version": "3.1.18", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", - "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", - "dev": true, - "requires": { - "glob": "^4.3.1", - "glob2base": "^0.0.12", - "minimatch": "^2.0.1", - "ordered-read-streams": "^0.1.0", - "through2": "^0.6.1", - "unique-stream": "^1.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", - "dev": true, - "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" - } - } - } - }, - "glob-watcher": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", - "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", - "dev": true, - "requires": { - "gaze": "^0.5.1" - } - }, - "glob2base": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", - "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", - "dev": true, - "requires": { - "find-index": "^0.1.1" - } - }, - "global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "dev": true, - "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - } - }, - "global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - } - }, - "globule": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", - "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", - "dev": true, - "requires": { - "glob": "~3.1.21", - "lodash": "~1.0.1", - "minimatch": "~0.2.11" - }, - "dependencies": { - "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", - "dev": true, - "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" - } - }, - "graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", - "dev": true - }, - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", - "dev": true - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "dev": true, - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, - "glogg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.0.tgz", - "integrity": "sha1-f+DxmfV6yQbPUS/urY+Q7kooT8U=", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, - "graceful-fs": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", - "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", - "dev": true, - "requires": { - "natives": "^1.1.0" - } - }, - "gulp": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz", - "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", - "dev": true, - "requires": { - "archy": "^1.0.0", - "chalk": "^1.0.0", - "deprecated": "^0.0.1", - "gulp-util": "^3.0.0", - "interpret": "^1.0.0", - "liftoff": "^2.1.0", - "minimist": "^1.1.0", - "orchestrator": "^0.3.0", - "pretty-hrtime": "^1.0.0", - "semver": "^4.1.0", - "tildify": "^1.0.0", - "v8flags": "^2.0.2", - "vinyl-fs": "^0.3.0" - } - }, - "gulp-concat": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz", - "integrity": "sha1-Yz0WyV2IUEYorQJmVmPO5aR5M1M=", - "dev": true, - "requires": { - "concat-with-sourcemaps": "^1.0.0", - "through2": "^2.0.0", - "vinyl": "^2.0.0" - }, - "dependencies": { - "clone": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", - "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", - "dev": true - }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true - }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", - "dev": true - }, - "vinyl": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.1.0.tgz", - "integrity": "sha1-Ah+cLPlR1rk5lDyJ617lrdT9kkw=", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - } - } - } - }, - "gulp-sourcemaps": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.12.1.tgz", - "integrity": "sha1-tDfR89mAzyboEYSCNxjOFa5ll7Y=", - "dev": true, - "requires": { - "@gulp-sourcemaps/map-sources": "1.X", - "acorn": "4.X", - "convert-source-map": "1.X", - "css": "2.X", - "debug-fabulous": "0.0.X", - "detect-newline": "2.X", - "graceful-fs": "4.X", - "source-map": "~0.6.0", - "strip-bom": "2.X", - "through2": "2.X", - "vinyl": "1.X" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - }, - "vinyl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", - "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", - "dev": true, - "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" - } - } - } - }, - "gulp-uglify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gulp-uglify/-/gulp-uglify-3.0.0.tgz", - "integrity": "sha1-DfAzHXKg0wLj434QlIXd3zPG0co=", - "dev": true, - "requires": { - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "lodash": "^4.13.1", - "make-error-cause": "^1.1.1", - "through2": "^2.0.0", - "uglify-js": "^3.0.5", - "vinyl-sourcemaps-apply": "^0.2.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true - } - } - }, - "gulp-util": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz", - "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", - "dev": true, - "requires": { - "array-differ": "^1.0.0", - "array-uniq": "^1.0.2", - "beeper": "^1.0.0", - "chalk": "^1.0.0", - "dateformat": "^2.0.0", - "fancy-log": "^1.1.0", - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "lodash._reescape": "^3.0.0", - "lodash._reevaluate": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.template": "^3.0.0", - "minimist": "^1.1.0", - "multipipe": "^0.1.2", - "object-assign": "^3.0.0", - "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl": "^0.5.0" - } - }, - "gulplog": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", - "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", - "dev": true, - "requires": { - "glogg": "^1.0.0" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-gulplog": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", - "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "homedir-polyfill": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", - "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", - "dev": true, - "requires": { - "parse-passwd": "^1.0.0" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true - }, - "interpret": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", - "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", - "dev": true - }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "dev": true, - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-odd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", - "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", - "dev": true, - "requires": { - "is-number": "^3.0.0" - } - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "dev": true, - "requires": { - "is-unc-path": "^1.0.0" - } - }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "dev": true, - "requires": { - "unc-path-regex": "^0.1.2" - } - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, - "is-windows": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz", - "integrity": "sha1-MQ23D3QtJZoWo2kgK1GvhCMzENk=", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - }, - "lazy-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", - "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", - "dev": true, - "requires": { - "set-getter": "^0.1.0" - } - }, - "lazy-debug-legacy": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/lazy-debug-legacy/-/lazy-debug-legacy-0.0.1.tgz", - "integrity": "sha1-U3cWwHduTPeePtG2IfdljCkRsbE=", - "dev": true - }, - "liftoff": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", - "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", - "dev": true, - "requires": { - "extend": "^3.0.0", - "findup-sync": "^2.0.0", - "fined": "^1.0.1", - "flagged-respawn": "^1.0.0", - "is-plain-object": "^2.0.4", - "object.map": "^1.0.0", - "rechoir": "^0.6.2", - "resolve": "^1.1.7" - } - }, - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", - "dev": true - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basetostring": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", - "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", - "dev": true - }, - "lodash._basevalues": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", - "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash._reescape": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", - "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", - "dev": true - }, - "lodash._reevaluate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", - "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", - "dev": true - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "dev": true - }, - "lodash._root": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", - "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", - "dev": true - }, - "lodash.escape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", - "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", - "dev": true, - "requires": { - "lodash._root": "^3.0.0" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, - "lodash.restparam": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", - "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", - "dev": true - }, - "lodash.template": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", - "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", - "dev": true, - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", - "lodash._basevalues": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0", - "lodash.keys": "^3.0.0", - "lodash.restparam": "^3.0.0", - "lodash.templatesettings": "^3.0.0" - } - }, - "lodash.templatesettings": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", - "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" - } - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", - "dev": true - }, - "make-error": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.2.tgz", - "integrity": "sha512-l9ra35l5VWLF24y75Tg8XgfGLX0ueRhph118WKM6H5denx4bB5QF59+4UAm9oJ2qsPQZas/CQUDdtDdfvYHBdQ==", - "dev": true - }, - "make-error-cause": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/make-error-cause/-/make-error-cause-1.2.2.tgz", - "integrity": "sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0=", - "dev": true, - "requires": { - "make-error": "^1.2.0" - } - }, - "make-iterator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.0.tgz", - "integrity": "sha1-V7713IXSOSO6I3ZzJNjo+PPZaUs=", - "dev": true, - "requires": { - "kind-of": "^3.1.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "micromatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.5.tgz", - "integrity": "sha512-ykttrLPQrz1PUJcXjwsTUjGoPJ64StIGNE2lGVD1c9CuguJ+L7/navsE8IcDNndOoCMvYV0qc/exfVbMHkUhvA==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.0", - "define-property": "^1.0.0", - "extend-shallow": "^2.0.1", - "extglob": "^2.0.2", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.0", - "nanomatch": "^1.2.5", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, - "minimatch": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", - "dev": true, - "requires": { - "brace-expansion": "^1.0.0" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "mixin-deep": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.0.tgz", - "integrity": "sha512-dgaCvoh6i1nosAUBKb0l0pfJ78K8+S9fluyIR2YvAeUD/QuMahnFnF3xYty5eYXMjhGSsB0DsW6A0uAZyetoAg==", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "multipipe": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", - "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", - "dev": true, - "requires": { - "duplexer2": "0.0.2" - } - }, - "nanomatch": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.7.tgz", - "integrity": "sha512-/5ldsnyurvEw7wNpxLFgjVvBLMta43niEYOy0CJ4ntcYSbx6bugRUTQeFb4BR/WanEL1o3aQgHuVLHQaB6tOqg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "is-odd": "^1.0.0", - "kind-of": "^5.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "natives": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz", - "integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==", - "dev": true - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "object-assign": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.defaults": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", - "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", - "dev": true, - "requires": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "object.map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", - "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", - "dev": true, - "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "once": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", - "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "orchestrator": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", - "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", - "dev": true, - "requires": { - "end-of-stream": "~0.1.5", - "sequencify": "~0.0.7", - "stream-consume": "~0.1.0" - } - }, - "ordered-read-streams": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz", - "integrity": "sha1-/VZamvjrRHO6abbtijQ1LLVS8SY=", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "parse-filepath": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", - "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - } - }, - "parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", - "dev": true - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, - "path": { - "version": "0.12.7", - "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", - "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", - "dev": true, - "requires": { - "process": "^0.11.1", - "util": "^0.10.3" - } - }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", - "dev": true - }, - "path-root": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", - "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", - "dev": true, - "requires": { - "path-root-regex": "^0.1.0" - } - }, - "path-root-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", - "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", - "dev": true - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, - "pretty-hrtime": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", - "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", - "dev": true - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "regex-not": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", - "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", - "dev": true - }, - "resolve": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } - }, - "resolve-dir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - } - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "semver": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", - "dev": true - }, - "sequencify": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", - "integrity": "sha1-kM/xnQLgcCf9dn9erT57ldHnOAw=", - "dev": true - }, - "set-getter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", - "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", - "dev": true, - "requires": { - "to-object-path": "^0.3.0" - } - }, - "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - } - }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", - "dev": true - }, - "snapdragon": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", - "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^2.0.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", - "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", - "dev": true, - "requires": { - "atob": "^2.0.0", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "sparkles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", - "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "stream-consume": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.0.tgz", - "integrity": "sha1-pB6tGm1ggc63n2WwYZAbbY89HQ8=", - "dev": true - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-bom": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", - "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", - "dev": true, - "requires": { - "first-chunk-stream": "^1.0.0", - "is-utf8": "^0.2.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "dev": true, - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "tildify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", - "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", - "dev": true, - "requires": { - "os-homedir": "^1.0.0" - } - }, - "time-stamp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", - "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "to-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", - "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "regex-not": "^1.0.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - }, - "traverse-chain": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", - "integrity": "sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE=", - "dev": true - }, - "uglify-js": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.8.tgz", - "integrity": "sha512-X0jAGtpSZRtd4RhbVNuGHyjZNa/h2MrVkKrR3Ew5iL2MJw6d7FmBke+fhVCALWySv1ygHnjjROG1KI1FAPvddw==", - "dev": true, - "requires": { - "commander": "~2.13.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", - "dev": true - }, - "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } - } - }, - "unique-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", - "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=", - "dev": true - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - } - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "use": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", - "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "lazy-cache": "^2.0.2" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "user-home": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", - "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", - "dev": true - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "requires": { - "inherits": "2.0.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true - } - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "v8flags": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", - "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", - "dev": true, - "requires": { - "user-home": "^1.1.1" - } - }, - "vinyl": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", - "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", - "dev": true, - "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" - } - }, - "vinyl-fs": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz", - "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", - "dev": true, - "requires": { - "defaults": "^1.0.0", - "glob-stream": "^3.1.5", - "glob-watcher": "^0.0.6", - "graceful-fs": "^3.0.0", - "mkdirp": "^0.5.0", - "strip-bom": "^1.0.0", - "through2": "^0.6.1", - "vinyl": "^0.4.0" - }, - "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", - "dev": true, - "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" - } - }, - "vinyl": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", - "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", - "dev": true, - "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" - } - } - } - }, - "vinyl-sourcemaps-apply": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", - "integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=", - "dev": true, - "requires": { - "source-map": "^0.5.1" - } - }, - "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - } - } -} diff --git a/hrui/package.json b/hrui/package.json deleted file mode 100644 index 9a11b1fa844..00000000000 --- a/hrui/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "hrui", - "version": "1.0.0", - "description": "CiviHR UI changes", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "devDependencies": { - "find": "^0.2.8", - "gulp": "^3.9.1", - "gulp-concat": "^2.6.1", - "gulp-sourcemaps": "^1.12.1", - "gulp-uglify": "^3.0.0", - "path": "^0.12.7" - } -} diff --git a/hrvisa/tests/phpunit/CRM/HRVisa/ActivityTest.php b/hrvisa/tests/phpunit/CRM/HRVisa/ActivityTest.php index d822db9ec16..49e40ddaa7a 100644 --- a/hrvisa/tests/phpunit/CRM/HRVisa/ActivityTest.php +++ b/hrvisa/tests/phpunit/CRM/HRVisa/ActivityTest.php @@ -16,8 +16,6 @@ class CRM_HRVisa_ActivityTest extends PHPUnit_Framework_TestCase implements Head public function setUpHeadless() { return \Civi\Test::headless() ->installMe(__DIR__) - // hrdemog is necessary because it creates the Immigration fields used by the tests - ->install('org.civicrm.hrdemog') ->install('uk.co.compucorp.civicrm.hrcore') ->apply(); } diff --git a/org.civicrm.bootstrapcivihr/css/civihr.css b/org.civicrm.bootstrapcivihr/css/civihr.css index 603203cd856..986221c8813 100644 --- a/org.civicrm.bootstrapcivihr/css/civihr.css +++ b/org.civicrm.bootstrapcivihr/css/civihr.css @@ -1 +1 @@ -#bootstrap-theme #civicrm-menu li.menumain.crm-Self_Service_Portal>a{border:1px solid #4d4d69;border-radius:2px;font-weight:600;height:35px;line-height:35px;padding:0 15px;margin-top:12px;text-transform:uppercase}#bootstrap-theme #civicrm-menu li.menumain.crm-Self_Service_Portal>a:hover{background:#3e3e54;color:#fff}#bootstrap-theme .crm-link-home .chr_logo{font-size:17px;margin-right:6px;vertical-align:sub}.crm-container .dataTables_processing, .crm-container .blockUI.blockOverlay{animation:spin 1.5s linear infinite;background:url(../img/spinner.svg) no-repeat center center !important;display:block;height:32px !important;margin:auto;width:32px !important;margin:8% 50% !important;opacity:1 !important}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}#bootstrap-theme .nav-pills-horizontal{margin-bottom:15px}#bootstrap-theme .panel-body-section{padding:15px 20px;padding-bottom:0;padding-top:0}#bootstrap-theme .panel-default-inverted>.panel-body{background:#ffffff}#bootstrap-theme .panel-default-inverted>.panel-footer, #bootstrap-theme .panel-default-inverted>.panel-heading{background:#fafbfc}#bootstrap-theme .panel-default-plain>.panel-heading, #bootstrap-theme .panel-default-plain-inverted>.panel-heading{padding-bottom:0}#bootstrap-theme .panel-default-plain>.panel-heading>hr, #bootstrap-theme .panel-default-plain-inverted>.panel-heading>hr{margin:15px 20px;margin-bottom:0;margin-left:0;margin-right:0}#bootstrap-theme .panel-default-plain>.panel-body{background:#ffffff}#bootstrap-theme .panel-default-plain>.panel-footer{background:#fafbfc}#bootstrap-theme .panel-default-plain-inverted>.panel-heading{background:#fafbfc}#bootstrap-theme .chr_appraisal-cycle-summary__details>.chr_appraisal-cycle-summary__meta{margin-right:15px}#bootstrap-theme .chr_appraisal-cycle-summary__actions{display:inline-block}#bootstrap-theme .chr_appraisal-cycle-summary__actions__toggle{color:inherit}#bootstrap-theme .chr_appraisal-cycle-summary__meta{font-size:16px;font-weight:600;line-height:1.1}#bootstrap-theme .help-text-link{display:inline-block;padding-left:5px}#bootstrap-theme .chr_leave-list:before, #bootstrap-theme .chr_leave-list:after{content:" ";display:table}#bootstrap-theme .chr_leave-list:after{clear:both}#bootstrap-theme .chr_leave-list>.chr_leave-list__type{margin-bottom:10px}#bootstrap-theme .chr_leave-list__type>.chr_leave-list__type__color{margin-right:5px}#bootstrap-theme .chr_leave-list__type__color{background:#e8eef0;display:inline-block;height:15px;vertical-align:sub;width:15px}#bootstrap-theme .chr_leave-list__type__count{float:right}#bootstrap-theme .chr_scroll-shadows__wrapper{overflow:hidden;position:relative}#bootstrap-theme .chr_scroll-shadows__shadows{overflow-x:auto}#bootstrap-theme .chr_scroll-shadows__shadows::before, #bootstrap-theme .chr_scroll-shadows__shadows::after{box-shadow:0 0 10px 1px rgba(48,40,40,0.5);content:'';display:block;height:calc(100% - 10px);opacity:0;position:absolute;top:5px;transition:opacity 0.2s ease-out;width:1px;z-index:1}#bootstrap-theme .chr_scroll-shadows__shadows::before{left:-1px}#bootstrap-theme .chr_scroll-shadows__shadows::after{right:-1px}#bootstrap-theme .chr_scroll-shadows__shadows--show-left::before, #bootstrap-theme .chr_scroll-shadows__shadows--show-right::after{opacity:1}#bootstrap-theme .chr_scroll-shadows__content{display:inline-block;min-width:100%}#bootstrap-theme .chr_sickness-days{display:inline-block;width:165px}#bootstrap-theme .chr_sickness-days--danger .chr_sickness-days__count{background:#cf3458}#bootstrap-theme .chr_sickness-days__count{background:#44cb7e;color:white;font-size:6.5384615385em;text-align:center}#bootstrap-theme .chr_sickness-days__label{background:#e8eef0;font-size:1.3846153846em;padding:5px 0;text-align:center;text-transform:uppercase}#bootstrap-theme .chr_steps{margin:0}#bootstrap-theme .chr_steps:before, #bootstrap-theme .chr_steps:after{content:" ";display:table}#bootstrap-theme .chr_steps:after{clear:both}#bootstrap-theme .chr_steps__step{display:table;float:left}#bootstrap-theme .chr_steps__step:not(:first-child) .chr_steps__step__arrow{padding-left:16px}#bootstrap-theme .chr_steps__step:not(:last-child){margin-right:6px}#bootstrap-theme .chr_steps__step:not(:last-child) .chr_steps__step__arrow:before{border-left-color:#fff;margin-left:6px;z-index:1}#bootstrap-theme .chr_steps__step__arrow{background:#4d4d69;border-color:#4d4d69;color:#fff;display:table-cell;height:24px;line-height:24px;padding:0 10px 0 10px;position:relative}#bootstrap-theme .chr_steps__step__arrow:after, #bootstrap-theme .chr_steps__step__arrow:before{content:"";border-color:transparent;border-style:solid;border-width:12px 0 12px 6px;display:block;height:0;left:100%;margin-top:-12px;position:absolute;top:50%;width:0}#bootstrap-theme .chr_steps__step__arrow:after{border-left-color:inherit;z-index:2}#bootstrap-theme .chr_steps__step__legend{display:table-row}#bootstrap-theme .chr_steps__step__legend>.chr_steps__step__legend__content{margin-top:10px}#bootstrap-theme .chr_steps__step__legend__content{background:white;border:1px solid #4d4d69;font-size:12px;padding:10px 4px;width:100%}#bootstrap-theme .chr_steps--compact>.chr_steps__step:not(:first-child) .chr_steps__step__arrow{padding-left:11px}#bootstrap-theme .chr_steps--compact .chr_steps__step__arrow{font-size:12px;font-weight:600;height:28px;line-height:28px;padding:0 5px 0 10px}#bootstrap-theme .chr_steps--compact .chr_steps__step__arrow:after, #bootstrap-theme .chr_steps--compact .chr_steps__step__arrow:before{border-width:14px 0 14px 6px;margin-top:-14px}#bootstrap-theme .chr_steps--flex{display:flex}#bootstrap-theme .chr_steps--flex .chr_steps__step{display:block;flex-grow:1;float:none}#bootstrap-theme .chr_steps--flex .chr_steps__step__arrow{display:inline-block;text-align:center;width:100%}#bootstrap-theme .chr_steps--flex .chr_steps__step__legend{display:block}#bootstrap-theme .chr_steps__step--danger>.chr_steps__step__arrow{background:#cf3458;border-color:#cf3458}#bootstrap-theme .chr_steps__step--danger .chr_steps__step__legend__content{border-color:#cf3458}#bootstrap-theme .chr_steps__step--primary>.chr_steps__step__arrow{background:#0071bd;border-color:#0071bd}#bootstrap-theme .chr_steps__step--primary .chr_steps__step__legend__content{border-color:#0071bd}#bootstrap-theme .chr_timeline{margin:0}#bootstrap-theme .chr_timeline:before, #bootstrap-theme .chr_timeline:after{content:" ";display:table}#bootstrap-theme .chr_timeline:after{clear:both}#bootstrap-theme .chr_timeline>.chr_timeline__entry{padding:2.6923076923em 0 0 3.0769230769em;position:relative}#bootstrap-theme .chr_timeline>.chr_timeline__entry:last-child{padding-bottom:2.6923076923em}#bootstrap-theme .chr_timeline__entry:after{content:"";border:3px solid #f3f6f7;bottom:0;left:7px;position:absolute;top:0}#bootstrap-theme .chr_timeline__entry:before{content:"";background:#f3f6f7;border:2px solid #e8eef0;border-radius:50%;display:inline-block;height:20px;left:0;position:absolute;vertical-align:bottom;width:20px;z-index:2}#bootstrap-theme .chr_timeline__entry--future:before{border-color:#0071bd}#bootstrap-theme .chr_timeline__entry--past:before{border-color:#cf3458}#bootstrap-theme .chr_timeline__entry__name{color:#464354;font-weight:600;display:block;margin-bottom:.3846153846em}#bootstrap-theme .civihr-ui-select.open, #bootstrap-theme .civihr-ui-select .select2-drop-active, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-drop-active{background:#fff !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close, #bootstrap-theme .civihr-ui-select.open .select2-chosen, #bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select a.select2-choice, #bootstrap-theme .civihr-ui-select .ui-select-search, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{background:none !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen, #bootstrap-theme .civihr-ui-select.open .ui-select-search, #bootstrap-theme .civihr-ui-select.ui-select-multiple, #bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item{border-width:1px !important;border-style:solid !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before, #bootstrap-theme .civihr-ui-select.open .select2-search::after, #bootstrap-theme .civihr-ui-select .select2-arrow::before, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{font-family:'FontAwesome';font-style:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen, #bootstrap-theme .civihr-ui-select .select2-input, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{line-height:28px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before, #bootstrap-theme .civihr-ui-select .select2-chosen, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{font-size:13px !important}#bootstrap-theme .civihr-ui-select.open .select2-arrow, #bootstrap-theme .civihr-ui-select:not(.open) .select2-choice, #bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select .ui-select-choices, #bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-search-field{padding:0 !important}#bootstrap-theme .civihr-ui-select{color:#555;width:100% !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled{color:#8b8baa !important;border-color:#8b8baa !important;background:#f3f6f7 !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-chosen{color:#8b8baa !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-arrow::before, #bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-choices::before{border-color:#8b8baa !important;color:#8b8baa !important}#bootstrap-theme .civihr-ui-select, #bootstrap-theme .civihr-ui-select *{border-color:rgba(0,0,0,0.15) !important}#bootstrap-theme .civihr-ui-select>*, #bootstrap-theme .civihr-ui-select{border-radius:2px !important;box-shadow:none !important}#bootstrap-theme .civihr-ui-select .select2-drop{border-radius:0 0 2px 2px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close{height:15px;left:unset !important;right:45px !important;width:15px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close{background:none !important;top:2px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before{content:'\f057';line-height:inherit !important;vertical-align:middle !important;text-align:right;display:block}#bootstrap-theme .civihr-ui-select.open:not(.ng-invalid), #bootstrap-theme .civihr-ui-select.open:not(.ng-invalid) *, #bootstrap-theme .civihr-ui-select.open:not(.ng-invalid).form-control{border-color:#0071bd !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen{color:#7d7d9f !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen{border:0 !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen>span:first-of-type{max-width:calc(100% - 20px);display:block;overflow:hidden;text-overflow:ellipsis}#bootstrap-theme .civihr-ui-select.open .select2-choice{border-bottom:0 !important}#bootstrap-theme .civihr-ui-select.open .ui-select-search{padding:0 5px !important;margin-top:5px !important}#bootstrap-theme .civihr-ui-select.open .select2-search-choice-close::before{display:none}#bootstrap-theme .civihr-ui-select.open .select2-search::after{position:relative;content:'\f002';color:#555 !important;right:30px}#bootstrap-theme .civihr-ui-select:not(.open){border-color:rgba(0,0,0,0.15) !important;padding:0 0 0 10px !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-choice{border:0 !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow{width:31px !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow::before{width:100%;display:block;text-align:center;line-height:30px;content:'\f0d7'}#bootstrap-theme .contact-lookup.civihr-ui-select:not(.open) .select2-arrow::before{content:'\f002' !important}#bootstrap-theme .civihr-ui-select:not(.open):not(.select2-container-disabled) .select2-arrow{border-left:solid 1px rgba(0,0,0,0.15) !important}#bootstrap-theme .civihr-ui-select:not(.open).select2-container-disabled .select2-arrow{border-left:solid 1px #8b8baa !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen{max-width:calc(100% - 30px) !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen:not(.empty){color:#0071bd !important}#bootstrap-theme .civihr-ui-select:not(.open) .ui-select-match[allow-clear] .select2-chosen{max-width:calc(100% - 60px) !important}#bootstrap-theme .civihr-ui-select .select2-input{width:inherit}#bootstrap-theme .civihr-ui-select .select2-arrow{cursor:pointer !important;right:0 !important;top:0 !important}#bootstrap-theme .civihr-ui-select .select2-arrow::before{color:#4d4d69;content:'\f0d8'}#bootstrap-theme .civihr-ui-select .select2-chosen{color:#4d4d69 !important;padding-left:5px !important}#bootstrap-theme .civihr-ui-select .select2-drop-active{border-top:0 !important;border-style:solid;border-width:1px !important;opacity:1 !important}#bootstrap-theme .civihr-ui-select a.select2-choice:hover{text-decoration:none !important}#bootstrap-theme .civihr-ui-select .ui-select-match{height:100% !important}#bootstrap-theme .civihr-ui-select .ui-select-choices{margin:5px 0 0 !important}#bootstrap-theme .civihr-ui-select .select2-result-label{padding:5px 10px !important;color:#4d4d69}#bootstrap-theme .civihr-ui-select .select2-highlighted{background:#f3f6f7 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple{height:100% !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item{box-sizing:border-box !important;line-height:17px !important;margin:5px 5px 5px 0 !important;padding:0 22px 0 5px !important;border-radius:0 !important;background:none}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item .select2-search-choice-close{right:5px !important;top:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item .select2-search-choice-close::before{display:block}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices{box-shadow:none !important;-moz-padding-start:0 !important;-webkit-padding-start:0 !important;margin-bottom:0 !important;width:100% !important;border:0;background-image:none !important;background:none !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{color:#4d4d69;padding-left:13px !important;width:26px !important;height:30px;top:0 !important;pointer-events:none;position:absolute}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open){border-color:rgba(0,0,0,0.15) !important;padding-left:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open) .select2-choices::before{content:'\f0d7'}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open) .select2-input{cursor:pointer;padding:0 0 0 5px !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-choices::before{content:'\f002';padding-right:15px}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .ui-select-search{border:0 !important;margin:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-search-field{margin:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-chosen{min-height:25px !important;border:0 !important;line-height:25px}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-drop-active{left:-1px;box-sizing:content-box !important}#bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid, #bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid *, #bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid.form-control{border-color:#cf3458 !important}#bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid:not(.open) .select2-arrow{border-left:solid 1px #cf3458 !important}#bootstrap-theme .result-list__contact-item{clear:left}#bootstrap-theme .result-list__contact-item::before{content:'\f007';float:left;height:22px;margin-right:10px;font-family:'FontAwesome';font-style:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}#bootstrap-theme #civihr-ui-select-contact{padding:10px !important;background:#f3f6f7 !important;border:solid 1px !important;margin:5px !important}#bootstrap-theme #civihr-ui-select-contact .refine-search__dropdown{box-shadow:none !important}#bootstrap-theme #civihr-ui-select-contact .refine-search__placeholder{color:#555;padding-bottom:10px}#bootstrap-theme #civihr-ui-select-contact .button-list{display:flex;justify-content:space-between}#bootstrap-theme #civihr-ui-select-contact .button-list__button{cursor:pointer}#bootstrap-theme #civihr-ui-select-contact .button-list__button:not(:last-of-type){padding-right:5px}#bootstrap-theme #civihr-ui-select-contact .button-list--with-upper-margin{border-top:solid 2px;padding-top:10px;margin-top:10px}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}#bootstrap-theme #civihr-ui-select-contact .loading-indicator{text-align:center}#bootstrap-theme #civihr-ui-select-contact .loading-indicator:before{content:'';animation:spin 1s infinite linear;background:url("../svgs/civicrm.svg") no-repeat center center !important;display:inline-block;height:36px;width:36px}#bootstrap-theme #civihr-ui-select-contact, #bootstrap-theme #civihr-ui-select-contact *{border-color:#e8eef0 !important}#bootstrap-theme .civihr-ui-select__content{padding:0 5px !important}#bootstrap-theme .civihr-ui-select__content-multiple{padding:0 5px !important}#bootstrap-theme .civihr-ui-select__custom-options{background:#585878 !important;padding:5px 10px !important;margin:5px 0 !important;border:solid 1px #4d4d69 !important;color:#555}#bootstrap-theme .civihr-ui-select__refine-search{padding-top:10px !important}#bootstrap-theme .civihr-ui-select__button-group{border-top:solid 1px #4d4d69 !important;padding-top:10px !important;margin-top:10px !important}#bootstrap-theme .civihr-ui-select__button{display:inline-block;cursor:pointer}#bootstrap-theme .civihr-ui-select__button:not(:last-child){padding-right:5px !important}#bootstrap-theme .civihr-ui-select.open, #bootstrap-theme .civihr-ui-select .select2-drop-active, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-drop-active{background:#fff !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close, #bootstrap-theme .civihr-ui-select.open .select2-chosen, #bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select a.select2-choice, #bootstrap-theme .civihr-ui-select .ui-select-search, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{background:none !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen, #bootstrap-theme .civihr-ui-select.open .ui-select-search, #bootstrap-theme .civihr-ui-select.ui-select-multiple, #bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item{border-width:1px !important;border-style:solid !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before, #bootstrap-theme .civihr-ui-select.open .select2-search::after, #bootstrap-theme .civihr-ui-select .select2-arrow::before, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{font-family:'FontAwesome';font-style:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen, #bootstrap-theme .civihr-ui-select .select2-input, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{line-height:28px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before, #bootstrap-theme .civihr-ui-select .select2-chosen, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{font-size:13px !important}#bootstrap-theme .civihr-ui-select.open .select2-arrow, #bootstrap-theme .civihr-ui-select:not(.open) .select2-choice, #bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select .ui-select-choices, #bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-search-field{padding:0 !important}#bootstrap-theme .civihr-ui-select{color:#555;width:100% !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled{color:#8b8baa !important;border-color:#8b8baa !important;background:#f3f6f7 !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-chosen{color:#8b8baa !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-arrow::before, #bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-choices::before{border-color:#8b8baa !important;color:#8b8baa !important}#bootstrap-theme .civihr-ui-select, #bootstrap-theme .civihr-ui-select *{border-color:rgba(0,0,0,0.15) !important}#bootstrap-theme .civihr-ui-select>*, #bootstrap-theme .civihr-ui-select{border-radius:2px !important;box-shadow:none !important}#bootstrap-theme .civihr-ui-select .select2-drop{border-radius:0 0 2px 2px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close{height:15px;left:unset !important;right:45px !important;width:15px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close{background:none !important;top:2px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before{content:'\f057';line-height:inherit !important;vertical-align:middle !important;text-align:right;display:block}#bootstrap-theme .civihr-ui-select.open:not(.ng-invalid), #bootstrap-theme .civihr-ui-select.open:not(.ng-invalid) *, #bootstrap-theme .civihr-ui-select.open:not(.ng-invalid).form-control{border-color:#0071bd !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen{color:#7d7d9f !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen{border:0 !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen>span:first-of-type{max-width:calc(100% - 20px);display:block;overflow:hidden;text-overflow:ellipsis}#bootstrap-theme .civihr-ui-select.open .select2-choice{border-bottom:0 !important}#bootstrap-theme .civihr-ui-select.open .ui-select-search{padding:0 5px !important;margin-top:5px !important}#bootstrap-theme .civihr-ui-select.open .select2-search-choice-close::before{display:none}#bootstrap-theme .civihr-ui-select.open .select2-search::after{position:relative;content:'\f002';color:#555 !important;right:30px}#bootstrap-theme .civihr-ui-select:not(.open){border-color:rgba(0,0,0,0.15) !important;padding:0 0 0 10px !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-choice{border:0 !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow{width:31px !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow::before{width:100%;display:block;text-align:center;line-height:30px;content:'\f0d7'}#bootstrap-theme .contact-lookup.civihr-ui-select:not(.open) .select2-arrow::before{content:'\f002' !important}#bootstrap-theme .civihr-ui-select:not(.open):not(.select2-container-disabled) .select2-arrow{border-left:solid 1px rgba(0,0,0,0.15) !important}#bootstrap-theme .civihr-ui-select:not(.open).select2-container-disabled .select2-arrow{border-left:solid 1px #8b8baa !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen{max-width:calc(100% - 30px) !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen:not(.empty){color:#0071bd !important}#bootstrap-theme .civihr-ui-select:not(.open) .ui-select-match[allow-clear] .select2-chosen{max-width:calc(100% - 60px) !important}#bootstrap-theme .civihr-ui-select .select2-input{width:inherit}#bootstrap-theme .civihr-ui-select .select2-arrow{cursor:pointer !important;right:0 !important;top:0 !important}#bootstrap-theme .civihr-ui-select .select2-arrow::before{color:#4d4d69;content:'\f0d8'}#bootstrap-theme .civihr-ui-select .select2-chosen{color:#4d4d69 !important;padding-left:5px !important}#bootstrap-theme .civihr-ui-select .select2-drop-active{border-top:0 !important;border-style:solid;border-width:1px !important;opacity:1 !important}#bootstrap-theme .civihr-ui-select a.select2-choice:hover{text-decoration:none !important}#bootstrap-theme .civihr-ui-select .ui-select-match{height:100% !important}#bootstrap-theme .civihr-ui-select .ui-select-choices{margin:5px 0 0 !important}#bootstrap-theme .civihr-ui-select .select2-result-label{padding:5px 10px !important;color:#4d4d69}#bootstrap-theme .civihr-ui-select .select2-highlighted{background:#f3f6f7 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple{height:100% !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item{box-sizing:border-box !important;line-height:17px !important;margin:5px 5px 5px 0 !important;padding:0 22px 0 5px !important;border-radius:0 !important;background:none}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item .select2-search-choice-close{right:5px !important;top:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item .select2-search-choice-close::before{display:block}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices{box-shadow:none !important;-moz-padding-start:0 !important;-webkit-padding-start:0 !important;margin-bottom:0 !important;width:100% !important;border:0;background-image:none !important;background:none !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{color:#4d4d69;padding-left:13px !important;width:26px !important;height:30px;top:0 !important;pointer-events:none;position:absolute}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open){border-color:rgba(0,0,0,0.15) !important;padding-left:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open) .select2-choices::before{content:'\f0d7'}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open) .select2-input{cursor:pointer;padding:0 0 0 5px !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-choices::before{content:'\f002';padding-right:15px}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .ui-select-search{border:0 !important;margin:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-search-field{margin:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-chosen{min-height:25px !important;border:0 !important;line-height:25px}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-drop-active{left:-1px;box-sizing:content-box !important}#bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid, #bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid *, #bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid.form-control{border-color:#cf3458 !important}#bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid:not(.open) .select2-arrow{border-left:solid 1px #cf3458 !important}#bootstrap-theme .result-list__contact-item{clear:left}#bootstrap-theme .result-list__contact-item::before{content:'\f007';float:left;height:22px;margin-right:10px;font-family:'FontAwesome';font-style:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}#bootstrap-theme .button-list{display:flex;justify-content:space-between}#bootstrap-theme .button-list__button{cursor:pointer}#bootstrap-theme .button-list__button:not(:last-of-type){padding-right:5px}#bootstrap-theme .button-list--with-upper-margin{border-top:solid 2px;padding-top:10px;margin-top:10px}#bootstrap-theme #civihr-ui-select-contact{padding:10px !important;background:#f3f6f7 !important;border:solid 1px !important;margin:5px !important}#bootstrap-theme #civihr-ui-select-contact .refine-search__dropdown{box-shadow:none !important}#bootstrap-theme #civihr-ui-select-contact .refine-search__placeholder{color:#555;padding-bottom:10px}#bootstrap-theme #civihr-ui-select-contact .button-list{display:flex;justify-content:space-between}#bootstrap-theme #civihr-ui-select-contact .button-list__button{cursor:pointer}#bootstrap-theme #civihr-ui-select-contact .button-list__button:not(:last-of-type){padding-right:5px}#bootstrap-theme #civihr-ui-select-contact .button-list--with-upper-margin{border-top:solid 2px;padding-top:10px;margin-top:10px}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}#bootstrap-theme #civihr-ui-select-contact .loading-indicator{text-align:center}#bootstrap-theme #civihr-ui-select-contact .loading-indicator:before{content:'';animation:spin 1s infinite linear;background:url("../svgs/civicrm.svg") no-repeat center center !important;display:inline-block;height:36px;width:36px}#bootstrap-theme #civihr-ui-select-contact, #bootstrap-theme #civihr-ui-select-contact *{border-color:#e8eef0 !important}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}#bootstrap-theme .loading-indicator{text-align:center}#bootstrap-theme .loading-indicator:before{content:'';animation:spin 1s infinite linear;background:url("../svgs/civicrm.svg") no-repeat center center !important;display:inline-block;height:36px;width:36px}#bootstrap-theme .refine-search__dropdown{box-shadow:none !important}#bootstrap-theme .refine-search__placeholder{color:#555;padding-bottom:10px}#bootstrap-theme #civihr-menu{background:#fff;box-shadow:0 3px 18px 0 rgba(70,67,84,0.25);position:fixed;top:0;width:100%;z-index:1000}#bootstrap-theme #civihr-menu #civicrm-menu{box-shadow:none;float:left;position:static !important;width:auto}#bootstrap-theme #civihr-menu .chr_user-menu{float:right}@font-face{font-family:'icomoon';src:url("../fonts/icomoon.ttf?tozcjz") format("truetype"),url("../fonts/icomoon.woff?tozcjz") format("woff"),url("../fonts/icomoon.svg?tozcjz#icomoon") format("svg");font-weight:normal;font-style:normal}#bootstrap-theme .chr_logo{display:inline-block;font-family:'icomoon' !important;font-size:1em;font-style:normal;font-weight:normal;font-variant:normal;line-height:1;position:relative;text-transform:none;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#bootstrap-theme .chr_logo:after{color:inherit;content:"\e900";margin-left:0.45em}#bootstrap-theme .chr_logo:before{color:inherit;content:"\e901";left:0;position:absolute;top:0}#bootstrap-theme .chr_logo--default-color:after{color:#82BD58}#bootstrap-theme .chr_logo--default-color:before{color:#1B6F90}#bootstrap-theme .chr_logo--default-color.chr_logo--full>i:after{color:#026085}#bootstrap-theme .chr_logo--default-size{font-size:20px}#bootstrap-theme .chr_logo--full:after{left:0;position:absolute;top:0}#bootstrap-theme .chr_logo--full>i:after{bottom:.2em;color:inherit;content:"\e902";font-size:.7em;font-style:normal;margin-left:2.4em;position:relative}#bootstrap-theme .chr_scroll-lock{height:100% !important;overflow:hidden !important;width:100% !important}#bootstrap-theme .chr_profile-card{display:inline-block}#bootstrap-theme .chr_profile-card__name{display:table-cell;vertical-align:middle}#bootstrap-theme .chr_profile-card__picture{display:table-cell;overflow:hidden;vertical-align:middle}#bootstrap-theme .chr_profile-card__picture>img{background:#e8eef0;border-radius:50%;width:100%;vertical-align:middle}#bootstrap-theme .chr_profile-card__picture+.chr_profile-card__name{padding-left:15px}#bootstrap-theme .chr_profile-card__picture--small>img{height:34px;width:34px}#bootstrap-theme .spinner{animation:spin 1.5s linear infinite;background:url(../img/spinner.svg) no-repeat center center !important;display:block;height:32px;margin:auto;width:32px}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}#bootstrap-theme .chr_user-menu{color:#464354;cursor:default;line-height:60px;padding:0 10px;position:relative}#bootstrap-theme .chr_user-menu:hover{background:#f3f6f7}#bootstrap-theme .chr_user-menu:hover>.chr_user-menu__dropdown{display:block}#bootstrap-theme .chr_user-menu__data>.chr_profile-card{margin:-2px 8px 0 8px;vertical-align:top}@media (max-width: 1250px){#bootstrap-theme .chr_user-menu__data>.chr_user-menu__arrow{display:none}}#bootstrap-theme .chr_user-menu__dropdown{background:#fff;display:none;position:absolute;right:0;z-index:99}#bootstrap-theme .chr_user-menu__dropdown ul{list-style-type:none;margin:0}#bootstrap-theme .chr_user-menu__dropdown li{line-height:50px;white-space:nowrap}#bootstrap-theme .chr_user-menu__dropdown li>a, #bootstrap-theme .chr_user-menu__dropdown li>span{padding:0 30px 0 20px}#bootstrap-theme .chr_user-menu__dropdown a{color:#464354;display:block}#bootstrap-theme .chr_user-menu__dropdown a:hover{background:#f3f6f7;color:#464354;text-decoration:none}#bootstrap-theme .chr_user-menu__dropdown a>i{margin-right:10px}#bootstrap-theme .chr_user-menu__dropdown__username{color:#464354}#bootstrap-theme .chr_user-menu__dropdown__username:after{border-top:1px solid #d3dee2;content:'';display:block;height:0;margin:0 30px 0 20px}.page-civicrm-activity .crm-search-tasks, .page-civicrm-case .crm-search-tasks{margin:20px 0;padding:18px 15px;background-color:#fff;box-shadow:0 3px 18px 0 rgba(48,40,40,0.25);border-radius:0}.page-civicrm-activity .crm-search-tasks .form-layout-compressed, .page-civicrm-case .crm-search-tasks .form-layout-compressed{margin:0}.page-civicrm-activity .crm-search-tasks .select2-container, .page-civicrm-case .crm-search-tasks .select2-container{width:180px !important}.page-civicrm-activity #searchForm{box-sizing:border-box}.page-civicrm-activity #searchForm tr:not(#activityCustom) td{padding:10px 20px}.page-civicrm-activity #searchForm tr:nth-child(n+8):nth-child(-n+9){display:none}.page-civicrm-activity #searchForm tr td{border:0 !important;padding:0}.page-civicrm-activity #searchForm tr td.font-size12pt{font-size:13px}.page-civicrm-activity #searchForm tr td .crm-button_qf_Search_refresh{float:right !important;margin:0}.page-civicrm-activity #searchForm tr td .crm-button_qf_Search_refresh>.crm-form-submit{margin-right:0 !important}.page-civicrm-activity #searchForm tr td .select2-choices, .page-civicrm-activity #searchForm tr td .select2-choice, .page-civicrm-activity #searchForm tr td #activity_subject{min-width:329px}.page-civicrm-activity #searchForm .crm-i{display:none}.page-civicrm-activity .ui-dialog .crm-submit-buttons{display:none}.page-civicrm-activity .ui-dialog table tr{border-bottom:0}.page-civicrm-activity .ui-dialog #Activity_Custom_Fields__1{border-bottom:none;padding:0}.page-civicrm-activity .ui-dialog #Activity_Custom_Fields__1 td.label{display:table-cell}.page-civicrm-activity .ui-dialog #Activity_Custom_Fields__1 .crm-accordion-wrapper{margin-left:5px;margin-right:0}.page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-block{box-shadow:none}.page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-custom_data, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-attachment, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-recurring_activity, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-schedule_followup{padding:0;margin-bottom:0}.page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-custom_data>td, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-custom_data #Activity_Custom_Fields__, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-attachment>td, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-attachment #Activity_Custom_Fields__, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-recurring_activity>td, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-recurring_activity #Activity_Custom_Fields__, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-schedule_followup>td, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-schedule_followup #Activity_Custom_Fields__{padding:0 20px}.page-civicrm-case .font-size12pt{font-size:13px}.page-civicrm-case .font-size12pt label{width:212px;display:inline-block}.page-civicrm-case .crm-case-search-form-block tr td.crm-submit-buttons{padding:12.5px 20px}.page-civicrm-case .crm-case-search-form-block tr:nth-child(n+1):nth-child(-n+4)>td{padding:5px 20px}.page-civicrm-case .crm-case-search-form-block tr:nth-child(n+1):nth-child(-n+4)>td:first-child{width:220px;box-sizing:border-box}.page-civicrm-case .crm-case-search-form-block tr.crm-case-search-form-block-sort_name>td .crm-button_qf_Search_refresh{float:right !important}.page-civicrm-case .crm-case-search-form-block tr.crm-case-search-form-block-sort_name>td #_qf_Search_refresh-top{margin-right:0 !important}.page-civicrm-case .crm-case-search-form-block tr .crm-i{display:none}.page-civicrm-case .crm-case-search-form-block #Application{margin-left:-5px;margin-right:-5px}.page-civicrm-case .crm-case-search-form-block #Application .crm-accordion-body td{padding-left:0 !important}.page-civicrm-case .caseSelector>tbody>tr .dataTable tr>td:first-child, .page-civicrm-case .caseSelector>tbody>tr .dataTable tr>th:first-child{text-align:center}.page-civicrm-case .caseSelector>tbody>tr th a{color:#464354}.page-civicrm-case .caseSelector>tbody>tr .nestedActivitySelector td:nth-child(8){text-align:left !important}.page-civicrm-case .caseSelector>tbody>tr .paginate_button{line-height:normal}.page-civicrm-case .caseSelector>tbody>tr .ui-buttonset .ui-button{padding:5px 10px}.page-civicrm-vacancy .crm-container .form-layout-compressed .advmultiselect input[type='button']{margin:8px 20px !important}.page-civicrm-vacancy .crm-container .form-layout-compressed .advmultiselect input[type='button']:first-child{margin-right:0 !important}.page-civicrm-vacancy .crm-container .form-layout-compressed .advmultiselect tr:first-child td:nth-child(2){vertical-align:bottom;padding-bottom:4px}.page-civicrm-vacancy .crm-container .crm-block.crm-form-block .form-layout-compressed .crm-profile-selector-preview{margin-left:20px}.page-civicrm-vacancy .crm-container .crm-block.crm-form-block .form-layout-compressed .crm-profile-selector-preview .crm-i{display:none}.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block{padding-top:20px}.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed, .page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>fieldset{margin:20px}.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed{margin-top:0}.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed td>.select2-container, .page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed td>.crm-form-text, .page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed td>.crm-form-date-wrapper .crm-form-text:nth-child(2){min-width:200px}@media (max-width: 1200px) and (min-width: 768px){.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-form-multiselect{min-width:160px;width:160px}}.page-civicrm-vacancy #addMorePermission{background:#0071bd;border-color:#0071bd;border-radius:3px;color:#fff;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;padding:8px 12px;text-shadow:none;text-transform:uppercase}.page-civicrm-vacancy #addMorePermission:hover{background:#58b7d1}.page-civicrm-vacancy #addMorePermission>.add-icon{background-image:none;text-indent:0;margin-right:3px}.page-civicrm-vacancy #addMorePermission>.add-icon:after{font-family:'FontAwesome';font-style:normal;text-rendering:auto;font-size:13px;content:"";color:#fff;position:relative;top:-1px}.page-civicrm-vacancy table.vacancy-popup{margin-bottom:20px}.page-civicrm-vacancy .view-hrvacancies .description{margin-bottom:20px}.page-civicrm-vacancy .view-hrvacancies td>a{color:#0071bd}.page-civicrm-vacancy .CRM_HRRecruitment_Form_Search .crm-search-form-block{margin-bottom:20px}.page-civicrm-vacancy #searchForm{padding:20px}.page-civicrm-vacancy #searchForm td{padding:0}.page-civicrm-vacancy #searchForm tr:nth-child(2) td{padding:20px 0}.page-civicrm-vacancy #searchForm #_qf_Search_refresh{margin-bottom:0 !important}.page-civicrm-vacancy #searchForm .listing-box{border-color:#4d4d69}.page-civicrm-vacancy #searchForm .listing-box>div{background-color:transparent}.page-civicrm-vacancy #searchForm .listing-box>div label{color:#4d4d69;font-weight:normal !important;padding:5px}.page-civicrm-vacancy #searchForm .font-size12pt{font-size:12px}.page-civicrm-vacancy #searchForm .crm-form-text{width:312px}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog{padding:0}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog-content{padding:0}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog-content .crm-block{box-shadow:none}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog table tr{border-bottom:0}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog table tr td{padding-left:0;border-bottom:0}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog .advmultiselect tr:first-child td:nth-child(2){vertical-align:top}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog .advmultiselect tr:first-child td:nth-child(2) input[type='button']:first-child{margin-left:0 !important;width:71px;display:block}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog .ui-dialog-buttonpane{margin:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-vacancy-summary>div:not(.collapsed) .crm-accordion-header::before{content:""}.page-civicrm-vacancy .hr-pipeline-tab .crm-accordion-header h2{color:#464354 !important;display:inline-block}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy{width:49%;margin-bottom:20px;border:1px solid #e8eef0;border-top-left-radius:4px;border-top-right-radius:4px;overflow:hidden}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div{padding:0;font-weight:normal}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table{width:100%;background-color:#fff;border:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr:nth-child(2) td{line-height:2em}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr td{color:#586277;padding:0 15px}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr td:not(:first-child){padding:10px 15px}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3{background-color:#4d4d69;padding:8px 15px}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3>a{color:#fff}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3>a .edit-icon{background-image:none;text-indent:0;top:-3px;margin:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3>a .edit-icon:after{font-family:'FontAwesome';font-style:normal;text-rendering:auto;font-size:13px;content:"";color:#fff}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3>a .edit-icon:hover:after{opacity:.8}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table .hr-stage{border-left:0 !important;width:auto;display:none}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table .hr-stage:first-child{display:block}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table .hr-stage a{font-weight:600;color:#0071bd;right:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr:first-child td{padding:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr:nth-child(2){font-weight:600}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-recent-activity{border:1px solid transparent;overflow:hidden;border-radius:2px}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-recent-activity .hr-recent-activity-title{background-color:#4d4d69;padding:8px 15px;line-height:2em}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-recent-activity .row-highlight{width:calc(100% + 1px)}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-recent-activity .row-highlight tr .hr-recent-activity-block{font-size:13px;color:#586277}.page-civicrm-vacancy .CRM_HRRecruitment_Form_Application .crm-profile-name-application_profile{padding:20px}.page-civicrm-vacancy .CRM_HRRecruitment_Form_Application .crm-profile-name-application_profile legend{padding-top:20px}#bootstrap-theme .nav-pills-horizontal{margin-bottom:15px}#bootstrap-theme .panel-body-section{padding:15px 20px;padding-bottom:0;padding-top:0}#bootstrap-theme .panel-default-inverted>.panel-body{background:#ffffff}#bootstrap-theme .panel-default-inverted>.panel-footer, #bootstrap-theme .panel-default-inverted>.panel-heading{background:#fafbfc}#bootstrap-theme .panel-default-plain>.panel-heading, #bootstrap-theme .panel-default-plain-inverted>.panel-heading{padding-bottom:0}#bootstrap-theme .panel-default-plain>.panel-heading>hr, #bootstrap-theme .panel-default-plain-inverted>.panel-heading>hr{margin:15px 20px;margin-bottom:0;margin-left:0;margin-right:0}#bootstrap-theme .panel-default-plain>.panel-body{background:#ffffff}#bootstrap-theme .panel-default-plain>.panel-footer{background:#fafbfc}#bootstrap-theme .panel-default-plain-inverted>.panel-heading{background:#fafbfc} #civihr-menu{background:#fff;box-shadow:0 3px 18px 0 rgba(70,67,84,0.25);position:fixed;top:0;width:100%;z-index:1000} #civihr-menu #civicrm-menu{box-shadow:none;float:left;position:static !important;width:auto} #civihr-menu .chr_user-menu{float:right}@font-face{font-family:'icomoon';src:url("../fonts/icomoon.ttf?tozcjz") format("truetype"),url("../fonts/icomoon.woff?tozcjz") format("woff"),url("../fonts/icomoon.svg?tozcjz#icomoon") format("svg");font-weight:normal;font-style:normal} .chr_logo{display:inline-block;font-family:'icomoon' !important;font-size:1em;font-style:normal;font-weight:normal;font-variant:normal;line-height:1;position:relative;text-transform:none;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} .chr_logo:after{color:inherit;content:"\e900";margin-left:0.45em} .chr_logo:before{color:inherit;content:"\e901";left:0;position:absolute;top:0} .chr_logo--default-color:after{color:#82BD58} .chr_logo--default-color:before{color:#1B6F90} .chr_logo--default-color.chr_logo--full>i:after{color:#026085} .chr_logo--default-size{font-size:20px} .chr_logo--full:after{left:0;position:absolute;top:0} .chr_logo--full>i:after{bottom:.2em;color:inherit;content:"\e902";font-size:.7em;font-style:normal;margin-left:2.4em;position:relative} .chr_scroll-lock{height:100% !important;overflow:hidden !important;width:100% !important} .chr_profile-card{display:inline-block} .chr_profile-card__name{display:table-cell;vertical-align:middle} .chr_profile-card__picture{display:table-cell;overflow:hidden;vertical-align:middle} .chr_profile-card__picture>img{background:#e8eef0;border-radius:50%;width:100%;vertical-align:middle} .chr_profile-card__picture+.chr_profile-card__name{padding-left:15px} .chr_profile-card__picture--small>img{height:34px;width:34px} .spinner{animation:spin 1.5s linear infinite;background:url(../img/spinner.svg) no-repeat center center !important;display:block;height:32px;margin:auto;width:32px}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}} .chr_user-menu{color:#464354;cursor:default;line-height:60px;padding:0 10px;position:relative} .chr_user-menu:hover{background:#f3f6f7} .chr_user-menu:hover>.chr_user-menu__dropdown{display:block} .chr_user-menu__data>.chr_profile-card{margin:-2px 8px 0 8px;vertical-align:top}@media (max-width: 1250px){ .chr_user-menu__data>.chr_user-menu__arrow{display:none}} .chr_user-menu__dropdown{background:#fff;display:none;position:absolute;right:0;z-index:99} .chr_user-menu__dropdown ul{list-style-type:none;margin:0} .chr_user-menu__dropdown li{line-height:50px;white-space:nowrap} .chr_user-menu__dropdown li>a, .chr_user-menu__dropdown li>span{padding:0 30px 0 20px} .chr_user-menu__dropdown a{color:#464354;display:block} .chr_user-menu__dropdown a:hover{background:#f3f6f7;color:#464354;text-decoration:none} .chr_user-menu__dropdown a>i{margin-right:10px} .chr_user-menu__dropdown__username{color:#464354} .chr_user-menu__dropdown__username:after{border-top:1px solid #d3dee2;content:'';display:block;height:0;margin:0 30px 0 20px} #civicrm-menu li.menumain.crm-Self_Service_Portal>a{border:1px solid #4d4d69;border-radius:2px;font-weight:600;height:35px;line-height:35px;padding:0 15px;margin-top:12px;text-transform:uppercase} #civicrm-menu li.menumain.crm-Self_Service_Portal>a:hover{background:#3e3e54;color:#fff} .crm-link-home .chr_logo{font-size:17px;margin-right:6px;vertical-align:sub} .crm-container .dataTables_processing, .crm-container .blockUI.blockOverlay{animation:spin 1.5s linear infinite;background:url(../img/spinner.svg) no-repeat center center !important;display:block;height:32px !important;margin:auto;width:32px !important;margin:8% 50% !important;opacity:1 !important}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}} +#bootstrap-theme #civicrm-menu li.menumain.crm-Self_Service_Portal>a{border:1px solid #4d4d69;border-radius:2px;font-weight:600;height:35px;line-height:35px;padding:0 15px;margin-top:12px;text-transform:uppercase}#bootstrap-theme #civicrm-menu li.menumain.crm-Self_Service_Portal>a:hover{background:#3e3e54;color:#fff}#bootstrap-theme .crm-link-home .chr_logo{font-size:17px;margin-right:6px;vertical-align:sub}.crm-container .dataTables_processing, .crm-container .blockUI.blockOverlay{animation:spin 1.5s linear infinite;background:url("../img/spinner.svg") no-repeat center center !important;display:block;height:32px !important;margin:auto;width:32px !important;margin:8% 50% !important;opacity:1 !important}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}#bootstrap-theme .nav-pills-horizontal{margin-bottom:15px}#bootstrap-theme .panel-body-section{padding:15px 20px;padding-bottom:0;padding-top:0}#bootstrap-theme .panel-default-inverted>.panel-body{background:#ffffff}#bootstrap-theme .panel-default-inverted>.panel-footer, #bootstrap-theme .panel-default-inverted>.panel-heading{background:#fafbfc}#bootstrap-theme .panel-default-plain>.panel-heading, #bootstrap-theme .panel-default-plain-inverted>.panel-heading{padding-bottom:0}#bootstrap-theme .panel-default-plain>.panel-heading>hr, #bootstrap-theme .panel-default-plain-inverted>.panel-heading>hr{margin:15px 20px;margin-bottom:0;margin-left:0;margin-right:0}#bootstrap-theme .panel-default-plain>.panel-body{background:#ffffff}#bootstrap-theme .panel-default-plain>.panel-footer{background:#fafbfc}#bootstrap-theme .panel-default-plain-inverted>.panel-heading{background:#fafbfc}#bootstrap-theme .chr_appraisal-cycle-summary__details>.chr_appraisal-cycle-summary__meta{margin-right:15px}#bootstrap-theme .chr_appraisal-cycle-summary__actions{display:inline-block}#bootstrap-theme .chr_appraisal-cycle-summary__actions__toggle{color:inherit}#bootstrap-theme .chr_appraisal-cycle-summary__meta{font-size:16px;font-weight:600;line-height:1.1}#bootstrap-theme .help-text-link{display:inline-block;padding-left:5px}#bootstrap-theme .chr_leave-list:before, #bootstrap-theme .chr_leave-list:after{content:" ";display:table}#bootstrap-theme .chr_leave-list:after{clear:both}#bootstrap-theme .chr_leave-list>.chr_leave-list__type{margin-bottom:10px}#bootstrap-theme .chr_leave-list__type>.chr_leave-list__type__color{margin-right:5px}#bootstrap-theme .chr_leave-list__type__color{background:#e8eef0;display:inline-block;height:15px;vertical-align:sub;width:15px}#bootstrap-theme .chr_leave-list__type__count{float:right}#bootstrap-theme .chr_scroll-shadows__wrapper{overflow:hidden;position:relative}#bootstrap-theme .chr_scroll-shadows__shadows{overflow-x:auto}#bootstrap-theme .chr_scroll-shadows__shadows::before, #bootstrap-theme .chr_scroll-shadows__shadows::after{box-shadow:0 0 10px 1px rgba(48,40,40,0.5);content:'';display:block;height:calc(100% - 10px);opacity:0;position:absolute;top:5px;transition:opacity 0.2s ease-out;width:1px;z-index:1}#bootstrap-theme .chr_scroll-shadows__shadows::before{left:-1px}#bootstrap-theme .chr_scroll-shadows__shadows::after{right:-1px}#bootstrap-theme .chr_scroll-shadows__shadows--show-left::before, #bootstrap-theme .chr_scroll-shadows__shadows--show-right::after{opacity:1}#bootstrap-theme .chr_scroll-shadows__content{display:inline-block;min-width:100%}#bootstrap-theme .chr_sickness-days{display:inline-block;width:165px}#bootstrap-theme .chr_sickness-days--danger .chr_sickness-days__count{background:#cf3458}#bootstrap-theme .chr_sickness-days__count{background:#44cb7e;color:white;font-size:6.5384615385em;text-align:center}#bootstrap-theme .chr_sickness-days__label{background:#e8eef0;font-size:1.3846153846em;padding:5px 0;text-align:center;text-transform:uppercase}#bootstrap-theme .chr_steps{margin:0}#bootstrap-theme .chr_steps:before, #bootstrap-theme .chr_steps:after{content:" ";display:table}#bootstrap-theme .chr_steps:after{clear:both}#bootstrap-theme .chr_steps__step{display:table;float:left}#bootstrap-theme .chr_steps__step:not(:first-child) .chr_steps__step__arrow{padding-left:16px}#bootstrap-theme .chr_steps__step:not(:last-child){margin-right:6px}#bootstrap-theme .chr_steps__step:not(:last-child) .chr_steps__step__arrow:before{border-left-color:#fff;margin-left:6px;z-index:1}#bootstrap-theme .chr_steps__step__arrow{background:#4d4d69;border-color:#4d4d69;color:#fff;display:table-cell;height:24px;line-height:24px;padding:0 10px 0 10px;position:relative}#bootstrap-theme .chr_steps__step__arrow:after, #bootstrap-theme .chr_steps__step__arrow:before{content:"";border-color:transparent;border-style:solid;border-width:12px 0 12px 6px;display:block;height:0;left:100%;margin-top:-12px;position:absolute;top:50%;width:0}#bootstrap-theme .chr_steps__step__arrow:after{border-left-color:inherit;z-index:2}#bootstrap-theme .chr_steps__step__legend{display:table-row}#bootstrap-theme .chr_steps__step__legend>.chr_steps__step__legend__content{margin-top:10px}#bootstrap-theme .chr_steps__step__legend__content{background:white;border:1px solid #4d4d69;font-size:12px;padding:10px 4px;width:100%}#bootstrap-theme .chr_steps--compact>.chr_steps__step:not(:first-child) .chr_steps__step__arrow{padding-left:11px}#bootstrap-theme .chr_steps--compact .chr_steps__step__arrow{font-size:12px;font-weight:600;height:28px;line-height:28px;padding:0 5px 0 10px}#bootstrap-theme .chr_steps--compact .chr_steps__step__arrow:after, #bootstrap-theme .chr_steps--compact .chr_steps__step__arrow:before{border-width:14px 0 14px 6px;margin-top:-14px}#bootstrap-theme .chr_steps--flex{display:flex}#bootstrap-theme .chr_steps--flex .chr_steps__step{display:block;flex-grow:1;float:none}#bootstrap-theme .chr_steps--flex .chr_steps__step__arrow{display:inline-block;text-align:center;width:100%}#bootstrap-theme .chr_steps--flex .chr_steps__step__legend{display:block}#bootstrap-theme .chr_steps__step--danger>.chr_steps__step__arrow{background:#cf3458;border-color:#cf3458}#bootstrap-theme .chr_steps__step--danger .chr_steps__step__legend__content{border-color:#cf3458}#bootstrap-theme .chr_steps__step--primary>.chr_steps__step__arrow{background:#0071bd;border-color:#0071bd}#bootstrap-theme .chr_steps__step--primary .chr_steps__step__legend__content{border-color:#0071bd}#bootstrap-theme .chr_timeline{margin:0}#bootstrap-theme .chr_timeline:before, #bootstrap-theme .chr_timeline:after{content:" ";display:table}#bootstrap-theme .chr_timeline:after{clear:both}#bootstrap-theme .chr_timeline>.chr_timeline__entry{padding:2.6923076923em 0 0 3.0769230769em;position:relative}#bootstrap-theme .chr_timeline>.chr_timeline__entry:last-child{padding-bottom:2.6923076923em}#bootstrap-theme .chr_timeline__entry:after{content:"";border:3px solid #f3f6f7;bottom:0;left:7px;position:absolute;top:0}#bootstrap-theme .chr_timeline__entry:before{content:"";background:#f3f6f7;border:2px solid #e8eef0;border-radius:50%;display:inline-block;height:20px;left:0;position:absolute;vertical-align:bottom;width:20px;z-index:2}#bootstrap-theme .chr_timeline__entry--future:before{border-color:#0071bd}#bootstrap-theme .chr_timeline__entry--past:before{border-color:#cf3458}#bootstrap-theme .chr_timeline__entry__name{color:#464354;font-weight:600;display:block;margin-bottom:.3846153846em}#bootstrap-theme .civihr-ui-select.open, #bootstrap-theme .civihr-ui-select .select2-drop-active, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-drop-active{background:#fff !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close, #bootstrap-theme .civihr-ui-select.open .select2-chosen, #bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select a.select2-choice, #bootstrap-theme .civihr-ui-select .ui-select-search, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{background:none !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen, #bootstrap-theme .civihr-ui-select.open .ui-select-search, #bootstrap-theme .civihr-ui-select.ui-select-multiple, #bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item{border-width:1px !important;border-style:solid !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before, #bootstrap-theme .civihr-ui-select.open .select2-search::after, #bootstrap-theme .civihr-ui-select .select2-arrow::before, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{font-family:'FontAwesome';font-style:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen, #bootstrap-theme .civihr-ui-select .select2-input, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{line-height:28px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before, #bootstrap-theme .civihr-ui-select .select2-chosen, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{font-size:13px !important}#bootstrap-theme .civihr-ui-select.open .select2-arrow, #bootstrap-theme .civihr-ui-select:not(.open) .select2-choice, #bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select .ui-select-choices, #bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-search-field{padding:0 !important}#bootstrap-theme .civihr-ui-select{color:#555;width:100% !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled{color:#8b8baa !important;border-color:#8b8baa !important;background:#f3f6f7 !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-chosen{color:#8b8baa !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-arrow::before, #bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-choices::before{border-color:#8b8baa !important;color:#8b8baa !important}#bootstrap-theme .civihr-ui-select, #bootstrap-theme .civihr-ui-select *{border-color:rgba(0,0,0,0.15) !important}#bootstrap-theme .civihr-ui-select>*, #bootstrap-theme .civihr-ui-select{border-radius:2px !important;box-shadow:none !important}#bootstrap-theme .civihr-ui-select .select2-drop{border-radius:0 0 2px 2px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close{height:15px;left:unset !important;right:45px !important;width:15px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close{background:none !important;top:2px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before{content:'\f057';line-height:inherit !important;vertical-align:middle !important;text-align:right;display:block}#bootstrap-theme .civihr-ui-select.open:not(.ng-invalid), #bootstrap-theme .civihr-ui-select.open:not(.ng-invalid) *, #bootstrap-theme .civihr-ui-select.open:not(.ng-invalid).form-control{border-color:#0071bd !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen{color:#7d7d9f !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen{border:0 !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen>span:first-of-type{max-width:calc(100% - 20px);display:block;overflow:hidden;text-overflow:ellipsis}#bootstrap-theme .civihr-ui-select.open .select2-choice{border-bottom:0 !important}#bootstrap-theme .civihr-ui-select.open .ui-select-search{padding:0 5px !important;margin-top:5px !important}#bootstrap-theme .civihr-ui-select.open .select2-search-choice-close::before{display:none}#bootstrap-theme .civihr-ui-select.open .select2-search::after{position:relative;content:'\f002';color:#555 !important;right:30px}#bootstrap-theme .civihr-ui-select:not(.open){border-color:rgba(0,0,0,0.15) !important;padding:0 0 0 10px !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-choice{border:0 !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow{width:31px !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow::before{width:100%;display:block;text-align:center;line-height:30px;content:'\f0d7'}#bootstrap-theme .contact-lookup.civihr-ui-select:not(.open) .select2-arrow::before{content:'\f002' !important}#bootstrap-theme .civihr-ui-select:not(.open):not(.select2-container-disabled) .select2-arrow{border-left:solid 1px rgba(0,0,0,0.15) !important}#bootstrap-theme .civihr-ui-select:not(.open).select2-container-disabled .select2-arrow{border-left:solid 1px #8b8baa !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen{max-width:calc(100% - 30px) !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen:not(.empty){color:#0071bd !important}#bootstrap-theme .civihr-ui-select:not(.open) .ui-select-match[allow-clear] .select2-chosen{max-width:calc(100% - 60px) !important}#bootstrap-theme .civihr-ui-select .select2-input{width:inherit}#bootstrap-theme .civihr-ui-select .select2-arrow{cursor:pointer !important;right:0 !important;top:0 !important}#bootstrap-theme .civihr-ui-select .select2-arrow::before{color:#4d4d69;content:'\f0d8'}#bootstrap-theme .civihr-ui-select .select2-chosen{color:#4d4d69 !important;padding-left:5px !important}#bootstrap-theme .civihr-ui-select .select2-drop-active{border-top:0 !important;border-style:solid;border-width:1px !important;opacity:1 !important}#bootstrap-theme .civihr-ui-select a.select2-choice:hover{text-decoration:none !important}#bootstrap-theme .civihr-ui-select .ui-select-match{height:100% !important}#bootstrap-theme .civihr-ui-select .ui-select-choices{margin:5px 0 0 !important}#bootstrap-theme .civihr-ui-select .select2-result-label{padding:5px 10px !important;color:#4d4d69}#bootstrap-theme .civihr-ui-select .select2-highlighted{background:#f3f6f7 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple{height:100% !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item{box-sizing:border-box !important;line-height:17px !important;margin:5px 5px 5px 0 !important;padding:0 22px 0 5px !important;border-radius:0 !important;background:none}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item .select2-search-choice-close{right:5px !important;top:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item .select2-search-choice-close::before{display:block}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices{box-shadow:none !important;-moz-padding-start:0 !important;-webkit-padding-start:0 !important;margin-bottom:0 !important;width:100% !important;border:0;background-image:none !important;background:none !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{color:#4d4d69;padding-left:13px !important;width:26px !important;height:30px;top:0 !important;pointer-events:none;position:absolute}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open){border-color:rgba(0,0,0,0.15) !important;padding-left:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open) .select2-choices::before{content:'\f0d7'}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open) .select2-input{cursor:pointer;padding:0 0 0 5px !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-choices::before{content:'\f002';padding-right:15px}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .ui-select-search{border:0 !important;margin:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-search-field{margin:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-chosen{min-height:25px !important;border:0 !important;line-height:25px}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-drop-active{left:-1px;box-sizing:content-box !important}#bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid, #bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid *, #bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid.form-control{border-color:#cf3458 !important}#bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid:not(.open) .select2-arrow{border-left:solid 1px #cf3458 !important}#bootstrap-theme .result-list__contact-item{clear:left}#bootstrap-theme .result-list__contact-item::before{content:'\f007';float:left;height:22px;margin-right:10px;font-family:'FontAwesome';font-style:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}#bootstrap-theme #civihr-ui-select-contact{padding:10px !important;background:#f3f6f7 !important;border:solid 1px !important;margin:5px !important}#bootstrap-theme #civihr-ui-select-contact .refine-search__dropdown{box-shadow:none !important}#bootstrap-theme #civihr-ui-select-contact .refine-search__placeholder{color:#555;padding-bottom:10px}#bootstrap-theme #civihr-ui-select-contact .button-list{display:flex;justify-content:space-between}#bootstrap-theme #civihr-ui-select-contact .button-list__button{cursor:pointer}#bootstrap-theme #civihr-ui-select-contact .button-list__button:not(:last-of-type){padding-right:5px}#bootstrap-theme #civihr-ui-select-contact .button-list--with-upper-margin{border-top:solid 2px;padding-top:10px;margin-top:10px}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}#bootstrap-theme #civihr-ui-select-contact .loading-indicator{text-align:center}#bootstrap-theme #civihr-ui-select-contact .loading-indicator:before{content:'';animation:spin 1s infinite linear;background:url("../svgs/civicrm.svg") no-repeat center center !important;display:inline-block;height:36px;width:36px}#bootstrap-theme #civihr-ui-select-contact, #bootstrap-theme #civihr-ui-select-contact *{border-color:#e8eef0 !important}#bootstrap-theme .civihr-ui-select__content{padding:0 5px !important}#bootstrap-theme .civihr-ui-select__content-multiple{padding:0 5px !important}#bootstrap-theme .civihr-ui-select__custom-options{background:#585878 !important;padding:5px 10px !important;margin:5px 0 !important;border:solid 1px #4d4d69 !important;color:#555}#bootstrap-theme .civihr-ui-select__refine-search{padding-top:10px !important}#bootstrap-theme .civihr-ui-select__button-group{border-top:solid 1px #4d4d69 !important;padding-top:10px !important;margin-top:10px !important}#bootstrap-theme .civihr-ui-select__button{display:inline-block;cursor:pointer}#bootstrap-theme .civihr-ui-select__button:not(:last-child){padding-right:5px !important}#bootstrap-theme .civihr-ui-select.open, #bootstrap-theme .civihr-ui-select .select2-drop-active, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-drop-active{background:#fff !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close, #bootstrap-theme .civihr-ui-select.open .select2-chosen, #bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select a.select2-choice, #bootstrap-theme .civihr-ui-select .ui-select-search, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{background:none !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen, #bootstrap-theme .civihr-ui-select.open .ui-select-search, #bootstrap-theme .civihr-ui-select.ui-select-multiple, #bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item{border-width:1px !important;border-style:solid !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before, #bootstrap-theme .civihr-ui-select.open .select2-search::after, #bootstrap-theme .civihr-ui-select .select2-arrow::before, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{font-family:'FontAwesome';font-style:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen, #bootstrap-theme .civihr-ui-select .select2-input, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{line-height:28px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before, #bootstrap-theme .civihr-ui-select .select2-chosen, #bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{font-size:13px !important}#bootstrap-theme .civihr-ui-select.open .select2-arrow, #bootstrap-theme .civihr-ui-select:not(.open) .select2-choice, #bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow, #bootstrap-theme .civihr-ui-select .ui-select-choices, #bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-search-field{padding:0 !important}#bootstrap-theme .civihr-ui-select{color:#555;width:100% !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled{color:#8b8baa !important;border-color:#8b8baa !important;background:#f3f6f7 !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-chosen{color:#8b8baa !important}#bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-arrow::before, #bootstrap-theme .civihr-ui-select:not(.open).form-control.select2-container-disabled .select2-choices::before{border-color:#8b8baa !important;color:#8b8baa !important}#bootstrap-theme .civihr-ui-select, #bootstrap-theme .civihr-ui-select *{border-color:rgba(0,0,0,0.15) !important}#bootstrap-theme .civihr-ui-select>*, #bootstrap-theme .civihr-ui-select{border-radius:2px !important;box-shadow:none !important}#bootstrap-theme .civihr-ui-select .select2-drop{border-radius:0 0 2px 2px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close{height:15px;left:unset !important;right:45px !important;width:15px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close{background:none !important;top:2px !important}#bootstrap-theme .civihr-ui-select .select2-search-choice-close::before{content:'\f057';line-height:inherit !important;vertical-align:middle !important;text-align:right;display:block}#bootstrap-theme .civihr-ui-select.open:not(.ng-invalid), #bootstrap-theme .civihr-ui-select.open:not(.ng-invalid) *, #bootstrap-theme .civihr-ui-select.open:not(.ng-invalid).form-control{border-color:#0071bd !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen{color:#7d7d9f !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen{border:0 !important}#bootstrap-theme .civihr-ui-select.open .select2-chosen>span:first-of-type{max-width:calc(100% - 20px);display:block;overflow:hidden;text-overflow:ellipsis}#bootstrap-theme .civihr-ui-select.open .select2-choice{border-bottom:0 !important}#bootstrap-theme .civihr-ui-select.open .ui-select-search{padding:0 5px !important;margin-top:5px !important}#bootstrap-theme .civihr-ui-select.open .select2-search-choice-close::before{display:none}#bootstrap-theme .civihr-ui-select.open .select2-search::after{position:relative;content:'\f002';color:#555 !important;right:30px}#bootstrap-theme .civihr-ui-select:not(.open){border-color:rgba(0,0,0,0.15) !important;padding:0 0 0 10px !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-choice{border:0 !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow{width:31px !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-arrow::before{width:100%;display:block;text-align:center;line-height:30px;content:'\f0d7'}#bootstrap-theme .contact-lookup.civihr-ui-select:not(.open) .select2-arrow::before{content:'\f002' !important}#bootstrap-theme .civihr-ui-select:not(.open):not(.select2-container-disabled) .select2-arrow{border-left:solid 1px rgba(0,0,0,0.15) !important}#bootstrap-theme .civihr-ui-select:not(.open).select2-container-disabled .select2-arrow{border-left:solid 1px #8b8baa !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen{max-width:calc(100% - 30px) !important}#bootstrap-theme .civihr-ui-select:not(.open) .select2-chosen:not(.empty){color:#0071bd !important}#bootstrap-theme .civihr-ui-select:not(.open) .ui-select-match[allow-clear] .select2-chosen{max-width:calc(100% - 60px) !important}#bootstrap-theme .civihr-ui-select .select2-input{width:inherit}#bootstrap-theme .civihr-ui-select .select2-arrow{cursor:pointer !important;right:0 !important;top:0 !important}#bootstrap-theme .civihr-ui-select .select2-arrow::before{color:#4d4d69;content:'\f0d8'}#bootstrap-theme .civihr-ui-select .select2-chosen{color:#4d4d69 !important;padding-left:5px !important}#bootstrap-theme .civihr-ui-select .select2-drop-active{border-top:0 !important;border-style:solid;border-width:1px !important;opacity:1 !important}#bootstrap-theme .civihr-ui-select a.select2-choice:hover{text-decoration:none !important}#bootstrap-theme .civihr-ui-select .ui-select-match{height:100% !important}#bootstrap-theme .civihr-ui-select .ui-select-choices{margin:5px 0 0 !important}#bootstrap-theme .civihr-ui-select .select2-result-label{padding:5px 10px !important;color:#4d4d69}#bootstrap-theme .civihr-ui-select .select2-highlighted{background:#f3f6f7 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple{height:100% !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item{box-sizing:border-box !important;line-height:17px !important;margin:5px 5px 5px 0 !important;padding:0 22px 0 5px !important;border-radius:0 !important;background:none}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item .select2-search-choice-close{right:5px !important;top:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .ui-select-match-item .select2-search-choice-close::before{display:block}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices{box-shadow:none !important;-moz-padding-start:0 !important;-webkit-padding-start:0 !important;margin-bottom:0 !important;width:100% !important;border:0;background-image:none !important;background:none !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-choices::before{color:#4d4d69;padding-left:13px !important;width:26px !important;height:30px;top:0 !important;pointer-events:none;position:absolute}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open){border-color:rgba(0,0,0,0.15) !important;padding-left:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open) .select2-choices::before{content:'\f0d7'}#bootstrap-theme .civihr-ui-select.ui-select-multiple:not(.open) .select2-input{cursor:pointer;padding:0 0 0 5px !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-choices::before{content:'\f002';padding-right:15px}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .ui-select-search{border:0 !important;margin:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-search-field{margin:0 !important}#bootstrap-theme .civihr-ui-select.ui-select-multiple.open .select2-chosen{min-height:25px !important;border:0 !important;line-height:25px}#bootstrap-theme .civihr-ui-select.ui-select-multiple .select2-drop-active{left:-1px;box-sizing:content-box !important}#bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid, #bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid *, #bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid.form-control{border-color:#cf3458 !important}#bootstrap-theme .ng-submitted .civihr-ui-select.ng-invalid:not(.open) .select2-arrow{border-left:solid 1px #cf3458 !important}#bootstrap-theme .result-list__contact-item{clear:left}#bootstrap-theme .result-list__contact-item::before{content:'\f007';float:left;height:22px;margin-right:10px;font-family:'FontAwesome';font-style:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}#bootstrap-theme .button-list{display:flex;justify-content:space-between}#bootstrap-theme .button-list__button{cursor:pointer}#bootstrap-theme .button-list__button:not(:last-of-type){padding-right:5px}#bootstrap-theme .button-list--with-upper-margin{border-top:solid 2px;padding-top:10px;margin-top:10px}#bootstrap-theme #civihr-ui-select-contact{padding:10px !important;background:#f3f6f7 !important;border:solid 1px !important;margin:5px !important}#bootstrap-theme #civihr-ui-select-contact .refine-search__dropdown{box-shadow:none !important}#bootstrap-theme #civihr-ui-select-contact .refine-search__placeholder{color:#555;padding-bottom:10px}#bootstrap-theme #civihr-ui-select-contact .button-list{display:flex;justify-content:space-between}#bootstrap-theme #civihr-ui-select-contact .button-list__button{cursor:pointer}#bootstrap-theme #civihr-ui-select-contact .button-list__button:not(:last-of-type){padding-right:5px}#bootstrap-theme #civihr-ui-select-contact .button-list--with-upper-margin{border-top:solid 2px;padding-top:10px;margin-top:10px}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}#bootstrap-theme #civihr-ui-select-contact .loading-indicator{text-align:center}#bootstrap-theme #civihr-ui-select-contact .loading-indicator:before{content:'';animation:spin 1s infinite linear;background:url("../svgs/civicrm.svg") no-repeat center center !important;display:inline-block;height:36px;width:36px}#bootstrap-theme #civihr-ui-select-contact, #bootstrap-theme #civihr-ui-select-contact *{border-color:#e8eef0 !important}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}#bootstrap-theme .loading-indicator{text-align:center}#bootstrap-theme .loading-indicator:before{content:'';animation:spin 1s infinite linear;background:url("../svgs/civicrm.svg") no-repeat center center !important;display:inline-block;height:36px;width:36px}#bootstrap-theme .refine-search__dropdown{box-shadow:none !important}#bootstrap-theme .refine-search__placeholder{color:#555;padding-bottom:10px}.page-civicrm-activity .crm-search-tasks, .page-civicrm-case .crm-search-tasks{margin:20px 0;padding:18px 15px;background-color:#fff;box-shadow:0 3px 18px 0 rgba(48,40,40,0.25);border-radius:0}.page-civicrm-activity .crm-search-tasks .form-layout-compressed, .page-civicrm-case .crm-search-tasks .form-layout-compressed{margin:0}.page-civicrm-activity .crm-search-tasks .select2-container, .page-civicrm-case .crm-search-tasks .select2-container{width:180px !important}.page-civicrm-activity #searchForm{box-sizing:border-box}.page-civicrm-activity #searchForm tr:not(#activityCustom) td{padding:10px 20px}.page-civicrm-activity #searchForm tr:nth-child(n+8):nth-child(-n+9){display:none}.page-civicrm-activity #searchForm tr td{border:0 !important;padding:0}.page-civicrm-activity #searchForm tr td.font-size12pt{font-size:13px}.page-civicrm-activity #searchForm tr td .crm-button_qf_Search_refresh{float:right !important;margin:0}.page-civicrm-activity #searchForm tr td .crm-button_qf_Search_refresh>.crm-form-submit{margin-right:0 !important}.page-civicrm-activity #searchForm tr td .select2-choices, .page-civicrm-activity #searchForm tr td .select2-choice, .page-civicrm-activity #searchForm tr td #activity_subject{min-width:329px}.page-civicrm-activity #searchForm .crm-i{display:none}.page-civicrm-activity .ui-dialog .crm-submit-buttons{display:none}.page-civicrm-activity .ui-dialog table tr{border-bottom:0}.page-civicrm-activity .ui-dialog #Activity_Custom_Fields__1{border-bottom:none;padding:0}.page-civicrm-activity .ui-dialog #Activity_Custom_Fields__1 td.label{display:table-cell}.page-civicrm-activity .ui-dialog #Activity_Custom_Fields__1 .crm-accordion-wrapper{margin-left:5px;margin-right:0}.page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-block{box-shadow:none}.page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-custom_data, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-attachment, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-recurring_activity, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-schedule_followup{padding:0;margin-bottom:0}.page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-custom_data>td, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-custom_data #Activity_Custom_Fields__, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-attachment>td, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-attachment #Activity_Custom_Fields__, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-recurring_activity>td, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-recurring_activity #Activity_Custom_Fields__, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-schedule_followup>td, .page-civicrm-activity .ui-dialog .CRM_Activity_Form_Activity .crm-activity-form-block-schedule_followup #Activity_Custom_Fields__{padding:0 20px}.page-civicrm-case .font-size12pt{font-size:13px}.page-civicrm-case .font-size12pt label{width:212px;display:inline-block}.page-civicrm-case .crm-case-search-form-block tr td.crm-submit-buttons{padding:12.5px 20px}.page-civicrm-case .crm-case-search-form-block tr:nth-child(n+1):nth-child(-n+4)>td{padding:5px 20px}.page-civicrm-case .crm-case-search-form-block tr:nth-child(n+1):nth-child(-n+4)>td:first-child{width:220px;box-sizing:border-box}.page-civicrm-case .crm-case-search-form-block tr.crm-case-search-form-block-sort_name>td .crm-button_qf_Search_refresh{float:right !important}.page-civicrm-case .crm-case-search-form-block tr.crm-case-search-form-block-sort_name>td #_qf_Search_refresh-top{margin-right:0 !important}.page-civicrm-case .crm-case-search-form-block tr .crm-i{display:none}.page-civicrm-case .crm-case-search-form-block #Application{margin-left:-5px;margin-right:-5px}.page-civicrm-case .crm-case-search-form-block #Application .crm-accordion-body td{padding-left:0 !important}.page-civicrm-case .caseSelector>tbody>tr .dataTable tr>td:first-child, .page-civicrm-case .caseSelector>tbody>tr .dataTable tr>th:first-child{text-align:center}.page-civicrm-case .caseSelector>tbody>tr th a{color:#464354}.page-civicrm-case .caseSelector>tbody>tr .nestedActivitySelector td:nth-child(8){text-align:left !important}.page-civicrm-case .caseSelector>tbody>tr .paginate_button{line-height:normal}.page-civicrm-case .caseSelector>tbody>tr .ui-buttonset .ui-button{padding:5px 10px}.page-civicrm-vacancy .crm-container .form-layout-compressed .advmultiselect input[type='button']{margin:8px 20px !important}.page-civicrm-vacancy .crm-container .form-layout-compressed .advmultiselect input[type='button']:first-child{margin-right:0 !important}.page-civicrm-vacancy .crm-container .form-layout-compressed .advmultiselect tr:first-child td:nth-child(2){vertical-align:bottom;padding-bottom:4px}.page-civicrm-vacancy .crm-container .crm-block.crm-form-block .form-layout-compressed .crm-profile-selector-preview{margin-left:20px}.page-civicrm-vacancy .crm-container .crm-block.crm-form-block .form-layout-compressed .crm-profile-selector-preview .crm-i{display:none}.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block{padding-top:20px}.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed, .page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>fieldset{margin:20px}.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed{margin-top:0}.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed td>.select2-container, .page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed td>.crm-form-text, .page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-block>table.form-layout-compressed td>.crm-form-date-wrapper .crm-form-text:nth-child(2){min-width:200px}@media (max-width: 1200px) and (min-width: 768px){.page-civicrm-vacancy .CRM_HRRecruitment_Form_HRVacancy .crm-form-multiselect{min-width:160px;width:160px}}.page-civicrm-vacancy #addMorePermission{background:#0071bd;border-color:#0071bd;border-radius:3px;color:#fff;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;padding:8px 12px;text-shadow:none;text-transform:uppercase}.page-civicrm-vacancy #addMorePermission:hover{background:#58b7d1}.page-civicrm-vacancy #addMorePermission>.add-icon{background-image:none;text-indent:0;margin-right:3px}.page-civicrm-vacancy #addMorePermission>.add-icon:after{font-family:'FontAwesome';font-style:normal;text-rendering:auto;font-size:13px;content:"";color:#fff;position:relative;top:-1px}.page-civicrm-vacancy table.vacancy-popup{margin-bottom:20px}.page-civicrm-vacancy .view-hrvacancies .description{margin-bottom:20px}.page-civicrm-vacancy .view-hrvacancies td>a{color:#0071bd}.page-civicrm-vacancy .CRM_HRRecruitment_Form_Search .crm-search-form-block{margin-bottom:20px}.page-civicrm-vacancy #searchForm{padding:20px}.page-civicrm-vacancy #searchForm td{padding:0}.page-civicrm-vacancy #searchForm tr:nth-child(2) td{padding:20px 0}.page-civicrm-vacancy #searchForm #_qf_Search_refresh{margin-bottom:0 !important}.page-civicrm-vacancy #searchForm .listing-box{border-color:#4d4d69}.page-civicrm-vacancy #searchForm .listing-box>div{background-color:transparent}.page-civicrm-vacancy #searchForm .listing-box>div label{color:#4d4d69;font-weight:normal !important;padding:5px}.page-civicrm-vacancy #searchForm .font-size12pt{font-size:12px}.page-civicrm-vacancy #searchForm .crm-form-text{width:312px}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog{padding:0}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog-content{padding:0}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog-content .crm-block{box-shadow:none}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog table tr{border-bottom:0}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog table tr td{padding-left:0;border-bottom:0}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog .advmultiselect tr:first-child td:nth-child(2){vertical-align:top}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog .advmultiselect tr:first-child td:nth-child(2) input[type='button']:first-child{margin-left:0 !important;width:71px;display:block}.page-civicrm-vacancy.page-civicrm-vacancy-dashboard .ui-dialog .ui-dialog-buttonpane{margin:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-vacancy-summary>div:not(.collapsed) .crm-accordion-header::before{content:""}.page-civicrm-vacancy .hr-pipeline-tab .crm-accordion-header h2{color:#464354 !important;display:inline-block}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy{width:49%;margin-bottom:20px;border:1px solid #e8eef0;border-top-left-radius:4px;border-top-right-radius:4px;overflow:hidden}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div{padding:0;font-weight:normal}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table{width:100%;background-color:#fff;border:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr:nth-child(2) td{line-height:2em}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr td{color:#586277;padding:0 15px}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr td:not(:first-child){padding:10px 15px}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3{background-color:#4d4d69;padding:8px 15px}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3>a{color:#fff}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3>a .edit-icon{background-image:none;text-indent:0;top:-3px;margin:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3>a .edit-icon:after{font-family:'FontAwesome';font-style:normal;text-rendering:auto;font-size:13px;content:"";color:#fff}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table h3>a .edit-icon:hover:after{opacity:.8}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table .hr-stage{border-left:0 !important;width:auto;display:none}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table .hr-stage:first-child{display:block}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table .hr-stage a{font-weight:600;color:#0071bd;right:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr:first-child td{padding:0}.page-civicrm-vacancy .hr-pipeline-tab .hr-vacancy>div>table tr:nth-child(2){font-weight:600}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-recent-activity{border:1px solid transparent;overflow:hidden;border-radius:2px}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-recent-activity .hr-recent-activity-title{background-color:#4d4d69;padding:8px 15px;line-height:2em}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-recent-activity .row-highlight{width:calc(100% + 1px)}.page-civicrm-vacancy .hr-pipeline-tab .hr-dashboard-recent-activity .row-highlight tr .hr-recent-activity-block{font-size:13px;color:#586277}.page-civicrm-vacancy .CRM_HRRecruitment_Form_Application .crm-profile-name-application_profile{padding:20px}.page-civicrm-vacancy .CRM_HRRecruitment_Form_Application .crm-profile-name-application_profile legend{padding-top:20px}#bootstrap-theme .nav-pills-horizontal{margin-bottom:15px}#bootstrap-theme .panel-body-section{padding:15px 20px;padding-bottom:0;padding-top:0}#bootstrap-theme .panel-default-inverted>.panel-body{background:#ffffff}#bootstrap-theme .panel-default-inverted>.panel-footer, #bootstrap-theme .panel-default-inverted>.panel-heading{background:#fafbfc}#bootstrap-theme .panel-default-plain>.panel-heading, #bootstrap-theme .panel-default-plain-inverted>.panel-heading{padding-bottom:0}#bootstrap-theme .panel-default-plain>.panel-heading>hr, #bootstrap-theme .panel-default-plain-inverted>.panel-heading>hr{margin:15px 20px;margin-bottom:0;margin-left:0;margin-right:0}#bootstrap-theme .panel-default-plain>.panel-body{background:#ffffff}#bootstrap-theme .panel-default-plain>.panel-footer{background:#fafbfc}#bootstrap-theme .panel-default-plain-inverted>.panel-heading{background:#fafbfc} #civihr-menu{background:#fff;box-shadow:0 3px 18px 0 rgba(70,67,84,0.25);position:fixed;top:0;width:100%;z-index:1000} #civihr-menu #civicrm-menu{box-shadow:none;float:left;position:static !important;width:auto} #civihr-menu .chr_user-menu{float:right}@font-face{font-family:'icomoon';src:url("../fonts/icomoon.ttf?tozcjz") format("truetype"),url("../fonts/icomoon.woff?tozcjz") format("woff"),url("../fonts/icomoon.svg?tozcjz#icomoon") format("svg");font-weight:normal;font-style:normal} .chr_logo{display:inline-block;font-family:'icomoon' !important;font-size:1em;font-style:normal;font-weight:normal;font-variant:normal;line-height:1;position:relative;text-transform:none;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} .chr_logo:after{color:inherit;content:"\e900";margin-left:0.45em} .chr_logo:before{color:inherit;content:"\e901";left:0;position:absolute;top:0} .chr_logo--default-color:after{color:#82BD58} .chr_logo--default-color:before{color:#1B6F90} .chr_logo--default-color.chr_logo--full>i:after{color:#026085} .chr_logo--default-size{font-size:20px} .chr_logo--full:after{left:0;position:absolute;top:0} .chr_logo--full>i:after{bottom:.2em;color:inherit;content:"\e902";font-size:.7em;font-style:normal;margin-left:2.4em;position:relative} .chr_scroll-lock{height:100% !important;overflow:hidden !important;width:100% !important} .chr_profile-card{display:inline-block} .chr_profile-card__name{display:table-cell;vertical-align:middle} .chr_profile-card__picture{display:table-cell;overflow:hidden;vertical-align:middle} .chr_profile-card__picture>img{background:#e8eef0;border-radius:50%;width:100%;vertical-align:middle} .chr_profile-card__picture+.chr_profile-card__name{padding-left:15px} .chr_profile-card__picture--small>img{height:34px;width:34px} .spinner{animation:spin 1.5s linear infinite;background:url("../img/spinner.svg") no-repeat center center !important;display:block;height:32px;margin:auto;width:32px}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}} .chr_user-menu{color:#464354;cursor:default;line-height:60px;padding:0 10px;position:relative} .chr_user-menu:hover{background:#f3f6f7} .chr_user-menu:hover>.chr_user-menu__dropdown{display:block} .chr_user-menu__data>.chr_profile-card{margin:-2px 8px 0 8px;vertical-align:top}@media (max-width: 1250px){ .chr_user-menu__data>.chr_user-menu__arrow{display:none}} .chr_user-menu__dropdown{background:#fff;display:none;position:absolute;right:0;z-index:99} .chr_user-menu__dropdown ul{list-style-type:none;margin:0} .chr_user-menu__dropdown li{line-height:50px;white-space:nowrap} .chr_user-menu__dropdown li>a, .chr_user-menu__dropdown li>span{padding:0 30px 0 20px} .chr_user-menu__dropdown a{color:#464354;display:block} .chr_user-menu__dropdown a:hover{background:#f3f6f7;color:#464354;text-decoration:none} .chr_user-menu__dropdown a>i{margin-right:10px} .chr_user-menu__dropdown__username{color:#464354} .chr_user-menu__dropdown__username:after{border-top:1px solid #d3dee2;content:'';display:block;height:0;margin:0 30px 0 20px} #civicrm-menu li.menumain.crm-Self_Service_Portal>a{border:1px solid #4d4d69;border-radius:2px;font-weight:600;height:35px;line-height:35px;padding:0 15px;margin-top:12px;text-transform:uppercase} #civicrm-menu li.menumain.crm-Self_Service_Portal>a:hover{background:#3e3e54;color:#fff} .crm-link-home .chr_logo{font-size:17px;margin-right:6px;vertical-align:sub} .crm-container .dataTables_processing, .crm-container .blockUI.blockOverlay{animation:spin 1.5s linear infinite;background:url("../img/spinner.svg") no-repeat center center !important;display:block;height:32px !important;margin:auto;width:32px !important;margin:8% 50% !important;opacity:1 !important}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}} diff --git a/org.civicrm.bootstrapcivihr/info.xml b/org.civicrm.bootstrapcivihr/info.xml index d5340929228..b06c8433577 100644 --- a/org.civicrm.bootstrapcivihr/info.xml +++ b/org.civicrm.bootstrapcivihr/info.xml @@ -8,8 +8,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/org.civicrm.bootstrapcivihr/package-lock.json b/org.civicrm.bootstrapcivihr/package-lock.json index 15d15490183..bd8fed834af 100644 --- a/org.civicrm.bootstrapcivihr/package-lock.json +++ b/org.civicrm.bootstrapcivihr/package-lock.json @@ -10,6 +10,15 @@ "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", "dev": true }, + "ansi-colors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", + "dev": true, + "requires": { + "ansi-wrap": "^0.1.0" + } + }, "ansi-cyan": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", @@ -55,6 +64,25 @@ "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", "dev": true }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "append-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/append-buffer/-/append-buffer-1.0.2.tgz", + "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=", + "dev": true, + "requires": { + "buffer-equal": "^1.0.0" + } + }, "archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", @@ -76,24 +104,36 @@ "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", "dev": true }, + "arr-filter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/arr-filter/-/arr-filter-1.1.2.tgz", + "integrity": "sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4=", + "dev": true, + "requires": { + "make-iterator": "^1.0.0" + } + }, "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, + "arr-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/arr-map/-/arr-map-2.0.2.tgz", + "integrity": "sha1-Onc0X/wc814qkYJWAfnljy4kysQ=", + "dev": true, + "requires": { + "make-iterator": "^1.0.0" + } + }, "arr-union": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, - "array-differ": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", - "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", - "dev": true - }, "array-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", @@ -106,17 +146,65 @@ "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true }, + "array-initial": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", + "integrity": "sha1-L6dLJnOTccOUe9enrcc74zSz15U=", + "dev": true, + "requires": { + "array-slice": "^1.0.0", + "is-number": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, + "array-last": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/array-last/-/array-last-1.3.0.tgz", + "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==", + "dev": true, + "requires": { + "is-number": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, "array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", "dev": true }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true + "array-sort": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-1.0.0.tgz", + "integrity": "sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg==", + "dev": true, + "requires": { + "default-compare": "^1.0.0", + "get-value": "^2.0.6", + "kind-of": "^5.0.2" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } }, "array-unique": { "version": "0.3.2", @@ -130,12 +218,56 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, + "async-done": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.1.tgz", + "integrity": "sha512-R1BaUeJ4PMoLNJuk+0tLJgjmEqVsdN118+Z8O+alhnQDQgy0kmD5Mqi0DNEmMx2LM0Ed5yekKu+ZXYvIHceicg==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.2", + "process-nextick-args": "^1.0.7", + "stream-exhaust": "^1.0.1" + } + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "async-settle": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz", + "integrity": "sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs=", + "dev": true, + "requires": { + "async-done": "^1.2.2" + } + }, "atob": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", - "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", + "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", "dev": true }, + "bach": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", + "integrity": "sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA=", + "dev": true, + "requires": { + "arr-filter": "^1.1.1", + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "array-each": "^1.0.0", + "array-initial": "^1.0.0", + "array-last": "^1.1.1", + "async-done": "^1.2.2", + "async-settle": "^1.0.0", + "now-and-later": "^2.0.0" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -155,6 +287,46 @@ "isobject": "^3.0.1", "mixin-deep": "^1.2.0", "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } } }, "base64-js": { @@ -163,16 +335,16 @@ "integrity": "sha1-EQHpVE9KdrG8OybUUsqW16NeeXg=", "dev": true }, - "beeper": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", - "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", + "binary-extensions": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", "dev": true }, "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -180,14 +352,13 @@ } }, "braces": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz", - "integrity": "sha512-P4O8UQRdGiMLWSizsApmXVQDBS6KCt7dSexgLKBmH5Hr1CZq7vsnscFh8oR1sP1ab1Zj0uCHCEzZeV6SfUf3rA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "dev": true, "requires": { "arr-flatten": "^1.1.0", "array-unique": "^0.3.2", - "define-property": "^1.0.0", "extend-shallow": "^2.0.1", "fill-range": "^4.0.0", "isobject": "^3.0.1", @@ -196,8 +367,31 @@ "snapdragon-node": "^2.0.1", "split-string": "^3.0.2", "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } } }, + "buffer-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", + "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -250,6 +444,27 @@ "supports-color": "^2.0.0" } }, + "chokidar": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", + "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.0", + "braces": "^2.3.0", + "fsevents": "^1.2.2", + "glob-parent": "^3.1.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "lodash.debounce": "^4.0.8", + "normalize-path": "^2.1.1", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0", + "upath": "^1.0.5" + } + }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -270,77 +485,103 @@ "requires": { "is-descriptor": "^0.1.0" } + } + } + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", + "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + }, + "cloneable-readable": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz", + "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "safe-buffer": "~5.1.0" } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true } } }, - "clone": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.3.tgz", - "integrity": "sha1-KY1+IjFmD0DAA8LtMUDezz9TCF8=", + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, - "clone-stats": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", - "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", - "dev": true + "collection-map": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-map/-/collection-map-1.0.0.tgz", + "integrity": "sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw=", + "dev": true, + "requires": { + "arr-map": "^2.0.2", + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } }, "collection-visit": { "version": "1.0.0", @@ -385,12 +626,78 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "convert-source-map": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", + "dev": true + }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "dev": true }, + "copy-props": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz", + "integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==", + "dev": true, + "requires": { + "each-props": "^1.3.0", + "is-plain-object": "^2.0.1" + } + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -429,13 +736,16 @@ "array-find-index": "^1.0.1" } }, - "dateformat": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", - "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=", - "dev": true - }, - "debug": { + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "^0.10.9" + } + }, + "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", @@ -456,29 +766,78 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "default-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz", + "integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==", "dev": true, "requires": { - "clone": "^1.0.2" + "kind-of": "^5.0.2" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } } }, - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "default-resolution": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", + "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", "dev": true, "requires": { - "is-descriptor": "^1.0.0" + "object-keys": "^1.0.12" } }, - "deprecated": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/deprecated/-/deprecated-0.0.1.tgz", - "integrity": "sha1-+cmvVGSvoeepcUWKi97yqpTVuxk=", - "dev": true + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } }, "detect-file": { "version": "1.0.0", @@ -501,13 +860,73 @@ "readable-stream": "~1.1.9" } }, + "duplexify": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", + "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", + "dev": true, + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "each-props": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz", + "integrity": "sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.1", + "object.defaults": "^1.1.0" + } + }, "end-of-stream": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz", - "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "~1.3.0" + "once": "^1.4.0" } }, "error-ex": { @@ -519,6 +938,50 @@ "is-arrayish": "^0.2.1" } }, + "es5-ext": { + "version": "0.10.46", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz", + "integrity": "sha512-24XxRvJXNFwEMpJb3nOkiRJKRoupmjYmOPVlI65Qy2SrtxwOTB+g6ODjBKOtwEHbYrhWRty9xxOWLNdClT2djw==", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "1" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "es6-weak-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", + "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.14", + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -570,62 +1033,14 @@ "is-descriptor": "^0.1.0" } }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "is-extendable": "^0.1.0" } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true } } }, @@ -639,18 +1054,30 @@ } }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } } }, "extglob": { @@ -667,6 +1094,55 @@ "regex-not": "^1.0.0", "snapdragon": "^0.8.1", "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } } }, "fancy-log": { @@ -690,14 +1166,19 @@ "is-number": "^3.0.0", "repeat-string": "^1.6.1", "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } } }, - "find-index": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", - "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=", - "dev": true - }, "find-up": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", @@ -718,6 +1199,17 @@ "is-glob": "^3.1.0", "micromatch": "^3.0.4", "resolve-dir": "^1.0.1" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } } }, "fined": { @@ -733,57 +1225,647 @@ "parse-filepath": "^1.0.1" } }, - "first-chunk-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", - "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", - "dev": true - }, - "flagged-respawn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz", - "integrity": "sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c=", - "dev": true - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "flagged-respawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz", + "integrity": "sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c=", + "dev": true + }, + "flush-write-stream": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", + "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.4" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "dev": true + }, + "fs-mkdirp-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", + "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "through2": "^2.0.3" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.21", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": "^2.1.0" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.5.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true, + "dev": true + } + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "from": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", - "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, - "gaze": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", - "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", - "dev": true, - "requires": { - "globule": "~0.1.0" - } - }, "get-stdin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", @@ -797,71 +1879,106 @@ "dev": true }, "glob": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", - "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { + "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^2.0.1", - "once": "^1.3.0" + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } } }, "glob-stream": { - "version": "3.1.18", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", - "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", + "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", "dev": true, "requires": { - "glob": "^4.3.1", - "glob2base": "^0.0.12", - "minimatch": "^2.0.1", - "ordered-read-streams": "^0.1.0", - "through2": "^0.6.1", - "unique-stream": "^1.0.0" + "extend": "^3.0.0", + "glob": "^7.1.1", + "glob-parent": "^3.1.0", + "is-negated-glob": "^1.0.0", + "ordered-read-streams": "^1.0.0", + "pumpify": "^1.3.5", + "readable-stream": "^2.1.5", + "remove-trailing-separator": "^1.0.1", + "to-absolute-glob": "^2.0.0", + "unique-stream": "^2.0.2" }, "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "safe-buffer": "~5.1.0" } } } }, "glob-watcher": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", - "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", - "dev": true, - "requires": { - "gaze": "^0.5.1" - } - }, - "glob2base": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", - "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.1.tgz", + "integrity": "sha512-fK92r2COMC199WCyGUblrZKhjra3cyVMDiypDdqg1vsSDmexnbYivK1kNR4QItiNXLKmGlqan469ks67RtNa2g==", "dev": true, "requires": { - "find-index": "^0.1.1" + "async-done": "^1.2.0", + "chokidar": "^2.0.0", + "just-debounce": "^1.0.0", + "object.defaults": "^1.1.0" } }, "global-modules": { @@ -888,89 +2005,59 @@ "which": "^1.2.14" } }, - "globule": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", - "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", - "dev": true, - "requires": { - "glob": "~3.1.21", - "lodash": "~1.0.1", - "minimatch": "~0.2.11" - }, - "dependencies": { - "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", - "dev": true, - "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" - } - }, - "graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", - "dev": true - }, - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", - "dev": true - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "dev": true, - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, "glogg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.0.tgz", - "integrity": "sha1-f+DxmfV6yQbPUS/urY+Q7kooT8U=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", + "integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==", "dev": true, "requires": { "sparkles": "^1.0.0" } }, "graceful-fs": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", - "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", - "dev": true, - "requires": { - "natives": "^1.1.0" - } + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true }, "gulp": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz", - "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", - "dev": true, - "requires": { - "archy": "^1.0.0", - "chalk": "^1.0.0", - "deprecated": "^0.0.1", - "gulp-util": "^3.0.0", - "interpret": "^1.0.0", - "liftoff": "^2.1.0", - "minimist": "^1.1.0", - "orchestrator": "^0.3.0", - "pretty-hrtime": "^1.0.0", - "semver": "^4.1.0", - "tildify": "^1.0.0", - "v8flags": "^2.0.2", - "vinyl-fs": "^0.3.0" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.0.tgz", + "integrity": "sha1-lXZsYB2t5Kd+0+eyttwDiBtZY2Y=", + "dev": true, + "requires": { + "glob-watcher": "^5.0.0", + "gulp-cli": "^2.0.0", + "undertaker": "^1.0.0", + "vinyl-fs": "^3.0.0" + }, + "dependencies": { + "gulp-cli": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.0.1.tgz", + "integrity": "sha512-RxujJJdN8/O6IW2nPugl7YazhmrIEjmiVfPKrWt68r71UCaLKS71Hp0gpKT+F6qOUFtr7KqtifDKaAJPRVvMYQ==", + "dev": true, + "requires": { + "ansi-colors": "^1.0.1", + "archy": "^1.0.0", + "array-sort": "^1.0.0", + "color-support": "^1.1.3", + "concat-stream": "^1.6.0", + "copy-props": "^2.0.1", + "fancy-log": "^1.3.2", + "gulplog": "^1.0.0", + "interpret": "^1.1.0", + "isobject": "^3.0.1", + "liftoff": "^2.5.0", + "matchdep": "^2.0.0", + "mute-stdout": "^1.0.0", + "pretty-hrtime": "^1.0.0", + "replace-homedir": "^1.0.0", + "semver-greatest-satisfied-range": "^1.1.0", + "v8flags": "^3.0.1", + "yargs": "^7.1.0" + } + } } }, "gulp-postcss": { @@ -1189,32 +2276,6 @@ } } }, - "gulp-util": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz", - "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", - "dev": true, - "requires": { - "array-differ": "^1.0.0", - "array-uniq": "^1.0.2", - "beeper": "^1.0.0", - "chalk": "^1.0.0", - "dateformat": "^2.0.0", - "fancy-log": "^1.1.0", - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "lodash._reescape": "^3.0.0", - "lodash._reevaluate": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.template": "^3.0.0", - "minimist": "^1.1.0", - "multipipe": "^0.1.2", - "object-assign": "^3.0.0", - "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl": "^0.5.0" - } - }, "gulplog": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", @@ -1239,14 +2300,11 @@ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, - "has-gulplog": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", - "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true }, "has-value": { "version": "1.0.0", @@ -1332,6 +2390,12 @@ "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", "dev": true }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", @@ -1343,12 +2407,23 @@ } }, "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } } }, "is-arrayish": { @@ -1357,6 +2432,15 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -1373,23 +2457,42 @@ } }, "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } } }, "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } } }, "is-directory": { @@ -1419,15 +2522,30 @@ "number-is-nan": "^1.0.0" } }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", "dev": true, "requires": { - "is-extglob": "^2.1.0" + "is-extglob": "^2.1.1" } }, + "is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", + "dev": true + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -1448,15 +2566,6 @@ } } }, - "is-odd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", - "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", - "dev": true, - "requires": { - "is-number": "^3.0.0" - } - }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -1490,10 +2599,16 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, + "is-valid-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", + "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=", + "dev": true + }, "is-windows": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz", - "integrity": "sha1-MQ23D3QtJZoWo2kgK1GvhCMzENk=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, "isarray": { @@ -1530,19 +2645,106 @@ "esprima": "^4.0.0" } }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "just-debounce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", + "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", + "dev": true + }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, - "lazy-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", - "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", + "last-run": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", + "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=", + "dev": true, + "requires": { + "default-resolution": "^2.0.0", + "es6-weak-map": "^2.0.1" + } + }, + "lazystream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", + "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", + "dev": true, + "requires": { + "readable-stream": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "lead": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", + "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", "dev": true, "requires": { - "set-getter": "^0.1.0" + "flush-write-stream": "^1.0.2" } }, "liftoff": { @@ -1591,30 +2793,6 @@ } } }, - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", - "dev": true - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basetostring": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", - "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", - "dev": true - }, - "lodash._basevalues": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", - "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", - "dev": true - }, "lodash._escapehtmlchar": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/lodash._escapehtmlchar/-/lodash._escapehtmlchar-2.4.1.tgz", @@ -1630,24 +2808,12 @@ "integrity": "sha1-7P4iYYoq3lC/7qQ5N+Ud9m8O23I=", "dev": true }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, "lodash._htmlescapes": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/lodash._htmlescapes/-/lodash._htmlescapes-2.4.1.tgz", "integrity": "sha1-MtFL8IRLbeb4tioFG09nwii2JMs=", "dev": true }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, "lodash._isnative": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/lodash._isnative/-/lodash._isnative-2.4.1.tgz", @@ -1660,24 +2826,6 @@ "integrity": "sha1-fAt/admKH3ZSn4kLDNsbTf7BHBE=", "dev": true }, - "lodash._reescape": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", - "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", - "dev": true - }, - "lodash._reevaluate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", - "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", - "dev": true - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "dev": true - }, "lodash._reunescapedhtml": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/lodash._reunescapedhtml/-/lodash._reunescapedhtml-2.4.1.tgz", @@ -1701,12 +2849,6 @@ } } }, - "lodash._root": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", - "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", - "dev": true - }, "lodash._shimkeys": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/lodash._shimkeys/-/lodash._shimkeys-2.4.1.tgz", @@ -1716,6 +2858,12 @@ "lodash._objecttypes": "~2.4.1" } }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, "lodash.defaults": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-2.4.1.tgz", @@ -1739,27 +2887,6 @@ } } }, - "lodash.escape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", - "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", - "dev": true, - "requires": { - "lodash._root": "^3.0.0" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, "lodash.isobject": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-2.4.1.tgz", @@ -1769,50 +2896,6 @@ "lodash._objecttypes": "~2.4.1" } }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, - "lodash.restparam": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", - "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", - "dev": true - }, - "lodash.template": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", - "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", - "dev": true, - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", - "lodash._basevalues": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0", - "lodash.keys": "^3.0.0", - "lodash.restparam": "^3.0.0", - "lodash.templatesettings": "^3.0.0" - } - }, - "lodash.templatesettings": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", - "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" - } - }, "lodash.values": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/lodash.values/-/lodash.values-2.4.1.tgz", @@ -1845,30 +2928,13 @@ "signal-exit": "^3.0.0" } }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", - "dev": true - }, "make-iterator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.0.tgz", - "integrity": "sha1-V7713IXSOSO6I3ZzJNjo+PPZaUs=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", "dev": true, "requires": { - "kind-of": "^3.1.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } + "kind-of": "^6.0.2" } }, "map-cache": { @@ -1898,6 +2964,18 @@ "object-visit": "^1.0.0" } }, + "matchdep": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz", + "integrity": "sha1-xvNINKDY28OzfCfui7yyfHd1WC4=", + "dev": true, + "requires": { + "findup-sync": "^2.0.0", + "micromatch": "^3.0.4", + "resolve": "^1.4.0", + "stack-trace": "0.0.10" + } + }, "meow": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", @@ -1925,33 +3003,33 @@ } }, "micromatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.5.tgz", - "integrity": "sha512-ykttrLPQrz1PUJcXjwsTUjGoPJ64StIGNE2lGVD1c9CuguJ+L7/navsE8IcDNndOoCMvYV0qc/exfVbMHkUhvA==", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "dev": true, "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", - "braces": "^2.3.0", - "define-property": "^1.0.0", - "extend-shallow": "^2.0.1", - "extglob": "^2.0.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", "fragment-cache": "^0.2.1", - "kind-of": "^6.0.0", - "nanomatch": "^1.2.5", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", "object.pick": "^1.3.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "to-regex": "^3.0.2" } }, "minimatch": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "^1.0.0" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -1961,9 +3039,9 @@ "dev": true }, "mixin-deep": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.0.tgz", - "integrity": "sha512-dgaCvoh6i1nosAUBKb0l0pfJ78K8+S9fluyIR2YvAeUD/QuMahnFnF3xYty5eYXMjhGSsB0DsW6A0uAZyetoAg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", "dev": true, "requires": { "for-in": "^1.0.2", @@ -1981,23 +3059,6 @@ } } }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -2013,37 +3074,42 @@ "duplexer2": "0.0.2" } }, + "mute-stdout": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.0.tgz", + "integrity": "sha1-WzLqB+tDyd7WEwQ0z5JvRrKn/U0=", + "dev": true + }, + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "dev": true, + "optional": true + }, "nanomatch": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.7.tgz", - "integrity": "sha512-/5ldsnyurvEw7wNpxLFgjVvBLMta43niEYOy0CJ4ntcYSbx6bugRUTQeFb4BR/WanEL1o3aQgHuVLHQaB6tOqg==", + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", "dev": true, "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "extend-shallow": "^2.0.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", "fragment-cache": "^0.2.1", - "is-odd": "^1.0.0", - "kind-of": "^5.0.2", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", "object.pick": "^1.3.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", "to-regex": "^3.0.1" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } } }, - "natives": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz", - "integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==", + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, "normalize-package-data": { @@ -2058,18 +3124,30 @@ "validate-npm-package-license": "^3.0.1" } }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "now-and-later": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.0.tgz", + "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", + "dev": true, + "requires": { + "once": "^1.3.2" + } + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, - "object-assign": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", - "dev": true - }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -2090,43 +3168,6 @@ "is-descriptor": "^0.1.0" } }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -2138,6 +3179,12 @@ } } }, + "object-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "dev": true + }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -2147,6 +3194,18 @@ "isobject": "^3.0.0" } }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, "object.defaults": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", @@ -2178,38 +3237,87 @@ "isobject": "^3.0.1" } }, + "object.reduce": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.reduce/-/object.reduce-1.0.1.tgz", + "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, "once": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", - "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1" } }, - "orchestrator": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", - "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", + "ordered-read-streams": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", + "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", "dev": true, "requires": { - "end-of-stream": "~0.1.5", - "sequencify": "~0.0.7", - "stream-consume": "~0.1.0" + "readable-stream": "^2.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } } }, - "ordered-read-streams": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz", - "integrity": "sha1-/VZamvjrRHO6abbtijQ1LLVS8SY=", - "dev": true - }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "^1.0.0" + } + }, "parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", @@ -2252,6 +3360,12 @@ "util": "^0.10.3" } }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, "path-exists": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", @@ -2261,10 +3375,16 @@ "pinkie-promise": "^2.0.0" } }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, "path-root": { @@ -2560,6 +3680,27 @@ "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "dev": true }, + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + } + }, "read-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", @@ -2593,6 +3734,56 @@ "string_decoder": "~0.10.x" } }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -2613,14 +3804,42 @@ } }, "regex-not": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", - "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "remove-bom-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", + "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", + "dev": true, + "requires": { + "is-buffer": "^1.1.5", + "is-utf8": "^0.2.1" + } + }, + "remove-bom-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz", + "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", "dev": true, "requires": { - "extend-shallow": "^2.0.1" + "remove-bom-buffer": "^3.0.0", + "safe-buffer": "^5.1.0", + "through2": "^2.0.3" } }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, "repeat-element": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", @@ -2643,9 +3862,26 @@ } }, "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true + }, + "replace-homedir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-1.0.0.tgz", + "integrity": "sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1", + "is-absolute": "^1.0.0", + "remove-trailing-separator": "^1.1.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-from-string": { @@ -2654,10 +3890,16 @@ "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=", "dev": true }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, "resolve": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", "dev": true, "requires": { "path-parse": "^1.0.5" @@ -2673,39 +3915,69 @@ "global-modules": "^1.0.0" } }, + "resolve-options": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz", + "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", + "dev": true, + "requires": { + "value-or-function": "^3.0.0" + } + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, "semver": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", "dev": true }, - "sequencify": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", - "integrity": "sha1-kM/xnQLgcCf9dn9erT57ldHnOAw=", - "dev": true - }, - "set-getter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", - "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", + "semver-greatest-satisfied-range": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz", + "integrity": "sha1-E+jCZYq5aRywzXEJMkAoDTb3els=", "dev": true, "requires": { - "to-object-path": "^0.3.0" + "sver-compat": "^1.5.0" } }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", @@ -2716,14 +3988,19 @@ "is-extendable": "^0.1.1", "is-plain-object": "^2.0.3", "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } } }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", - "dev": true - }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -2731,9 +4008,9 @@ "dev": true }, "snapdragon": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", - "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", "dev": true, "requires": { "base": "^0.11.1", @@ -2743,7 +4020,7 @@ "map-cache": "^0.2.2", "source-map": "^0.5.6", "source-map-resolve": "^0.5.0", - "use": "^2.0.0" + "use": "^3.1.0" }, "dependencies": { "define-property": { @@ -2755,62 +4032,14 @@ "is-descriptor": "^0.1.0" } }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "is-extendable": "^0.1.0" } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true } } }, @@ -2823,6 +4052,46 @@ "define-property": "^1.0.0", "isobject": "^3.0.0", "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } } }, "snapdragon-util": { @@ -2852,12 +4121,12 @@ "dev": true }, "source-map-resolve": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", - "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", "dev": true, "requires": { - "atob": "^2.0.0", + "atob": "^2.1.1", "decode-uri-component": "^0.2.0", "resolve-url": "^0.2.1", "source-map-url": "^0.4.0", @@ -2871,9 +4140,9 @@ "dev": true }, "sparkles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", - "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz", + "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==", "dev": true }, "spdx-correct": { @@ -2913,27 +4182,6 @@ "dev": true, "requires": { "extend-shallow": "^3.0.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } } }, "sprintf-js": { @@ -2942,81 +4190,30 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", + "dev": true + }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", "dev": true, "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "is-descriptor": "^0.1.0" } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true } } }, @@ -3029,12 +4226,29 @@ "duplexer": "~0.1.1" } }, - "stream-consume": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.0.tgz", - "integrity": "sha1-pB6tGm1ggc63n2WwYZAbbY89HQ8=", + "stream-exhaust": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", + "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", + "dev": true + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", "dev": true }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", @@ -3050,16 +4264,6 @@ "ansi-regex": "^2.0.0" } }, - "strip-bom": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", - "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", - "dev": true, - "requires": { - "first-chunk-stream": "^1.0.0", - "is-utf8": "^0.2.0" - } - }, "strip-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", @@ -3075,6 +4279,16 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "sver-compat": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz", + "integrity": "sha1-PPh9/rTQe0o/FIJ7wYaz/QxkXNg=", + "dev": true, + "requires": { + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" + } + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -3097,25 +4311,31 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", + "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", + "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { "safe-buffer": "~5.1.0" @@ -3123,13 +4343,14 @@ } } }, - "tildify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", - "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", + "through2-filter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", + "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", "dev": true, "requires": { - "os-homedir": "^1.0.0" + "through2": "~2.0.0", + "xtend": "~4.0.0" } }, "time-stamp": { @@ -3138,6 +4359,16 @@ "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", "dev": true }, + "to-absolute-glob": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", + "dev": true, + "requires": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + } + }, "to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", @@ -3159,82 +4390,15 @@ } }, "to-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", - "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", "dev": true, "requires": { - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "regex-not": "^1.0.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" } }, "to-regex-range": { @@ -3247,18 +4411,56 @@ "repeat-string": "^1.6.1" } }, + "to-through": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-through/-/to-through-2.0.0.tgz", + "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", + "dev": true, + "requires": { + "through2": "^2.0.3" + } + }, "trim-newlines": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", "dev": true }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, + "undertaker": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.0.tgz", + "integrity": "sha1-M52kZGJS0ILcN45wgGcpl1DhG0k=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "bach": "^1.0.0", + "collection-map": "^1.0.0", + "es6-weak-map": "^2.0.1", + "last-run": "^1.1.0", + "object.defaults": "^1.0.0", + "object.reduce": "^1.0.0", + "undertaker-registry": "^1.0.0" + } + }, + "undertaker-registry": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-1.0.1.tgz", + "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=", + "dev": true + }, "union-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", @@ -3271,6 +4473,15 @@ "set-value": "^0.4.3" }, "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, "set-value": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", @@ -3286,10 +4497,14 @@ } }, "unique-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", - "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=", - "dev": true + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz", + "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", + "dev": true, + "requires": { + "json-stable-stringify": "^1.0.0", + "through2-filter": "^2.0.0" + } }, "unset-value": { "version": "1.0.0", @@ -3337,6 +4552,12 @@ } } }, + "upath": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", + "dev": true + }, "urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", @@ -3344,88 +4565,9 @@ "dev": true }, "use": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", - "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "lazy-cache": "^2.0.2" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "user-home": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", - "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, "util": { @@ -3452,12 +4594,12 @@ "dev": true }, "v8flags": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", - "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.1.tgz", + "integrity": "sha512-iw/1ViSEaff8NJ3HLyEjawk/8hjJib3E7pvG4pddVXfUg1983s3VGsiClDjhK64MQVDGqc1Q8r18S4VKQZS9EQ==", "dev": true, "requires": { - "user-home": "^1.1.1" + "homedir-polyfill": "^1.0.1" } }, "validate-npm-package-license": { @@ -3470,73 +4612,112 @@ "spdx-expression-parse": "~1.0.0" } }, + "value-or-function": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz", + "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=", + "dev": true + }, "vinyl": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", - "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + }, + "dependencies": { + "clone-stats": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + } } }, "vinyl-fs": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz", - "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", - "dev": true, - "requires": { - "defaults": "^1.0.0", - "glob-stream": "^3.1.5", - "glob-watcher": "^0.0.6", - "graceful-fs": "^3.0.0", - "mkdirp": "^0.5.0", - "strip-bom": "^1.0.0", - "through2": "^0.6.1", - "vinyl": "^0.4.0" + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz", + "integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==", + "dev": true, + "requires": { + "fs-mkdirp-stream": "^1.0.0", + "glob-stream": "^6.1.0", + "graceful-fs": "^4.0.0", + "is-valid-glob": "^1.0.0", + "lazystream": "^1.0.0", + "lead": "^1.0.0", + "object.assign": "^4.0.4", + "pumpify": "^1.3.5", + "readable-stream": "^2.3.3", + "remove-bom-buffer": "^3.0.0", + "remove-bom-stream": "^1.2.0", + "resolve-options": "^1.1.0", + "through2": "^2.0.0", + "to-through": "^2.0.0", + "value-or-function": "^3.0.0", + "vinyl": "^2.0.0", + "vinyl-sourcemap": "^1.1.0" }, "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true }, "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", - "dev": true, - "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "vinyl": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", - "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" + "safe-buffer": "~5.1.0" } } } }, + "vinyl-sourcemap": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz", + "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", + "dev": true, + "requires": { + "append-buffer": "^1.0.2", + "convert-source-map": "^1.5.0", + "graceful-fs": "^4.1.6", + "normalize-path": "^2.1.1", + "now-and-later": "^2.0.0", + "remove-bom-buffer": "^3.0.0", + "vinyl": "^2.0.0" + } + }, "vinyl-sourcemaps-apply": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", @@ -3547,14 +4728,30 @@ } }, "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { "isexe": "^2.0.0" } }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -3566,6 +4763,58 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yargs": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", + "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "dev": true, + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^5.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + } + } + }, + "yargs-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", + "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "dev": true, + "requires": { + "camelcase": "^3.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + } + } } } } diff --git a/org.civicrm.bootstrapcivihr/package.json b/org.civicrm.bootstrapcivihr/package.json index 5bcbbdfb182..9dc48599c6c 100644 --- a/org.civicrm.bootstrapcivihr/package.json +++ b/org.civicrm.bootstrapcivihr/package.json @@ -9,7 +9,7 @@ "author": "", "license": "ISC", "devDependencies": { - "gulp": "^3.9.1", + "gulp": "^4.0.0", "gulp-postcss": "^7.0.1", "gulp-transform-selectors": "0.0.2", "path": "^0.12.7", diff --git a/org.civicrm.bootstrapcivihr/scss/civihr.scss b/org.civicrm.bootstrapcivihr/scss/civihr.scss index 204708e43ec..fea63c3ef46 100644 --- a/org.civicrm.bootstrapcivihr/scss/civihr.scss +++ b/org.civicrm.bootstrapcivihr/scss/civihr.scss @@ -8,7 +8,8 @@ @import 'overrides/crm/*'; @import 'overrides/style/*'; @import 'components/*'; -@import 'common/*'; +@import 'components/civihr-ui-select/**/*'; +@import 'common/**/*'; @import 'pages/*'; @import 'overrides/style/*'; diff --git a/org.civicrm.bootstrapcivihr/scss/mixins/_spinner.scss b/org.civicrm.bootstrapcivihr/scss/mixins/_spinner.scss index 8e0e002fc07..17a790b62af 100644 --- a/org.civicrm.bootstrapcivihr/scss/mixins/_spinner.scss +++ b/org.civicrm.bootstrapcivihr/scss/mixins/_spinner.scss @@ -6,7 +6,7 @@ */ @mixin spinner($force-size: 'false', $speed: 1.5s, $size: 32px) { animation: spin $speed linear infinite; - background: url(../img/spinner.svg) no-repeat center center !important; + background: url($crm-image-path + 'spinner.svg') no-repeat center center !important; display: block; height: if($force-size == 'true', $size !important, $size); margin: auto; diff --git a/org.civicrm.hremergency/info.xml b/org.civicrm.hremergency/info.xml index 200acff82c9..910ac278afc 100644 --- a/org.civicrm.hremergency/info.xml +++ b/org.civicrm.hremergency/info.xml @@ -8,8 +8,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/org.civicrm.reqangular/gulp-tasks/requirejs.js b/org.civicrm.reqangular/gulp-tasks/requirejs.js index 76f309b546b..ff1b4fa1b5e 100644 --- a/org.civicrm.reqangular/gulp-tasks/requirejs.js +++ b/org.civicrm.reqangular/gulp-tasks/requirejs.js @@ -13,9 +13,15 @@ module.exports = function () { name: 'cache-templates', fn: function (cb) { gulp.src(path.join(commonFolder, 'templates', '/**/*.html')) - .pipe(templateCache({ moduleSystem: 'RequireJS' })) + .pipe(templateCache({ + moduleSystem: 'RequireJS', + module: 'common.templates', + standalone: true, + transformUrl: function (url) { + return url.replace(/^\//, ''); + } + })) .pipe(replace("['angular']", "['common/angular']")) - .pipe(replace('module(\'templates\')', 'module(\'common.templates\', [])')) .pipe(gulp.dest(path.join(commonFolder, 'modules'))); cb(); diff --git a/org.civicrm.reqangular/info.xml b/org.civicrm.reqangular/info.xml index a10ed6ce637..dbdf0805b49 100755 --- a/org.civicrm.reqangular/info.xml +++ b/org.civicrm.reqangular/info.xml @@ -10,8 +10,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/org.civicrm.reqangular/js/build.js b/org.civicrm.reqangular/js/build.js index 40f90f11575..2881f47964c 100755 --- a/org.civicrm.reqangular/js/build.js +++ b/org.civicrm.reqangular/js/build.js @@ -22,11 +22,10 @@ 'common/angularXeditable': 'common/vendor/angular/xeditable', 'common/rangy-core': 'common/vendor/angular/rangy-core', 'common/rangy-selectionsaverestore': 'common/vendor/angular/rangy-selectionsaverestore', - 'common/text-angular-sanitize': 'common/vendor/angular/textAngular-sanitize.min', + 'common/text-angular-sanitize': 'common/vendor/angular/textAngular-sanitize', 'common/text-angular-setup': 'common/vendor/angular/textAngularSetup', 'common/text-angular': 'common/vendor/angular/textAngular', 'common/ui-select': 'common/vendor/angular/select', - 'common/require': 'common/vendor/require.min', 'common/d3': 'common/vendor/d3.min', 'common/lodash': 'common/vendor/lodash.min', 'common/moment': 'common/vendor/moment.min', diff --git a/org.civicrm.reqangular/js/dist/reqangular.min.js b/org.civicrm.reqangular/js/dist/reqangular.min.js index 3e6b48592e3..2a0b9b68632 100644 --- a/org.civicrm.reqangular/js/dist/reqangular.min.js +++ b/org.civicrm.reqangular/js/dist/reqangular.min.js @@ -1,12 +1,6 @@ /* - RequireJS 2.1.20 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved. - Available via the MIT or new BSD license. - see: http://github.com/jrburke/requirejs for details -*/ - -/* - AngularJS v1.5.9 - (c) 2010-2016 Google, Inc. http://angularjs.org + AngularJS v1.7.2 + (c) 2010-2018 Google, Inc. http://angularjs.org License: MIT */ @@ -17,8 +11,8 @@ */ /** - * @license AngularJS v1.5.9 - * (c) 2010-2016 Google, Inc. http://angularjs.org + * @license AngularJS v1.7.2 + * (c) 2010-2018 Google, Inc. http://angularjs.org * License: MIT */ @@ -34,8 +28,8 @@ Build date: 2016-12-27 * * Copyright 2015, Tim Down * Licensed under the MIT license. - * Version: 1.3.0 - * Build date: 10 May 2015 + * Version: 1.3.1-dev + * Build date: 20 May 2015 */ /** @@ -49,8 +43,8 @@ Build date: 2016-12-27 * * Copyright 2015, Tim Down * Licensed under the MIT license. - * Version: 1.3.0 - * Build date: 10 May 2015 + * Version: 1.3.1-dev + * Build date: 20 May 2015 */ /** @@ -63,7 +57,7 @@ Build date: 2016-12-27 @license textAngular Author : Austin Anderson License : 2013 MIT -Version 1.5.0 +Version 2.0.0 See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use. */ @@ -89,40 +83,40 @@ See README.md or https://github.com/fraywing/textAngular/wiki for requirements a /** * State-based routing for AngularJS - * @version v0.2.15 + * @version v0.4.3 * @link http://angular-ui.github.com/ * @license MIT License, http://www.opensource.org/licenses/MIT */ -function validElementString(e){try{return 0!==angular.element(e).length}catch(e){return!1}}function registerTextAngularTool(e,t){if(!e||""===e||taTools.hasOwnProperty(e))throw"textAngular Error: A unique name is required for a Tool Definition";if(t.display&&(""===t.display||!validElementString(t.display))||!t.display&&!t.buttontext&&!t.iconclass)throw'textAngular Error: Tool Definition for "'+e+'" does not have a valid display/iconclass/buttontext value';taTools[e]=t}var requirejs,require,define;!function(ba){function G(e){return"[object Function]"===K.call(e)}function H(e){return"[object Array]"===K.call(e)}function v(e,t){if(e){var n;for(n=0;nthis.depCount&&!this.defined){if(G(a)){if(this.events.error&&this.map.isDefine||e.onError!==ca)try{o=C.execCb(i,a,r,o)}catch(e){n=e}else o=C.execCb(i,a,r,o);if(this.map.isDefine&&void 0===o&&((r=this.module)?o=r.exports:this.usingExports&&(o=this.exports)),n)return n.requireMap=this.map,n.requireModules=this.map.isDefine?[this.map.id]:null,n.requireType=this.map.isDefine?"define":"require",d(this.error=n)}else o=a;this.exports=o,this.map.isDefine&&!this.ignore&&(P[i]=o,e.onResourceLoad)&&e.onResourceLoad(C,this.map,this.depMaps),h(i),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else t(C.defQueueMap,i)||this.fetch()}},callPlugin:function(){var r=this.map,o=r.id,a=l(r.prefix);this.depMaps.push(a),f(a,"defined",u(this,function(a){var s,p;p=n(j,this.map.id);var m=this.map.name,g=this.map.parentMap?this.map.parentMap.name:null,v=C.makeRequire(r.parentMap,{enableBuildCallback:!0});this.map.unnormalized?(a.normalize&&(m=a.normalize(m,function(e){return i(e,g,!0)})||""),a=l(r.prefix+"!"+m,this.map.parentMap),f(a,"defined",u(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),(p=n(_,a.id))&&(this.depMaps.push(a),this.events.error&&p.on("error",u(this,function(e){this.emit("error",e)})),p.enable())):p?(this.map.url=C.nameToUrl(p),this.load()):(s=u(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),s.error=u(this,function(e){this.inited=!0,this.error=e,e.requireModules=[o],A(_,function(e){0===e.map.id.indexOf(o+"_unnormalized")&&h(e.map.id)}),d(e)}),s.fromText=u(this,function(n,i){var a=r.name,u=l(a),f=M;i&&(n=i),f&&(M=!1),c(u),t(S.config,o)&&(S.config[a]=S.config[o]);try{e.exec(n)}catch(e){return d(B("fromtexteval","fromText eval for "+o+" failed: "+e,e,[o]))}f&&(M=!0),this.depMaps.push(u),C.completeLoad(a),v([a],s)}),a.load(r.name,v,s,S))})),C.enable(a,this),this.pluginMaps[a.id]=a},enable:function(){D[this.map.id]=this,this.enabling=this.enabled=!0,v(this.depMaps,u(this,function(e,r){var i,o;if("string"==typeof e){if(e=l(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[r]=e,i=n(k,e.id))return void(this.depExports[r]=i(this));this.depCount+=1,f(e,"defined",u(this,function(e){this.undefed||(this.defineDep(r,e),this.check())})),this.errback?f(e,"error",u(this,this.errback)):this.events.error&&f(e,"error",u(this,function(e){this.emit("error",e)}))}i=e.id,o=_[i],!t(k,i)&&o&&!o.enabled&&C.enable(e,this)})),A(this.pluginMaps,u(this,function(e){var t=n(_,e.id);t&&!t.enabled&&C.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){v(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},C={config:S,contextName:r,registry:_,defined:P,urlFetched:F,defQueue:I,defQueueMap:{},Module:x,makeModuleMap:l,nextTick:e.nextTick,onError:d,configure:function(e){e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/");var t=S.shim,n={paths:!0,bundles:!0,config:!0,map:!0};A(e,function(e,t){n[t]?(S[t]||(S[t]={}),U(S[t],e,!0,!0)):S[t]=e}),e.bundles&&A(e.bundles,function(e,t){v(e,function(e){e!==t&&(j[e]=t)})}),e.shim&&(A(e.shim,function(e,n){H(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=C.makeShimExports(e)),t[n]=e}),S.shim=t),e.packages&&v(e.packages,function(e){var t,e="string"==typeof e?{name:e}:e;t=e.name,e.location&&(S.paths[t]=e.location),S.pkgs[t]=e.name+"/"+(e.main||"main").replace(ha,"").replace(Q,"")}),A(_,function(e,t){!e.inited&&!e.map.unnormalized&&(e.map=l(t,null,!0))}),(e.deps||e.callback)&&C.require(e.deps||[],e.callback)},makeShimExports:function(e){return function(){var t;return e.init&&(t=e.init.apply(ba,arguments)),t||e.exports&&da(e.exports)}},makeRequire:function(a,s){function u(n,i,o){var f,p;return s.enableBuildCallback&&i&&G(i)&&(i.__requireJsBuild=!0),"string"==typeof n?G(i)?d(B("requireargs","Invalid require call"),o):a&&t(k,n)?k[n](_[a.id]):e.get?e.get(C,n,a,u):(f=l(n,a,!1,!0),f=f.id,t(P,f)?P[f]:d(B("notloaded",'Module name "'+f+'" has not been loaded yet for context: '+r+(a?"":". Use require([])")))):($(),C.nextTick(function(){$(),p=c(l(null,a)),p.skipMap=s.skipMap,p.init(n,i,o,{enabled:!0}),g()}),u)}return s=s||{},U(u,{isBrowser:z,toUrl:function(e){var t,n=e.lastIndexOf("."),r=e.split("/")[0];return-1!==n&&("."!==r&&".."!==r||1i.attachEvent.toString().indexOf("[native code")||Y?(i.addEventListener("load",t.onScriptLoad,!1),i.addEventListener("error",t.onScriptError,!1)):(M=!0,i.attachEvent("onreadystatechange",t.onScriptLoad)),i.src=r,J=i,D?y.insertBefore(i,D):y.appendChild(i),J=null,i;if(ea)try{importScripts(r),t.completeLoad(n)}catch(e){t.onError(B("importscripts","importScripts failed for "+n+" at "+r,e,[n]))}},z&&!s.skipDataMain&&T(document.getElementsByTagName("script"),function(t){if(y||(y=t.parentNode),I=t.getAttribute("data-main"))return r=I,s.baseUrl||(E=r.split("/"),r=E.pop(),O=E.length?E.join("/")+"/":"./",s.baseUrl=O),r=r.replace(Q,""),e.jsExtRegExp.test(r)&&(r=I),s.deps=s.deps?s.deps.concat(r):[r],!0}),define=function(e,t,n){var r,i;"string"!=typeof e&&(n=t,t=e,e=null),H(t)||(n=t,t=null),!t&&G(n)&&(t=[],n.length&&(n.toString().replace(ja,"").replace(ka,function(e,n){t.push(n)}),t=(1===n.length?["require"]:["require","exports","module"]).concat(t))),M&&((r=J)||(N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(e){if("interactive"===e.readyState)return N=e}),r=N),r&&(e||(e=r.getAttribute("data-requiremodule")),i=F[r.getAttribute("data-requirecontext")])),i?(i.defQueue.push([e,t,n]),i.defQueueMap[e]=!0):R.push([e,t,n])},define.amd={jQuery:!0},e.exec=function(b){return eval(b)},e(s)}}(this),define("common/require",function(){}),function(e){"use strict";function t(e){return function(){var t,n=arguments[0];for(t="["+(e?e+":":"")+n+"] http://errors.angularjs.org/1.5.9/"+(e?e+"/":"")+n,n=1;n").append(e).html();try{return e[0].nodeType===br?Jn(t):t.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(e,t){return"<"+Jn(t)})}catch(e){return Jn(t)}}function V(e){try{return decodeURIComponent(e)}catch(e){}}function z(e){var t={};return r((e||"").split("&"),function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),n=e.indexOf("="),-1!==n&&(r=e.substring(0,n),i=e.substring(n+1)),r=V(r),v(r)&&(i=!v(i)||V(i),Zn.call(t,r)?lr(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))}),t}function B(e){var t=[];return r(e,function(e,n){lr(e)?r(e,function(e){t.push(W(n,!0)+(!0===e?"":"="+W(e,!0)))}):t.push(W(n,!0)+(!0===e?"":"="+W(e,!0)))}),t.length?t.join("&"):""}function Y(e){return W(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function W(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}function G(e,t){var n,r,i=mr.length;for(r=0;r protocol indicates an extension, document.location.href does not match."))}function Z(t,n,i){y(i)||(i={}),i=l({strictDi:!1},i);var o=function(){if(t=Yn(t),t.injector()){var r=t[0]===e.document?"document":q(t);throw ir("btstrpd",r.replace(//,">"))}return n=n||[],n.unshift(["$provide",function(e){e.value("$rootElement",t)}]),i.debugInfoEnabled&&n.push(["$compileProvider",function(e){e.debugInfoEnabled(!0)}]),n.unshift("ng"),r=Fe(n,i.strictDi),r.invoke(["$rootScope","$rootElement","$compile","$injector",function(e,t,n,r){e.$apply(function(){t.data("$injector",r),n(t)(e)})}]),r},a=/^NG_ENABLE_DEBUG_INFO!/,s=/^NG_DEFER_BOOTSTRAP!/;if(e&&a.test(e.name)&&(i.debugInfoEnabled=!0,e.name=e.name.replace(a,"")),e&&!s.test(e.name))return o();e.name=e.name.replace(s,""),or.resumeBootstrap=function(e){return r(e,function(e){n.push(e)}),o()},C(or.resumeDeferredBootstrap)&&or.resumeDeferredBootstrap()}function J(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function Q(e){if(!(e=or.element(e).injector()))throw ir("test");return e.get("$$testability")}function X(e,t){return t=t||"_",e.replace(vr,function(e,n){return(n?t:"")+e.toLowerCase()})}function ee(e,t,n){if(!e)throw ir("areq",t||"?",n||"required");return e}function te(e,t,n){return n&&lr(e)&&(e=e[e.length-1]),ee(C(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function ne(e,t){if("hasOwnProperty"===e)throw ir("badname",t)}function re(e,t,n){if(!t)return e;t=t.split(".");for(var r,i=e,o=t.length,a=0;a")+i[2],i=i[0];i--;)n=n.lastChild;a=I(a,n.childNodes),n=o.firstChild,n.textContent=""}else a.push(t.createTextNode(e));return o.textContent="",o.innerHTML="",r(a,function(e){o.appendChild(e)}),o}function fe(e,t){var n=e.parentNode;n&&n.replaceChild(t,e),t.appendChild(e)}function de(t){if(t instanceof de)return t;var n;if($(t)&&(t=cr(t),n=!0),!(this instanceof de)){if(n&&"<"!==t.charAt(0))throw Sr("nosel");return new de(t)}if(n){n=e.document;var r;t=(r=_r.exec(t))?[n.createElement(r[1])]:(r=ce(t,n))?r.childNodes:[]}xe(this,t)}function pe(e){return e.cloneNode(!0)}function he(e,t){if(t||ge(e),e.querySelectorAll)for(var n=e.querySelectorAll("*"),r=0,i=n.length;r=Bn)&&("function"==typeof e&&/^(?:class\b|constructor\()/.test(Function.prototype.toString.call(e)+" ")),r?(n.unshift(null),new(Function.prototype.bind.apply(e,n))):e.apply(t,n)}, -instantiate:function(e,t,n){var r=lr(e)?e[e.length-1]:e;return e=i(e,t,n),e.unshift(null),new(Function.prototype.bind.apply(r,e))},get:r,annotate:Fe.$$annotate,has:function(t){return p.hasOwnProperty(t+"Provider")||e.hasOwnProperty(t)}}}t=!0===t;var c={},f=[],d=new Re([],!0),p={$provide:{provider:n(i),factory:n(s),service:n(function(e,t){return s(e,["$injector",function(e){return e.instantiate(t)}])}),value:n(function(e,t){return s(e,h(t),!1)}),constant:n(function(e,t){ne(e,"constant"),p[e]=t,v[e]=t}),decorator:function(e,t){var n=m.get(e+"Provider"),r=n.$get;n.$get=function(){var e=w.invoke(r,n);return w.invoke(t,null,{$delegate:e})}}}},m=p.$injector=u(p,function(e,t){throw or.isString(t)&&f.push(t),Vr("unpr",f.join(" <- "))}),v={},b=u(v,function(e,t){var n=m.get(e+"Provider",t);return w.invoke(n.$get,n,void 0,e)}),w=b;p.$injectorProvider={$get:h(b)};var x=l(e),w=b.get("$injector");return w.strictDi=t,r(x,function(e){e&&w.invoke(e)}),w}function je(){var e=!0;this.disableAutoScrolling=function(){e=!1},this.$get=["$window","$location","$rootScope",function(t,n,r){function i(e){var t=null;return Array.prototype.some.call(e,function(e){if("a"===A(e))return t=e,!0}),t}function o(e){if(e){e.scrollIntoView();var n;n=a.yOffset,C(n)?n=n():T(n)?(n=n[0],n="fixed"!==t.getComputedStyle(n).position?0:n.getBoundingClientRect().bottom):w(n)||(n=0),n&&(e=e.getBoundingClientRect().top,t.scrollBy(0,e-n))}else t.scrollTo(0,0)}function a(e){e=$(e)?e:n.hash();var t;e?(t=s.getElementById(e))?o(t):(t=i(s.getElementsByName(e)))?o(t):"top"===e&&o(null):o(null)}var s=t.document;return e&&r.$watch(function(){return n.hash()},function(e,t){e===t&&""===e||_e(function(){r.$evalAsync(a)})}),a}]}function Le(e,t){return e||t?e?t?(lr(e)&&(e=e.join(" ")),lr(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function Ue(e){$(e)&&(e=e.split(" "));var t=oe();return r(e,function(e){e.length&&(t[e]=!0)}),t}function He(e){return y(e)?e:{}}function qe(e,t,n,i){function o(e){try{e.apply(null,Xn.call(arguments,1))}finally{if(0===--v)for(;y.length;)try{y.pop()()}catch(e){n.error(e)}}}function a(){C=null,s(),l()}function s(){b=k(),b=g(b)?null:b,R(b,_)&&(b=_),_=b}function l(){w===u.url()&&$===b||(w=u.url(),$=b,r(E,function(e){e(u.url(),b)}))}var u=this,c=e.location,f=e.history,p=e.setTimeout,h=e.clearTimeout,m={};u.isMock=!1;var v=0,y=[];u.$$completeOutstandingRequest=o,u.$$incOutstandingRequestCount=function(){v++},u.notifyWhenNoOutstandingRequests=function(e){0===v?e():y.push(e)};var b,$,w=c.href,x=t.find("base"),C=null,k=i.history?function(){try{return f.state}catch(e){}}:d;s(),$=b,u.url=function(t,n,r){if(g(r)&&(r=null),c!==e.location&&(c=e.location),f!==e.history&&(f=e.history),t){var o=$===r;if(w===t&&(!i.history||o))return u;var a=w&&yt(w)===yt(t);return w=t,$=r,!i.history||a&&o?(a||(C=t),n?c.replace(t):a?(n=c,r=t.indexOf("#"),r=-1===r?"":t.substr(r),n.hash=r):c.href=t,c.href!==t&&(C=t)):(f[n?"replaceState":"pushState"](r,"",t),s(),$=b),C&&(C=t),u}return C||c.href.replace(/%27/g,"'")},u.state=function(){return b};var E=[],S=!1,_=null;u.onUrlChange=function(t){return S||(i.history&&Yn(e).on("popstate",a),Yn(e).on("hashchange",a),S=!0),E.push(t),t},u.$$applicationDestroyed=function(){Yn(e).off("hashchange popstate",a)},u.$$checkUrlChange=l,u.baseHref=function(){var e=x.attr("href");return e?e.replace(/^(https?:)?\/\/[^\/]*/,""):""},u.defer=function(e,t){var n;return v++,n=p(function(){delete m[n],o(e)},t||0),m[n]=!0,n},u.defer.cancel=function(e){return!!m[e]&&(delete m[e],h(e),o(d),!0)}}function Ve(){this.$get=["$window","$log","$sniffer","$document",function(e,t,n,r){return new qe(e,r,t,n)}]}function ze(){this.$get=function(){function e(e,r){function i(e){e!==d&&(p?p===e&&(p=e.n):p=e,o(e.n,e.p),o(e,d),d=e,d.n=null)}function o(e,t){e!==t&&(e&&(e.p=t),t&&(t.n=e))}if(e in n)throw t("$cacheFactory")("iid",e);var a=0,s=l({},r,{id:e}),u=oe(),c=r&&r.capacity||Number.MAX_VALUE,f=oe(),d=null,p=null;return n[e]={put:function(e,t){if(!g(t)){if(cc&&this.remove(p.key),t}},get:function(e){if(c",t=xe.firstChild.attributes;var r=t[0];t.removeNamedItem(r.name),r.value=n,e.attributes.setNamedItem(r)}function H(e,t){try{e.addClass(t)}catch(e){}}function V(t,n,r,i,o){t instanceof Yn||(t=Yn(t));for(var a=/\S+/,s=0,l=t.length;s").append(t).html())):n?Nr.clone.call(t):t,a)for(var s in a)r.data("$"+s+"Controller",a[s].instance);return V.$$addScopeInfo(r,e),n&&n(r,e),c&&c(e,r,r,i),r}}function z(e,t,n,r,i,o){function a(e,n,r,i){var o,a,s,l,u,c,p;if(f)for(p=Array(n.length),l=0;lh.priority)break;if(($=h.scope)&&(h.templateUrl||(y($)?(ue("new/isolated scope",E||x,h,N),E=h):ue("new/isolated scope",E,h,N)),x=x||h),m=h.name,!I&&(h.replace&&(h.templateUrl||h.template)||h.transclude&&!h.$$tlb)){for($=j+1;I=e[$++];)if(I.transclude&&!I.$$tlb||I.replace&&(I.templateUrl||I.template)){F=!0;break}I=!0}if(!h.templateUrl&&h.controller&&($=h.controller,k=k||oe(),ue("'"+m+"' controller",k[m],h,N),k[m]=h),$=h.transclude)if(T=!0,h.$$tlb||(ue("transclusion",M,h,N),M=h),"element"===$)O=!0,w=h.priority,v=N,N=n.$$element=Yn(V.$$createComment(m,n[m])),t=N[0],ge(a,Xn.call(v,0),t),v[0].$$parentNode=v[0].parentNode,R=Z(F,v,i,w,s&&s.name,{nonTlbTranscludeDirective:M});else{var B=oe();if(v=Yn(pe(t)).contents(),y($)){v=[];var W=oe(),J=oe();r($,function(e,t){var n="?"===e.charAt(0);e=n?e.substring(1):e,W[e]=t,B[t]=null,J[t]=n}),r(N.contents(),function(e){var t=W[Ge(A(e))];t?(J[t]=!0,B[t]=B[t]||[],B[t].push(e)):v.push(e)}),r(J,function(e,t){if(!e)throw Jr("reqslot",t)});for(var X in B)B[X]&&(B[X]=Z(F,B[X],i))}N.empty(),R=Z(F,v,i,void 0,void 0,{needsNewScope:h.$$isolateScope||h.$$newScope}),R.$$slots=B}if(h.template)if(D=!0,ue("template",_,h,N),_=h,$=C(h.template)?h.template(N,n):h.template,$=Te($),h.replace){if(s=h,v=Mr.test($)?Ze(de(h.templateNamespace,cr($))):[],t=v[0],1!==v.length||1!==t.nodeType)throw Jr("tplrt",m,"");ge(a,N,t),U={$attr:{}},$=Y(t,[],U);var ee=e.splice(j+1,e.length-(j+1));(E||x)&&ne($,E,x),e=e.concat($).concat(ee),ae(n,U),U=e.length}else N.html($);if(h.templateUrl)D=!0,ue("template",_,h,N),_=h,h.replace&&(s=h),p=se(e.splice(j,e.length-j),N,n,a,T&&R,u,c,{controllerDirectives:k,newScopeDirective:x!==h&&x,newIsolateScopeDirective:E,templateDirective:_,nonTlbTranscludeDirective:M}),U=e.length;else if(h.compile)try{b=h.compile(N,n,R);var re=h.$$originalDirective||h;C(b)?d(null,P(re,b),H,z):b&&d(P(re,b.pre),P(re,b.post),H,z)}catch(e){o(e,q(N))}h.terminal&&(p.terminal=!0,w=Math.max(w,h.priority))}return p.scope=x&&!0===x.scope,p.transcludeOnThisElement=T,p.templateOnThisElement=D,p.transclude=R,f.hasElementTranscludeDirective=O,p}function Q(e,t,n,i){var o;if($(t)){var a=t.match(w);t=t.substring(a[0].length);var s=a[1]||a[3],a="?"===a[2];if("^^"===s?n=n.parent():o=(o=i&&i[t])&&o.instance,!o){var l="$"+t+"Controller";o=s?n.inheritedData(l):n.data(l)}if(!o&&!a)throw Jr("ctreq",t,e)}else if(lr(t))for(o=[],s=0,a=t.length;sd.priority)&&-1!==d.restrict.indexOf(r)){if(l&&(d=f(d,{$$start:l,$$end:c})),!d.$$bindings){var m=d,v=d,b=d.name,$={isolateScope:null,bindToController:null};if(y(v.scope)&&(!0===v.bindToController?($.bindToController=i(v.scope,b,!0),$.isolateScope={}):$.isolateScope=i(v.scope,b,!1)),y(v.bindToController)&&($.bindToController=i(v.bindToController,b,!0)),y($.bindToController)){var w=v.controller,x=v.controllerAs;if(!w)throw Jr("noctrl",b);if(!Je(w,x))throw Jr("noident",b)}var C=m.$$bindings=$;y(C.isolateScope)&&(d.$$isolateBindings=C.isolateScope)}e.push(d),s=d}}catch(e){o(e)}}return s}function ie(e){if(u.hasOwnProperty(e))for(var n=t.get(e+"Directive"),r=0,i=n.length;r"+n+"",r.childNodes[0].childNodes;default:return n}}function he(e,t){if("srcdoc"===t)return D.HTML;var n=A(e);if("src"===t||"ngSrc"===t){if(-1===["img","video","audio","source","track"].indexOf(n))return D.RESOURCE_URL}else if("xlinkHref"===t||"form"===n&&"action"===t)return D.RESOURCE_URL}function me(e,t,r,i,o){var a=he(e,i);o=b[i]||o;var s=n(r,!0,a,o);if(s){if("multiple"===i&&"select"===A(e))throw Jr("selmulti",q(e));t.push({priority:100,compile:function(){return{pre:function(e,t,l){if(t=l.$$observers||(l.$$observers=oe()),x.test(i))throw Jr("nodomevents");var u=l[i];u!==r&&(s=u&&n(u,!0,a,o),r=u),s&&(l[i]=s(e),(t[i]||(t[i]=[])).$$inter=!0,(l.$$observers&&l.$$observers[i].$$scope||e).$watch(s,function(e,t){"class"===i&&e!==t?l.$updateClass(e,t):l.$set(i,e)}))}}}})}}function ge(t,n,r){var i,o,a=n[0],s=n.length,l=a.parentNode;if(t)for(i=0,o=t.length;i=t)return e;for(;t--;)8===e[t].nodeType&&er.call(e,t,1);return e}function Je(e,t){if(t&&$(t))return t;if($(e)){var n=ti.exec(e);if(n)return n[3]}}function Qe(){var e={},n=!1;this.has=function(t){return e.hasOwnProperty(t)},this.register=function(t,n){ne(t,"controller"),y(t)?l(e,t):e[t]=n},this.allowGlobals=function(){n=!0},this.$get=["$injector","$window",function(r,i){function o(e,n,r,i){if(!e||!y(e.$scope))throw t("$controller")("noscp",i,n);e.$scope[n]=r}return function(t,a,s,u){var c,f,d;if(s=!0===s,u&&$(u)&&(d=u),$(t)){if(!(u=t.match(ti)))throw ei("ctrlfmt",t);f=u[1],d=d||u[3],t=e.hasOwnProperty(f)?e[f]:re(a.$scope,f,!0)||(n?re(i,f,!0):void 0),te(t,f,!0)}return s?(s=(lr(t)?t[t.length-1]:t).prototype,c=Object.create(s||null),d&&o(a,d,c,f||t.name),l(function(){var e=r.invoke(t,c,a,f);return e!==c&&(y(e)||C(e))&&(c=e,d&&o(a,d,c,f||t.name)),c},{instance:c,identifier:d})):(c=r.instantiate(t,a,f),d&&o(a,d,c,f||t.name),c)}}]}function Xe(){this.$get=["$window",function(e){return Yn(e.document)}]}function et(){this.$get=["$log",function(e){return function(t,n){e.error.apply(e,arguments)}}]}function tt(e){return y(e)?x(e)?e.toISOString():j(e):e}function nt(){this.$get=function(){return function(e){if(!e)return"";var t=[];return i(e,function(e,n){null===e||g(e)||(lr(e)?r(e,function(e){t.push(W(n)+"="+W(tt(e)))}):t.push(W(n)+"="+W(tt(e))))}),t.join("&")}}}function rt(){this.$get=function(){return function(e){function t(e,o,a){null===e||g(e)||(lr(e)?r(e,function(e,n){t(e,o+"["+(y(e)?n:"")+"]")}):y(e)&&!x(e)?i(e,function(e,n){t(e,o+(a?"":"[")+n+(a?"":"]"))}):n.push(W(o)+"="+W(tt(e))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function it(e,t){if($(e)){var n=e.replace(si,"").trim();if(n){var r=t("Content-Type");(r=r&&0===r.indexOf(ri))||(r=(r=n.match(oi))&&ai[r[0]].test(n)),r&&(e=L(n))}}return e}function ot(e){var t,n=oe();return $(e)?r(e.split("\n"),function(e){t=e.indexOf(":");var r=Jn(cr(e.substr(0,t)));e=cr(e.substr(t+1)),r&&(n[r]=n[r]?n[r]+", "+e:e)}):y(e)&&r(e,function(e,t){var r=Jn(t),i=cr(e);r&&(n[r]=n[r]?n[r]+", "+i:i)}),n}function at(e){var t;return function(n){return t||(t=ot(e)),n?(n=t[Jn(n)],void 0===n&&(n=null),n):t}}function st(e,t,n,i){return C(i)?i(e,t,n):(r(i,function(r){e=r(e,t,n)}),e)}function lt(){var e=this.defaults={transformResponse:[it],transformRequest:[function(e){return y(e)&&"[object File]"!==nr.call(e)&&"[object Blob]"!==nr.call(e)&&"[object FormData]"!==nr.call(e)?j(e):e}],headers:{common:{Accept:"application/json, text/plain, */*"},post:se(ii),put:se(ii),patch:se(ii)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer"},n=!1;this.useApplyAsync=function(e){return v(e)?(n=!!e,this):n};var i=!0;this.useLegacyPromiseExtensions=function(e){return v(e)?(i=!!e,this):i};var o=this.interceptors=[];this.$get=["$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector",function(a,s,u,c,f,d){function p(n){function o(e,t){for(var n=0,r=t.length;ne?t:f.reject(t)}if(!y(n))throw t("$http")("badreq",n);if(!$(n.url))throw t("$http")("badreq",n.url);var u=l({method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse,paramSerializer:e.paramSerializer},n);u.headers=function(t){var n,r,i,o=e.headers,s=l({},t.headers),o=l({},o.common,o[Jn(t.method)]);e:for(n in o){r=Jn(n);for(i in s)if(Jn(i)===r)continue e;s[n]=o[n]}return a(s,se(t))}(n),u.method=Qn(u.method),u.paramSerializer=$(u.paramSerializer)?d.get(u.paramSerializer):u.paramSerializer;var c=[],p=[],m=f.when(u);return r(w,function(e){(e.request||e.requestError)&&c.unshift(e.request,e.requestError),(e.response||e.responseError)&&p.push(e.response,e.responseError)}),m=o(m,c),m=m.then(function(t){var n=t.headers,i=st(t.data,at(n),void 0,t.transformRequest);return g(i)&&r(n,function(e,t){"content-type"===Jn(t)&&delete n[t]}),g(t.withCredentials)&&!g(e.withCredentials)&&(t.withCredentials=e.withCredentials),h(t,i).then(s,s)}),m=o(m,p),i?(m.success=function(e){return te(e,"fn"),m.then(function(t){e(t.data,t.status,t.headers,u)}),m},m.error=function(e){return te(e,"fn"),m.then(null,function(t){e(t.data,t.status,t.headers,u)}),m}):(m.success=ui("success"),m.error=ui("error")),m}function h(t,i){function o(e){if(e){var t={};return r(e,function(e,r){t[r]=function(t){function r(){e(t)}n?c.$applyAsync(r):c.$$phase?r():c.$apply(r)}}),t}}function l(e,t,r,i){function o(){u(t,e,r,i)}$&&(200<=e&&300>e?$.put(S,[e,t,ot(r),i]):$.remove(S)),n?c.$applyAsync(o):(o(),c.$$phase||c.$apply())}function u(e,n,r,i){n=-1<=n?n:0,(200<=n&&300>n?x.resolve:x.reject)({data:e,status:n,headers:at(r),config:t,statusText:i})}function d(e){u(e.data,e.status,se(e.headers()),e.statusText)}function h(){var e=p.pendingRequests.indexOf(t);-1!==e&&p.pendingRequests.splice(e,1)}var $,w,x=f.defer(),k=x.promise,E=t.headers,S=m(t.url,t.paramSerializer(t.params));return p.pendingRequests.push(t),k.then(h,h),!t.cache&&!e.cache||!1===t.cache||"GET"!==t.method&&"JSONP"!==t.method||($=y(t.cache)?t.cache:y(e.cache)?e.cache:b),$&&(w=$.get(S),v(w)?w&&C(w.then)?w.then(d,d):lr(w)?u(w[1],w[0],se(w[2]),w[3]):u(w,200,{},"OK"):$.put(S,k)),g(w)&&((w=an(t.url)?s()[t.xsrfCookieName||e.xsrfCookieName]:void 0)&&(E[t.xsrfHeaderName||e.xsrfHeaderName]=w),a(t.method,S,i,l,E,t.timeout,t.withCredentials,t.responseType,o(t.eventHandlers),o(t.uploadEventHandlers))),k}function m(e,t){return 0=l&&(y.resolve(m),h(b.$$intervalId),delete a[b.$$intervalId]),g||e.$apply()},s),a[b.$$intervalId]=y,b}var a={};return o.cancel=function(e){return!!(e&&e.$$intervalId in a)&&(a[e.$$intervalId].reject("canceled"),t.clearInterval(e.$$intervalId),delete a[e.$$intervalId],!0)},o}]}function ht(e){e=e.split("/");for(var t=e.length;t--;)e[t]=Y(e[t]);return e.join("/")}function mt(e,t){var n=on(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=c(n.port)||pi[n.protocol]||null}function gt(e,t){if(mi.test(e))throw hi("badpath",e);var n="/"!==e.charAt(0);n&&(e="/"+e);var r=on(e);t.$$path=decodeURIComponent(n&&"/"===r.pathname.charAt(0)?r.pathname.substring(1):r.pathname),t.$$search=z(r.search),t.$$hash=decodeURIComponent(r.hash),t.$$path&&"/"!==t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function vt(e,t){if(0===t.lastIndexOf(e,0))return t.substr(e.length)}function yt(e){var t=e.indexOf("#");return-1===t?e:e.substr(0,t)}function bt(e){return e.replace(/(#.+)|#$/,"$1")}function $t(e,t,n){this.$$html5=!0,n=n||"",mt(e,this),this.$$parse=function(e){var n=vt(t,e);if(!$(n))throw hi("ipthprfx",e,t);gt(n,this),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=B(this.$$search),n=this.$$hash?"#"+Y(this.$$hash):"";this.$$url=ht(this.$$path)+(e?"?"+e:"")+n,this.$$absUrl=t+this.$$url.substr(1)},this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return v(o=vt(e,r))?(a=o,a=n&&v(o=vt(n,o))?t+(vt("/",o)||o):e+a):v(o=vt(t,r))?a=t+o:t===r+"/"&&(a=t),a&&this.$$parse(a),!!a}}function wt(e,t,n){mt(e,this),this.$$parse=function(r){var i,o=vt(e,r)||vt(t,r);g(o)||"#"!==o.charAt(0)?this.$$html5?i=o:(i="",g(o)&&(e=r,this.replace())):(i=vt(n,o),g(i)&&(i=o)),gt(i,this),r=this.$$path;var o=e,a=/^\/[A-Z]:(\/.*)/;0===i.lastIndexOf(o,0)&&(i=i.replace(o,"")),a.exec(i)||(r=(i=a.exec(r))?i[1]:r),this.$$path=r,this.$$compose()},this.$$compose=function(){var t=B(this.$$search),r=this.$$hash?"#"+Y(this.$$hash):"";this.$$url=ht(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+(this.$$url?n+this.$$url:"")},this.$$parseLinkUrl=function(t,n){return yt(e)===yt(t)&&(this.$$parse(t),!0)}}function xt(e,t,n){this.$$html5=!0,wt.apply(this,arguments),this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return e===yt(r)?o=r:(a=vt(t,r))?o=e+n+a:t===r+"/"&&(o=t),o&&this.$$parse(o),!!o},this.$$compose=function(){var t=B(this.$$search),r=this.$$hash?"#"+Y(this.$$hash):"";this.$$url=ht(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+n+this.$$url}}function Ct(e){return function(){return this[e]}}function kt(e,t){return function(n){return g(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function Et(){var e="",t={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(t){return v(t)?(e=t,this):e},this.html5Mode=function(e){return _(e)?(t.enabled=e,this):y(e)?(_(e.enabled)&&(t.enabled=e.enabled),_(e.requireBase)&&(t.requireBase=e.requireBase),_(e.rewriteLinks)&&(t.rewriteLinks=e.rewriteLinks),this):t},this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(n,r,i,o,a){function s(e,t,n){var i=u.url(),o=u.$$state;try{r.url(e,t,n),u.$$state=r.state()}catch(e){throw u.url(i),u.$$state=o,e}}function l(e,t){n.$broadcast("$locationChangeSuccess",u.absUrl(),e,u.$$state,t)}var u,c;c=r.baseHref();var f,d=r.url();if(t.enabled){if(!c&&t.requireBase)throw hi("nobase");f=d.substring(0,d.indexOf("/",d.indexOf("//")+2))+(c||"/"),c=i.history?$t:xt}else f=yt(d),c=wt;var p=f.substr(0,yt(f).lastIndexOf("/")+1);u=new c(f,p,"#"+e),u.$$parseLinkUrl(d,d),u.$$state=r.state();var h=/^\s*(javascript|mailto):/i;o.on("click",function(e){if(t.rewriteLinks&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&2!==e.which&&2!==e.button){for(var i=Yn(e.target);"a"!==A(i[0]);)if(i[0]===o[0]||!(i=i.parent())[0])return;var s=i.prop("href"),l=i.attr("href")||i.attr("xlink:href");y(s)&&"[object SVGAnimatedString]"===s.toString()&&(s=on(s.animVal).href),h.test(s)||!s||i.attr("target")||e.isDefaultPrevented()||!u.$$parseLinkUrl(s,l)||(e.preventDefault(),u.absUrl()!==r.url()&&(n.$apply(),a.angular["ff-684208-preventDefault"]=!0))}}),bt(u.absUrl())!==bt(d)&&r.url(u.absUrl(),!0);var m=!0;return r.onUrlChange(function(e,t){g(vt(p,e))?a.location.href=e:(n.$evalAsync(function(){var r,i=u.absUrl(),o=u.$$state;e=bt(e),u.$$parse(e),u.$$state=t,r=n.$broadcast("$locationChangeStart",e,i,t,o).defaultPrevented,u.absUrl()===e&&(r?(u.$$parse(i),u.$$state=o,s(i,!1,o)):(m=!1,l(i,o)))}),n.$$phase||n.$digest())}),n.$watch(function(){var e=bt(r.url()),t=bt(u.absUrl()),o=r.state(),a=u.$$replace,c=e!==t||u.$$html5&&i.history&&o!==u.$$state;(m||c)&&(m=!1,n.$evalAsync(function(){var t=u.absUrl(),r=n.$broadcast("$locationChangeStart",t,e,u.$$state,o).defaultPrevented;u.absUrl()===t&&(r?(u.$$parse(e),u.$$state=o):(c&&s(t,a,o===u.$$state?null:u.$$state),l(e,o)))})),u.$$replace=!1}),u}]}function St(){var e=!0,t=this;this.debugEnabled=function(t){return v(t)?(e=t,this):e},this.$get=["$window",function(n){function i(e){return e instanceof Error&&(e.stack?e=e.message&&-1===e.stack.indexOf(e.message)?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function o(e){var t=n.console||{},o=t[e]||t.log||d;e=!1;try{e=!!o.apply}catch(e){}return e?function(){var e=[];return r(arguments,function(t){e.push(i(t))}),o.apply(t,e)}:function(e,t){o(e,null==t?"":t)}}return{log:o("log"),info:o("info"),warn:o("warn"),error:o("error"),debug:function(){var n=o("debug");return function(){e&&n.apply(t,arguments)}}()}}]}function _t(e,t){if("__defineGetter__"===e||"__defineSetter__"===e||"__lookupGetter__"===e||"__lookupSetter__"===e||"__proto__"===e)throw vi("isecfld",t);return e}function Mt(e){return e+""}function Tt(e,t){if(e){if(e.constructor===e)throw vi("isecfn",t);if(e.window===e)throw vi("isecwindow",t);if(e.children&&(e.nodeName||e.prop&&e.attr&&e.find))throw vi("isecdom",t);if(e===Object)throw vi("isecobj",t)}return e}function Dt(e,t){if(e){if(e.constructor===e)throw vi("isecfn",t);if(e===Di||e===Ai||e===Oi)throw vi("isecff",t)}}function At(e,t){if(e&&(e===yi||e===bi||e===$i||e===wi||e===xi||e===Ci||e===ki||e===Ei||e===Si||e===_i||e===Mi||e===Ti))throw vi("isecaf",t)}function Ot(e,t){return void 0!==e?e:t}function Nt(e,t){return void 0===e?t:void 0===t?e:e+t}function Rt(e,t){var n,i,o;switch(e.type){case Fi.Program:n=!0,r(e.body,function(e){Rt(e.expression,t),n=n&&e.expression.constant}),e.constant=n;break;case Fi.Literal:e.constant=!0,e.toWatch=[];break;case Fi.UnaryExpression:Rt(e.argument,t),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case Fi.BinaryExpression:Rt(e.left,t),Rt(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case Fi.LogicalExpression:Rt(e.left,t),Rt(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case Fi.ConditionalExpression:Rt(e.test,t),Rt(e.alternate,t),Rt(e.consequent,t),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case Fi.Identifier:e.constant=!1,e.toWatch=[e];break;case Fi.MemberExpression:Rt(e.object,t),e.computed&&Rt(e.property,t),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=[e];break;case Fi.CallExpression:n=o=!!e.filter&&!t(e.callee.name).$stateful,i=[],r(e.arguments,function(e){Rt(e,t),n=n&&e.constant,e.constant||i.push.apply(i,e.toWatch)}),e.constant=n,e.toWatch=o?i:[e];break;case Fi.AssignmentExpression:Rt(e.left,t),Rt(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case Fi.ArrayExpression:n=!0,i=[],r(e.elements,function(e){Rt(e,t),n=n&&e.constant,e.constant||i.push.apply(i,e.toWatch)}),e.constant=n,e.toWatch=i;break;case Fi.ObjectExpression:n=!0,i=[],r(e.properties,function(e){Rt(e.value,t),n=n&&e.value.constant&&!e.computed,e.value.constant||i.push.apply(i,e.value.toWatch)}),e.constant=n,e.toWatch=i;break;case Fi.ThisExpression:e.constant=!1,e.toWatch=[];break;case Fi.LocalsExpression:e.constant=!1,e.toWatch=[]}}function It(e){if(1===e.length){e=e[0].expression;var t=e.toWatch;return 1!==t.length?t:t[0]!==e?t:void 0}}function Pt(e){return e.type===Fi.Identifier||e.type===Fi.MemberExpression}function Ft(e){if(1===e.body.length&&Pt(e.body[0].expression))return{type:Fi.AssignmentExpression,left:e.body[0].expression,right:{type:Fi.NGValueParameter},operator:"="}}function jt(e){return 0===e.body.length||1===e.body.length&&(e.body[0].expression.type===Fi.Literal||e.body[0].expression.type===Fi.ArrayExpression||e.body[0].expression.type===Fi.ObjectExpression)}function Lt(e,t){this.astBuilder=e,this.$filter=t}function Ut(e,t){this.astBuilder=e,this.$filter=t}function Ht(e){return"constructor"===e}function qt(e){return C(e.valueOf)?e.valueOf():Ni.call(e)}function Vt(){var e,t,n=oe(),i=oe(),o={true:!0,false:!1,null:null,undefined:void 0};this.addLiteral=function(e,t){o[e]=t},this.setIdentifierFns=function(n,r){return e=n,t=r,this},this.$get=["$filter",function(a){function s(e,t,r){var o,s,u;switch(r=r||$,typeof e){case"string":u=e=e.trim();var g=r?i:n;if(!(o=g[u])){":"===e.charAt(0)&&":"===e.charAt(1)&&(s=!0,e=e.substring(2)),o=r?b:y;var v=new Pi(o);o=new ji(v,a,o).parse(e),o.constant?o.$$watchDelegate=h:s?o.$$watchDelegate=o.literal?p:f:o.inputs&&(o.$$watchDelegate=c),r&&(o=l(o)),g[u]=o}return m(o,t);case"function":return m(e,t);default:return m(d,t)}}function l(e){function t(t,n,r,i){var o=$;$=!0;try{return e(t,n,r,i)}finally{$=o}}if(!e)return e;t.$$watchDelegate=e.$$watchDelegate,t.assign=l(e.assign),t.constant=e.constant,t.literal=e.literal;for(var n=0;e.inputs&&n=this.promise.$$state.status&&r&&r.length&&e(function(){for(var e,i,o=0,a=r.length;oe)for(t in c++,o)Zn.call(i,t)||(m--,delete o[t])}else o!==i&&(o=i,c++);return c}}r.$stateful=!0;var i,o,a,s=this,u=1y&&(g=4-y,w[g]||(w[g]=[]),w[g].push({msg:C(e.exp)?"fn: "+(e.exp.name||e.exp.toString()):e.exp,newVal:n,oldVal:r}))}catch(e){t(e)}if(!(f=m.$$watchersCount&&m.$$childHead||m!==this&&m.$$nextSibling))for(;m!==this&&!(f=m.$$nextSibling);)m=m.$parent}while(m=f);if((p||k.length)&&!y--)throw x.$$phase=null,o("infdig",i,w)}while(p||k.length);for(x.$$phase=null;_Bn)throw Li("iequirks");var i=se(Ui);i.isEnabled=function(){return e},i.trustAs=n.trustAs,i.getTrusted=n.getTrusted,i.valueOf=n.valueOf,e||(i.trustAs=i.getTrusted=function(e,t){return t},i.valueOf=p),i.parseAs=function(e,n){var r=t(n);return r.literal&&r.constant?r:t(n,function(t){return i.getTrusted(e,t)})};var o=i.parseAs,a=i.getTrusted,s=i.trustAs;return r(Ui,function(e,t){var n=Jn(t);i[le("parse_as_"+n)]=function(t){return o(e,t)},i[le("get_trusted_"+n)]=function(t){return a(e,t)},i[le("trust_as_"+n)]=function(t){return s(e,t)}}),i}]}function en(){this.$get=["$window","$document",function(e,t){var n,r={},i=!(e.chrome&&(e.chrome.app&&e.chrome.app.runtime||!e.chrome.app&&e.chrome.runtime&&e.chrome.runtime.id))&&e.history&&e.history.pushState,o=c((/android (\d+)/.exec(Jn((e.navigator||{}).userAgent))||[])[1]),a=/Boxee/i.test((e.navigator||{}).userAgent),s=t[0]||{},l=/^(Moz|webkit|ms)(?=[A-Z])/,u=s.body&&s.body.style,f=!1,d=!1;if(u){for(var p in u)if(f=l.exec(p)){n=f[0],n=n[0].toUpperCase()+n.substr(1);break}n||(n="WebkitOpacity"in u&&"webkit"),f=!!("transition"in u||n+"Transition"in u),d=!!("animation"in u||n+"Animation"in u),!o||f&&d||(f=$(u.webkitTransition),d=$(u.webkitAnimation))}return{history:!(!i||4>o||a),hasEvent:function(e){if("input"===e&&11>=Bn)return!1;if(g(r[e])){var t=s.createElement("div");r[e]="on"+e in t}return r[e]},csp:dr(),vendorPrefix:n,transitions:f,animations:d,android:o}}]}function tn(){var e;this.httpOptions=function(t){return t?(e=t,this):e},this.$get=["$templateCache","$http","$q","$sce",function(t,n,r,i){function o(a,s){o.totalPendingRequests++,$(a)&&!g(t.get(a))||(a=i.getTrustedResourceUrl(a));var u=n.defaults&&n.defaults.transformResponse;return lr(u)?u=u.filter(function(e){return e!==it}):u===it&&(u=null),n.get(a,l({cache:t,transformResponse:u},e)).finally(function(){o.totalPendingRequests--}).then(function(e){return t.put(a,e.data),e.data},function(e){if(!s)throw Hi("tpload",a,e.status,e.statusText);return r.reject(e)})}return o.totalPendingRequests=0,o}]}function nn(){this.$get=["$rootScope","$browser","$location",function(e,t,n){return{findBindings:function(e,t,n){e=e.getElementsByClassName("ng-binding");var i=[];return r(e,function(e){var o=or.element(e).data("$binding");o&&r(o,function(r){n?new RegExp("(^|\\s)"+fr(t)+"(\\s|\\||$)").test(r)&&i.push(e):-1!==r.indexOf(t)&&i.push(e)})}),i},findModels:function(e,t,n){for(var r=["ng-","data-ng-","ng\\:"],i=0;in&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):0>n&&(n=e.length),r=0;e.charAt(r)===Yi;r++);if(r===(o=e.length))t=[0],n=1;else{for(o--;e.charAt(o)===Yi;)o--;for(n-=r,t=[],i=0;r<=o;r++,i++)t[i]=+e.charAt(r)}return n>zi&&(t=t.splice(0,zi-1),a=n-1,n=1),{d:t,e:a,i:n}}function yn(e,t,n,r){var i=e.d,o=i.length-e.i;if(t=g(t)?Math.min(Math.max(n,o),r):+t,n=t+e.i,r=i[n],0n-1){for(r=0;r>n;r--)i.unshift(0),e.i++;i.unshift(1),e.i++}else i[n-1]++;for(;os;)l.unshift(0),s++;for(0=t.lgSize&&s.unshift(l.splice(-t.lgSize,l.length).join(""));l.length>t.gSize;)s.unshift(l.splice(-t.gSize,l.length).join(""));l.length&&s.unshift(l.join("")),l=s.join(n),o.length&&(l+=r+o.join("")),i&&(l+="e+"+i)}return 0>e&&!a?t.negPre+l+t.negSuf:t.posPre+l+t.posSuf}function $n(e,t,n,r){var i="";for((0>e||r&&0>=e)&&(r?e=1-e:(e=-e,i="-")),e=""+e;e.length-n)&&(o+=n),0===o&&-12===n&&(o=12),$n(o,t,r,i)}}function xn(e,t,n){return function(r,i){var o=r["get"+e]();return i[Qn((n?"STANDALONE":"")+(t?"SHORT":"")+e)][o]}}function Cn(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(4>=t?5:12)-t)}function kn(e){return function(t){var n=Cn(t.getFullYear());return t=+new Date(t.getFullYear(),t.getMonth(),t.getDate()+(4-t.getDay()))-+n,t=1+Math.round(t/6048e5),$n(t,e)}}function En(e,t){return 0>=e.getFullYear()?t.ERAS[0]:t.ERAS[1]}function Sn(e){function t(e){var t;if(t=e.match(n)){e=new Date(0);var r=0,i=0,o=t[8]?e.setUTCFullYear:e.setFullYear,a=t[8]?e.setUTCHours:e.setHours;t[9]&&(r=c(t[9]+t[10]),i=c(t[9]+t[11])),o.call(e,c(t[1]),c(t[2])-1,c(t[3])),r=c(t[4]||0)-r,i=c(t[5]||0)-i,o=c(t[6]||0),t=Math.round(1e3*parseFloat("0."+(t[7]||0))),a.call(e,r,i,o,t)}return e}var n=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,i,o){var a,s,l="",u=[];if(i=i||"mediumDate",i=e.DATETIME_FORMATS[i]||i,$(n)&&(n=Ki.test(n)?c(n):t(n)),w(n)&&(n=new Date(n)),!x(n)||!isFinite(n.getTime()))return n;for(;i;)(s=Gi.exec(i))?(u=I(u,s,1),i=u.pop()):(u.push(i),i=null);var f=n.getTimezoneOffset();return o&&(f=U(o,f),n=H(n,o,!0)),r(u,function(t){a=Wi[t],l+=a?a(n,e.DATETIME_FORMATS,f):"''"===t?"'":t.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),l}}function _n(){return function(e,t){return g(t)&&(t=2),j(e,t)}}function Mn(){return function(e,t,r){return t=1/0===Math.abs(Number(t))?Number(t):c(t),sr(t)?e:(w(e)&&(e=e.toString()),n(e)?(r=!r||isNaN(r)?0:c(r),r=0>r?Math.max(0,e.length+r):r,0<=t?Tn(e,r,r+t):0===r?Tn(e,t,e.length):Tn(e,Math.max(0,r+t),r)):e)}}function Tn(e,t,n){return $(e)?e.slice(t,n):Xn.call(e,t,n)}function Dn(e){function r(t){return t.map(function(t){var n=1,r=p;if(C(t))r=t;else if($(t)&&("+"!==t.charAt(0)&&"-"!==t.charAt(0)||(n="-"===t.charAt(0)?-1:1,t=t.substring(1)),""!==t&&(r=e(t),r.constant)))var i=r(),r=function(e){return e[i]};return{get:r,descending:n}})}function i(e){switch(typeof e){case"number":case"boolean":case"string":return!0;default:return!1}}function o(e,t){var n=0,r=e.type,i=t.type;if(r===i){var i=e.value,o=t.value;"string"===r?(i=i.toLowerCase(),o=o.toLowerCase()):"object"===r&&(y(i)&&(i=e.index),y(o)&&(o=t.index)),i!==o&&(n=it||37<=t&&40>=t||c(e,this,this.value)}),i.hasEvent("paste")&&t.on("paste cut",c)}t.on("change",u),ho[a]&&r.$$hasNativeValidators&&a===n.type&&t.on("keydown wheel mousedown",function(e){if(!l){var t=this.validity,n=t.badInput,r=t.typeMismatch;l=o.defer(function(){l=null,t.badInput===n&&t.typeMismatch===r||u(e)})}}),r.$render=function(){var e=r.$isEmpty(r.$viewValue)?"":r.$viewValue;t.val()!==e&&t.val(e)}}function In(e,t){return function(n,i){var o,a;if(x(n))return n;if($(n)){if('"'===n.charAt(0)&&'"'===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),io.test(n))return new Date(n);if(e.lastIndex=0,o=e.exec(n))return o.shift(),a=i?{yyyy:i.getFullYear(),MM:i.getMonth()+1,dd:i.getDate(),HH:i.getHours(),mm:i.getMinutes(),ss:i.getSeconds(),sss:i.getMilliseconds()/1e3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},r(o,function(e,n){n=m},a.$observe("min",function(e){m=d(e),s.$validate()})}if(v(a.max)||a.ngMax){var y;s.$validators.max=function(e){return!f(e)||g(y)||n(e)<=y},a.$observe("max",function(e){y=d(e),s.$validate()})}}}function Fn(e,t,n,r){(r.$$hasNativeValidators=y(t[0].validity))&&r.$parsers.push(function(e){var n=t.prop("validity")||{};return n.badInput||n.typeMismatch?void 0:e})}function jn(e){e.$$parserName="number",e.$parsers.push(function(t){return e.$isEmpty(t)?null:so.test(t)?parseFloat(t):void 0}),e.$formatters.push(function(t){if(!e.$isEmpty(t)){if(!w(t))throw Uo("numfmt",t);t=t.toString()}return t})}function Ln(e){return v(e)&&!w(e)&&(e=parseFloat(e)),sr(e)?void 0:e}function Un(e){var t=e.toString(),n=t.indexOf(".");return-1===n?-1e&&(e=/e-(\d+)$/.exec(t))?Number(e[1]):0:t.length-n-1}function Hn(e,t,n,r,i){if(v(r)){if(e=e(r),!e.constant)throw Uo("constexpr",n,r);return e(t)}return i}function qn(e,t){return e="ngClass"+e,["$animate",function(n){function i(e,t){var n=[],r=0;e:for(;r(?:<\/\1>|)$/,Mr=/<|&#?\w+;/,Tr=/<([\w:-]+)/,Dr=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Ar={option:[1,'"],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Ar.optgroup=Ar.option,Ar.tbody=Ar.tfoot=Ar.colgroup=Ar.caption=Ar.thead,Ar.th=Ar.td;var Or=e.Node.prototype.contains||function(e){return!!(16&this.compareDocumentPosition(e))},Nr=de.prototype={ready:function(t){function n(){r||(r=!0,t())}var r=!1;"complete"===e.document.readyState?e.setTimeout(n):(this.on("DOMContentLoaded",n),de(e).on("load",n))},toString:function(){var e=[];return r(this,function(t){e.push(""+t)}),"["+e.join(", ")+"]"},eq:function(e){return Yn(0<=e?this[e]:this[this.length+e])},length:0,push:tr,sort:[].sort,splice:[].splice},Rr={};r("multiple selected checked disabled readOnly required open".split(" "),function(e){Rr[Jn(e)]=e});var Ir={};r("input select option textarea button form details".split(" "),function(e){Ir[e]=!0});var Pr={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern"};r({data:ye,removeData:ge,hasData:function(e){for(var t in wr[e.ng339])return!0;return!1},cleanData:function(e){for(var t=0,n=e.length;t/,Lr=/^[^\(]*\(\s*([^\)]*)\)/m,Ur=/,/,Hr=/^\s*(_?)(\S+?)\1\s*$/,qr=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Vr=t("$injector");Fe.$$annotate=function(e,t,n){var i;if("function"==typeof e){if(!(i=e.$inject)){if(i=[],e.length){if(t)throw $(n)&&n||(n=e.name||Pe(e)),Vr("strictdi",n);t=Ie(e),r(t[1].split(Ur),function(e){e.replace(Hr,function(e,t,n){i.push(n)})})}e.$inject=i}}else lr(e)?(t=e.length-1,te(e[t],"fn"),i=e.slice(0,t)):te(e,"fn",!0);return i};var zr=t("$animate"),Br=function(){this.$get=d},Yr=function(){var e=new Re,t=[];this.$get=["$$AnimateRunner","$rootScope",function(n,i){function o(e,t,n){var i=!1;return t&&(t=$(t)?t.split(" "):lr(t)?t:[],r(t,function(t){t&&(i=!0,e[t]=n)})),i}function a(){r(t,function(t){var n=e.get(t);if(n){var i=Ue(t.attr("class")),o="",a="";r(n,function(e,t){e!==!!i[t]&&(e?o+=(o.length?" ":"")+t:a+=(a.length?" ":"")+t)}),r(t,function(e){o&&we(e,o),a&&$e(e,a)}),e.remove(t)}}),t.length=0}return{enabled:d,on:d,off:d,pin:d,push:function(r,s,l,u){return u&&u(),l=l||{},l.from&&r.css(l.from),l.to&&r.css(l.to),(l.addClass||l.removeClass)&&(s=l.addClass,u=l.removeClass,l=e.get(r)||{},s=o(l,s,!0),u=o(l,u,!1),(s||u)&&(e.put(r,l),t.push(r),1===t.length&&i.$$postDigest(a))),r=new n,r.complete(),r}}}]},Wr=["$provide",function(e){var t=this;this.$$registeredAnimations=Object.create(null),this.register=function(n,r){if(n&&"."!==n.charAt(0))throw zr("notcsel",n);var i=n+"-animation";t.$$registeredAnimations[n.substr(1)]=i,e.factory(i,r)},this.classNameFilter=function(e){if(1===arguments.length&&(this.$$classNameFilter=e instanceof RegExp?e:null)&&/(\s+|\/)ng-animate(\s+|\/)/.test(this.$$classNameFilter.toString()))throw zr("nongcls","ng-animate");return this.$$classNameFilter},this.$get=["$$animateQueue",function(e){function t(e,t,n){if(n){var r;e:{for(r=0;r <= >= && || ! = |".split(" "),function(e){Ri[e]=!0});var Ii={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Pi=function(e){this.options=e};Pi.prototype={constructor:Pi,lex:function(e){for(this.text=e,this.index=0,this.tokens=[];this.index=e&&"string"==typeof e},isWhitespace:function(e){return" "===e||"\r"===e||"\t"===e||"\n"===e||"\v"===e||" "===e},isIdentifierStart:function(e){return this.options.isIdentifierStart?this.options.isIdentifierStart(e,this.codePointAt(e)):this.isValidIdentifierStart(e)},isValidIdentifierStart:function(e){return"a"<=e&&"z">=e||"A"<=e&&"Z">=e||"_"===e||"$"===e},isIdentifierContinue:function(e){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(e,this.codePointAt(e)):this.isValidIdentifierContinue(e)},isValidIdentifierContinue:function(e,t){return this.isValidIdentifierStart(e,t)||this.isNumber(e)},codePointAt:function(e){return 1===e.length?e.charCodeAt(0):(e.charCodeAt(0)<<10)+e.charCodeAt(1)-56613888},peekMultichar:function(){var e=this.text.charAt(this.index),t=this.peek();if(!t)return e;var n=e.charCodeAt(0),r=t.charCodeAt(0);return 55296<=n&&56319>=n&&56320<=r&&57343>=r?e+t:e},isExpOperator:function(e){return"-"===e||"+"===e||this.isNumber(e)},throwError:function(e,t,n){throw n=n||this.index,t=v(t)?"s "+t+"-"+this.index+" ["+this.text.substring(t,n)+"]":" "+n,vi("lexerr",e,t,this.text)},readNumber:function(){for(var e="",t=this.index;this.index","<=",">=");)t={type:Fi.BinaryExpression,operator:e.text,left:t,right:this.additive()};return t},additive:function(){for(var e,t=this.multiplicative();e=this.expect("+","-");)t={type:Fi.BinaryExpression,operator:e.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t={type:Fi.BinaryExpression,operator:e.text,left:t,right:this.unary()};return t},unary:function(){var e;return(e=this.expect("+","-","!"))?{type:Fi.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e;this.expect("(")?(e=this.filterChain(),this.consume(")")):this.expect("[")?e=this.arrayDeclaration():this.expect("{")?e=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?e=N(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:Fi.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError("not a primary expression",this.peek());for(var t;t=this.expect("(","[",".");)"("===t.text?(e={type:Fi.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(")")):"["===t.text?(e={type:Fi.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume("]")):"."===t.text?e={type:Fi.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return e},filter:function(e){e=[e];for(var t={ -type:Fi.CallExpression,callee:this.identifier(),arguments:e,filter:!0};this.expect(":");)e.push(this.expression());return t},parseArguments:function(){var e=[];if(")"!==this.peekToken().text)do{e.push(this.filterChain())}while(this.expect(","));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError("is not a valid identifier",e),{type:Fi.Identifier,name:e.text}},constant:function(){return{type:Fi.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if("]"!==this.peekToken().text)do{if(this.peek("]"))break;e.push(this.expression())}while(this.expect(","));return this.consume("]"),{type:Fi.ArrayExpression,elements:e}},object:function(){var e,t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;e={type:Fi.Property,kind:"init"},this.peek().constant?(e.key=this.constant(),e.computed=!1,this.consume(":"),e.value=this.expression()):this.peek().identifier?(e.key=this.identifier(),e.computed=!1,this.peek(":")?(this.consume(":"),e.value=this.expression()):e.value=e.key):this.peek("[")?(this.consume("["),e.key=this.expression(),this.consume("]"),e.computed=!0,this.consume(":"),e.value=this.expression()):this.throwError("invalid key",this.peek()),t.push(e)}while(this.expect(","));return this.consume("}"),{type:Fi.ObjectExpression,properties:t}},throwError:function(e,t){throw vi("syntax",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw vi("ueoe",this.text);var t=this.expect(e);return t||this.throwError("is unexpected, expecting ["+e+"]",this.peek()),t},peekToken:function(){if(0===this.tokens.length)throw vi("ueoe",this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){e=this.tokens[e];var o=e.text;if(o===t||o===n||o===r||o===i||!(t||n||r||i))return e}return!1},expect:function(e,t,n,r){return!!(e=this.peek(e,t,n,r))&&(this.tokens.shift(),e)},selfReferential:{this:{type:Fi.ThisExpression},$locals:{type:Fi.LocalsExpression}}},Lt.prototype={compile:function(e,t){var n=this,i=this.astBuilder.ast(e);this.state={nextId:0,filters:{},expensiveChecks:t,fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},Rt(i,n.$filter);var o,a="";return this.stage="assign",(o=Ft(i))&&(this.state.computing="assign",a=this.nextId(),this.recurse(o,a),this.return_(a),a="fn.assign="+this.generateFunction("assign","s,v,l")),o=It(i.body),n.stage="inputs",r(o,function(e,t){var r="fn"+t;n.state[r]={vars:[],body:[],own:{}},n.state.computing=r;var i=n.nextId();n.recurse(e,i),n.return_(i),n.state.inputs.push(r),e.watchId=t}),this.state.computing="fn",this.stage="main",this.recurse(i),a='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+a+this.watchFns()+"return fn;",a=new Function("$filter","ensureSafeMemberName","ensureSafeObject","ensureSafeFunction","getStringValue","ensureSafeAssignContext","ifDefined","plus","text",a)(this.$filter,_t,Tt,Dt,Mt,At,Ot,Nt,e),this.state=this.stage=void 0,a.literal=jt(i),a.constant=i.constant,a},USE:"use",STRICT:"strict",watchFns:function(){var e=[],t=this.state.inputs,n=this;return r(t,function(t){e.push("var "+t+"="+n.generateFunction(t,"s"))}),t.length&&e.push("fn.inputs=["+t.join(",")+"];"),e.join("")},generateFunction:function(e,t){return"function("+t+"){"+this.varsPrefix(e)+this.body(e)+"};"},filterPrefix:function(){var e=[],t=this;return r(this.state.filters,function(n,r){e.push(n+"=$filter("+t.escape(r)+")")}),e.length?"var "+e.join(",")+";":""},varsPrefix:function(e){return this.state[e].vars.length?"var "+this.state[e].vars.join(",")+";":""},body:function(e){return this.state[e].body.join("")},recurse:function(e,t,n,i,o,a){var s,l,u,c,f,p=this;if(i=i||d,!a&&v(e.watchId))t=t||this.nextId(),this.if_("i",this.lazyAssign(t,this.computedMember("i",e.watchId)),this.lazyRecurse(e,t,n,i,o,!0));else switch(e.type){case Fi.Program:r(e.body,function(t,n){p.recurse(t.expression,void 0,void 0,function(e){l=e}),n!==e.body.length-1?p.current().body.push(l,";"):p.return_(l)});break;case Fi.Literal:c=this.escape(e.value),this.assign(t,c),i(c);break;case Fi.UnaryExpression:this.recurse(e.argument,void 0,void 0,function(e){l=e}),c=e.operator+"("+this.ifDefined(l,0)+")",this.assign(t,c),i(c);break;case Fi.BinaryExpression:this.recurse(e.left,void 0,void 0,function(e){s=e}),this.recurse(e.right,void 0,void 0,function(e){l=e}),c="+"===e.operator?this.plus(s,l):"-"===e.operator?this.ifDefined(s,0)+e.operator+this.ifDefined(l,0):"("+s+")"+e.operator+"("+l+")",this.assign(t,c),i(c);break;case Fi.LogicalExpression:t=t||this.nextId(),p.recurse(e.left,t),p.if_("&&"===e.operator?t:p.not(t),p.lazyRecurse(e.right,t)),i(t);break;case Fi.ConditionalExpression:t=t||this.nextId(),p.recurse(e.test,t),p.if_(t,p.lazyRecurse(e.alternate,t),p.lazyRecurse(e.consequent,t)),i(t);break;case Fi.Identifier:t=t||this.nextId(),n&&(n.context="inputs"===p.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",e.name)+"?l:s"),n.computed=!1,n.name=e.name),_t(e.name),p.if_("inputs"===p.stage||p.not(p.getHasOwnProperty("l",e.name)),function(){p.if_("inputs"===p.stage||"s",function(){o&&1!==o&&p.if_(p.not(p.nonComputedMember("s",e.name)),p.lazyAssign(p.nonComputedMember("s",e.name),"{}")),p.assign(t,p.nonComputedMember("s",e.name))})},t&&p.lazyAssign(t,p.nonComputedMember("l",e.name))),(p.state.expensiveChecks||Ht(e.name))&&p.addEnsureSafeObject(t),i(t);break;case Fi.MemberExpression:s=n&&(n.context=this.nextId())||this.nextId(),t=t||this.nextId(),p.recurse(e.object,s,void 0,function(){p.if_(p.notNull(s),function(){o&&1!==o&&p.addEnsureSafeAssignContext(s),e.computed?(l=p.nextId(),p.recurse(e.property,l),p.getStringValue(l),p.addEnsureSafeMemberName(l),o&&1!==o&&p.if_(p.not(p.computedMember(s,l)),p.lazyAssign(p.computedMember(s,l),"{}")),c=p.ensureSafeObject(p.computedMember(s,l)),p.assign(t,c),n&&(n.computed=!0,n.name=l)):(_t(e.property.name),o&&1!==o&&p.if_(p.not(p.nonComputedMember(s,e.property.name)),p.lazyAssign(p.nonComputedMember(s,e.property.name),"{}")),c=p.nonComputedMember(s,e.property.name),(p.state.expensiveChecks||Ht(e.property.name))&&(c=p.ensureSafeObject(c)),p.assign(t,c),n&&(n.computed=!1,n.name=e.property.name))},function(){p.assign(t,"undefined")}),i(t)},!!o);break;case Fi.CallExpression:t=t||this.nextId(),e.filter?(l=p.filter(e.callee.name),u=[],r(e.arguments,function(e){var t=p.nextId();p.recurse(e,t),u.push(t)}),c=l+"("+u.join(",")+")",p.assign(t,c),i(t)):(l=p.nextId(),s={},u=[],p.recurse(e.callee,l,s,function(){p.if_(p.notNull(l),function(){p.addEnsureSafeFunction(l),r(e.arguments,function(e){p.recurse(e,p.nextId(),void 0,function(e){u.push(p.ensureSafeObject(e))})}),s.name?(p.state.expensiveChecks||p.addEnsureSafeObject(s.context),c=p.member(s.context,s.name,s.computed)+"("+u.join(",")+")"):c=l+"("+u.join(",")+")",c=p.ensureSafeObject(c),p.assign(t,c)},function(){p.assign(t,"undefined")}),i(t)}));break;case Fi.AssignmentExpression:if(l=this.nextId(),s={},!Pt(e.left))throw vi("lval");this.recurse(e.left,void 0,s,function(){p.if_(p.notNull(s.context),function(){p.recurse(e.right,l),p.addEnsureSafeObject(p.member(s.context,s.name,s.computed)),p.addEnsureSafeAssignContext(s.context),c=p.member(s.context,s.name,s.computed)+e.operator+l,p.assign(t,c),i(t||c)})},1);break;case Fi.ArrayExpression:u=[],r(e.elements,function(e){p.recurse(e,p.nextId(),void 0,function(e){u.push(e)})}),c="["+u.join(",")+"]",this.assign(t,c),i(c);break;case Fi.ObjectExpression:u=[],f=!1,r(e.properties,function(e){e.computed&&(f=!0)}),f?(t=t||this.nextId(),this.assign(t,"{}"),r(e.properties,function(e){e.computed?(s=p.nextId(),p.recurse(e.key,s)):s=e.key.type===Fi.Identifier?e.key.name:""+e.key.value,l=p.nextId(),p.recurse(e.value,l),p.assign(p.member(t,s,e.computed),l)})):(r(e.properties,function(t){p.recurse(t.value,e.constant?void 0:p.nextId(),void 0,function(e){u.push(p.escape(t.key.type===Fi.Identifier?t.key.name:""+t.key.value)+":"+e)})}),c="{"+u.join(",")+"}",this.assign(t,c)),i(t||c);break;case Fi.ThisExpression:this.assign(t,"s"),i("s");break;case Fi.LocalsExpression:this.assign(t,"l"),i("l");break;case Fi.NGValueParameter:this.assign(t,"v"),i("v")}},getHasOwnProperty:function(e,t){var n=e+"."+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+"&&("+this.escape(t)+" in "+e+")")),r[n]},assign:function(e,t){if(e)return this.current().body.push(e,"=",t,";"),e},filter:function(e){return this.state.filters.hasOwnProperty(e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return"ifDefined("+e+","+this.escape(t)+")"},plus:function(e,t){return"plus("+e+","+t+")"},return_:function(e){this.current().body.push("return ",e,";")},if_:function(e,t,n){if(!0===e)t();else{var r=this.current().body;r.push("if(",e,"){"),t(),r.push("}"),n&&(r.push("else{"),n(),r.push("}"))}},not:function(e){return"!("+e+")"},notNull:function(e){return e+"!=null"},nonComputedMember:function(e,t){var n=/[^$_a-zA-Z0-9]/g;return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?e+"."+t:e+'["'+t.replace(n,this.stringEscapeFn)+'"]'},computedMember:function(e,t){return e+"["+t+"]"},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},addEnsureSafeObject:function(e){this.current().body.push(this.ensureSafeObject(e),";")},addEnsureSafeMemberName:function(e){this.current().body.push(this.ensureSafeMemberName(e),";")},addEnsureSafeFunction:function(e){this.current().body.push(this.ensureSafeFunction(e),";")},addEnsureSafeAssignContext:function(e){this.current().body.push(this.ensureSafeAssignContext(e),";")},ensureSafeObject:function(e){return"ensureSafeObject("+e+",text)"},ensureSafeMemberName:function(e){return"ensureSafeMemberName("+e+",text)"},ensureSafeFunction:function(e){return"ensureSafeFunction("+e+",text)"},getStringValue:function(e){this.assign(e,"getStringValue("+e+")")},ensureSafeAssignContext:function(e){return"ensureSafeAssignContext("+e+",text)"},lazyRecurse:function(e,t,n,r,i,o){var a=this;return function(){a.recurse(e,t,n,r,i,o)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if($(e))return"'"+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(w(e))return e.toString();if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(void 0===e)return"undefined";throw vi("esc")},nextId:function(e,t){var n="v"+this.state.nextId++;return e||this.current().vars.push(n+(t?"="+t:"")),n},current:function(){return this.state[this.state.computing]}},Ut.prototype={compile:function(e,t){var n=this,i=this.astBuilder.ast(e);this.expression=e,this.expensiveChecks=t,Rt(i,n.$filter);var o,a;(o=Ft(i))&&(a=this.recurse(o)),o=It(i.body);var s;o&&(s=[],r(o,function(e,t){var r=n.recurse(e);e.input=r,s.push(r),e.watchId=t}));var l=[];return r(i.body,function(e){l.push(n.recurse(e.expression))}),o=0===i.body.length?d:1===i.body.length?l[0]:function(e,t){var n;return r(l,function(r){n=r(e,t)}),n},a&&(o.assign=function(e,t,n){return a(e,n,t)}),s&&(o.inputs=s),o.literal=jt(i),o.constant=i.constant,o},recurse:function(e,t,n){var i,o,a,s=this;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case Fi.Literal:return this.value(e.value,t);case Fi.UnaryExpression:return o=this.recurse(e.argument),this["unary"+e.operator](o,t);case Fi.BinaryExpression:case Fi.LogicalExpression:return i=this.recurse(e.left),o=this.recurse(e.right),this["binary"+e.operator](i,o,t);case Fi.ConditionalExpression:return this["ternary?:"](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case Fi.Identifier:return _t(e.name,s.expression),s.identifier(e.name,s.expensiveChecks||Ht(e.name),t,n,s.expression);case Fi.MemberExpression:return i=this.recurse(e.object,!1,!!n),e.computed||(_t(e.property.name,s.expression),o=e.property.name),e.computed&&(o=this.recurse(e.property)),e.computed?this.computedMember(i,o,t,n,s.expression):this.nonComputedMember(i,o,s.expensiveChecks,t,n,s.expression);case Fi.CallExpression:return a=[],r(e.arguments,function(e){a.push(s.recurse(e))}),e.filter&&(o=this.$filter(e.callee.name)),e.filter||(o=this.recurse(e.callee,!0)),e.filter?function(e,n,r,i){for(var s=[],l=0;l":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)>t(r,i,o,a),n?{value:r}:r}},"binary<=":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)<=t(r,i,o,a),n?{value:r}:r}},"binary>=":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)>=t(r,i,o,a),n?{value:r}:r}},"binary&&":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)&&t(r,i,o,a),n?{value:r}:r}},"binary||":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)||t(r,i,o,a),n?{value:r}:r}},"ternary?:":function(e,t,n,r){return function(i,o,a,s){return i=e(i,o,a,s)?t(i,o,a,s):n(i,o,a,s),r?{value:i}:i}},value:function(e,t){return function(){return t?{context:void 0,name:void 0,value:e}:e}},identifier:function(e,t,n,r,i){return function(o,a,s,l){return o=a&&e in a?a:o,r&&1!==r&&o&&!o[e]&&(o[e]={}),a=o?o[e]:void 0,t&&Tt(a,i),n?{context:o,name:e,value:a}:a}},computedMember:function(e,t,n,r,i){return function(o,a,s,l){var u,c,f=e(o,a,s,l);return null!=f&&(u=t(o,a,s,l),u+="",_t(u,i),r&&1!==r&&(At(f),f&&!f[u]&&(f[u]={})),c=f[u],Tt(c,i)),n?{context:f,name:u,value:c}:c}},nonComputedMember:function(e,t,n,r,i,o){return function(a,s,l,u){return a=e(a,s,l,u),i&&1!==i&&(At(a),a&&!a[t]&&(a[t]={})),s=null!=a?a[t]:void 0,(n||Ht(t))&&Tt(s,o),r?{context:a,name:t,value:s}:s}},inputs:function(e,t){return function(n,r,i,o){return o?o[t]:e(n,r,i)}}};var ji=function(e,t,n){this.lexer=e,this.$filter=t,this.options=n,this.ast=new Fi(e,n),this.astCompiler=n.csp?new Ut(this.ast,t):new Lt(this.ast,t)};ji.prototype={constructor:ji,parse:function(e){return this.astCompiler.compile(e,this.options.expensiveChecks)}};var Li=t("$sce"),Ui={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Hi=t("$compile"),qi=e.document.createElement("a"),Vi=on(e.location.href);ln.$inject=["$document"],cn.$inject=["$provide"];var zi=22,Bi=".",Yi="0";mn.$inject=["$locale"],gn.$inject=["$locale"];var Wi={yyyy:wn("FullYear",4,0,!1,!0),yy:wn("FullYear",2,0,!0,!0),y:wn("FullYear",1,0,!1,!0),MMMM:xn("Month"),MMM:xn("Month",!0),MM:wn("Month",2,1),M:wn("Month",1,1),LLLL:xn("Month",!1,!0),dd:wn("Date",2),d:wn("Date",1),HH:wn("Hours",2),H:wn("Hours",1),hh:wn("Hours",2,-12),h:wn("Hours",1,-12),mm:wn("Minutes",2),m:wn("Minutes",1),ss:wn("Seconds",2),s:wn("Seconds",1),sss:wn("Milliseconds",3),EEEE:xn("Day"),EEE:xn("Day",!0),a:function(e,t){return 12>e.getHours()?t.AMPMS[0]:t.AMPMS[1]},Z:function(e,t,n){return e=-1*n,e=(0<=e?"+":"")+($n(Math[0=e.getFullYear()?t.ERANAMES[0]:t.ERANAMES[1]}},Gi=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,Ki=/^\-?\d+$/;Sn.$inject=["$locale"];var Zi=h(Jn),Ji=h(Qn);Dn.$inject=["$parse"];var Qi=h({restrict:"E",compile:function(e,t){if(!t.href&&!t.xlinkHref)return function(e,t){if("a"===t[0].nodeName.toLowerCase()){var n="[object SVGAnimatedString]"===nr.call(t.prop("href"))?"xlink:href":"href";t.on("click",function(e){t.attr(n)||e.preventDefault()})}}}}),Xi={};r(Rr,function(e,t){function n(e,n,i){e.$watch(i[r],function(e){i.$set(t,!!e)})}if("multiple"!==e){var r=Ge("ng-"+t),i=n;"checked"===e&&(i=function(e,t,i){i.ngModel!==i[r]&&n(e,t,i)}),Xi[r]=function(){return{restrict:"A",priority:100,link:i}}}}),r(Pr,function(e,t){Xi[t]=function(){return{priority:100,link:function(e,n,r){if("ngPattern"===t&&"/"===r.ngPattern.charAt(0)&&(n=r.ngPattern.match(Kn)))return void r.$set("ngPattern",new RegExp(n[1],n[2]));e.$watch(r[t],function(e){r.$set(t,e)})}}}}),r(["src","srcset","href"],function(e){var t=Ge("ng-"+e);Xi[t]=function(){return{priority:99,link:function(n,r,i){var o=e,a=e;"href"===e&&"[object SVGAnimatedString]"===nr.call(r.prop("href"))&&(a="xlinkHref",i.$attr[a]="xlink:href",o=null),i.$observe(t,function(t){t?(i.$set(a,t),Bn&&o&&r.prop(o,i[a])):"href"===e&&i.$set(a,null)})}}}});var eo={$addControl:d,$$renameControl:function(e,t){e.$name=t},$removeControl:d,$setValidity:d,$setDirty:d,$setPristine:d,$setSubmitted:d};On.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var to=function(e){return["$timeout","$parse",function(t,n){function r(e){return""===e?n('this[""]').assign:n(e).assign||d}return{name:"form",restrict:e?"EAC":"E",require:["form","^^?form"],controller:On,compile:function(n,i){n.addClass(Fo).addClass(Io);var o=i.name?"name":!(!e||!i.ngForm)&&"ngForm";return{pre:function(e,n,i,a){var s=a[0];if(!("action"in i)){var u=function(t){e.$apply(function(){s.$commitViewValue(),s.$setSubmitted()}),t.preventDefault()};n[0].addEventListener("submit",u,!1),n.on("$destroy",function(){t(function(){n[0].removeEventListener("submit",u,!1)},0,!1)})}(a[1]||s.$$parentForm).$addControl(s);var c=o?r(s.$name):d;o&&(c(e,s),i.$observe(o,function(t){s.$name!==t&&(c(e,void 0),s.$$parentForm.$$renameControl(s,t),(c=r(s.$name))(e,s))})),n.on("$destroy",function(){s.$$parentForm.$removeControl(s),c(e,void 0),l(s,eo)})}}}}}]},no=to(),ro=to(!0),io=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,oo=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:\/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,ao=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,so=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,lo=/^(\d{4,})-(\d{2})-(\d{2})$/,uo=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,co=/^(\d{4,})-W(\d\d)$/,fo=/^(\d{4,})-(\d\d)$/,po=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ho=oe();r(["date","datetime-local","month","time","week"],function(e){ho[e]=!0});var mo={text:function(e,t,n,r,i,o){Rn(e,t,n,r,i,o),Nn(r)},date:Pn("date",lo,In(lo,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":Pn("datetimelocal",uo,In(uo,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:Pn("time",po,In(po,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:Pn("week",co,function(e,t){if(x(e))return e;if($(e)){co.lastIndex=0;var n=co.exec(e);if(n){var r=+n[1],i=+n[2],o=n=0,a=0,s=0,l=Cn(r),i=7*(i-1);return t&&(n=t.getHours(),o=t.getMinutes(),a=t.getSeconds(),s=t.getMilliseconds()),new Date(r,0,l.getDate()+i,n,o,a,s)}}return NaN},"yyyy-Www"),month:Pn("month",fo,In(fo,["yyyy","MM"]),"yyyy-MM"),number:function(e,t,n,r,i,o){Fn(e,t,n,r),Rn(e,t,n,r,i,o),jn(r);var a,s;(v(n.min)||n.ngMin)&&(r.$validators.min=function(e){return r.$isEmpty(e)||g(a)||e>=a},n.$observe("min",function(e){a=Ln(e),r.$validate()})),(v(n.max)||n.ngMax)&&(r.$validators.max=function(e){return r.$isEmpty(e)||g(s)||e<=s},n.$observe("max",function(e){s=Ln(e),r.$validate()}))},url:function(e,t,n,r,i,o){Rn(e,t,n,r,i,o),Nn(r),r.$$parserName="url",r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||oo.test(n)}},email:function(e,t,n,r,i,o){Rn(e,t,n,r,i,o),Nn(r),r.$$parserName="email",r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||ao.test(n)}},radio:function(e,t,n,r){g(n.name)&&t.attr("name",++ar),t.on("click",function(e){t[0].checked&&r.$setViewValue(n.value,e&&e.type)}),r.$render=function(){t[0].checked=n.value===r.$viewValue},n.$observe("value",r.$render)},range:function(e,t,n,r,i,o){function a(e,r){t.attr(e,n[e]),n.$observe(e,r)}function s(e){f=Ln(e),sr(r.$modelValue)||(c?(e=t.val(),f>e&&(e=f,t.val(e)),r.$setViewValue(e)):r.$validate())}function l(e){d=Ln(e),sr(r.$modelValue)||(c?(e=t.val(),d=f},a("min",s)),i&&(r.$validators.max=c?function(){return!0}:function(e,t){return r.$isEmpty(t)||g(d)||t<=d},a("max",l)),o&&(r.$validators.step=c?function(){return!h.stepMismatch}:function(e,t){var n;if(!(n=r.$isEmpty(t)||g(p))){n=f||0;var i=p,o=Number(t);if((0|o)!==o||(0|n)!==n||(0|i)!==i){var a=Math.max(Un(o),Un(n),Un(i)),a=Math.pow(10,a),o=o*a;n*=a,i*=a}n=0==(o-n)%i}return n},a("step",u))},checkbox:function(e,t,n,r,i,o,a,s){var l=Hn(s,e,"ngTrueValue",n.ngTrueValue,!0),u=Hn(s,e,"ngFalseValue",n.ngFalseValue,!1);t.on("click",function(e){r.$setViewValue(t[0].checked,e&&e.type)}),r.$render=function(){t[0].checked=r.$viewValue},r.$isEmpty=function(e){return!1===e},r.$formatters.push(function(e){return R(e,l)}),r.$parsers.push(function(e){return e?l:u})},hidden:d,button:d,submit:d,reset:d,file:d},go=["$browser","$sniffer","$filter","$parse",function(e,t,n,r){return{restrict:"E",require:["?ngModel"],link:{pre:function(i,o,a,s){if(s[0]){var l=Jn(a.type);"range"!==l||a.hasOwnProperty("ngInputRange")||(l="text"),(mo[l]||mo.text)(i,o,a,s[0],t,e,n,r)}}}}}],vo=/^(true|false|\d+)$/,yo=function(){return{restrict:"A",priority:100,compile:function(e,t){return vo.test(t.ngValue)?function(e,t,n){n.$set("value",e.$eval(n.ngValue))}:function(e,t,n){e.$watch(n.ngValue,function(e){n.$set("value",e)})}}}},bo=["$compile",function(e){return{restrict:"AC",compile:function(t){return e.$$addBindingClass(t),function(t,n,r){e.$$addBindingInfo(n,r.ngBind),n=n[0],t.$watch(r.ngBind,function(e){n.textContent=g(e)?"":e})}}}}],$o=["$interpolate","$compile",function(e,t){return{compile:function(n){return t.$$addBindingClass(n),function(n,r,i){n=e(r.attr(i.$attr.ngBindTemplate)),t.$$addBindingInfo(r,n.expressions),r=r[0],i.$observe("ngBindTemplate",function(e){r.textContent=g(e)?"":e})}}}}],wo=["$sce","$parse","$compile",function(e,t,n){return{restrict:"A",compile:function(r,i){var o=t(i.ngBindHtml),a=t(i.ngBindHtml,function(t){return e.valueOf(t)});return n.$$addBindingClass(r),function(t,r,i){n.$$addBindingInfo(r,i.ngBindHtml),t.$watch(a,function(){var n=o(t);r.html(e.getTrustedHtml(n)||"")})}}}}],xo=h({restrict:"A",require:"ngModel",link:function(e,t,n,r){r.$viewChangeListeners.push(function(){e.$eval(n.ngChange)})}}),Co=qn("",!0),ko=qn("Odd",0),Eo=qn("Even",1),So=An({compile:function(e,t){t.$set("ngCloak",void 0),e.removeClass("ng-cloak")}}),_o=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Mo={},To={blur:!0,focus:!0};r("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(e){var t=Ge("ng-"+e);Mo[t]=["$parse","$rootScope",function(n,r){return{restrict:"A",compile:function(i,o){var a=n(o[t],null,!0);return function(t,n){n.on(e,function(n){var i=function(){a(t,{$event:n})};To[e]&&r.$$phase?t.$evalAsync(i):t.$apply(i)})}}}}]});var Do=["$animate","$compile",function(e,t){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(n,r,i,o,a){var s,l,u;n.$watch(i.ngIf,function(n){n?l||a(function(n,o){l=o,n[n.length++]=t.$$createComment("end ngIf",i.ngIf),s={clone:n},e.enter(n,r.parent(),r)}):(u&&(u.remove(),u=null),l&&(l.$destroy(),l=null),s&&(u=ie(s.clone),e.leave(u).then(function(){u=null}),s=null))})}}}],Ao=["$templateRequest","$anchorScroll","$animate",function(e,t,n){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:or.noop,compile:function(r,i){var o=i.ngInclude||i.src,a=i.onload||"",s=i.autoscroll;return function(r,i,l,u,c){var f,d,p,h=0,m=function(){d&&(d.remove(),d=null),f&&(f.$destroy(),f=null),p&&(n.leave(p).then(function(){d=null}),d=p,p=null)};r.$watch(o,function(o){var l=function(){!v(s)||s&&!r.$eval(s)||t()},d=++h;o?(e(o,!0).then(function(e){if(!r.$$destroyed&&d===h){var t=r.$new();u.template=e,e=c(t,function(e){m(),n.enter(e,null,i).then(l)}),f=t,p=e,f.$emit("$includeContentLoaded",o),r.$eval(a)}},function(){r.$$destroyed||d!==h||(m(),r.$emit("$includeContentError",o))}),r.$emit("$includeContentRequested",o)):(m(),u.template=null)})}}}}],Oo=["$compile",function(t){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(n,r,i,o){nr.call(r[0]).match(/SVG/)?(r.empty(),t(ce(o.template,e.document).childNodes)(n,function(e){r.append(e)},{futureParentElement:r})):(r.html(o.template),t(r.contents())(n))}}}],No=An({priority:450,compile:function(){return{pre:function(e,t,n){e.$eval(n.ngInit)}}}}),Ro=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(e,t,n,i){var o=t.attr(n.$attr.ngList)||", ",a="false"!==n.ngTrim,s=a?cr(o):o;i.$parsers.push(function(e){if(!g(e)){var t=[];return e&&r(e.split(s),function(e){e&&t.push(a?cr(e):e)}),t}}),i.$formatters.push(function(e){if(lr(e))return e.join(o)}),i.$isEmpty=function(e){return!e||!e.length}}}},Io="ng-valid",Po="ng-invalid",Fo="ng-pristine",jo="ng-dirty",Lo="ng-pending",Uo=t("ngModel"),Ho=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(e,t,n,i,o,a,s,l,u,c){this.$modelValue=this.$viewValue=Number.NaN,this.$$rawModelValue=void 0,this.$validators={},this.$asyncValidators={},this.$parsers=[],this.$formatters=[],this.$viewChangeListeners=[],this.$untouched=!0,this.$touched=!1,this.$pristine=!0,this.$dirty=!1,this.$valid=!0,this.$invalid=!1,this.$error={},this.$$success={},this.$pending=void 0,this.$name=c(n.name||"",!1)(e),this.$$parentForm=eo;var f,p=o(n.ngModel),h=p.assign,m=p,y=h,b=null,$=this;this.$$setOptions=function(e){if(($.$options=e)&&e.getterSetter){var t=o(n.ngModel+"()"),r=o(n.ngModel+"($$$p)");m=function(e){var n=p(e);return C(n)&&(n=t(e)),n},y=function(e,t){C(p(e))?r(e,{$$$p:t}):h(e,t)}}else if(!p.assign)throw Uo("nonassign",n.ngModel,q(i))},this.$render=d,this.$isEmpty=function(e){return g(e)||""===e||null===e||e!==e},this.$$updateEmptyClasses=function(e){$.$isEmpty(e)?(a.removeClass(i,"ng-not-empty"),a.addClass(i,"ng-empty")):(a.removeClass(i,"ng-empty"),a.addClass(i,"ng-not-empty"))};var x=0;Vn({ctrl:this,$element:i,set:function(e,t){e[t]=!0},unset:function(e,t){delete e[t]},$animate:a}),this.$setPristine=function(){$.$dirty=!1,$.$pristine=!0,a.removeClass(i,jo),a.addClass(i,Fo)},this.$setDirty=function(){$.$dirty=!0,$.$pristine=!1,a.removeClass(i,Fo),a.addClass(i,jo),$.$$parentForm.$setDirty()},this.$setUntouched=function(){$.$touched=!1,$.$untouched=!0,a.setClass(i,"ng-untouched","ng-touched")},this.$setTouched=function(){$.$touched=!0,$.$untouched=!1,a.setClass(i,"ng-touched","ng-untouched")},this.$rollbackViewValue=function(){s.cancel(b),$.$viewValue=$.$$lastCommittedViewValue,$.$render()},this.$validate=function(){if(!sr($.$modelValue)){var e=$.$$rawModelValue,t=$.$valid,n=$.$modelValue,r=$.$options&&$.$options.allowInvalid;$.$$runValidators(e,$.$$lastCommittedViewValue,function(i){r||t===i||($.$modelValue=i?e:void 0,$.$modelValue!==n&&$.$$writeModelToScope())})}},this.$$runValidators=function(e,t,n){function i(e,t){a===x&&$.$setValidity(e,t)}function o(e){a===x&&n(e)}x++;var a=x;!function(){var e=$.$$parserName||"parse";return g(f)?(i(e,null),!0):(f||(r($.$validators,function(e,t){i(t,null)}),r($.$asyncValidators,function(e,t){i(t,null)})),i(e,f),f)}()?o(!1):function(){var n=!0;return r($.$validators,function(r,o){var a=r(e,t);n=n&&a,i(o,a)}),!!n||(r($.$asyncValidators,function(e,t){i(t,null)}),!1)}()?function(){var n=[],a=!0;r($.$asyncValidators,function(r,o){var s=r(e,t);if(!s||!C(s.then))throw Uo("nopromise",s);i(o,void 0),n.push(s.then(function(){i(o,!0)},function(){a=!1,i(o,!1)}))}),n.length?u.all(n).then(function(){o(a)},d):o(!0)}():o(!1)},this.$commitViewValue=function(){var e=$.$viewValue;s.cancel(b),($.$$lastCommittedViewValue!==e||""===e&&$.$$hasNativeValidators)&&($.$$updateEmptyClasses(e),$.$$lastCommittedViewValue=e,$.$pristine&&this.$setDirty(),this.$$parseAndValidate())},this.$$parseAndValidate=function(){var t=$.$$lastCommittedViewValue;if(f=!g(t)||void 0)for(var n=0;n<$.$parsers.length;n++)if(t=$.$parsers[n](t),g(t)){f=!1;break}sr($.$modelValue)&&($.$modelValue=m(e));var r=$.$modelValue,i=$.$options&&$.$options.allowInvalid;$.$$rawModelValue=t,i&&($.$modelValue=t,$.$modelValue!==r&&$.$$writeModelToScope()),$.$$runValidators(t,$.$$lastCommittedViewValue,function(e){i||($.$modelValue=e?t:void 0,$.$modelValue!==r&&$.$$writeModelToScope())})},this.$$writeModelToScope=function(){y(e,$.$modelValue),r($.$viewChangeListeners,function(e){try{e()}catch(e){t(e)}})},this.$setViewValue=function(e,t){$.$viewValue=e,$.$options&&!$.$options.updateOnDefault||$.$$debounceViewValueCommit(t)},this.$$debounceViewValueCommit=function(t){var n=0,r=$.$options;r&&v(r.debounce)&&(r=r.debounce,w(r)?n=r:w(r[t])?n=r[t]:w(r.default)&&(n=r.default)),s.cancel(b),n?b=s(function(){$.$commitViewValue()},n):l.$$phase?$.$commitViewValue():e.$apply(function(){$.$commitViewValue()})},e.$watch(function(){var t=m(e) -;if(t!==$.$modelValue&&($.$modelValue===$.$modelValue||t===t)){$.$modelValue=$.$$rawModelValue=t,f=void 0;for(var n=$.$formatters,r=n.length,i=t;r--;)i=n[r](i);$.$viewValue!==i&&($.$$updateEmptyClasses(i),$.$viewValue=$.$$lastCommittedViewValue=i,$.$render(),$.$$runValidators($.$modelValue,$.$viewValue,d))}return t})}],qo=["$rootScope",function(e){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:Ho,priority:1,compile:function(t){return t.addClass(Fo).addClass("ng-untouched").addClass(Io),{pre:function(e,t,n,r){var i=r[0];t=r[1]||i.$$parentForm,i.$$setOptions(r[2]&&r[2].$options),t.$addControl(i),n.$observe("name",function(e){i.$name!==e&&i.$$parentForm.$$renameControl(i,e)}),e.$on("$destroy",function(){i.$$parentForm.$removeControl(i)})},post:function(t,n,r,i){var o=i[0];o.$options&&o.$options.updateOn&&n.on(o.$options.updateOn,function(e){o.$$debounceViewValueCommit(e&&e.type)}),n.on("blur",function(){o.$touched||(e.$$phase?t.$evalAsync(o.$setTouched):t.$apply(o.$setTouched))})}}}}}],Vo=/(\s+|^)default(\s+|$)/,zo=function(){return{restrict:"A",controller:["$scope","$attrs",function(e,t){var n=this;this.$options=N(e.$eval(t.ngModelOptions)),v(this.$options.updateOn)?(this.$options.updateOnDefault=!1,this.$options.updateOn=cr(this.$options.updateOn.replace(Vo,function(){return n.$options.updateOnDefault=!0," "}))):this.$options.updateOnDefault=!0}]}},Bo=An({terminal:!0,priority:1e3}),Yo=t("ngOptions"),Wo=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,Go=["$compile","$document","$parse",function(t,i,o){function a(e,t,r){function i(e,t,n,r,i){this.selectValue=e,this.viewValue=t,this.label=n,this.group=r,this.disabled=i}function a(e){var t;if(!u&&n(e))t=e;else{t=[];for(var r in e)e.hasOwnProperty(r)&&"$"!==r.charAt(0)&&t.push(r)}return t}var s=e.match(Wo);if(!s)throw Yo("iexp",e,q(t));var l=s[5]||s[7],u=s[6];e=/ as /.test(s[0])&&s[1];var c=s[9];t=o(s[2]?s[1]:l);var f=e&&o(e)||t,d=c&&o(c),p=c?function(e,t){return d(r,t)}:function(e){return Ne(e)},h=function(e,t){return p(e,$(e,t))},m=o(s[2]||s[1]),g=o(s[3]||""),v=o(s[4]||""),y=o(s[8]),b={},$=u?function(e,t){return b[u]=t,b[l]=e,b}:function(e){return b[l]=e,b};return{trackBy:c,getTrackByValue:h,getWatchables:o(y,function(e){var t=[];e=e||[];for(var n=a(e),i=n.length,o=0;oi||r.$isEmpty(t)||t.length<=i}}}}},pa=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){if(r){var i=0;n.$observe("minlength",function(e){i=c(e)||0,r.$validate()}),r.$validators.minlength=function(e,t){return r.$isEmpty(t)||t.length>=i}}}}};e.angular.bootstrap?e.console&&console.log("WARNING: Tried to load angular more than once."):(function(){var t;if(!yr){var n=pr();(Wn=g(n)?e.jQuery:n?e[n]:void 0)&&Wn.fn.on?(Yn=Wn,l(Wn.fn,{scope:Nr.scope,isolateScope:Nr.isolateScope,controller:Nr.controller,injector:Nr.injector,inheritedData:Nr.inheritedData}),t=Wn.cleanData,Wn.cleanData=function(e){for(var n,r,i=0;null!=(r=e[i]);i++)(n=Wn._data(r,"events"))&&n.$destroy&&Wn(r).triggerHandler("$destroy");t(e)}):Yn=de,or.element=Yn,yr=!0}}(),function(n){l(n,{bootstrap:Z,copy:N,extend:l,merge:u,equals:R,element:Yn,forEach:r,injector:Fe,noop:d,bind:P,toJson:j,fromJson:L,identity:p,isUndefined:g,isDefined:v,isString:$,isFunction:C,isObject:y,isNumber:w,isElement:T,isArray:lr,version:$r,isDate:x,lowercase:Jn,uppercase:Qn,callbacks:{$$counter:0},getTestability:Q,$$minErr:t,$$csp:dr,reloadWithDebugInfo:J}),(Gn=ae(e))("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:Kt}),e.provider("$compile",Ye).directive({a:Qi,input:go,textarea:go,form:no,script:oa,select:la,option:ua,ngBind:bo,ngBindHtml:wo,ngBindTemplate:$o,ngClass:Co,ngClassEven:Eo,ngClassOdd:ko,ngCloak:So,ngController:_o,ngForm:ro,ngHide:Qo,ngIf:Do,ngInclude:Ao,ngInit:No,ngNonBindable:Bo,ngPluralize:Ko,ngRepeat:Zo,ngShow:Jo,ngStyle:Xo,ngSwitch:ea,ngSwitchWhen:ta,ngSwitchDefault:na,ngOptions:Go,ngTransclude:ia,ngModel:qo,ngList:Ro,ngChange:xo,pattern:fa,ngPattern:fa,required:ca,ngRequired:ca,minlength:pa,ngMinlength:pa,maxlength:da,ngMaxlength:da,ngValue:yo,ngModelOptions:zo}).directive({ngInclude:Oo}).directive(Xi).directive(Mo),e.provider({$anchorScroll:je,$animate:Wr,$animateCss:Zr,$$animateJs:Br,$$animateQueue:Yr,$$AnimateRunner:Kr,$$animateAsyncRun:Gr,$browser:Ve,$cacheFactory:ze,$controller:Qe,$document:Xe,$exceptionHandler:et,$filter:cn,$$forceReflow:ni,$interpolate:dt,$interval:pt,$http:lt,$httpParamSerializer:nt,$httpParamSerializerJQLike:rt,$httpBackend:ct,$xhrFactory:ut,$jsonpCallbacks:fi,$location:Et,$log:St,$parse:Vt,$rootScope:Gt,$q:zt,$$q:Bt,$sce:Xt,$sceDelegate:Qt,$sniffer:en,$templateCache:Be,$templateRequest:tn,$$testability:nn,$timeout:rn,$window:sn,$$rAF:Wt,$$jqLite:Oe,$$HashMap:Fr,$$cookieReader:un})}])}(or),or.module("ngLocale",[],["$provide",function(e){function t(e){e+="";var t=e.indexOf(".");return-1==t?0:e.length-t-1}e.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a",short:"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-¤",negSuf:"",posPre:"¤",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(e,n){var r=0|e,i=n;return void 0===i&&(i=Math.min(t(e),3)),Math.pow(10,i),1==r&&0==i?"one":"other"}})}]),Yn(e.document).ready(function(){K(e.document,Z)}))}(window),!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(''),define("common/angular",function(e){return function(){return e.angular}}(this)),function(e,t){"use strict";function n(e,t,n){if(!e)throw K("areq",t||"?",n||"required");return e}function r(e,t){return e||t?e?t?(P(e)&&(e=e.join(" ")),P(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function i(e){var t={};return e&&(e.to||e.from)&&(t.to=e.to,t.from=e.from),t}function o(e,t,n){var r="";return e=P(e)?e:e&&H(e)&&e.length?e.split(/\s+/):[],I(e,function(e,i){e&&0=e&&(e=i,i=0,n.push(o),o=[]),o.push(a.fn),a.children.forEach(function(e){i++,r.push(e)}),e--}return o.length&&n.push(o),n}(r)}var u=[],p=c(e);return function(a,c,h){function m(e){e=e.hasAttribute("ng-animate-ref")?[e]:e.querySelectorAll("[ng-animate-ref]");var t=[];return I(e,function(e){var n=e.getAttribute("ng-animate-ref");n&&n.length&&t.push(e)}),t}function g(e){var t=[],n={};I(e,function(e,r){var i=v(e.element),o=0<=["enter","move"].indexOf(e.event),i=e.structural?m(i):[];if(i.length){var a=o?"to":"from";I(i,function(e){var t=e.getAttribute("ng-animate-ref");n[t]=n[t]||{},n[t][a]={animationID:r,element:V(e)}})}else t.push(e)});var r={},i={};return I(n,function(n,o){var a=n.from,s=n.to;if(a&&s){var l=e[a.animationID],u=e[s.animationID],c=a.animationID.toString();if(!i[c]){var f=i[c]={structural:!0,beforeStart:function(){l.beforeStart(),u.beforeStart()},close:function(){l.close(),u.close()},classes:y(l.classes,u.classes),from:l,to:u,anchors:[]};f.classes.length?t.push(f):(t.push(l),t.push(u))}i[c].anchors.push({out:a.element,in:s.element})}else a=a?a.animationID:s.animationID,s=a.toString(),r[s]||(r[s]=!0,t.push(e[a]))}),t}function y(e,t){e=e.split(" "),t=t.split(" ");for(var n=[],r=0;r=ee&&t>=te&&(K=!0,m())}function L(){function t(){if(!V){if(C(!1),I(ie,function(e){q.style[e[0]]=e[1]}),R(e,U),r.addClass(e,pe),be.recalculateTimingStyles){if(de=q.className+" "+fe,he=y(q,de),ve=_(q,de,he),ye=ve.maxDelay,X=Math.max(ye,0),0===(te=ve.maxDuration))return void m();be.hasTransitions=0l.expectedEndTime)?s.cancel(l.timer):i.push(m)}a&&(o=s(n,o,!1),i[0]={timer:o,expectedEndTime:t},i.push(m),e.data("$$animateCss",i)),se.length&&e.on(se.join(" "),j),U.to&&(U.cleanupStyles&&M(H,q,Object.keys(U.to)),h(e,U))}}function n(){var t=e.data("$$animateCss");if(t){for(var n=1;n1){g[r].element.data(v,n.direction);var u=m.getCurrentIndex();angular.isNumber(u)&&g[u].element&&g[u].element.data(v,n.direction),e.$currentTransition=!0,i.on("addClass",g[r].element,function(t,n){if("close"===n&&(e.$currentTransition=null,i.off("addClass",t),b.length)){var r=b.pop().slide,a=r.index,l=a>m.getCurrentIndex()?"next":"prev";o(),s(r,a,l)}})}e.active=n.index,y=n.index,a(r),f()}}function l(e){for(var t=0;t0&&(p=n(d,t))}function d(){var t=+e.interval;h&&!isNaN(t)&&t>0&&g.length?e.next():e.pause()}var p,h,m=this,g=m.slides=e.slides=[],v="uib-slideDirection",y=e.active,b=[],$=!1;m.addSlide=function(t,n){g.push({slide:t,element:n}),g.sort(function(e,t){return+e.slide.index-+t.slide.index}),(t.index===e.active||1===g.length&&!angular.isNumber(e.active))&&(e.$currentTransition&&(e.$currentTransition=null),y=t.index,e.active=t.index,a(y),m.select(g[l(t)]),1===g.length&&e.play())},m.getCurrentIndex=function(){for(var e=0;e0&&y===n?n>=g.length?(y=g.length-1,e.active=y,a(y),m.select(g[g.length-1])):(y=n,e.active=y,a(y),m.select(g[n])):y>n&&(y--,e.active=y),0===g.length&&(y=null,e.active=null,o())},m.select=e.select=function(t,n){var r=l(t.slide);void 0===n&&(n=r>m.getCurrentIndex()?"next":"prev"),t.slide.index===y||e.$currentTransition?t&&t.slide.index!==y&&e.$currentTransition&&b.push(g[r]):s(t.slide,r,n)},e.indexOfSlide=function(e){return+e.slide.index},e.isActive=function(t){return e.active===t.slide.index},e.isPrevDisabled=function(){return 0===e.active&&e.noWrap()},e.isNextDisabled=function(){return e.active===g.length-1&&e.noWrap()},e.pause=function(){e.noPause||(h=!1,u())},e.play=function(){h||(h=!0,f())},e.$on("$destroy",function(){$=!0,u()}),e.$watch("noTransition",function(e){i.enabled(t,!e)}),e.$watch("interval",f),e.$watchCollection("slides",c),e.$watch("active",function(e){if(angular.isNumber(e)&&y!==e){for(var t=0;t-1){var a=!1;e=e.split("");for(var s=o;s-1){e=e.split(""),i[o]="("+r.regex+")",e[o]="$";for(var a=o+1,s=o+r.key.length;a28?29===n&&(e%4==0&&e%100!=0||e%400==0):3!==t&&5!==t&&8!==t&&10!==t||n<31)}function a(e){return parseInt(e,10)}function s(e,t){return e&&t?f(e,t):e}function l(e,t){return e&&t?f(e,t,!0):e}function u(e,t){e=e.replace(/:/g,"");var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return isNaN(n)?t:n}function c(e,t){return e=new Date(e.getTime()),e.setMinutes(e.getMinutes()+t),e}function f(e,t,n){n=n?-1:1;var r=e.getTimezoneOffset();return c(e,n*(u(t,r)-r))}var d,p,h=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;this.init=function(){d=t.id,this.parsers={},this.formatters={},p=[{key:"yyyy",regex:"\\d{4}",apply:function(e){this.year=+e},formatter:function(e){var t=new Date;return t.setFullYear(Math.abs(e.getFullYear())),n(t,"yyyy")}},{key:"yy",regex:"\\d{2}",apply:function(e){e=+e,this.year=e<69?e+2e3:e+1900},formatter:function(e){var t=new Date;return t.setFullYear(Math.abs(e.getFullYear())),n(t,"yy")}},{key:"y",regex:"\\d{1,4}",apply:function(e){this.year=+e},formatter:function(e){var t=new Date;return t.setFullYear(Math.abs(e.getFullYear())),n(t,"y")}},{key:"M!",regex:"0?[1-9]|1[0-2]",apply:function(e){this.month=e-1},formatter:function(e){return/^[0-9]$/.test(e.getMonth())?n(e,"MM"):n(e,"M")}},{key:"MMMM",regex:t.DATETIME_FORMATS.MONTH.join("|"),apply:function(e){this.month=t.DATETIME_FORMATS.MONTH.indexOf(e)},formatter:function(e){return n(e,"MMMM")}},{key:"MMM",regex:t.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(e){this.month=t.DATETIME_FORMATS.SHORTMONTH.indexOf(e)},formatter:function(e){return n(e,"MMM")}},{key:"MM",regex:"0[1-9]|1[0-2]",apply:function(e){this.month=e-1},formatter:function(e){return n(e,"MM")}},{key:"M",regex:"[1-9]|1[0-2]",apply:function(e){this.month=e-1},formatter:function(e){return n(e,"M")}},{key:"d!",regex:"[0-2]?[0-9]{1}|3[0-1]{1}",apply:function(e){this.date=+e},formatter:function(e){return/^[1-9]$/.test(e.getDate())?n(e,"dd"):n(e,"d")}},{key:"dd",regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(e){this.date=+e},formatter:function(e){return n(e,"dd")}},{key:"d",regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(e){this.date=+e},formatter:function(e){return n(e,"d")}},{key:"EEEE",regex:t.DATETIME_FORMATS.DAY.join("|"),formatter:function(e){return n(e,"EEEE")}},{key:"EEE",regex:t.DATETIME_FORMATS.SHORTDAY.join("|"),formatter:function(e){return n(e,"EEE")}},{key:"HH",regex:"(?:0|1)[0-9]|2[0-3]",apply:function(e){this.hours=+e},formatter:function(e){return n(e,"HH")}},{key:"hh",regex:"0[0-9]|1[0-2]",apply:function(e){this.hours=+e},formatter:function(e){return n(e,"hh")}},{key:"H",regex:"1?[0-9]|2[0-3]",apply:function(e){this.hours=+e},formatter:function(e){return n(e,"H")}},{key:"h",regex:"[0-9]|1[0-2]",apply:function(e){this.hours=+e},formatter:function(e){return n(e,"h")}},{key:"mm",regex:"[0-5][0-9]",apply:function(e){this.minutes=+e},formatter:function(e){return n(e,"mm")}},{key:"m",regex:"[0-9]|[1-5][0-9]",apply:function(e){this.minutes=+e},formatter:function(e){return n(e,"m")}},{key:"sss",regex:"[0-9][0-9][0-9]",apply:function(e){this.milliseconds=+e},formatter:function(e){return n(e,"sss")}},{key:"ss",regex:"[0-5][0-9]",apply:function(e){this.seconds=+e},formatter:function(e){return n(e,"ss")}},{key:"s",regex:"[0-9]|[1-5][0-9]",apply:function(e){this.seconds=+e},formatter:function(e){return n(e,"s")}},{key:"a",regex:t.DATETIME_FORMATS.AMPMS.join("|"),apply:function(e){12===this.hours&&(this.hours=0),"PM"===e&&(this.hours+=12)},formatter:function(e){return n(e,"a")}},{key:"Z",regex:"[+-]\\d{4}",apply:function(e){var t=e.match(/([+-])(\d{2})(\d{2})/),n=t[1],r=t[2],i=t[3];this.hours+=a(n+r),this.minutes+=a(n+i)},formatter:function(e){return n(e,"Z")}},{key:"ww",regex:"[0-4][0-9]|5[0-3]",formatter:function(e){return n(e,"ww")}},{key:"w",regex:"[0-9]|[1-4][0-9]|5[0-3]",formatter:function(e){return n(e,"w")}},{key:"GGGG",regex:t.DATETIME_FORMATS.ERANAMES.join("|").replace(/\s/g,"\\s"),formatter:function(e){return n(e,"GGGG")}},{key:"GGG",regex:t.DATETIME_FORMATS.ERAS.join("|"),formatter:function(e){return n(e,"GGG")}},{key:"GG",regex:t.DATETIME_FORMATS.ERAS.join("|"),formatter:function(e){return n(e,"GG")}},{key:"G",regex:t.DATETIME_FORMATS.ERAS.join("|"),formatter:function(e){return n(e,"G")}}]},this.init(),this.filter=function(e,n){if(!angular.isDate(e)||isNaN(e)||!n)return"";n=t.DATETIME_FORMATS[n]||n,t.id!==d&&this.init(),this.formatters[n]||(this.formatters[n]=i(n,"formatter"));var r=this.formatters[n],o=r.map,a=n;return o.reduce(function(t,n,r){var i=a.match(new RegExp("(.*)"+n.key));i&&angular.isString(i[1])&&(t+=i[1],a=a.replace(i[1]+n.key,""));var s=r===o.length-1?a:"";return n.apply?t+n.apply.call(null,e)+s:t+s},"")},this.parse=function(n,r,a){if(!angular.isString(n)||!r)return n;r=t.DATETIME_FORMATS[r]||r,r=r.replace(h,"\\$&"),t.id!==d&&this.init(),this.parsers[r]||(this.parsers[r]=i(r,"apply"));var s=this.parsers[r],l=s.regex,u=s.map,c=n.match(l),f=!1;if(c&&c.length){var p,m;angular.isDate(a)&&!isNaN(a.getTime())?p={year:a.getFullYear(),month:a.getMonth(),date:a.getDate(),hours:a.getHours(),minutes:a.getMinutes(),seconds:a.getSeconds(),milliseconds:a.getMilliseconds()}:(a&&e.warn("dateparser:","baseDate is not a valid date"),p={year:1900,month:0,date:1,hours:0,minutes:0,seconds:0,milliseconds:0});for(var g=1,v=c.length;gd.modes.indexOf(d[t]))&&(e.datepickerMode=d[t],e.datepickerOptions.datepickerMode=d[t])}):d[t]=e[t]=s[t]||null}}),e.uniqueId="datepicker-"+e.$id+"-"+Math.floor(1e4*Math.random()),e.disabled=angular.isDefined(t.disabled)||!1,angular.isDefined(t.ngDisabled)&&m.push(e.$parent.$watch(t.ngDisabled,function(t){e.disabled=t,d.refreshView()})),e.isActive=function(t){return 0===d.compare(t.date,d.activeDate)&&(e.activeDateId=t.uid,!0)},this.init=function(t){p=t,h=t.$options||s.ngModelOptions,e.datepickerOptions.initDate?(d.activeDate=c.fromTimezone(e.datepickerOptions.initDate,h.timezone)||new Date,e.$watch("datepickerOptions.initDate",function(e){e&&(p.$isEmpty(p.$modelValue)||p.$invalid)&&(d.activeDate=c.fromTimezone(e,h.timezone),d.refreshView())})):d.activeDate=new Date;var n=p.$modelValue?new Date(p.$modelValue):new Date;this.activeDate=isNaN(n)?c.fromTimezone(new Date,h.timezone):c.fromTimezone(n,h.timezone),p.$render=function(){d.render()}},this.render=function(){if(p.$viewValue){var e=new Date(p.$viewValue);!isNaN(e)?this.activeDate=c.fromTimezone(e,h.timezone):u||o.error('Datepicker directive: "ng-model" value must be a Date object')}this.refreshView()},this.refreshView=function(){if(this.element){e.selectedDt=null,this._refreshView(),e.activeDt&&(e.activeDateId=e.activeDt.uid);var t=p.$viewValue?new Date(p.$viewValue):null;t=c.fromTimezone(t,h.timezone),p.$setValidity("dateDisabled",!t||this.element&&!this.isDisabled(t))}},this.createDateObject=function(t,n){var r=p.$viewValue?new Date(p.$viewValue):null;r=c.fromTimezone(r,h.timezone);var i=new Date;i=c.fromTimezone(i,h.timezone);var o=this.compare(t,i),a={date:t,label:c.filter(t,n),selected:r&&0===this.compare(t,r),disabled:this.isDisabled(t),past:o<0,current:0===o,future:o>0,customClass:this.customClass(t)||null};return r&&0===this.compare(t,r)&&(e.selectedDt=a),d.activeDate&&0===this.compare(a.date,d.activeDate)&&(e.activeDt=a),a},this.isDisabled=function(t){return e.disabled||this.minDate&&this.compare(t,this.minDate)<0||this.maxDate&&this.compare(t,this.maxDate)>0||e.dateDisabled&&e.dateDisabled({date:t,mode:e.datepickerMode})},this.customClass=function(t){return e.customClass({date:t,mode:e.datepickerMode})},this.split=function(e,t){for(var n=[];e.length>0;)n.push(e.splice(0,t));return n},e.select=function(t){if(e.datepickerMode===d.minMode){var n=p.$viewValue?c.fromTimezone(new Date(p.$viewValue),h.timezone):new Date(0,0,0,0,0,0,0);n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n=c.toTimezone(n,h.timezone),p.$setViewValue(n),p.$render()}else d.activeDate=t,f(d.modes[d.modes.indexOf(e.datepickerMode)-1]),e.$emit("uib:datepicker.mode");e.$broadcast("uib:datepicker.focus")},e.move=function(e){var t=d.activeDate.getFullYear()+e*(d.step.years||0),n=d.activeDate.getMonth()+e*(d.step.months||0);d.activeDate.setFullYear(t,n,1),d.refreshView()},e.toggleMode=function(t){t=t||1,e.datepickerMode===d.maxMode&&1===t||e.datepickerMode===d.minMode&&-1===t||(f(d.modes[d.modes.indexOf(e.datepickerMode)+t]),e.$emit("uib:datepicker.mode"))},e.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var g=function(){d.element[0].focus()};e.$on("uib:datepicker.focus",g),e.keydown=function(t){var n=e.keys[t.which];if(n&&!t.shiftKey&&!t.altKey&&!e.disabled)if(t.preventDefault(),d.shortcutPropagation||t.stopPropagation(),"enter"===n||"space"===n){if(d.isDisabled(d.activeDate))return;e.select(d.activeDate)}else!t.ctrlKey||"up"!==n&&"down"!==n?(d.handleKeyDown(n,t),d.refreshView()):e.toggleMode("up"===n?1:-1)},e.$on("$destroy",function(){for(;m.length;)m.shift()()})}]).controller("UibDaypickerController",["$scope","$element","dateFilter",function(e,t,n){function r(e,t){return 1!==t||e%4!=0||e%100==0&&e%400!=0?o[t]:29}function i(e){var t=new Date(e);t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t)/864e5)/7)+1}var o=[31,28,31,30,31,30,31,31,30,31,30,31];this.step={months:1},this.element=t,this.init=function(t){angular.extend(t,this),e.showWeeks=t.showWeeks,t.refreshView()},this.getDates=function(e,t){for(var n,r=new Array(t),i=new Date(e),o=0;o0?7-a:-a,l=new Date(o);s>0&&l.setDate(1-s);for(var u=this.getDates(l,42),c=0;c<42;c++)u[c]=angular.extend(this.createDateObject(u[c],this.formatDay),{secondary:u[c].getMonth()!==r,uid:e.uniqueId+"-"+c});e.labels=new Array(7);for(var f=0;f<7;f++)e.labels[f]={abbr:n(u[f].date,this.formatDayHeader),full:n(u[f].date,"EEEE")};if(e.title=n(this.activeDate,this.formatDayTitle),e.rows=this.split(u,7),e.showWeeks){e.weekNumbers=[];for(var d=(11-this.startingDay)%7,p=e.rows.length,h=0;h
');e.find("body").append(a),n=a[0].offsetWidth-a[0].clientWidth,n=isFinite(n)?n:0,a.remove()}return n},scrollbarPadding:function(e){e=this.getRawNode(e);var n=t.getComputedStyle(e),r=this.parseStyle(n.paddingRight),i=this.parseStyle(n.paddingBottom),o=this.scrollParent(e,!1,!0),s=this.scrollbarWidth(o,a.test(o.tagName));return{scrollbarWidth:s,widthOverflow:o.scrollWidth>o.clientWidth,right:r+s,originalRight:r,heightOverflow:o.scrollHeight>o.clientHeight,bottom:i+s,originalBottom:i}},isScrollable:function(e,n){e=this.getRawNode(e);var r=n?i.hidden:i.normal,o=t.getComputedStyle(e);return r.test(o.overflow+o.overflowY+o.overflowX)},scrollParent:function(n,r,o){n=this.getRawNode(n);var a=r?i.hidden:i.normal,s=e[0].documentElement,l=t.getComputedStyle(n);if(o&&a.test(l.overflow+l.overflowY+l.overflowX))return n;var u="absolute"===l.position,c=n.parentElement||s;if(c===s||"fixed"===l.position)return s;for(;c.parentElement&&c!==s;){var f=t.getComputedStyle(c);if(u&&"static"!==f.position&&(u=!1),!u&&a.test(f.overflow+f.overflowY+f.overflowX))break;c=c.parentElement}return c},position:function(n,r){n=this.getRawNode(n);var i=this.offset(n);if(r){var o=t.getComputedStyle(n);i.top-=this.parseStyle(o.marginTop),i.left-=this.parseStyle(o.marginLeft)}var a=this.offsetParent(n),s={top:0,left:0};return a!==e[0].documentElement&&(s=this.offset(a),s.top+=a.clientTop-a.scrollTop,s.left+=a.clientLeft-a.scrollLeft),{width:Math.round(angular.isNumber(i.width)?i.width:n.offsetWidth),height:Math.round(angular.isNumber(i.height)?i.height:n.offsetHeight),top:Math.round(i.top-s.top),left:Math.round(i.left-s.left)}},offset:function(n){n=this.getRawNode(n);var r=n.getBoundingClientRect();return{width:Math.round(angular.isNumber(r.width)?r.width:n.offsetWidth),height:Math.round(angular.isNumber(r.height)?r.height:n.offsetHeight),top:Math.round(r.top+(t.pageYOffset||e[0].documentElement.scrollTop)),left:Math.round(r.left+(t.pageXOffset||e[0].documentElement.scrollLeft))}},viewportOffset:function(n,r,i){n=this.getRawNode(n),i=!1!==i;var o=n.getBoundingClientRect(),a={top:0,left:0,bottom:0,right:0},s=r?e[0].documentElement:this.scrollParent(n),l=s.getBoundingClientRect();if(a.top=l.top+s.clientTop,a.left=l.left+s.clientLeft,s===e[0].documentElement&&(a.top+=t.pageYOffset,a.left+=t.pageXOffset),a.bottom=a.top+s.clientHeight,a.right=a.left+s.clientWidth,i){var u=t.getComputedStyle(s);a.top+=this.parseStyle(u.paddingTop),a.bottom-=this.parseStyle(u.paddingBottom),a.left+=this.parseStyle(u.paddingLeft),a.right-=this.parseStyle(u.paddingRight)}return{top:Math.round(o.top-a.top),bottom:Math.round(a.bottom-o.bottom),left:Math.round(o.left-a.left),right:Math.round(a.right-o.right)}},parsePlacement:function(e){var t=o.auto.test(e);return t&&(e=e.replace(o.auto,"")),e=e.split("-"),e[0]=e[0]||"top",o.primary.test(e[0])||(e[0]="top"),e[1]=e[1]||"center",o.secondary.test(e[1])||(e[1]="center"),e[2]=!!t,e},positionElements:function(e,n,r,i){e=this.getRawNode(e),n=this.getRawNode(n);var a=angular.isDefined(n.offsetWidth)?n.offsetWidth:n.prop("offsetWidth"),s=angular.isDefined(n.offsetHeight)?n.offsetHeight:n.prop("offsetHeight");r=this.parsePlacement(r);var l=i?this.offset(e):this.position(e),u={top:0,left:0,placement:""};if(r[2]){var c=this.viewportOffset(e,i),f=t.getComputedStyle(n),d={width:a+Math.round(Math.abs(this.parseStyle(f.marginLeft)+this.parseStyle(f.marginRight))),height:s+Math.round(Math.abs(this.parseStyle(f.marginTop)+this.parseStyle(f.marginBottom)))};if(r[0]="top"===r[0]&&d.height>c.top&&d.height<=c.bottom?"bottom":"bottom"===r[0]&&d.height>c.bottom&&d.height<=c.top?"top":"left"===r[0]&&d.width>c.left&&d.width<=c.right?"right":"right"===r[0]&&d.width>c.right&&d.width<=c.left?"left":r[0],r[1]="top"===r[1]&&d.height-l.height>c.bottom&&d.height-l.height<=c.top?"bottom":"bottom"===r[1]&&d.height-l.height>c.top&&d.height-l.height<=c.bottom?"top":"left"===r[1]&&d.width-l.width>c.right&&d.width-l.width<=c.left?"right":"right"===r[1]&&d.width-l.width>c.left&&d.width-l.width<=c.right?"left":r[1],"center"===r[1])if(o.vertical.test(r[0])){var p=l.width/2-a/2;c.left+p<0&&d.width-l.width<=c.right?r[1]="left":c.right+p<0&&d.width-l.width<=c.left&&(r[1]="right")}else{var h=l.height/2-d.height/2;c.top+h<0&&d.height-l.height<=c.bottom?r[1]="top":c.bottom+h<0&&d.height-l.height<=c.top&&(r[1]="bottom")}}switch(r[0]){case"top":u.top=l.top-s;break;case"bottom":u.top=l.top+l.height;break;case"left":u.left=l.left-a;break;case"right":u.left=l.left+l.width}switch(r[1]){case"top":u.top=l.top;break;case"bottom":u.top=l.top+l.height-s;break;case"left":u.left=l.left;break;case"right":u.left=l.left+l.width-a;break;case"center":o.vertical.test(r[0])?u.left=l.left+l.width/2-a/2:u.top=l.top+l.height/2-s/2}return u.top=Math.round(u.top),u.left=Math.round(u.left),u.placement="center"===r[1]?r[0]:r[0]+"-"+r[1],u},positionArrow:function(e,n){e=this.getRawNode(e);var r=e.querySelector(".tooltip-inner, .popover-inner");if(r){var i=angular.element(r).hasClass("tooltip-inner"),a=i?e.querySelector(".tooltip-arrow"):e.querySelector(".arrow");if(a){var s={top:"",bottom:"",left:"",right:""};if(n=this.parsePlacement(n),"center"===n[1])return void angular.element(a).css(s);var l="border-"+n[0]+"-width",u=t.getComputedStyle(a)[l],c="border-";o.vertical.test(n[0])?c+=n[0]+"-"+n[1]:c+=n[1]+"-"+n[0],c+="-radius";var f=t.getComputedStyle(i?r:e)[c];switch(n[0]){case"top":s.bottom=i?"0":"-"+u;break;case"bottom":s.top=i?"0":"-"+u;break;case"left":s.right=i?"0":"-"+u;break;case"right":s.left=i?"0":"-"+u}s[n[1]]=f,angular.element(a).css(s)}}}}}]),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(e,t,n,r,i,o,a,s,l,u,c,f,d,p,h,m){function g(t){var n=f.parse(t,x,e.date);if(isNaN(n))for(var r=0;r
"),O?(I=O.timezone,e.ngModelOptions=angular.copy(O),e.ngModelOptions.timezone=null,!0===e.ngModelOptions.updateOnDefault&&(e.ngModelOptions.updateOn=e.ngModelOptions.updateOn?e.ngModelOptions.updateOn+" default":"default"),M.attr("ng-model-options","ngModelOptions")):I=null,M.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":S}),T=angular.element(M.children()[0]),T.attr("template-url",_),e.datepickerOptions||(e.datepickerOptions={}),P&&"month"===n.type&&(e.datepickerOptions.datepickerMode="month",e.datepickerOptions.minMode="month"),T.attr("datepicker-options","datepickerOptions"),P?A.$formatters.push(function(t){return e.date=f.fromTimezone(t,I),t}):(A.$$parserName="date",A.$validators.date=y,A.$parsers.unshift(v),A.$formatters.push(function(t){return A.$isEmpty(t)?(e.date=t,t):(angular.isNumber(t)&&(t=new Date(t)),e.date=f.fromTimezone(t,I),f.filter(e.date,x))})),A.$viewChangeListeners.push(function(){e.date=g(A.$viewValue)}),t.on("keydown",$),N=r(M)(e),M.remove(),k?s.find("body").append(N):t.after(N),e.$on("$destroy",function(){for(!0===e.isOpen&&(l.$$phase||e.$apply(function(){e.isOpen=!1})),N.remove(),t.off("keydown",$),s.off("click",b),D&&D.off("scroll",w),angular.element(a).off("resize",w);F.length;)F.shift()()})},e.getText=function(t){return e[t+"Text"]||d[t+"Text"]},e.isDisabled=function(t){"today"===t&&(t=f.fromTimezone(new Date,I));var n={};return angular.forEach(["minDate","maxDate"],function(t){e.datepickerOptions[t]?angular.isDate(e.datepickerOptions[t])?n[t]=f.fromTimezone(new Date(e.datepickerOptions[t]),I):(m&&i.warn("Literal date support has been deprecated, please switch to date object usage"),n[t]=new Date(c(e.datepickerOptions[t],"medium"))):n[t]=null}),e.datepickerOptions&&n.minDate&&e.compare(t,n.minDate)<0||n.maxDate&&e.compare(t,n.maxDate)>0},e.compare=function(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate())-new Date(t.getFullYear(),t.getMonth(),t.getDate())},e.dateSelection=function(n){angular.isDefined(n)&&(e.date=n);var r=e.date?f.filter(e.date,x):null;t.val(r),A.$setViewValue(r),C&&(e.isOpen=!1,t[0].focus())},e.keydown=function(n){27===n.which&&(n.stopPropagation(),e.isOpen=!1,t[0].focus())},e.select=function(t,n){if(n.stopPropagation(),"today"===t){var r=new Date;angular.isDate(e.date)?(t=new Date(e.date),t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate())):t=new Date(r.setHours(0,0,0,0))}e.dateSelection(t)},e.close=function(n){n.stopPropagation(),e.isOpen=!1,t[0].focus()},e.disabled=angular.isDefined(n.disabled)||!1,n.ngDisabled&&F.push(e.$parent.$watch(o(n.ngDisabled),function(t){e.disabled=t})),e.$watch("isOpen",function(r){r?e.disabled?e.isOpen=!1:p(function(){w(),E&&e.$broadcast("uib:datepicker.focus"),s.on("click",b);var r=n.popupPlacement?n.popupPlacement:d.placement;k||u.parsePlacement(r)[2]?(D=D||angular.element(u.scrollParent(t)))&&D.on("scroll",w):D=null,angular.element(a).on("resize",w)},0,!1):(s.off("click",b),D&&D.off("scroll",w),angular.element(a).off("resize",w))}),e.$on("uib:datepicker.mode",function(){p(w,0,!1)})}]).directive("uibDatepickerPopup",function(){return{require:["ngModel","uibDatepickerPopup"],controller:"UibDatepickerPopupController",scope:{datepickerOptions:"=?",isOpen:"=?",currentText:"@",clearText:"@",closeText:"@"},link:function(e,t,n,r){var i=r[0];r[1].init(i)}}}).directive("uibDatepickerPopupWrap",function(){return{replace:!0,transclude:!0,templateUrl:function(e,t){return t.templateUrl||"uib/template/datepickerPopup/popup.html"}}}),angular.module("ui.bootstrap.debounce",[]).factory("$$debounce",["$timeout",function(e){return function(t,n){var r;return function(){var i=this,o=Array.prototype.slice.call(arguments);r&&e.cancel(r),r=e(function(){t.apply(i,o)},n)}}}]),angular.module("ui.bootstrap.dropdown",["ui.bootstrap.position"]).constant("uibDropdownConfig",{appendToOpenClass:"uib-dropdown-open",openClass:"open"}).service("uibDropdownService",["$document","$rootScope",function(e,t){var n=null;this.open=function(t,o){n||(e.on("click",r),o.on("keydown",i)),n&&n!==t&&(n.isOpen=!1),n=t},this.close=function(t,o){n===t&&(n=null,e.off("click",r),o.off("keydown",i))};var r=function(e){if(n&&!(e&&"disabled"===n.getAutoClose()||e&&3===e.which)){var r=n.getToggleElement();if(!(e&&r&&r[0].contains(e.target))){var i=n.getDropdownElement();e&&"outsideClick"===n.getAutoClose()&&i&&i[0].contains(e.target)||(n.isOpen=!1,t.$$phase||n.$apply())}}},i=function(e){27===e.which?(e.stopPropagation(),n.focusToggleElement(),r()):n.isKeynavEnabled()&&-1!==[38,40].indexOf(e.which)&&n.isOpen&&(e.preventDefault(),e.stopPropagation(),n.focusDropdownEntry(e.which))}}]).controller("UibDropdownController",["$scope","$element","$attrs","$parse","uibDropdownConfig","uibDropdownService","$animate","$uibPosition","$document","$compile","$templateRequest",function(e,t,n,r,i,o,a,s,l,u,c){var f,d,p=this,h=e.$new(),m=i.appendToOpenClass,g=i.openClass,v=angular.noop,y=n.onToggle?r(n.onToggle):angular.noop,b=!1,$=null,w=!1,x=l.find("body");t.addClass("dropdown"),this.init=function(){if(n.isOpen&&(d=r(n.isOpen),v=d.assign,e.$watch(d,function(e){h.isOpen=!!e})),angular.isDefined(n.dropdownAppendTo)){var i=r(n.dropdownAppendTo)(h);i&&($=angular.element(i))}b=angular.isDefined(n.dropdownAppendToBody),w=angular.isDefined(n.keyboardNav),b&&!$&&($=x),$&&p.dropdownMenu&&($.append(p.dropdownMenu),t.on("$destroy",function(){p.dropdownMenu.remove()}))},this.toggle=function(e){return h.isOpen=arguments.length?!!e:!h.isOpen,angular.isFunction(v)&&v(h,h.isOpen),h.isOpen},this.isOpen=function(){return h.isOpen},h.getToggleElement=function(){return p.toggleElement},h.getAutoClose=function(){return n.autoClose||"always"},h.getElement=function(){return t},h.isKeynavEnabled=function(){return w},h.focusDropdownEntry=function(e){var n=p.dropdownMenu?angular.element(p.dropdownMenu).find("a"):t.find("ul").eq(0).find("a");switch(e){case 40:angular.isNumber(p.selectedOption)?p.selectedOption=p.selectedOption===n.length-1?p.selectedOption:p.selectedOption+1:p.selectedOption=0;break;case 38:angular.isNumber(p.selectedOption)?p.selectedOption=0===p.selectedOption?0:p.selectedOption-1:p.selectedOption=n.length-1}n[p.selectedOption].focus()},h.getDropdownElement=function(){return p.dropdownMenu},h.focusToggleElement=function(){p.toggleElement&&p.toggleElement[0].focus()},h.$watch("isOpen",function(n,r){if($&&p.dropdownMenu){var i,l,d,w=s.positionElements(t,p.dropdownMenu,"bottom-left",!0);if(i={top:w.top+"px",display:n?"block":"none"},l=p.dropdownMenu.hasClass("dropdown-menu-right"),l?(i.left="auto",d=s.scrollbarWidth(!0),i.right=window.innerWidth-d-(w.left+t.prop("offsetWidth"))+"px"):(i.left=w.left+"px",i.right="auto"),!b){var x=s.offset($);i.top=w.top-x.top+"px",l?i.right=window.innerWidth-(w.left-x.left+t.prop("offsetWidth"))+"px":i.left=w.left-x.left+"px"}p.dropdownMenu.css(i)}var C=$||t;if(C.hasClass($?m:g)===!n&&a[n?"addClass":"removeClass"](C,$?m:g).then(function(){angular.isDefined(n)&&n!==r&&y(e,{open:!!n})}),n)p.dropdownMenuTemplateUrl&&c(p.dropdownMenuTemplateUrl).then(function(e){f=h.$new(),u(e.trim())(f,function(e){var t=e;p.dropdownMenu.replaceWith(t),p.dropdownMenu=t})}),h.focusToggleElement(),o.open(h,t);else{if(p.dropdownMenuTemplateUrl){f&&f.$destroy();var k=angular.element('');p.dropdownMenu.replaceWith(k),p.dropdownMenu=k}o.close(h,t),p.selectedOption=null}angular.isFunction(v)&&v(e,n)})}]).directive("uibDropdown",function(){return{controller:"UibDropdownController",link:function(e,t,n,r){r.init()}}}).directive("uibDropdownMenu",function(){return{restrict:"A",require:"?^uibDropdown",link:function(e,t,n,r){if(r&&!angular.isDefined(n.dropdownNested)){t.addClass("dropdown-menu");var i=n.templateUrl;i&&(r.dropdownMenuTemplateUrl=i),r.dropdownMenu||(r.dropdownMenu=t)}}}}).directive("uibDropdownToggle",function(){return{require:"?^uibDropdown",link:function(e,t,n,r){if(r){t.addClass("dropdown-toggle"),r.toggleElement=t;var i=function(i){i.preventDefault(),t.hasClass("disabled")||n.disabled||e.$apply(function(){r.toggle()})};t.bind("click",i),t.attr({"aria-haspopup":!0,"aria-expanded":!1}),e.$watch(r.isOpen,function(e){t.attr("aria-expanded",!!e)}),e.$on("$destroy",function(){t.unbind("click",i)})}}}}),angular.module("ui.bootstrap.stackedMap",[]).factory("$$stackedMap",function(){return{createNew:function(){var e=[];return{add:function(t,n){e.push({key:t,value:n})},get:function(t){for(var n=0;n-1&&e0&&(t=w.top().value,t.modalDomEl.toggleClass(t.windowTopClass||"",e))}function p(){if(v&&-1===c()){var e=y;h(v,y,function(){e=null}),v=void 0,y=void 0}}function h(t,n,r,i){function a(){a.done||(a.done=!0,e.leave(t).then(function(){t.remove(),i&&i.resolve()}),n.$destroy(),r&&r())}var s,l=null,u=function(){return s||(s=o.defer(),l=s.promise),function(){s.resolve()}};return n.$broadcast(C.NOW_CLOSING_EVENT,u),o.when(l).then(a)}function m(e){if(e.isDefaultPrevented())return e;var t=w.top();if(t)switch(e.which){case 27:t.value.keyboard&&(e.preventDefault(),i.$apply(function(){C.dismiss(t.key,"escape key press")}));break;case 9:var n=C.loadFocusElementList(t),r=!1;e.shiftKey?(C.isFocusInFirstItem(e,n)||C.isModalFocused(e,t))&&(r=C.focusLastFocusableElement(n)):C.isFocusInLastItem(e,n)&&(r=C.focusFirstFocusableElement(n)),r&&(e.preventDefault(),e.stopPropagation())}}function g(e,t,n){return!e.value.modalScope.$broadcast("modal.closing",t,n).defaultPrevented}var v,y,b,$="modal-open",w=s.createNew(),x=a.createNew(),C={NOW_CLOSING_EVENT:"modal.stack.now-closing"},k=0,E=null;return i.$watch(c,function(e){y&&(y.index=e)}),n.on("keydown",m),i.$on("$destroy",function(){n.off("keydown",m)}),C.open=function(t,o){var a=n[0].activeElement,s=o.openedClass||$;d(!1),E=w.top(),w.add(t,{deferred:o.deferred,renderDeferred:o.renderDeferred,closedDeferred:o.closedDeferred,modalScope:o.scope,backdrop:o.backdrop,keyboard:o.keyboard,openedClass:o.openedClass,windowTopClass:o.windowTopClass,animation:o.animation,appendTo:o.appendTo}),x.put(s,t);var u=o.appendTo,f=c();if(!u.length)throw new Error("appendTo element not found. Make sure that the element passed is in DOM.");f>=0&&!v&&(y=i.$new(!0),y.modalOptions=o,y.index=f,v=angular.element('
'),v.attr("backdrop-class",o.backdropClass),o.animation&&v.attr("modal-animation","true"),r(v)(y),e.enter(v,u),b=l.scrollbarPadding(u),b.heightOverflow&&b.scrollbarWidth&&u.css({paddingRight:b.right+"px"})),k=E?parseInt(E.value.modalDomEl.attr("index"),10)+1:0;var p=angular.element('
');p.attr({"template-url":o.windowTemplateUrl,"window-class":o.windowClass,"window-top-class":o.windowTopClass,size:o.size,index:k,animate:"animate"}).html(o.content),o.animation&&p.attr("modal-animation","true"),u.addClass(s),e.enter(r(p)(o.scope),u),w.top().value.modalDomEl=p,w.top().value.modalOpener=a},C.close=function(e,t){var n=w.get(e);return n&&g(n,t,!0)?(n.value.modalScope.$$uibDestructionScheduled=!0,n.value.deferred.resolve(t),f(e,n.value.modalOpener),!0):!n},C.dismiss=function(e,t){var n=w.get(e);return n&&g(n,t,!1)?(n.value.modalScope.$$uibDestructionScheduled=!0,n.value.deferred.reject(t),f(e,n.value.modalOpener),!0):!n},C.dismissAll=function(e){for(var t=this.getTop();t&&this.dismiss(t.key,e);)t=this.getTop()},C.getTop=function(){return w.top()},C.modalRendered=function(e){var t=w.get(e);t&&t.value.renderDeferred.resolve()},C.focusFirstFocusableElement=function(e){return e.length>0&&(e[0].focus(),!0)},C.focusLastFocusableElement=function(e){return e.length>0&&(e[e.length-1].focus(),!0)},C.isModalFocused=function(e,t){if(e&&t){var n=t.value.modalDomEl;if(n&&n.length)return(e.target||e.srcElement)===n[0]}return!1},C.isFocusInFirstItem=function(e,t){return t.length>0&&(e.target||e.srcElement)===t[0]},C.isFocusInLastItem=function(e,t){return t.length>0&&(e.target||e.srcElement)===t[t.length-1]},C.loadFocusElementList=function(e){if(e){var t=e.value.modalDomEl;if(t&&t.length){var n=t[0].querySelectorAll("a[href], area[href], input:not([disabled]), button:not([disabled]),select:not([disabled]), textarea:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable=true]");return n?Array.prototype.filter.call(n,function(e){return u(e)}):n}}},C}]).provider("$uibModal",function(){var e={options:{animation:!0,backdrop:!0,keyboard:!0},$get:["$rootScope","$q","$document","$templateRequest","$controller","$uibResolve","$uibModalStack",function(t,n,r,i,o,a,s){function l(e){return e.template?n.when(e.template):i(angular.isFunction(e.templateUrl)?e.templateUrl():e.templateUrl)}var u={},c=null;return u.getPromiseChain=function(){return c},u.open=function(i){function u(){return v}var f=n.defer(),d=n.defer(),p=n.defer(),h=n.defer(),m={result:f.promise,opened:d.promise,closed:p.promise,rendered:h.promise,close:function(e){return s.close(m,e)},dismiss:function(e){return s.dismiss(m,e)}};if(i=angular.extend({},e.options,i),i.resolve=i.resolve||{},i.appendTo=i.appendTo||r.find("body").eq(0),!i.template&&!i.templateUrl)throw new Error("One of template or templateUrl options is required.");var g,v=n.all([l(i),a.resolve(i.resolve,{},null,null)]);return g=c=n.all([c]).then(u,u).then(function(e){var n=i.scope||t,r=n.$new();r.$close=m.close,r.$dismiss=m.dismiss,r.$on("$destroy",function(){r.$$uibDestructionScheduled||r.$dismiss("$uibUnscheduledDestruction")});var a,l,u={};i.controller&&(u.$scope=r,u.$scope.$resolve={},u.$uibModalInstance=m,angular.forEach(e[1],function(e,t){u[t]=e,u.$scope.$resolve[t]=e}),l=o(i.controller,u,!0,i.controllerAs),i.controllerAs&&i.bindToController&&(a=l.instance,a.$close=r.$close,a.$dismiss=r.$dismiss,angular.extend(a,{$resolve:u.$scope.$resolve},n)),a=l(),angular.isFunction(a.$onInit)&&a.$onInit()),s.open(m,{scope:r,deferred:f,renderDeferred:h,closedDeferred:p,content:e[0],animation:i.animation,backdrop:i.backdrop,keyboard:i.keyboard,backdropClass:i.backdropClass,windowTopClass:i.windowTopClass,windowClass:i.windowClass,windowTemplateUrl:i.windowTemplateUrl,size:i.size,openedClass:i.openedClass,appendTo:i.appendTo}),d.resolve(!0)},function(e){d.reject(e),f.reject(e)}).finally(function(){c===g&&(c=null)}),m},u}]};return e}),angular.module("ui.bootstrap.paging",[]).factory("uibPaging",["$parse",function(e){return{create:function(t,n,r){t.setNumPages=r.numPages?e(r.numPages).assign:angular.noop,t.ngModelCtrl={$setViewValue:angular.noop},t._watchers=[],t.init=function(e,i){t.ngModelCtrl=e,t.config=i,e.$render=function(){t.render()},r.itemsPerPage?t._watchers.push(n.$parent.$watch(r.itemsPerPage,function(e){t.itemsPerPage=parseInt(e,10),n.totalPages=t.calculateTotalPages(),t.updatePage()})):t.itemsPerPage=i.itemsPerPage,n.$watch("totalItems",function(e,r){(angular.isDefined(e)||e!==r)&&(n.totalPages=t.calculateTotalPages(),t.updatePage())})},t.calculateTotalPages=function(){var e=t.itemsPerPage<1?1:Math.ceil(n.totalItems/t.itemsPerPage);return Math.max(e||0,1)},t.render=function(){n.page=parseInt(t.ngModelCtrl.$viewValue,10)||1},n.selectPage=function(e,r){r&&r.preventDefault(),(!n.ngDisabled||!r)&&n.page!==e&&e>0&&e<=n.totalPages&&(r&&r.target&&r.target.blur(),t.ngModelCtrl.$setViewValue(e),t.ngModelCtrl.$render())},n.getText=function(e){return n[e+"Text"]||t.config[e+"Text"]},n.noPrevious=function(){return 1===n.page},n.noNext=function(){return n.page===n.totalPages},t.updatePage=function(){t.setNumPages(n.$parent,n.totalPages),n.page>n.totalPages?n.selectPage(n.totalPages):t.ngModelCtrl.$render()},n.$on("$destroy",function(){for(;t._watchers.length;)t._watchers.shift()()})}}}]),angular.module("ui.bootstrap.pager",["ui.bootstrap.paging"]).controller("UibPagerController",["$scope","$attrs","uibPaging","uibPagerConfig",function(e,t,n,r){e.align=angular.isDefined(t.align)?e.$parent.$eval(t.align):r.align,n.create(this,e,t)}]).constant("uibPagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:!0}).directive("uibPager",["uibPagerConfig",function(e){return{scope:{totalItems:"=",previousText:"@",nextText:"@",ngDisabled:"="},require:["uibPager","?ngModel"],controller:"UibPagerController",controllerAs:"pager",templateUrl:function(e,t){return t.templateUrl||"uib/template/pager/pager.html"},replace:!0,link:function(t,n,r,i){var o=i[0],a=i[1];a&&o.init(a,e)}}}]),angular.module("ui.bootstrap.pagination",["ui.bootstrap.paging"]).controller("UibPaginationController",["$scope","$attrs","$parse","uibPaging","uibPaginationConfig",function(e,t,n,r,i){function o(e,t,n){return{number:e,text:t,active:n}}function a(e,t){var n=[],r=1,i=t,a=angular.isDefined(l)&&lt&&(i=t,r=i-l+1)):(r=(Math.ceil(e/l)-1)*l+1,i=Math.min(r+l-1,t)));for(var s=r;s<=i;s++){var p=o(s,d(s),s===e);n.push(p)}if(a&&l>0&&(!u||c||f)){if(r>1){if(!f||r>3){var h=o(r-1,"...",!1);n.unshift(h)}if(f){if(3===r){var m=o(2,"2",!1);n.unshift(m)}var g=o(1,"1",!1);n.unshift(g)}}if(i0&&e.page<=e.totalPages&&(e.pages=a(e.page,e.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(e,t){return{scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@",ngDisabled:"="},require:["uibPagination","?ngModel"],controller:"UibPaginationController",controllerAs:"pagination",templateUrl:function(e,t){return t.templateUrl||"uib/template/pagination/pagination.html"},replace:!0,link:function(e,n,r,i){var o=i[0],a=i[1];a&&o.init(a,t)}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.stackedMap"]).provider("$uibTooltip",function(){function e(e){var t=/[A-Z]/g;return e.replace(t,function(e,t){return(t?"-":"")+e.toLowerCase()})}var t={placement:"top",placementClassPrefix:"",animation:!0,popupDelay:0,popupCloseDelay:0,useContentExp:!1},n={mouseenter:"mouseleave",click:"click",outsideClick:"outsideClick",focus:"blur",none:""},r={};this.options=function(e){angular.extend(r,e)},this.setTriggers=function(e){angular.extend(n,e)},this.$get=["$window","$compile","$timeout","$document","$uibPosition","$interpolate","$rootScope","$parse","$$stackedMap",function(i,o,a,s,l,u,c,f,d){function p(e){if(27===e.which){var t=h.top();t&&(t.value.close(),h.removeTop(),t=null)}}var h=d.createNew();return s.on("keypress",p),c.$on("$destroy",function(){s.off("keypress",p)}),function(i,c,d,p){function m(e){var t=(e||p.trigger||d).split(" ");return{show:t,hide:t.map(function(e){return n[e]||e})}}p=angular.extend({},t,r,p);var g=e(i),v=u.startSymbol(),y=u.endSymbol(),b="
';return{compile:function(e,t){var n=o(b);return function(e,t,r,o){function u(){j.isOpen?g():d()}function d(){F&&!e.$eval(r[c+"Enable"])||($(),C(),j.popupDelay?A||(A=a(v,j.popupDelay,!1)):v())}function g(){y(),j.popupCloseDelay?O||(O=a(b,j.popupCloseDelay,!1)):b()}function v(){if(y(),$(),!j.content)return angular.noop;w(),j.$evalAsync(function(){j.isOpen=!0,k(!0),V()})}function y(){A&&(a.cancel(A),A=null),N&&(a.cancel(N),N=null)}function b(){j&&j.$evalAsync(function(){j&&(j.isOpen=!1,k(!1),j.animation?D||(D=a(x,150,!1)):x())})}function $(){O&&(a.cancel(O),O=null),D&&(a.cancel(D),D=null)}function w(){M||(T=j.$new(),M=n(T,function(e){I?s.find("body").append(e):t.after(e)}),E())}function x(){y(),$(),S(),M&&(M.remove(),M=null),T&&(T.$destroy(),T=null)}function C(){j.title=r[c+"Title"],j.content=H?H(e):r[i],j.popupClass=r[c+"Class"],j.placement=angular.isDefined(r[c+"Placement"])?r[c+"Placement"]:p.placement;var t=l.parsePlacement(j.placement);R=t[1]?t[0]+"-"+t[1]:t[0];var n=parseInt(r[c+"PopupDelay"],10),o=parseInt(r[c+"PopupCloseDelay"],10);j.popupDelay=isNaN(n)?p.popupDelay:n,j.popupCloseDelay=isNaN(o)?p.popupCloseDelay:o}function k(t){U&&angular.isFunction(U.assign)&&U.assign(e,t)}function E(){q.length=0,H?(q.push(e.$watch(H,function(e){j.content=e,!e&&j.isOpen&&b()})),q.push(T.$watch(function(){L||(L=!0,T.$$postDigest(function(){L=!1,j&&j.isOpen&&V()}))}))):q.push(r.$observe(i,function(e){j.content=e,!e&&j.isOpen?b():V()})),q.push(r.$observe(c+"Title",function(e){j.title=e,j.isOpen&&V()})),q.push(r.$observe(c+"Placement",function(e){j.placement=e||p.placement,j.isOpen&&V()}))}function S(){q.length&&(angular.forEach(q,function(e){e()}),q.length=0)}function _(e){j&&j.isOpen&&M&&(t[0].contains(e.target)||M[0].contains(e.target)||g())}var M,T,D,A,O,N,R,I=!!angular.isDefined(p.appendToBody)&&p.appendToBody,P=m(void 0),F=angular.isDefined(r[c+"Enable"]),j=e.$new(!0),L=!1,U=!!angular.isDefined(r[c+"IsOpen"])&&f(r[c+"IsOpen"]),H=!!p.useContentExp&&f(r[i]),q=[],V=function(){M&&M.html()&&(N||(N=a(function(){var e=l.positionElements(t,M,j.placement,I);M.css({top:e.top+"px",left:e.left+"px"}),M.hasClass(e.placement.split("-")[0])||(M.removeClass(R.split("-")[0]),M.addClass(e.placement.split("-")[0])),M.hasClass(p.placementClassPrefix+e.placement)||(M.removeClass(p.placementClassPrefix+R),M.addClass(p.placementClassPrefix+e.placement)),M.hasClass("uib-position-measure")?(l.positionArrow(M,e.placement),M.removeClass("uib-position-measure")):R!==e.placement&&l.positionArrow(M,e.placement),R=e.placement,N=null},0,!1)))};j.origScope=e,j.isOpen=!1,h.add(j,{close:b}),j.contentExp=function(){return j.content},r.$observe("disabled",function(e){e&&y(),e&&j.isOpen&&b()}),U&&e.$watch(U,function(e){j&&!e===j.isOpen&&u()});var z=function(){P.show.forEach(function(e){"outsideClick"===e?t.off("click",u):(t.off(e,d),t.off(e,u))}),P.hide.forEach(function(e){"outsideClick"===e?s.off("click",_):t.off(e,g)})};!function(){var e=r[c+"Trigger"];z(),P=m(e),"none"!==P.show&&P.show.forEach(function(e,n){"outsideClick"===e?(t.on("click",u),s.on("click",_)):e===P.hide[n]?t.on(e,u):e&&(t.on(e,d),t.on(P.hide[n],g)),t.on("keypress",function(e){27===e.which&&g()})})}();var B=e.$eval(r[c+"Animation"]);j.animation=angular.isDefined(B)?!!B:p.animation;var Y,W=c+"AppendToBody";Y=W in r&&void 0===r[W]||e.$eval(r[W]),I=angular.isDefined(Y)?Y:I,e.$on("$destroy",function(){z(),x(),h.remove(j),j=null})}}}}}]}).directive("uibTooltipTemplateTransclude",["$animate","$sce","$compile","$templateRequest",function(e,t,n,r){return{link:function(i,o,a){var s,l,u,c=i.$eval(a.tooltipTemplateTranscludeScope),f=0,d=function(){l&&(l.remove(),l=null),s&&(s.$destroy(),s=null),u&&(e.leave(u).then(function(){l=null}),l=u,u=null)};i.$watch(t.parseAsResourceUrl(a.uibTooltipTemplateTransclude),function(t){var a=++f;t?(r(t,!0).then(function(r){if(a===f){var i=c.$new(),l=r,p=n(l)(i,function(t){d(),e.enter(t,o)});s=i,u=p,s.$emit("$includeContentLoaded",t)}},function(){a===f&&(d(),i.$emit("$includeContentError",t))}),i.$emit("$includeContentRequested",t)):d()}),i.$on("$destroy",d)}}}]).directive("uibTooltipClasses",["$uibPosition",function(e){return{restrict:"A",link:function(t,n,r){if(t.placement){var i=e.parsePlacement(t.placement);n.addClass(i[0])}t.popupClass&&n.addClass(t.popupClass),t.animation()&&n.addClass(r.tooltipAnimationClass)}}}]).directive("uibTooltipPopup",function(){return{replace:!0,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-popup.html"}}).directive("uibTooltip",["$uibTooltip",function(e){return e("uibTooltip","tooltip","mouseenter")}]).directive("uibTooltipTemplatePopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/tooltip/tooltip-template-popup.html"}}).directive("uibTooltipTemplate",["$uibTooltip",function(e){return e("uibTooltipTemplate","tooltip","mouseenter",{useContentExp:!0})}]).directive("uibTooltipHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-html-popup.html"}}).directive("uibTooltipHtml",["$uibTooltip",function(e){return e("uibTooltipHtml","tooltip","mouseenter",{useContentExp:!0})}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("uibPopoverTemplatePopup",function(){return{replace:!0,scope:{uibTitle:"@",contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/popover/popover-template.html"}}).directive("uibPopoverTemplate",["$uibTooltip",function(e){return e("uibPopoverTemplate","popover","click",{useContentExp:!0})}]).directive("uibPopoverHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",uibTitle:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover-html.html"}}).directive("uibPopoverHtml",["$uibTooltip",function(e){return e("uibPopoverHtml","popover","click",{useContentExp:!0})}]).directive("uibPopoverPopup",function(){return{replace:!0,scope:{uibTitle:"@",content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover.html"}}).directive("uibPopover",["$uibTooltip",function(e){return e("uibPopover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("uibProgressConfig",{animate:!0,max:100}).controller("UibProgressController",["$scope","$attrs","uibProgressConfig",function(e,t,n){function r(){return angular.isDefined(e.maxParam)?e.maxParam:n.max}var i=this,o=angular.isDefined(t.animate)?e.$parent.$eval(t.animate):n.animate;this.bars=[],e.max=r(),this.addBar=function(e,t,n){o||t.css({transition:"none"}),this.bars.push(e),e.max=r(),e.title=n&&angular.isDefined(n.title)?n.title:"progressbar",e.$watch("value",function(t){e.recalculatePercentage()}),e.recalculatePercentage=function(){var t=i.bars.reduce(function(e,t){return t.percent=+(100*t.value/t.max).toFixed(2),e+t.percent},0);t>100&&(e.percent-=t-100)},e.$on("$destroy",function(){t=null,i.removeBar(e)})},this.removeBar=function(e){this.bars.splice(this.bars.indexOf(e),1),this.bars.forEach(function(e){e.recalculatePercentage()})},e.$watch("maxParam",function(e){i.bars.forEach(function(e){e.max=r(),e.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(e,t,n,r){r.addBar(e,t,n)}}}).directive("uibProgressbar",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",scope:{value:"=",maxParam:"=?max",type:"@"},templateUrl:"uib/template/progressbar/progressbar.html",link:function(e,t,n,r){r.addBar(e,angular.element(t.children()[0]),{title:n.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(e,t,n){var r={$setViewValue:angular.noop},i=this;this.init=function(i){r=i,r.$render=this.render,r.$formatters.push(function(e){return angular.isNumber(e)&&e<<0!==e&&(e=Math.round(e)),e}),this.stateOn=angular.isDefined(t.stateOn)?e.$parent.$eval(t.stateOn):n.stateOn,this.stateOff=angular.isDefined(t.stateOff)?e.$parent.$eval(t.stateOff):n.stateOff,this.enableReset=angular.isDefined(t.enableReset)?e.$parent.$eval(t.enableReset):n.enableReset;var o=angular.isDefined(t.titles)?e.$parent.$eval(t.titles):n.titles;this.titles=angular.isArray(o)&&o.length>0?o:n.titles;var a=angular.isDefined(t.ratingStates)?e.$parent.$eval(t.ratingStates):new Array(angular.isDefined(t.max)?e.$parent.$eval(t.max):n.max);e.range=this.buildTemplateObjects(a)},this.buildTemplateObjects=function(e){for(var t=0,n=e.length;t=this.titles.length?e+1:this.titles[e]},e.rate=function(t){if(!e.readonly&&t>=0&&t<=e.range.length){var n=i.enableReset&&r.$viewValue===t?0:t;r.$setViewValue(n),r.$render()}},e.enter=function(t){e.readonly||(e.value=t),e.onHover({value:t})},e.reset=function(){e.value=r.$viewValue,e.onLeave()},e.onKeydown=function(t){/(37|38|39|40)/.test(t.which)&&(t.preventDefault(),t.stopPropagation(),e.rate(e.value+(38===t.which||39===t.which?1:-1)))},this.render=function(){e.value=r.$viewValue,e.title=i.getTitle(e.value-1)}}]).directive("uibRating",function(){return{require:["uibRating","ngModel"],scope:{readonly:"=?readOnly",onHover:"&",onLeave:"&"},controller:"UibRatingController",templateUrl:"uib/template/rating/rating.html",replace:!0,link:function(e,t,n,r){var i=r[0],o=r[1];i.init(o)}}}),angular.module("ui.bootstrap.tabs",[]).controller("UibTabsetController",["$scope",function(e){function t(e){for(var t=0;tt.index?1:e.index0&&t<13:t>=0&&t<24)&&""!==e.hours)return e.showMeridian&&(12===t&&(t=0),e.meridian===w[1]&&(t+=12)),t}function l(){var t=+e.minutes;if(t>=0&&t<60&&""!==e.minutes)return t}function u(){var t=+e.seconds;return t>=0&&t<60?t:void 0}function c(e,t){return null===e?"":angular.isDefined(e)&&e.toString().length<2&&!t?"0"+e:e.toString()}function f(e){d(),$.$setViewValue(new Date(y)),p(e)}function d(){$.$setValidity("time",!0),e.invalidHours=!1,e.invalidMinutes=!1,e.invalidSeconds=!1}function p(t){if($.$modelValue){var n=y.getHours(),r=y.getMinutes(),i=y.getSeconds();e.showMeridian&&(n=0===n||12===n?12:n%12),e.hours="h"===t?n:c(n,!x),"m"!==t&&(e.minutes=c(r)),e.meridian=y.getHours()<12?w[0]:w[1],"s"!==t&&(e.seconds=c(i)),e.meridian=y.getHours()<12?w[0]:w[1]}else e.hours=null,e.minutes=null,e.seconds=null,e.meridian=w[0]}function h(e){y=g(y,e),f()}function m(e,t){return g(e,60*t)}function g(e,t){var n=new Date(e.getTime()+1e3*t),r=new Date(e);return r.setHours(n.getHours(),n.getMinutes(),n.getSeconds()),r}function v(){return(null===e.hours||""===e.hours)&&(null===e.minutes||""===e.minutes)&&(!e.showSeconds||e.showSeconds&&(null===e.seconds||""===e.seconds))}var y=new Date,b=[],$={$setViewValue:angular.noop},w=angular.isDefined(n.meridians)?e.$parent.$eval(n.meridians):a.meridians||o.DATETIME_FORMATS.AMPMS,x=!angular.isDefined(n.padHours)||e.$parent.$eval(n.padHours);e.tabindex=angular.isDefined(n.tabindex)?n.tabindex:0,t.removeAttr("tabindex"),this.init=function(t,r){$=t,$.$render=this.render,$.$formatters.unshift(function(e){return e?new Date(e):null});var i=r.eq(0),o=r.eq(1),s=r.eq(2);(angular.isDefined(n.mousewheel)?e.$parent.$eval(n.mousewheel):a.mousewheel)&&this.setupMousewheelEvents(i,o,s),(angular.isDefined(n.arrowkeys)?e.$parent.$eval(n.arrowkeys):a.arrowkeys)&&this.setupArrowkeyEvents(i,o,s),e.readonlyInput=angular.isDefined(n.readonlyInput)?e.$parent.$eval(n.readonlyInput):a.readonlyInput,this.setupInputEvents(i,o,s)};var C=a.hourStep;n.hourStep&&b.push(e.$parent.$watch(r(n.hourStep),function(e){C=+e}));var k=a.minuteStep;n.minuteStep&&b.push(e.$parent.$watch(r(n.minuteStep),function(e){k=+e}));var E;b.push(e.$parent.$watch(r(n.min),function(e){var t=new Date(e);E=isNaN(t)?void 0:t}));var S;b.push(e.$parent.$watch(r(n.max),function(e){var t=new Date(e);S=isNaN(t)?void 0:t}));var _=!1;n.ngDisabled&&b.push(e.$parent.$watch(r(n.ngDisabled),function(e){_=e})),e.noIncrementHours=function(){var e=m(y,60*C);return _||e>S||ey&&e>S},e.noIncrementMinutes=function(){var e=m(y,k);return _||e>S||ey&&e>S},e.noIncrementSeconds=function(){var e=g(y,M);return _||e>S||ey&&e>S},e.noToggleMeridian=function(){return y.getHours()<12?_||m(y,720)>S:_||m(y,-720)0};t.bind("mousewheel wheel",function(t){_||e.$apply(i(t)?e.incrementHours():e.decrementHours()),t.preventDefault()}),n.bind("mousewheel wheel",function(t){_||e.$apply(i(t)?e.incrementMinutes():e.decrementMinutes()),t.preventDefault()}),r.bind("mousewheel wheel",function(t){_||e.$apply(i(t)?e.incrementSeconds():e.decrementSeconds()),t.preventDefault()})},this.setupArrowkeyEvents=function(t,n,r){t.bind("keydown",function(t){_||(38===t.which?(t.preventDefault(),e.incrementHours(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementHours(),e.$apply()))}),n.bind("keydown",function(t){_||(38===t.which?(t.preventDefault(),e.incrementMinutes(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementMinutes(),e.$apply()))}),r.bind("keydown",function(t){_||(38===t.which?(t.preventDefault(),e.incrementSeconds(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementSeconds(),e.$apply()))})},this.setupInputEvents=function(t,n,r){if(e.readonlyInput)return e.updateHours=angular.noop,e.updateMinutes=angular.noop,void(e.updateSeconds=angular.noop);var i=function(t,n,r){$.$setViewValue(null),$.$setValidity("time",!1),angular.isDefined(t)&&(e.invalidHours=t),angular.isDefined(n)&&(e.invalidMinutes=n),angular.isDefined(r)&&(e.invalidSeconds=r)};e.updateHours=function(){var e=s(),t=l();$.$setDirty(),angular.isDefined(e)&&angular.isDefined(t)?(y.setHours(e),y.setMinutes(t),yS?i(!0):f("h")):i(!0)},t.bind("blur",function(t){$.$setTouched(),v()?d():null===e.hours||""===e.hours?i(!0):!e.invalidHours&&e.hours<10&&e.$apply(function(){e.hours=c(e.hours,!x)})}),e.updateMinutes=function(){var e=l(),t=s();$.$setDirty(),angular.isDefined(e)&&angular.isDefined(t)?(y.setHours(t),y.setMinutes(e),yS?i(void 0,!0):f("m")):i(void 0,!0)},n.bind("blur",function(t){$.$setTouched(),v()?d():null===e.minutes?i(void 0,!0):!e.invalidMinutes&&e.minutes<10&&e.$apply(function(){e.minutes=c(e.minutes)})}),e.updateSeconds=function(){var e=u();$.$setDirty(),angular.isDefined(e)?(y.setSeconds(e),f("s")):i(void 0,void 0,!0)},r.bind("blur",function(t){v()?d():!e.invalidSeconds&&e.seconds<10&&e.$apply(function(){e.seconds=c(e.seconds)})})},this.render=function(){var t=$.$viewValue;isNaN(t)?($.$setValidity("time",!1),i.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.')):(t&&(y=t),yS?($.$setValidity("time",!1),e.invalidHours=!0,e.invalidMinutes=!0):d(),p())},e.showSpinners=angular.isDefined(n.showSpinners)?e.$parent.$eval(n.showSpinners):a.showSpinners,e.incrementHours=function(){e.noIncrementHours()||h(60*C*60)},e.decrementHours=function(){e.noDecrementHours()||h(60*-C*60)},e.incrementMinutes=function(){e.noIncrementMinutes()||h(60*k)},e.decrementMinutes=function(){e.noDecrementMinutes()||h(60*-k)},e.incrementSeconds=function(){e.noIncrementSeconds()||h(M)},e.decrementSeconds=function(){e.noDecrementSeconds()||h(-M)},e.toggleMeridian=function(){var t=l(),n=s();e.noToggleMeridian()||(angular.isDefined(t)&&angular.isDefined(n)?h(720*(y.getHours()<12?60:-60)):e.meridian=e.meridian===w[0]?w[1]:w[0])},e.blur=function(){$.$setTouched()},e.$on("$destroy",function(){for(;b.length;)b.shift()()})}]).directive("uibTimepicker",["uibTimepickerConfig",function(e){return{require:["uibTimepicker","?^ngModel"], -controller:"UibTimepickerController",controllerAs:"timepicker",replace:!0,scope:{},templateUrl:function(t,n){return n.templateUrl||e.templateUrl},link:function(e,t,n,r){var i=r[0],o=r[1];o&&i.init(o,t.find("input"))}}}]),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.debounce","ui.bootstrap.position"]).factory("uibTypeaheadParser",["$parse",function(e){var t=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(n){var r=n.match(t);if(!r)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+n+'".');return{itemName:r[3],source:e(r[4]),viewMapper:e(r[2]||r[1]),modelMapper:e(r[1])}}}}]).controller("UibTypeaheadController",["$scope","$element","$attrs","$compile","$parse","$q","$timeout","$document","$window","$rootScope","$$debounce","$uibPosition","uibTypeaheadParser",function(e,t,n,r,i,o,a,s,l,u,c,f,d){function p(){L.moveInProgress||(L.moveInProgress=!0,L.$digest()),Z()}function h(){L.position=T?f.offset(t):f.position(t),L.position.top+=t.prop("offsetHeight")}var m,g,v=[9,13,27,38,40],y=e.$eval(n.typeaheadMinLength);y||0===y||(y=1),e.$watch(n.typeaheadMinLength,function(e){y=e||0===e?e:1});var b=e.$eval(n.typeaheadWaitMs)||0,$=!1!==e.$eval(n.typeaheadEditable);e.$watch(n.typeaheadEditable,function(e){$=!1!==e});var w,x,C=i(n.typeaheadLoading).assign||angular.noop,k=n.typeaheadShouldSelect?i(n.typeaheadShouldSelect):function(e,t){var n=t.$event;return 13===n.which||9===n.which},E=i(n.typeaheadOnSelect),S=!!angular.isDefined(n.typeaheadSelectOnBlur)&&e.$eval(n.typeaheadSelectOnBlur),_=i(n.typeaheadNoResults).assign||angular.noop,M=n.typeaheadInputFormatter?i(n.typeaheadInputFormatter):void 0,T=!!n.typeaheadAppendToBody&&e.$eval(n.typeaheadAppendToBody),D=n.typeaheadAppendTo?e.$eval(n.typeaheadAppendTo):null,A=!1!==e.$eval(n.typeaheadFocusFirst),O=!!n.typeaheadSelectOnExact&&e.$eval(n.typeaheadSelectOnExact),N=i(n.typeaheadIsOpen).assign||angular.noop,R=e.$eval(n.typeaheadShowHint)||!1,I=i(n.ngModel),P=i(n.ngModel+"($$$p)"),F=function(t,n){return angular.isFunction(I(e))&&g&&g.$options&&g.$options.getterSetter?P(t,{$$$p:n}):I.assign(t,n)},j=d.parse(n.uibTypeahead),L=e.$new(),U=e.$on("$destroy",function(){L.$destroy()});L.$on("$destroy",U);var H="typeahead-"+L.$id+"-"+Math.floor(1e4*Math.random());t.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":H});var q,V;R&&(q=angular.element("
"),q.css("position","relative"),t.after(q),V=t.clone(),V.attr("placeholder",""),V.attr("tabindex","-1"),V.val(""),V.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"}),t.css({position:"relative","vertical-align":"top","background-color":"transparent"}),q.append(V),V.after(t));var z=angular.element("
");z.attr({id:H,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(n.typeaheadTemplateUrl)&&z.attr("template-url",n.typeaheadTemplateUrl),angular.isDefined(n.typeaheadPopupTemplateUrl)&&z.attr("popup-template-url",n.typeaheadPopupTemplateUrl);var B=function(){R&&V.val("")},Y=function(){L.matches=[],L.activeIdx=-1,t.attr("aria-expanded",!1),B()},W=function(e){return H+"-option-"+e};L.$watch("activeIdx",function(e){e<0?t.removeAttr("aria-activedescendant"):t.attr("aria-activedescendant",W(e))});var G=function(e,t){return!!(L.matches.length>t&&e)&&e.toUpperCase()===L.matches[t].label.toUpperCase()},K=function(n,r){var i={$viewValue:n};C(e,!0),_(e,!1),o.when(j.source(e,i)).then(function(o){var a=n===m.$viewValue;if(a&&w)if(o&&o.length>0){L.activeIdx=A?0:-1,_(e,!1),L.matches.length=0;for(var s=0;s0&&l.slice(0,n.length).toUpperCase()===n.toUpperCase()?V.val(n+l.slice(n.length)):V.val("")}}else Y(),_(e,!0);a&&C(e,!1)},function(){Y(),C(e,!1),_(e,!0)})};T&&(angular.element(l).on("resize",p),s.find("body").on("scroll",p));var Z=c(function(){L.matches.length&&h(),L.moveInProgress=!1},200);L.moveInProgress=!1,L.query=void 0;var J,Q=function(e){J=a(function(){K(e)},b)},X=function(){J&&a.cancel(J)};Y(),L.assignIsOpen=function(t){N(e,t)},L.select=function(r,i){var o,s,l={};x=!0,l[j.itemName]=s=L.matches[r].model,o=j.modelMapper(e,l),F(e,o),m.$setValidity("editable",!0),m.$setValidity("parse",!0),E(e,{$item:s,$model:o,$label:j.viewMapper(e,l),$event:i}),Y(),!1!==L.$eval(n.typeaheadFocusOnSelect)&&a(function(){t[0].focus()},0,!1)},t.on("keydown",function(t){if(0!==L.matches.length&&-1!==v.indexOf(t.which)){var n=k(e,{$event:t});if(-1===L.activeIdx&&n||9===t.which&&t.shiftKey)return Y(),void L.$digest();t.preventDefault();var r;switch(t.which){case 27:t.stopPropagation(),Y(),e.$digest();break;case 38:L.activeIdx=(L.activeIdx>0?L.activeIdx:L.matches.length)-1,L.$digest(),r=z.find("li")[L.activeIdx],r.parentNode.scrollTop=r.offsetTop;break;case 40:L.activeIdx=(L.activeIdx+1)%L.matches.length,L.$digest(),r=z.find("li")[L.activeIdx],r.parentNode.scrollTop=r.offsetTop;break;default:n&&L.$apply(function(){angular.isNumber(L.debounceUpdate)||angular.isObject(L.debounceUpdate)?c(function(){L.select(L.activeIdx,t)},angular.isNumber(L.debounceUpdate)?L.debounceUpdate:L.debounceUpdate.default):L.select(L.activeIdx,t)})}}}),t.bind("focus",function(e){w=!0,0!==y||m.$viewValue||a(function(){K(m.$viewValue,e)},0)}),t.bind("blur",function(e){S&&L.matches.length&&-1!==L.activeIdx&&!x&&(x=!0,L.$apply(function(){angular.isObject(L.debounceUpdate)&&angular.isNumber(L.debounceUpdate.blur)?c(function(){L.select(L.activeIdx,e)},L.debounceUpdate.blur):L.select(L.activeIdx,e)})),!$&&m.$error.editable&&(m.$setViewValue(),m.$setValidity("editable",!0),m.$setValidity("parse",!0),t.val("")),w=!1,x=!1});var ee=function(n){t[0]!==n.target&&3!==n.which&&0!==L.matches.length&&(Y(),u.$$phase||e.$digest())};s.on("click",ee),e.$on("$destroy",function(){s.off("click",ee),(T||D)&&te.remove(),T&&(angular.element(l).off("resize",p),s.find("body").off("scroll",p)),z.remove(),R&&q.remove()});var te=r(z)(L);T?s.find("body").append(te):D?angular.element(D).eq(0).append(te):t.after(te),this.init=function(t,n){m=t,g=n,L.debounceUpdate=m.$options&&i(m.$options.debounce)(e),m.$parsers.unshift(function(t){return w=!0,0===y||t&&t.length>=y?b>0?(X(),Q(t)):K(t):(C(e,!1),X(),Y()),$?t:t?void m.$setValidity("editable",!1):(m.$setValidity("editable",!0),null)}),m.$formatters.push(function(t){var n,r,i={};return $||m.$setValidity("editable",!0),M?(i.$model=t,M(e,i)):(i[j.itemName]=t,n=j.viewMapper(e,i),i[j.itemName]=void 0,r=j.viewMapper(e,i),n!==r?n:t)})}}]).directive("uibTypeahead",function(){return{controller:"UibTypeaheadController",require:["ngModel","^?ngModelOptions","uibTypeahead"],link:function(e,t,n,r){r[2].init(r[0],r[1])}}}).directive("uibTypeaheadPopup",["$$debounce",function(e){return{scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&",assignIsOpen:"&",debounce:"&"},replace:!0,templateUrl:function(e,t){return t.popupTemplateUrl||"uib/template/typeahead/typeahead-popup.html"},link:function(t,n,r){t.templateUrl=r.templateUrl,t.isOpen=function(){var e=t.matches.length>0;return t.assignIsOpen({isOpen:e}),e},t.isActive=function(e){return t.active===e},t.selectActive=function(e){t.active=e},t.selectMatch=function(n,r){var i=t.debounce();angular.isNumber(i)||angular.isObject(i)?e(function(){t.select({activeIdx:n,evt:r})},angular.isNumber(i)?i:i.default):t.select({activeIdx:n,evt:r})}}}}]).directive("uibTypeaheadMatch",["$templateRequest","$compile","$parse",function(e,t,n){return{scope:{index:"=",match:"=",query:"="},link:function(r,i,o){var a=n(o.templateUrl)(r.$parent)||"uib/template/typeahead/typeahead-match.html";e(a).then(function(e){var n=angular.element(e.trim());i.replaceWith(n),t(n)(r)})}}}]).filter("uibTypeaheadHighlight",["$sce","$injector","$log",function(e,t,n){function r(e){return e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function i(e){return/<.*>/g.test(e)}var o;return o=t.has("$sanitize"),function(t,a){return!o&&i(t)&&n.warn("Unsafe use of typeahead please use ngSanitize"),t=a?(""+t).replace(new RegExp(r(a),"gi"),"$&"):t,o||(t=e.trustAsHtml(t)),t}}]),angular.module("uib/template/accordion/accordion-group.html",[]).run(["$templateCache",function(e){e.put("uib/template/accordion/accordion-group.html",'
\n \n
\n
\n
\n
\n')}]),angular.module("uib/template/accordion/accordion.html",[]).run(["$templateCache",function(e){e.put("uib/template/accordion/accordion.html",'
')}]),angular.module("uib/template/alert/alert.html",[]).run(["$templateCache",function(e){e.put("uib/template/alert/alert.html",'\n')}]),angular.module("uib/template/carousel/carousel.html",[]).run(["$templateCache",function(e){e.put("uib/template/carousel/carousel.html",'\n')}]),angular.module("uib/template/carousel/slide.html",[]).run(["$templateCache",function(e){e.put("uib/template/carousel/slide.html",'
\n')}]),angular.module("uib/template/datepicker/datepicker.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepicker/datepicker.html",'
\n \n \n \n
\n')}]),angular.module("uib/template/datepicker/day.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepicker/day.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
{{::label.abbr}}
{{ weekNumbers[$index] }}\n \n
\n')}]),angular.module("uib/template/datepicker/month.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepicker/month.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n')}]),angular.module("uib/template/datepicker/year.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepicker/year.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n')}]),angular.module("uib/template/datepickerPopup/popup.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepickerPopup/popup.html",'
\n \n
\n')}]),angular.module("uib/template/modal/backdrop.html",[]).run(["$templateCache",function(e){e.put("uib/template/modal/backdrop.html",'\n')}]),angular.module("uib/template/modal/window.html",[]).run(["$templateCache",function(e){e.put("uib/template/modal/window.html",'\n')}]),angular.module("uib/template/pager/pager.html",[]).run(["$templateCache",function(e){e.put("uib/template/pager/pager.html",'\n')}]),angular.module("uib/template/pagination/pagination.html",[]).run(["$templateCache",function(e){e.put("uib/template/pagination/pagination.html",'\n')}]),angular.module("uib/template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function(e){e.put("uib/template/tooltip/tooltip-html-popup.html",'
\n
\n
\n
\n')}]),angular.module("uib/template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(e){e.put("uib/template/tooltip/tooltip-popup.html",'
\n
\n
\n
\n')}]),angular.module("uib/template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function(e){e.put("uib/template/tooltip/tooltip-template-popup.html",'
\n
\n
\n
\n')}]),angular.module("uib/template/popover/popover-html.html",[]).run(["$templateCache",function(e){e.put("uib/template/popover/popover-html.html",'
\n
\n\n
\n

\n
\n
\n
\n')}]),angular.module("uib/template/popover/popover-template.html",[]).run(["$templateCache",function(e){e.put("uib/template/popover/popover-template.html",'
\n
\n\n
\n

\n
\n
\n
\n')}]),angular.module("uib/template/popover/popover.html",[]).run(["$templateCache",function(e){e.put("uib/template/popover/popover.html",'
\n
\n\n
\n

\n
\n
\n
\n')}]),angular.module("uib/template/progressbar/bar.html",[]).run(["$templateCache",function(e){e.put("uib/template/progressbar/bar.html",'
\n')}]),angular.module("uib/template/progressbar/progress.html",[]).run(["$templateCache",function(e){e.put("uib/template/progressbar/progress.html",'
')}]),angular.module("uib/template/progressbar/progressbar.html",[]).run(["$templateCache",function(e){e.put("uib/template/progressbar/progressbar.html",'
\n
\n
\n')}]),angular.module("uib/template/rating/rating.html",[]).run(["$templateCache",function(e){e.put("uib/template/rating/rating.html",'\n ({{ $index < value ? \'*\' : \' \' }})\n \n\n')}]),angular.module("uib/template/tabs/tab.html",[]).run(["$templateCache",function(e){e.put("uib/template/tabs/tab.html",'\n')}]),angular.module("uib/template/tabs/tabset.html",[]).run(["$templateCache",function(e){e.put("uib/template/tabs/tabset.html",'
\n \n
\n
\n
\n
\n
\n')}]),angular.module("uib/template/timepicker/timepicker.html",[]).run(["$templateCache",function(e){e.put("uib/template/timepicker/timepicker.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
  
\n \n :\n \n :\n \n
  
\n')}]),angular.module("uib/template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(e){e.put("uib/template/typeahead/typeahead-match.html",'\n')}]),angular.module("uib/template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(e){e.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}),define("common/angularBootstrap",["common/angular"],function(){}),function(e,t){(function(e){var t=e.module("angularFileUpload",[]);t.value("fileUploaderOptions",{url:"/",alias:"file",headers:{},queue:[],progress:0,autoUpload:!1,removeAfterUpload:!1,method:"POST",filters:[],formData:[],queueLimit:Number.MAX_VALUE,withCredentials:!1}).factory("FileUploader",["fileUploaderOptions","$rootScope","$http","$window","$compile",function(t,n,r,i,o){function a(n){var r=e.copy(t);e.extend(this,r,n,{isUploading:!1,_nextIndex:0,_failFilterIndex:-1,_directives:{select:[],drop:[],over:[]}}),this.filters.unshift({name:"queueLimit",fn:this._queueLimitFilter}),this.filters.unshift({name:"folder",fn:this._folderFilter})}function s(t){var n=e.isElement(t),r=n?t.value:t;this["_createFrom"+(e.isString(r)?"FakePath":"Object")](r)}function l(t,n,r){var i=e.isElement(n),o=i?e.element(n):null,s=i?null:n;e.extend(this,{url:t.url,alias:t.alias,headers:e.copy(t.headers),formData:e.copy(t.formData),removeAfterUpload:t.removeAfterUpload,withCredentials:t.withCredentials,method:t.method},r,{uploader:t,file:new a.FileLikeObject(n),isReady:!1,isUploading:!1,isUploaded:!1,isSuccess:!1,isCancel:!1,isError:!1,progress:0,index:null,_file:s,_input:o}),o&&this._replaceNode(o)}function u(t){e.extend(this,t),this.uploader._directives[this.prop].push(this),this._saveLinks(),this.bind()}function c(e){c.super_.apply(this,arguments),this.uploader.isHTML5||this.element.removeAttr("multiple"),this.element.prop("value",null)}function f(e){f.super_.apply(this,arguments)}function d(e){d.super_.apply(this,arguments)}return a.prototype.isHTML5=!(!i.File||!i.FormData),a.prototype.addToQueue=function(t,n,r){var i=this.isArrayLikeObject(t)?t:[t],o=this._getFilters(r),s=this.queue.length,l=[];e.forEach(i,function(e){var t=new a.FileLikeObject(e);if(this._isValidFile(t,o,n)){var r=new a.FileItem(this,e,n);l.push(r),this.queue.push(r),this._onAfterAddingFile(r)}else{var i=this.filters[this._failFilterIndex];this._onWhenAddingFileFailed(t,i,n)}},this),this.queue.length!==s&&(this._onAfterAddingAll(l),this.progress=this._getTotalProgress()),this._render(),this.autoUpload&&this.uploadAll()},a.prototype.removeFromQueue=function(e){var t=this.getIndexOfItem(e),n=this.queue[t];n.isUploading&&n.cancel(),this.queue.splice(t,1),n._destroy(),this.progress=this._getTotalProgress()},a.prototype.clearQueue=function(){for(;this.queue.length;)this.queue[0].remove();this.progress=0},a.prototype.uploadItem=function(e){var t=this.getIndexOfItem(e),n=this.queue[t],r=this.isHTML5?"_xhrTransport":"_iframeTransport";n._prepareToUploading(),this.isUploading||(this.isUploading=!0,this[r](n))},a.prototype.cancelItem=function(e){var t=this.getIndexOfItem(e),n=this.queue[t],r=this.isHTML5?"_xhr":"_form";n&&n.isUploading&&n[r].abort()},a.prototype.uploadAll=function(){var t=this.getNotUploadedItems().filter(function(e){return!e.isUploading});t.length&&(e.forEach(t,function(e){e._prepareToUploading()}),t[0].upload())},a.prototype.cancelAll=function(){var t=this.getNotUploadedItems();e.forEach(t,function(e){e.cancel()})},a.prototype.isFile=function(e){var t=i.File;return t&&e instanceof t},a.prototype.isFileLikeObject=function(e){return e instanceof a.FileLikeObject},a.prototype.isArrayLikeObject=function(t){return e.isObject(t)&&"length"in t},a.prototype.getIndexOfItem=function(t){return e.isNumber(t)?t:this.queue.indexOf(t)},a.prototype.getNotUploadedItems=function(){return this.queue.filter(function(e){return!e.isUploaded})},a.prototype.getReadyItems=function(){return this.queue.filter(function(e){return e.isReady&&!e.isUploading}).sort(function(e,t){return e.index-t.index})},a.prototype.destroy=function(){e.forEach(this._directives,function(t){e.forEach(this._directives[t],function(e){e.destroy()},this)},this)},a.prototype.onAfterAddingAll=function(e){},a.prototype.onAfterAddingFile=function(e){},a.prototype.onWhenAddingFileFailed=function(e,t,n){},a.prototype.onBeforeUploadItem=function(e){},a.prototype.onProgressItem=function(e,t){},a.prototype.onProgressAll=function(e){},a.prototype.onSuccessItem=function(e,t,n,r){},a.prototype.onErrorItem=function(e,t,n,r){},a.prototype.onCancelItem=function(e,t,n,r){},a.prototype.onCompleteItem=function(e,t,n,r){},a.prototype.onCompleteAll=function(){},a.prototype._getTotalProgress=function(e){if(this.removeAfterUpload)return e||0;var t=this.getNotUploadedItems().length,n=t?this.queue.length-t:this.queue.length,r=100/this.queue.length,i=(e||0)*r/100;return Math.round(n*r+i)},a.prototype._getFilters=function(t){if(e.isUndefined(t))return this.filters;if(e.isArray(t))return t;var n=t.match(/[^\s,]+/g);return this.filters.filter(function(e){return-1!==n.indexOf(e.name)},this)},a.prototype._render=function(){n.$$phase||n.$apply()},a.prototype._folderFilter=function(e){return!(!e.size&&!e.type)},a.prototype._queueLimitFilter=function(){return this.queue.length=200&&e<300||304===e},a.prototype._transformResponse=function(t,n){var i=this._headersGetter(n);return e.forEach(r.defaults.transformResponse,function(e){t=e(t,i)}),t},a.prototype._parseHeaders=function(t){var n,r,i,o={};return t?(e.forEach(t.split("\n"),function(e){i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim(),n&&(o[n]=o[n]?o[n]+", "+r:r)}),o):o},a.prototype._headersGetter=function(e){return function(t){return t?e[t.toLowerCase()]||null:e}},a.prototype._xhrTransport=function(t){var n=t._xhr=new XMLHttpRequest,r=new FormData,i=this;i._onBeforeUploadItem(t),e.forEach(t.formData,function(t){e.forEach(t,function(e,t){r.append(t,e)})}),r.append(t.alias,t._file,t.file.name),n.upload.onprogress=function(e){var n=Math.round(e.lengthComputable?100*e.loaded/e.total:0);i._onProgressItem(t,n)},n.onload=function(){var e=i._parseHeaders(n.getAllResponseHeaders()),r=i._transformResponse(n.response,e),o=i._isSuccessCode(n.status)?"Success":"Error";i["_on"+o+"Item"](t,r,n.status,e),i._onCompleteItem(t,r,n.status,e)},n.onerror=function(){var e=i._parseHeaders(n.getAllResponseHeaders()),r=i._transformResponse(n.response,e);i._onErrorItem(t,r,n.status,e),i._onCompleteItem(t,r,n.status,e)},n.onabort=function(){var e=i._parseHeaders(n.getAllResponseHeaders()),r=i._transformResponse(n.response,e);i._onCancelItem(t,r,n.status,e),i._onCompleteItem(t,r,n.status,e)},n.open(t.method,t.url,!0),n.withCredentials=t.withCredentials,e.forEach(t.headers,function(e,t){n.setRequestHeader(t,e)}),n.send(r),this._render()},a.prototype._iframeTransport=function(t){var n=e.element('
'),r=e.element('"),n=e.prop("attributes");angular.forEach(n,function(e){t.attr(e.name,e.value)}),t.attr("src",t.attr("ta-insert-video")),e.replaceWith(t)}}]).value("taTranslations",{html:{tooltip:"Toggle html / Rich Text"},heading:{tooltip:"Heading "},p:{tooltip:"Paragraph"},pre:{tooltip:"Preformatted text"},ul:{tooltip:"Unordered List"},ol:{tooltip:"Ordered List"},quote:{tooltip:"Quote/unquote selection or paragraph"},undo:{tooltip:"Undo"},redo:{tooltip:"Redo"},bold:{tooltip:"Bold"},italic:{tooltip:"Italic"},underline:{tooltip:"Underline"},strikeThrough:{tooltip:"Strikethrough"},justifyLeft:{tooltip:"Align text left"},justifyRight:{tooltip:"Align text right"},justifyFull:{tooltip:"Justify text"},justifyCenter:{tooltip:"Center"},indent:{tooltip:"Increase indent"},outdent:{tooltip:"Decrease indent"},clear:{tooltip:"Clear formatting"},insertImage:{dialogPrompt:"Please enter an image URL to insert",tooltip:"Insert image",hotkey:"the - possibly language dependent hotkey ... for some future implementation"},insertVideo:{tooltip:"Insert video",dialogPrompt:"Please enter a youtube URL to embed"},insertLink:{tooltip:"Insert / edit link",dialogPrompt:"Please enter a URL to insert"},editLink:{reLinkButton:{tooltip:"Relink"},unLinkButton:{tooltip:"Unlink"},targetToggle:{buttontext:"Open in New Window"}},wordcount:{tooltip:"Display words Count"},charcount:{tooltip:"Display characters Count"}}).factory("taToolFunctions",["$window","taTranslations",function(e,t){return{imgOnSelectAction:function(e,t,n){var r=function(){n.updateTaBindtaTextElement(),n.hidePopover()};e.preventDefault(),n.displayElements.popover.css("width","375px");var i=n.displayElements.popoverContainer;i.empty();var o=angular.element('
'),a=angular.element('');a.on("click",function(e){e.preventDefault(),t.css({width:"100%",height:""}),r()});var s=angular.element('');s.on("click",function(e){e.preventDefault(),t.css({width:"50%",height:""}),r()});var l=angular.element('');l.on("click",function(e){e.preventDefault(),t.css({width:"25%",height:""}),r()});var u=angular.element('');u.on("click",function(e){e.preventDefault(),t.css({width:"",height:""}),r()}),o.append(a),o.append(s),o.append(l),o.append(u),i.append(o),o=angular.element('
');var c=angular.element('');c.on("click",function(e){e.preventDefault(),t.css("float","left"),t.css("cssFloat","left"),t.css("styleFloat","left"),r()});var f=angular.element('');f.on("click",function(e){e.preventDefault(),t.css("float","right"),t.css("cssFloat","right"),t.css("styleFloat","right"),r()});var d=angular.element('');d.on("click",function(e){e.preventDefault(),t.css("float",""),t.css("cssFloat",""),t.css("styleFloat",""),r()}),o.append(c),o.append(d),o.append(f),i.append(o),o=angular.element('
');var p=angular.element('');p.on("click",function(e){e.preventDefault(),t.remove(),r()}),o.append(p),i.append(o),n.showPopover(t),n.showResizeOverlay(t)},aOnSelectAction:function(n,r,i){n.preventDefault(),i.displayElements.popover.css("width","436px");var o=i.displayElements.popoverContainer;o.empty(),o.css("line-height","28px");var a=angular.element(''+r.attr("href")+"");a.css({display:"inline-block","max-width":"200px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","vertical-align":"middle"}),o.append(a);var s=angular.element('
'),l=angular.element('');l.on("click",function(n){n.preventDefault();var o=e.prompt(t.insertLink.dialogPrompt,r.attr("href"));o&&""!==o&&"http://"!==o&&(r.attr("href",o),i.updateTaBindtaTextElement()),i.hidePopover()}),s.append(l);var u=angular.element('');u.on("click",function(e){e.preventDefault(),r.replaceWith(r.contents()),i.updateTaBindtaTextElement(),i.hidePopover()}),s.append(u);var c=angular.element('");"_blank"===r.attr("target")&&c.addClass("active"),c.on("click",function(e){e.preventDefault(),r.attr("target","_blank"===r.attr("target")?"":"_blank"),c.toggleClass("active"),i.updateTaBindtaTextElement()}),s.append(c),o.append(s),i.showPopover(r)},extractYoutubeVideoId:function(e){var t=/(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i,n=e.match(t);return n&&n[1]||null}}}]).run(["taRegisterTool","$window","taTranslations","taSelection","taToolFunctions","$sanitize","taOptions",function(e,t,n,r,i,o,a){var s={};if(o("",s),!0===a.forceTextAngularSanitize&&"taSanitize"!==s.version)throw angular.$$minErr("textAngular")("textAngularSetup","The textAngular-sanitize provider has been replaced by another -- have you included angular-sanitize by mistake?");e("html",{iconclass:"fa fa-code",tooltiptext:n.html.tooltip,action:function(){this.$editor().switchView()},activeState:function(){return this.$editor().showHtml}});var l=function(e){return function(){return this.$editor().queryFormatBlockState(e)}},u=function(){return this.$editor().wrapSelection("formatBlock","<"+this.name.toUpperCase()+">")};angular.forEach(["h1","h2","h3","h4","h5","h6"],function(t){e(t.toLowerCase(),{buttontext:t.toUpperCase(),tooltiptext:n.heading.tooltip+t.charAt(1),action:u,activeState:l(t.toLowerCase())})}),e("p",{buttontext:"P",tooltiptext:n.p.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","

")},activeState:function(){return this.$editor().queryFormatBlockState("p")}}),e("pre",{buttontext:"pre",tooltiptext:n.pre.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","

")},activeState:function(){return this.$editor().queryFormatBlockState("pre")}}),e("ul",{iconclass:"fa fa-list-ul",tooltiptext:n.ul.tooltip,action:function(){return this.$editor().wrapSelection("insertUnorderedList",null)},activeState:function(){return this.$editor().queryCommandState("insertUnorderedList")}}),e("ol",{iconclass:"fa fa-list-ol",tooltiptext:n.ol.tooltip,action:function(){return this.$editor().wrapSelection("insertOrderedList",null)},activeState:function(){return this.$editor().queryCommandState("insertOrderedList")}}),e("quote",{iconclass:"fa fa-quote-right",tooltiptext:n.quote.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","
")},activeState:function(){return this.$editor().queryFormatBlockState("blockquote")}}),e("undo",{iconclass:"fa fa-undo",tooltiptext:n.undo.tooltip,action:function(){return this.$editor().wrapSelection("undo",null)}}),e("redo",{iconclass:"fa fa-repeat",tooltiptext:n.redo.tooltip,action:function(){return this.$editor().wrapSelection("redo",null)}}),e("bold",{iconclass:"fa fa-bold",tooltiptext:n.bold.tooltip,action:function(){return this.$editor().wrapSelection("bold",null)},activeState:function(){return this.$editor().queryCommandState("bold")},commandKeyCode:98}),e("justifyLeft",{iconclass:"fa fa-align-left",tooltiptext:n.justifyLeft.tooltip,action:function(){return this.$editor().wrapSelection("justifyLeft",null)},activeState:function(e){ -if(e&&"#document"===e.nodeName)return!1;var t=!1;return e&&(t="left"===e.css("text-align")||"left"===e.attr("align")||"right"!==e.css("text-align")&&"center"!==e.css("text-align")&&"justify"!==e.css("text-align")&&!this.$editor().queryCommandState("justifyRight")&&!this.$editor().queryCommandState("justifyCenter")&&!this.$editor().queryCommandState("justifyFull")),t=t||this.$editor().queryCommandState("justifyLeft")}}),e("justifyRight",{iconclass:"fa fa-align-right",tooltiptext:n.justifyRight.tooltip,action:function(){return this.$editor().wrapSelection("justifyRight",null)},activeState:function(e){if(e&&"#document"===e.nodeName)return!1;var t=!1;return e&&(t="right"===e.css("text-align")),t=t||this.$editor().queryCommandState("justifyRight")}}),e("justifyFull",{iconclass:"fa fa-align-justify",tooltiptext:n.justifyFull.tooltip,action:function(){return this.$editor().wrapSelection("justifyFull",null)},activeState:function(e){var t=!1;return e&&(t="justify"===e.css("text-align")),t=t||this.$editor().queryCommandState("justifyFull")}}),e("justifyCenter",{iconclass:"fa fa-align-center",tooltiptext:n.justifyCenter.tooltip,action:function(){return this.$editor().wrapSelection("justifyCenter",null)},activeState:function(e){if(e&&"#document"===e.nodeName)return!1;var t=!1;return e&&(t="center"===e.css("text-align")),t=t||this.$editor().queryCommandState("justifyCenter")}}),e("indent",{iconclass:"fa fa-indent",tooltiptext:n.indent.tooltip,action:function(){return this.$editor().wrapSelection("indent",null)},activeState:function(){return this.$editor().queryFormatBlockState("blockquote")},commandKeyCode:"TabKey"}),e("outdent",{iconclass:"fa fa-outdent",tooltiptext:n.outdent.tooltip,action:function(){return this.$editor().wrapSelection("outdent",null)},activeState:function(){return!1},commandKeyCode:"ShiftTabKey"}),e("italics",{iconclass:"fa fa-italic",tooltiptext:n.italic.tooltip,action:function(){return this.$editor().wrapSelection("italic",null)},activeState:function(){return this.$editor().queryCommandState("italic")},commandKeyCode:105}),e("underline",{iconclass:"fa fa-underline",tooltiptext:n.underline.tooltip,action:function(){return this.$editor().wrapSelection("underline",null)},activeState:function(){return this.$editor().queryCommandState("underline")},commandKeyCode:117}),e("strikeThrough",{iconclass:"fa fa-strikethrough",tooltiptext:n.strikeThrough.tooltip,action:function(){return this.$editor().wrapSelection("strikeThrough",null)},activeState:function(){return document.queryCommandState("strikeThrough")}}),e("clear",{iconclass:"fa fa-ban",tooltiptext:n.clear.tooltip,action:function(e,t){var n;this.$editor().wrapSelection("removeFormat",null);var i=angular.element(r.getSelectionElement()),o=function(e){e=angular.element(e);var t=e;angular.forEach(e.children(),function(e){var n=angular.element("

");n.html(angular.element(e).html()),t.after(n),t=n}),e.remove()};if(angular.forEach(i.find("ul"),o),angular.forEach(i.find("ol"),o),"li"===i[0].tagName.toLowerCase()){var a=i[0].parentNode.childNodes,s=[],l=[],u=!1;for(n=0;n

");if(f.html(angular.element(i[0]).html()),0===s.length||0===l.length)0===l.length?c.after(f):c[0].parentNode.insertBefore(f[0],c[0]),0===s.length&&0===l.length?c.remove():angular.element(i[0]).remove();else{var d=angular.element("<"+c[0].tagName+">"),p=angular.element("<"+c[0].tagName+">");for(n=0;n';return this.$editor().wrapSelection("insertHTML",o,!0)}},onElementSelect:{element:"img",onlyWithAttrs:["ta-insert-video"],action:i.imgOnSelectAction}}),e("insertLink",{tooltiptext:n.insertLink.tooltip,iconclass:"fa fa-link",action:function(){var e;if((e=t.prompt(n.insertLink.dialogPrompt,"http://"))&&""!==e&&"http://"!==e)return this.$editor().wrapSelection("createLink",e,!0)},activeState:function(e){return!!e&&"A"===e[0].tagName},onElementSelect:{element:"a",action:i.aOnSelectAction}}),e("wordcount",{display:'
Words:
',disabled:!0,wordcount:0,activeState:function(){var e=this.$editor().displayElements.text,t=e[0].innerHTML||"",n=0;return""!==t.replace(/\s*<[^>]*?>\s*/g,"")&&(n=t.replace(/<\/?(b|i|em|strong|span|u|strikethrough|a|img|small|sub|sup|label)( [^>*?])?>/gi,"").replace(/(<[^>]*?>\s*<[^>]*?>)/gi," ").replace(/(<[^>]*?>)/gi,"").replace(/\s+/gi," ").match(/\S+/g).length),this.wordcount=n,this.$editor().wordcount=n,!1}}),e("charcount",{display:'
Characters:
',disabled:!0,charcount:0,activeState:function(){var e=this.$editor().displayElements.text,t=e[0].innerText||e[0].textContent,n=t.replace(/(\r\n|\n|\r)/gm,"").replace(/^\s+/g," ").replace(/\s+$/g," ").length;return this.charcount=n,this.$editor().charcount=n,!1}})}]),define("common/text-angular-setup",function(){}),"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="textAngular"),function(){var e={ie:function(){for(var e=3,t=document.createElement("div"),n=t.getElementsByTagName("i");t.innerHTML="\x3c!--[if gt IE "+ ++e+"]>4?e:void 0}(),webkit:/AppleWebKit\/([\d.]+)/i.test(navigator.userAgent)},t=!1;e.webkit&&(document.addEventListener("mousedown",function(e){var n=e||window.event,r=n.target;if(t&&null!==r){for(var i=!1,o=r;null!==o&&"html"!==o.tagName.toLowerCase()&&!i;)i="true"===o.contentEditable,o=o.parentNode;i||(document.getElementById("textAngular-editableFix-010203040506070809").setSelectionRange(0,0),r.focus(),r.select&&r.select())}t=!1},!1),angular.element(document).ready(function(){angular.element(document.body).append(angular.element(''))}));var n=/^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i,r=/^(ul|li|ol)$/i,i=/^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i;String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o,a,s,l,u,c;if(e.ie>8||void 0===e.ie){for(var f=document.styleSheets,d=0;d
");return r[0].innerHTML=n,angular.forEach(e,function(e){var n=[];e.selector&&""!==e.selector?n=r.find(e.selector):e.customAttribute&&""!==e.customAttribute&&(n=t.getByAttribute(r,e.customAttribute)),angular.forEach(n,function(t){t=angular.element(t),e.selector&&""!==e.selector&&e.customAttribute&&""!==e.customAttribute?void 0!==t.attr(e.customAttribute)&&e.renderLogic(t):e.renderLogic(t)})}),r[0].innerHTML}}]).factory("taFixChrome",function(){return function(e){if(!e||!angular.isString(e)||e.length<=0)return e;for(var t,n,r,i=/<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/gi,o="",a=0;t=i.exec(e);)(n=t[3]||t[4])&&n.match(/line-height: 1.[0-9]{3,12};|color: inherit; line-height: 1.1;/i)&&(n=n.replace(/( |)font-family: inherit;|( |)line-height: 1.[0-9]{3,12};|( |)color: inherit;/gi,""),r="<"+t[1].trim(),n.trim().length>0&&(r+=" style="+t[2].substring(0,1)+n+t[2].substring(0,1)),r+=t[5].trim()+">",o+=e.substring(a,t.index)+r,a=t.index+t[0].length);return o+=e.substring(a),a>0?o.replace(/(.*?)<\/span>(|)/gi,"$1"):e}}).factory("taSanitize",["$sanitize",function(e){function t(e,t){for(var n,r=0,i=0,o=/<[^>]*>/gi;n=o.exec(e);)if(i=n.index,"/"===n[0].substr(1,1)){if(0===r)break;r--}else r++;return t+e.substring(0,i)+angular.element(t)[0].outerHTML.substring(t.length)+e.substring(i)}function n(e){if(!e||!angular.isString(e)||e.length<=0)return e;for(var r,o,a,s,l,c,f=/<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/gi,d="",p="",h=0;o=f.exec(e);){s=o[3]||o[4];var m=new RegExp(u,"i");if(angular.isString(s)&&m.test(s)){l="";for(var g=new RegExp(u,"ig");a=g.exec(s);)for(r=0;r");c=n(e.substring(h,o.index)),d.length>0?p+=t(c,d):p+=c,s=s.replace(new RegExp(u,"ig"),""),p+="<"+o[1].trim(),s.length>0&&(p+=' style="'+s+'"'),p+=o[5]+">",h=o.index+o[0].length,d=l}}return d.length>0?p+=t(e.substring(h),d):p+=e.substring(h),p}function r(e){if(!e||!angular.isString(e)||e.length<=0)return e;for(var t,n=/<([^>\/]+?)align=("([^"]+)"|'([^']+)')([^>]*)>/gi,r="",i=0;t=n.exec(e);){r+=e.substring(i,t.index),i=t.index+t[0].length;var o="<"+t[1]+t[5];/style=("([^"]+)"|'([^']+)')/gi.test(o)?o=o.replace(/style=("([^"]+)"|'([^']+)')/i,'style="$2$3 text-align:'+(t[3]||t[4])+';"'):o+=' style="text-align:'+(t[3]||t[4])+';"',o+=">",r+=o}return r+e.substring(i)}for(var i=[{property:"font-weight",values:["bold"],tag:"b"},{property:"font-style",values:["italic"],tag:"i"}],o=[],a=0;a0&&(s+="|"),s+=i[a].values[l];s+=");)",o.push(s)}var u="("+o.join("|")+")";return function(t,i,o){if(!o)try{t=n(t)}catch(e){}t=r(t);var a;try{a=e(t),o&&(a=t)}catch(e){a=i||""}var s,l=a.match(/(]*>.*?<\/pre[^>]*>)/gi),u=a.replace(/(&#(9|10);)*/gi,""),c=/]*>.*?<\/pre[^>]*>/gi,f=0,d=0;for(a="";null!==(s=c.exec(u))&&f=0;i--)r=angular.element("<"+n+">"+o[i].innerHTML+""),t.after(r);t.remove(),e.setSelectionToElementEnd(r[0])},a=function(t){/()$/i.test(t.innerHTML.trim())?e.setSelectionBeforeElement(angular.element(t).find("br")[0]):e.setSelectionToElementEnd(t)},s=function(e,t){var n=angular.element("<"+t+">"+e[0].innerHTML+"");e.after(n),e.remove(),a(n.find("li")[0])},l=function(e,n,r){for(var i="",o=0;o"+e[o].innerHTML+"";var s=angular.element("<"+r+">"+i+"");n.after(s),n.remove(),a(s.find("li")[0])};return function(a,u){return a=t(a),function(c,f,d,p){var h,m,g,v,y,b,$,w=angular.element("<"+a+">");try{$=e.getSelectionElement()}catch(e){}var x=angular.element($);if(void 0!==$){var C=$.tagName.toLowerCase();if("insertorderedlist"===c.toLowerCase()||"insertunorderedlist"===c.toLowerCase()){var k=t("insertorderedlist"===c.toLowerCase()?"ol":"ul");if(C===k)return o(x,a);if("li"===C&&x.parent()[0].tagName.toLowerCase()===k&&1===x.parent().children().length)return o(x.parent(),a);if("li"===C&&x.parent()[0].tagName.toLowerCase()!==k&&1===x.parent().children().length)return s(x.parent(),k);if(C.match(n)&&!x.hasClass("ta-bind")){if("ol"===C||"ul"===C)return s(x,k);var E=!1;return angular.forEach(x.children(),function(e){e.tagName.match(n)&&(E=!0)}),E?l(x.children(),x,k):l([angular.element("
"+$.innerHTML+"
")[0]],x,k)}if(C.match(n)){if(v=e.getOnlySelectedElements(),0===v.length)m=angular.element("<"+k+">
  • "+$.innerHTML+"
  • "),x.html(""),x.append(m);else{if(1===v.length&&("ol"===v[0].tagName.toLowerCase()||"ul"===v[0].tagName.toLowerCase()))return v[0].tagName.toLowerCase()===k?o(angular.element(v[0]),a):s(angular.element(v[0]),k);g="";var S=[];for(h=0;h"+_[0].innerHTML+"":g+=_[0].childNodes[0].innerHTML,S.unshift(_)}m=angular.element("<"+k+">"+g+""),S.pop().replaceWith(m),angular.forEach(S,function(e){e.remove()})}return void e.setSelectionToElementEnd(m[0])}}else{if("formatblock"===c.toLowerCase()){for(b=d.toLowerCase().replace(/[<>]/gi,""),"default"===b.trim()&&(b=a,d="<"+a+">"),m="li"===C?x.parent():x;!m[0].tagName||!m[0].tagName.match(n)&&!m.parent().attr("contenteditable");)m=m.parent(),C=(m[0].tagName||"").toLowerCase();if(C===b){v=m.children();var M=!1;for(h=0;h=0;h--)v[h].parentNode&&v[h].parentNode.removeChild(v[h])}else for(h=0;h"),w[0].innerHTML=D[h].outerHTML,D[h]=w[0]),T.parent()[0].insertBefore(D[h],T[0]);T.remove()}return void e.setSelectionToElementEnd(m[0])}if("createlink"===c.toLowerCase()){var A='';if(e.getSelection().collapsed)e.insertHtml(A+d+"",u);else if(rangy.getSelection().getRangeAt(0).canSurroundContents()){var O=angular.element(A+"")[0];rangy.getSelection().getRangeAt(0).surroundContents(O)}return}if("inserthtml"===c.toLowerCase())return void e.insertHtml(d,u)}}try{i[0].execCommand(c,f,d)}catch(e){}}}}]).service("taSelection",["$window","$document","taDOM",function(e,t,r){var o=t[0],a=e.rangy,s=function(e,t){return e.tagName&&e.tagName.match(/^br$/i)&&0===t&&!e.previousSibling?{element:e.parentNode,offset:0}:{element:e,offset:t}},l={getSelection:function(){var e=a.getSelection().getRangeAt(0),t=e.commonAncestorContainer,n={start:s(e.startContainer,e.startOffset),end:s(e.endContainer,e.endOffset),collapsed:e.collapsed};return t=3===t.nodeType?t.parentNode:t,t.parentNode===n.start.element||t.parentNode===n.end.element?n.container=t.parentNode:n.container=t,n},getOnlySelectedElements:function(){var e=a.getSelection().getRangeAt(0),t=e.commonAncestorContainer;return t=3===t.nodeType?t.parentNode:t,e.getNodes([1],function(e){return e.parentNode===t})},getSelectionElement:function(){return l.getSelection().container},setSelection:function(e,t,n){var r=a.createRange();r.setStart(e,t),r.setEnd(e,n),a.getSelection().setSingleRange(r)},setSelectionBeforeElement:function(e){var t=a.createRange();t.selectNode(e),t.collapse(!0),a.getSelection().setSingleRange(t)},setSelectionAfterElement:function(e){var t=a.createRange();t.selectNode(e),t.collapse(!1),a.getSelection().setSingleRange(t)},setSelectionToElementStart:function(e){var t=a.createRange();t.selectNodeContents(e),t.collapse(!0),a.getSelection().setSingleRange(t)},setSelectionToElementEnd:function(e){var t=a.createRange();t.selectNodeContents(e),t.collapse(!1),e.childNodes&&e.childNodes[e.childNodes.length-1]&&"br"===e.childNodes[e.childNodes.length-1].nodeName&&(t.startOffset=t.endOffset=t.startOffset-1),a.getSelection().setSingleRange(t)},insertHtml:function(e,t){var s,u,c,f,d,p,h,m=angular.element("
    "+e+"
    "),g=a.getSelection().getRangeAt(0),v=o.createDocumentFragment(),y=m[0].childNodes,b=!0;if(y.length>0){for(f=[],c=0;c)$/i.test(g.startContainer.innerHTML)&&g.selectNode(g.startContainer)}else b=!0,p=v=o.createTextNode(e);if(b)g.deleteContents();else if(g.collapsed&&g.startContainer!==t)if(g.startContainer.innerHTML&&g.startContainer.innerHTML.match(/^<[^>]*>$/i))s=g.startContainer,1===g.startOffset?(g.setStartAfter(s),g.setEndAfter(s)):(g.setStartBefore(s),g.setEndBefore(s));else{if(3===g.startContainer.nodeType&&g.startContainer.parentNode!==t)for(s=g.startContainer.parentNode,u=s.cloneNode(),r.splitNodes(s.childNodes,s,u,g.startContainer,g.startOffset);!i.test(s.nodeName);){angular.element(s).after(u),s=s.parentNode;var w=u;u=s.cloneNode(),r.splitNodes(s.childNodes,s,u,w)}else s=g.startContainer,u=s.cloneNode(),r.splitNodes(s.childNodes,s,u,void 0,void 0,g.startOffset);if(angular.element(s).after(u),g.setStartAfter(s),g.setEndAfter(s),/^(|)$/i.test(s.innerHTML.trim())&&(g.setStartBefore(s),g.setEndBefore(s),angular.element(s).remove()),/^(|)$/i.test(u.innerHTML.trim())&&angular.element(u).remove(),"li"===s.nodeName.toLowerCase()){for(h=o.createDocumentFragment(),d=0;d"),r.transferChildNodes(v.childNodes[d],m[0]),r.transferNodeAttributes(v.childNodes[d],m[0]),h.appendChild(m[0]);v=h,p&&(p=v.childNodes[v.childNodes.length-1],p=p.childNodes[p.childNodes.length-1])}}else g.deleteContents();g.insertNode(v),p&&l.setSelectionToElementEnd(p)}};return l}]).service("taDOM",function(){var e={getByAttribute:function(t,n){var r=[],i=t.children();return i.length&&angular.forEach(i,function(t){r=r.concat(e.getByAttribute(angular.element(t),n))}),void 0!==t.attr(n)&&r.push(t),r},transferChildNodes:function(e,t){for(t.innerHTML="";e.childNodes.length>0;)t.appendChild(e.childNodes[0]);return t},splitNodes:function(t,n,r,i,o,a){if(!i&&isNaN(a))throw new Error("taDOM.splitNodes requires a splitNode or splitIndex");for(var s=document.createDocumentFragment(),l=document.createDocumentFragment(),u=0;t.length>0&&(isNaN(a)||a!==u)&&t[0]!==i;)s.appendChild(t[0]),u++;for(!isNaN(o)&&o>=0&&t[0]&&(s.appendChild(document.createTextNode(t[0].nodeValue.substring(0,o))),t[0].nodeValue=t[0].nodeValue.substring(o));t.length>0;)l.appendChild(t[0]);e.transferChildNodes(s,n),e.transferChildNodes(l,r)},transferNodeAttributes:function(e,t){for(var n=0;n");return t.html(e),t.text().length<=i}}}}).directive("taMinText",function(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){var i=parseInt(e.$eval(n.taMinText));if(isNaN(i))throw"Min text must be an integer";n.$observe("taMinText",function(e){if(i=parseInt(e),isNaN(i))throw"Min text must be an integer";r.$dirty&&r.$validate()}),r.$validators.taMinText=function(e){var t=angular.element("
    ");return t.html(e),!t.text().length||t.text().length>=i}}}}),angular.module("textAngular.taBind",["textAngular.factories","textAngular.DOM"]).service("_taBlankTest",[function(){var e=/<(a|abbr|acronym|bdi|bdo|big|cite|code|del|dfn|img|ins|kbd|label|map|mark|q|ruby|rp|rt|s|samp|time|tt|var)[^>]*(>|$)/i;return function(t){return function(n){if(!n)return!0;var r,i=/(^[^<]|>)[^<]/i.exec(n);return i?r=i.index:(n=n.toString().replace(/="[^"]*"/i,"").replace(/="[^"]*"/i,"").replace(/="[^"]*"/i,"").replace(/="[^"]*"/i,""),r=n.indexOf(">")),n=n.trim().substring(r,r+100),!/^[^<>]+$/i.test(n)&&(!(0!==n.length&&n!==t&&!/^>(\s| )*<\/[^>]+>$/gi.test(n))||!/>\s*[^\s<]/i.test(n)&&!e.test(n))}}}]).directive("taButton",[function(){return{link:function(e,t,n){t.attr("unselectable","on"),t.on("mousedown",function(e,t){return t&&angular.extend(e,t),e.preventDefault(),!1})}}}]).directive("taBind",["taSanitize","$timeout","$window","$document","taFixChrome","taBrowserTag","taSelection","taSelectableElements","taApplyCustomRenderers","taOptions","_taBlankTest","$parse","taDOM","textAngularManager",function(r,o,l,u,c,f,d,h,m,g,v,y,b,$){return{priority:2,require:["ngModel","?ngModelOptions"],link:function(f,w,x,C){function k(e){var t;return V.forEach(function(n){if(n.keyCode===e.keyCode){var r=(e.metaKey?U:0)+(e.ctrlKey?L:0)+(e.shiftKey?q:0)+(e.altKey?H:0);if(n.forbiddenModifiers&r)return;n.mustHaveModifiers.every(function(e){return r&e})&&(t=n.specialKey)}}),t}var E,S,_,M,T=C[0],D=C[1]||{},A=void 0!==w.attr("contenteditable")&&w.attr("contenteditable"),O=A||"textarea"===w[0].tagName.toLowerCase()||"input"===w[0].tagName.toLowerCase(),N=!1,R=!1,I=!1,P=x.taUnsafeSanitizer||g.disableSanitizer,F=/^(9|19|20|27|33|34|35|36|37|38|39|40|45|112|113|114|115|116|117|118|119|120|121|122|123|144|145)$/i,j=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,L=1,U=2,H=4,q=8,V=[{specialKey:"UndoKey",forbiddenModifiers:H+q,mustHaveModifiers:[U+L],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H,mustHaveModifiers:[U+L,q],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H+q,mustHaveModifiers:[U+L],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:U+q+H+L,mustHaveModifiers:[],keyCode:9},{specialKey:"ShiftTabKey",forbiddenModifiers:U+H+L,mustHaveModifiers:[q],keyCode:9}];void 0===x.taDefaultWrap&&(x.taDefaultWrap="p"),""===x.taDefaultWrap?(_="",M=void 0===e.ie?"

    ":e.ie>=11?"


    ":e.ie<=8?"

     

    ":"

     

    "):(_=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+">":"<"+x.taDefaultWrap+">",M=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+"> ":"<"+x.taDefaultWrap+"> "),D.$options||(D.$options={});var z=v(M),B=function(e){if(z(e))return e;var t=angular.element("
    "+e+"
    ");if(0===t.children().length)e="<"+x.taDefaultWrap+">"+e+"";else{var r,i=t[0].childNodes,o=!1;for(r=0;r"+l+"":e+=l}else if(s.match(n))e+=a.outerHTML;else{var u=a.outerHTML||a.nodeValue;""!==u.trim()?e+="<"+x.taDefaultWrap+">"+u+"":e+=u}}else e="<"+x.taDefaultWrap+">"+e+""}return e};x.taPaste&&(S=y(x.taPaste)),w.addClass("ta-bind");var Y;f["$undoManager"+(x.id||"")]=T.$undoManager={_stack:[],_index:0,_max:1e3,push:function(e){return void 0===e||null===e||void 0!==this.current()&&null!==this.current()&&e===this.current()?e:(this._indexthis._max&&this._stack.shift(),this._index=this._stack.length-1,e)},undo:function(){return this.setToIndex(this._index-1)},redo:function(){return this.setToIndex(this._index+1)},setToIndex:function(e){if(!(e<0||e>this._stack.length-1))return this._index=e,this.current()},current:function(){return this._stack[this._index]}};var W,G=f["$undoTaBind"+(x.id||"")]=function(){if(!N&&A){var e=T.$undoManager.undo();void 0!==e&&null!==e&&(ce(e),J(e,!1),W&&o.cancel(W),W=o(function(){w[0].focus(),d.setSelectionToElementEnd(w[0])},1))}},K=f["$redoTaBind"+(x.id||"")]=function(){if(!N&&A){var e=T.$undoManager.redo();void 0!==e&&null!==e&&(ce(e),J(e,!1),W&&o.cancel(W),W=o(function(){w[0].focus(),d.setSelectionToElementEnd(w[0])},1))}},Z=function(){if(A)return w[0].innerHTML;if(O)return w.val();throw"textAngular Error: attempting to update non-editable taBind"},J=function(e,t,n){I=n||!1,void 0!==t&&null!==t||(t=A),void 0!==e&&null!==e||(e=Z()),z(e)?(""!==T.$viewValue&&T.$setViewValue(""),t&&""!==T.$undoManager.current()&&T.$undoManager.push("")):(ue(),T.$viewValue!==e&&(T.$setViewValue(e),t&&T.$undoManager.push(e))),T.$render()};f["updateTaBind"+(x.id||"")]=function(){N||J(void 0,void 0,!0)};var Q=function(e){return T.$oldViewValue=r(c(e),T.$oldViewValue,P)};if(w.attr("required")&&(T.$validators.required=function(e,t){return!z(e||t)}),T.$parsers.push(Q),T.$parsers.unshift(B),T.$formatters.push(Q),T.$formatters.unshift(B),T.$formatters.unshift(function(e){return T.$undoManager.push(e||"")}),O)if(f.events={},A){var X=!1,ee=function(e){if(e&&e.trim().length){if(e.match(/class=["']*Mso(Normal|List)/i)||e.match(/content=["']*Word.Document/i)){var t=e.match(/([\s\S]*?)/i);t=t?t[1]:e,t=t.replace(/[\s\S]*?<\/o:p>/gi,"").replace(/class=(["']|)MsoNormal(["']|)/gi,"");var n=angular.element("
    "+t+"
    "),i=angular.element("
    "),a={element:null,lastIndent:[],lastLi:null,isUl:!1};a.lastIndent.peek=function(){var e=this.length;if(e>0)return this[e-1]};for(var s=function(e){a.isUl=e,a.element=angular.element(e?"
      ":"
        "),a.lastIndent=[],a.lastIndent.peek=function(){var e=this.length;if(e>0)return this[e-1]},a.lastLevelMatch=null},l=0;l<=n[0].childNodes.length;l++)if(n[0].childNodes[l]&&"#text"!==n[0].childNodes[l].nodeName){var u=n[0].childNodes[l].tagName.toLowerCase();if("p"===u||"h1"===u||"h2"===u||"h3"===u||"h4"===u||"h5"===u||"h6"===u){var c=angular.element(n[0].childNodes[l]),p=(c.attr("class")||"").match(/MsoList(Bullet|Number|Paragraph)(CxSp(First|Middle|Last)|)/i);if(p){if(c[0].childNodes.length<2||c[0].childNodes[1].childNodes.length<1)continue;var h="bullet"===p[1].toLowerCase()||"number"!==p[1].toLowerCase()&&!(/^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]]":"
          "),a.lastLi.append(a.element);else if(null!=a.lastIndent.peek()&&a.lastIndent.peek()>g){for(;null!=a.lastIndent.peek()&&a.lastIndent.peek()>g;)if("li"!==a.element.parent()[0].tagName.toLowerCase()){if(!/[uo]l/i.test(a.element.parent()[0].tagName.toLowerCase()))break;a.element=a.element.parent(),a.lastIndent.pop()}else a.element=a.element.parent();a.isUl="ul"===a.element[0].tagName.toLowerCase(),h!==a.isUl&&(s(h),i.append(a.element))}a.lastLevelMatch=v,g!==a.lastIndent.peek()&&a.lastIndent.push(g),a.lastLi=angular.element("
        1. "),a.element.append(a.lastLi),a.lastLi.html(c.html().replace(/[\s\S]*?/gi,"")),c.remove()}else s(!1),i.append(c)}}var y=function(e){e=angular.element(e);for(var t=e[0].childNodes.length-1;t>=0;t--)e.after(e[0].childNodes[t]);e.remove()};angular.forEach(i.find("span"),function(e){e.removeAttribute("lang"),e.attributes.length<=0&&y(e)}),angular.forEach(i.find("font"),y),e=i.html()}else{if(e=e.replace(/<(|\/)meta[^>]*?>/gi,""),e.match(/<[^>]*?(ta-bind)[^>]*?>/)){if(e.match(/<[^>]*?(text-angular)[^>]*?>/)){var $=angular.element("
          "+e+"
          ");$.find("textarea").remove();for(var x=b.getByAttribute($,"ta-bind"),C=0;C',"")}}else e.match(/^.<\/span>/gi)||(e=e.replace(/<(|\/)span[^>]*?>/gi,"")));e=e.replace(/
          ]*?>/gi,"").replace(/( | )<\/span>/gi," ")}//i.test(e)&&!1===/(|).*/i.test(e)&&(e=e.replace(/.*<\/li(\s.*)?>/i,"
            $&
          ")),e=e.replace(/^[ |\u00A0]+/gm,function(e){for(var t="",n=0;n").replace(/\t/g,"    "),S&&(e=S(f,{$html:e})||e),e=r(e,"",P),d.insertHtml(e,w[0]),o(function(){T.$setViewValue(Z()),X=!1,w.removeClass("processing-paste")},0)}else X=!1,w.removeClass("processing-paste")};w.on("paste",f.events.paste=function(e,t){if(t&&angular.extend(e,t),N||X)return e.stopPropagation(),e.preventDefault(),!1;X=!0,w.addClass("processing-paste");var n,r=(e.originalEvent||e).clipboardData;if(r&&r.getData&&r.types.length>0){for(var i="",a=0;a
    ');u.find("body").append(c),c[0].focus(),o(function(){l.rangy.restoreSelection(s),ee(c[0].innerHTML),w[0].focus(),c.remove()},0)}),w.on("cut",f.events.cut=function(e){N?e.preventDefault():o(function(){T.$setViewValue(Z())},0)}),w.on("keydown",f.events.keydown=function(e,t){t&&angular.extend(e,t),e.specialKey=k(e);var n;if(g.keyMappings.forEach(function(t){e.specialKey===t.commandKeyCode&&(e.specialKey=void 0),t.testForKey(e)&&(n=t.commandKeyCode),"UndoKey"!==t.commandKeyCode&&"RedoKey"!==t.commandKeyCode||t.enablePropagation||e.preventDefault()}),void 0!==n&&(e.specialKey=n),void 0===e.specialKey||"UndoKey"===e.specialKey&&"RedoKey"===e.specialKey||(e.preventDefault(),$.sendKeyCommand(f,e)),!N&&("UndoKey"===e.specialKey&&(G(),e.preventDefault()),"RedoKey"===e.specialKey&&(K(),e.preventDefault()),13===e.keyCode&&!e.shiftKey)){var r,o=d.getSelectionElement();if(!o.tagName.match(i))return;var a=angular.element(_),s=["blockquote","ul","ol"];if(function(e,t){for(var n=0;n$/i.test(o.innerHTML.trim())&&!o.nextSibling){r=angular.element(o);var l=r.parent();l.after(a),r.remove(),0===l.children().length&&l.remove(),d.setSelectionToElementStart(a[0]),e.preventDefault()}/^<[^>]+><\/[^>]+>$/i.test(o.innerHTML.trim())&&(r=angular.element(o),r.after(a),r.remove(),d.setSelectionToElementStart(a[0]),e.preventDefault())}}});var te;if(w.on("keyup",f.events.keyup=function(e,t){if(t&&angular.extend(e,t),9===e.keyCode){return void(d.getSelection().start.element===w[0]&&w.children().length&&d.setSelectionToElementStart(w.children()[0]))}if(Y&&o.cancel(Y),!N&&!F.test(e.keyCode)){if(""!==_&&13===e.keyCode&&!e.shiftKey){for(var n=d.getSelectionElement();!n.tagName.match(i)&&n!==w[0];)n=n.parentNode;if(n.tagName.toLowerCase()!==x.taDefaultWrap&&"li"!==n.tagName.toLowerCase()&&(""===n.innerHTML.trim()||"
    "===n.innerHTML.trim())){var r=angular.element(_);angular.element(n).replaceWith(r),d.setSelectionToElementStart(r[0])}}var a=Z();""!==_&&""===a.trim()?(ce(_),d.setSelectionToElementStart(w.children()[0])):"<"!==a.substring(0,1)&&x.taDefaultWrap;var s=E!==e.keyCode&&j.test(e.keyCode);te&&o.cancel(te),te=o(function(){J(a,s,!0)},D.$options.debounce||400),s||(Y=o(function(){T.$undoManager.push(a)},250)),E=e.keyCode}}),w.on("blur",f.events.blur=function(){R=!1,N?(I=!0,T.$render()):J(void 0,void 0,!0)}),x.placeholder&&(e.ie>8||void 0===e.ie)){var ne;if(!x.id)throw"textAngular Error: An unique ID is required for placeholders to work";ne=a("#"+x.id+".placeholder-text:before",'content: "'+x.placeholder+'"'),f.$on("$destroy",function(){s(ne)})}w.on("focus",f.events.focus=function(){R=!0,w.removeClass("placeholder-text"),ue()}),w.on("mouseup",f.events.mouseup=function(){d.getSelection().start.element===w[0]&&w.children().length&&d.setSelectionToElementStart(w.children()[0])}),w.on("mousedown",f.events.mousedown=function(e,t){t&&angular.extend(e,t),e.stopPropagation()})}else{w.on("change blur",f.events.change=f.events.blur=function(){N||T.$setViewValue(Z())}),w.on("keydown",f.events.keydown=function(e,t){if(t&&angular.extend(e,t),9===e.keyCode){var n=this.selectionStart,r=this.selectionEnd,i=w.val();if(e.shiftKey){var o=i.lastIndexOf("\n",n),a=i.lastIndexOf("\t",n);-1!==a&&a>=o&&(w.val(i.substring(0,a)+i.substring(a+1)),this.selectionStart=this.selectionEnd=n-1)}else w.val(i.substring(0,n)+"\t"+i.substring(r)),this.selectionStart=this.selectionEnd=n+1;e.preventDefault()}});var re=function(e,t){for(var n="",r=0;r"+e+"
    ")[0].childNodes;return t.length>0&&(e="",ie(t,function(t,n){var r=n.nodeName.toLowerCase();return"#comment"===r?void(e+="\x3c!--"+n.nodeValue+"--\x3e"):"#text"===r?void(e+=n.textContent):void(n.outerHTML&&(e.length>0&&(e+="\n"),e+="ul"===r||"ol"===r?""+oe(n,0):""+n.outerHTML))})),e})}var ae,se=function(e){return f.$emit("ta-element-select",this),e.preventDefault(),!1},le=function(e,t){if(t&&angular.extend(e,t),!p&&!N){p=!0;var n;n=e.originalEvent?e.originalEvent.dataTransfer:e.dataTransfer,f.$emit("ta-drop-event",this,e,n),o(function(){p=!1,J(void 0,void 0,!0)},100)}},ue=f["reApplyOnSelectorHandlers"+(x.id||"")]=function(){N||angular.forEach(h,function(e){w.find(e).off("click",se).on("click",se)})},ce=function(e){w[0].innerHTML=e},fe=!1;T.$render=function(){if(!fe){fe=!0;var e=T.$viewValue||"";I||(A&&R&&(w.removeClass("placeholder-text"),ae&&o.cancel(ae),ae=o(function(){R||(w[0].focus(),d.setSelectionToElementEnd(w.children()[w.children().length-1])),ae=void 0},1)),A?(ce(x.placeholder?""===e?_:e:""===e?_:e),N?w.off("drop",le):(ue(),w.on("drop",le))):"textarea"!==w[0].tagName.toLowerCase()&&"input"!==w[0].tagName.toLowerCase()?ce(m(e)):w.val(e)),A&&x.placeholder&&(""===e?R?w.removeClass("placeholder-text"):w.addClass("placeholder-text"):w.removeClass("placeholder-text")),fe=I=!1}},x.taReadonly&&(N=f.$eval(x.taReadonly),N?(w.addClass("ta-readonly"),"textarea"!==w[0].tagName.toLowerCase()&&"input"!==w[0].tagName.toLowerCase()||w.attr("disabled","disabled"),void 0!==w.attr("contenteditable")&&w.attr("contenteditable")&&w.removeAttr("contenteditable")):(w.removeClass("ta-readonly"),"textarea"===w[0].tagName.toLowerCase()||"input"===w[0].tagName.toLowerCase()?w.removeAttr("disabled"):A&&w.attr("contenteditable","true")),f.$watch(x.taReadonly,function(e,t){t!==e&&(e?(w.addClass("ta-readonly"),"textarea"!==w[0].tagName.toLowerCase()&&"input"!==w[0].tagName.toLowerCase()||w.attr("disabled","disabled"),void 0!==w.attr("contenteditable")&&w.attr("contenteditable")&&w.removeAttr("contenteditable"),angular.forEach(h,function(e){w.find(e).on("click",se)}),w.off("drop",le)):(w.removeClass("ta-readonly"),"textarea"===w[0].tagName.toLowerCase()||"input"===w[0].tagName.toLowerCase()?w.removeAttr("disabled"):A&&w.attr("contenteditable","true"),angular.forEach(h,function(e){w.find(e).off("click",se)}),w.on("drop",le)),N=e)})),A&&!N&&(angular.forEach(h,function(e){w.find(e).on("click",se)}),w.on("drop",le),w.on("blur",function(){e.webkit&&(t=!0)}))}}}]);var p=!1,h=angular.module("textAngular",["ngSanitize","textAngularSetup","textAngular.factories","textAngular.DOM","textAngular.validators","textAngular.taBind"]);h.config([function(){angular.forEach(taTools,function(e,t){delete taTools[t]})}]),h.run([function(){if(!window.rangy)throw"rangy-core.js and rangy-selectionsaverestore.js are required for textAngular to work correctly, rangy-core is not yet loaded.";if(window.rangy.init(),!window.rangy.saveSelection)throw"rangy-selectionsaverestore.js is required for textAngular to work correctly."}]),h.directive("textAngular",["$compile","$timeout","taOptions","taSelection","taExecCommand","textAngularManager","$window","$document","$animate","$log","$q","$parse",function(e,t,n,r,i,o,a,s,l,u,c,f){return{require:"?ngModel",scope:{},restrict:"EA",priority:2,link:function(d,p,h,m){var g,v,y,b,$,w,x,C,k,E,S,_=h.serial?h.serial:Math.floor(1e16*Math.random());d._name=h.name?h.name:"textAngularEditor"+_;var M=function(e,n,r){t(function(){var t=function(){e.off(n,t),r.apply(this,arguments)};e.on(n,t)},100)};if(k=i(h.taDefaultWrap),angular.extend(d,angular.copy(n),{wrapSelection:function(e,t,n){"undo"===e.toLowerCase()?d["$undoTaBindtaTextElement"+_]():"redo"===e.toLowerCase()?d["$redoTaBindtaTextElement"+_]():(k(e,!1,t,d.defaultTagAttributes),n&&d["reApplyOnSelectorHandlerstaTextElement"+_](),d.displayElements.text[0].focus())},showHtml:d.$eval(h.taShowHtml)||!1}),h.taFocussedClass&&(d.classes.focussed=h.taFocussedClass),h.taTextEditorClass&&(d.classes.textEditor=h.taTextEditorClass),h.taHtmlEditorClass&&(d.classes.htmlEditor=h.taHtmlEditorClass),h.taDefaultTagAttributes)try{angular.extend(d.defaultTagAttributes,angular.fromJson(h.taDefaultTagAttributes))}catch(e){u.error(e)}h.taTextEditorSetup&&(d.setup.textEditorSetup=d.$parent.$eval(h.taTextEditorSetup)),h.taHtmlEditorSetup&&(d.setup.htmlEditorSetup=d.$parent.$eval(h.taHtmlEditorSetup)),h.taFileDrop?d.fileDropHandler=d.$parent.$eval(h.taFileDrop):d.fileDropHandler=d.defaultFileDropHandler,x=p[0].innerHTML,p[0].innerHTML="",d.displayElements={forminput:angular.element(""),html:angular.element(""),text:angular.element("
    "),scrollWindow:angular.element("
    "),popover:angular.element('
    '),popoverArrow:angular.element('
    '),popoverContainer:angular.element('
    '),resize:{overlay:angular.element('
    '),background:angular.element('
    '),anchors:[angular.element('
    '),angular.element('
    '),angular.element('
    '),angular.element('
    ')],info:angular.element('
    ')}},d.displayElements.popover.append(d.displayElements.popoverArrow),d.displayElements.popover.append(d.displayElements.popoverContainer),d.displayElements.scrollWindow.append(d.displayElements.popover),d.displayElements.popover.on("mousedown",function(e,t){return t&&angular.extend(e,t),e.preventDefault(),!1}),d.showPopover=function(e){d.displayElements.popover.css("display","block"),d.reflowPopover(e),l.addClass(d.displayElements.popover,"in"),M(s.find("body"),"click keyup",function(){d.hidePopover()})},d.reflowPopover=function(e){d.displayElements.text[0].offsetHeight-51>e[0].offsetTop?(d.displayElements.popover.css("top",e[0].offsetTop+e[0].offsetHeight+d.displayElements.scrollWindow[0].scrollTop+"px"),d.displayElements.popover.removeClass("top").addClass("bottom")):(d.displayElements.popover.css("top",e[0].offsetTop-54+d.displayElements.scrollWindow[0].scrollTop+"px"),d.displayElements.popover.removeClass("bottom").addClass("top"));var t=d.displayElements.text[0].offsetWidth-d.displayElements.popover[0].offsetWidth,n=e[0].offsetLeft+e[0].offsetWidth/2-d.displayElements.popover[0].offsetWidth/2;d.displayElements.popover.css("left",Math.max(0,Math.min(t,n))+"px"),d.displayElements.popoverArrow.css("margin-left",Math.min(n,Math.max(0,n-t))-11+"px")},d.hidePopover=function(){d.displayElements.popover.css("display",""),d.displayElements.popoverContainer.attr("style",""),d.displayElements.popoverContainer.attr("class","popover-content"),d.displayElements.popover.removeClass("in")},d.displayElements.resize.overlay.append(d.displayElements.resize.background),angular.forEach(d.displayElements.resize.anchors,function(e){d.displayElements.resize.overlay.append(e)}),d.displayElements.resize.overlay.append(d.displayElements.resize.info),d.displayElements.scrollWindow.append(d.displayElements.resize.overlay),d.reflowResizeOverlay=function(e){e=angular.element(e)[0],d.displayElements.resize.overlay.css({display:"block",left:e.offsetLeft-5+"px",top:e.offsetTop-5+"px",width:e.offsetWidth+10+"px",height:e.offsetHeight+10+"px"}),d.displayElements.resize.info.text(e.offsetWidth+" x "+e.offsetHeight)},d.showResizeOverlay=function(e){var t=s.find("body");E=function(n){var r={width:parseInt(e.attr("width")),height:parseInt(e.attr("height")),x:n.clientX,y:n.clientY};(void 0===r.width||isNaN(r.width))&&(r.width=e[0].offsetWidth),(void 0===r.height||isNaN(r.height))&&(r.height=e[0].offsetHeight),d.hidePopover();var i=r.height/r.width,o=function(t){function n(e){return Math.round(Math.max(0,e))}var o={x:Math.max(0,r.width+(t.clientX-r.x)),y:Math.max(0,r.height+(t.clientY-r.y))},a=void 0!==h.taResizeForceAspectRatio,s=h.taResizeMaintainAspectRatio;if(a||s&&!t.shiftKey){var l=o.y/o.x;o.x=i>l?o.x:o.y/i,o.y=i>l?o.x*i:o.y}var u=angular.element(e);u.css("height",n(o.y)+"px"),u.css("width",n(o.x)+"px"),d.reflowResizeOverlay(e)};t.on("mousemove",o),M(t,"mouseup",function(e){e.preventDefault(),e.stopPropagation(),t.off("mousemove",o),d.$apply(function(){d.hidePopover(),d.updateTaBindtaTextElement()},100)}),n.stopPropagation(),n.preventDefault()},d.displayElements.resize.anchors[3].off("mousedown"),d.displayElements.resize.anchors[3].on("mousedown",E),d.reflowResizeOverlay(e),M(t,"click",function(){d.hideResizeOverlay()})},d.hideResizeOverlay=function(){d.displayElements.resize.anchors[3].off("mousedown",E),d.displayElements.resize.overlay.css("display","")},d.setup.htmlEditorSetup(d.displayElements.html),d.setup.textEditorSetup(d.displayElements.text),d.displayElements.html.attr({id:"taHtmlElement"+_,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":p.attr("ng-model-options")}),d.displayElements.text.attr({id:"taTextElement"+_,contentEditable:"true","ta-bind":"ta-bind","ng-model":"html","ng-model-options":p.attr("ng-model-options")}),d.displayElements.scrollWindow.attr({"ng-hide":"showHtml"}),h.taDefaultWrap&&d.displayElements.text.attr("ta-default-wrap",h.taDefaultWrap),h.taUnsafeSanitizer&&(d.displayElements.text.attr("ta-unsafe-sanitizer",h.taUnsafeSanitizer),d.displayElements.html.attr("ta-unsafe-sanitizer",h.taUnsafeSanitizer)),d.displayElements.scrollWindow.append(d.displayElements.text),p.append(d.displayElements.scrollWindow),p.append(d.displayElements.html),d.displayElements.forminput.attr("name",d._name),p.append(d.displayElements.forminput),h.tabindex&&(p.removeAttr("tabindex"),d.displayElements.text.attr("tabindex",h.tabindex),d.displayElements.html.attr("tabindex",h.tabindex)),h.placeholder&&(d.displayElements.text.attr("placeholder",h.placeholder),d.displayElements.html.attr("placeholder",h.placeholder)),h.taDisabled&&(d.displayElements.text.attr("ta-readonly","disabled"),d.displayElements.html.attr("ta-readonly","disabled"),d.disabled=d.$parent.$eval(h.taDisabled),d.$parent.$watch(h.taDisabled,function(e){d.disabled=e,d.disabled?p.addClass(d.classes.disabled):p.removeClass(d.classes.disabled)})),h.taPaste&&(d._pasteHandler=function(e){return f(h.taPaste)(d.$parent,{$html:e})},d.displayElements.text.attr("ta-paste","_pasteHandler($html)")),e(d.displayElements.scrollWindow)(d),e(d.displayElements.html)(d),d.updateTaBindtaTextElement=d["updateTaBindtaTextElement"+_],d.updateTaBindtaHtmlElement=d["updateTaBindtaHtmlElement"+_],p.addClass("ta-root"),d.displayElements.scrollWindow.addClass("ta-text ta-editor "+d.classes.textEditor),d.displayElements.html.addClass("ta-html ta-editor "+d.classes.htmlEditor),d._actionRunning=!1;var T=!1;if(d.startAction=function(){return d._actionRunning=!0,T=a.rangy.saveSelection(),function(){T&&a.rangy.restoreSelection(T)}},d.endAction=function(){d._actionRunning=!1,T&&(d.showHtml?d.displayElements.html[0].focus():d.displayElements.text[0].focus(),a.rangy.removeMarkers(T)),T=!1,d.updateSelectedStyles(),d.showHtml||d["updateTaBindtaTextElement"+_]()},$=function(){d.focussed=!0,p.addClass(d.classes.focussed),C.focus(),p.triggerHandler("focus")},d.displayElements.html.on("focus",$),d.displayElements.text.on("focus",$),w=function(e){return d._actionRunning||s[0].activeElement===d.displayElements.html[0]||s[0].activeElement===d.displayElements.text[0]||(p.removeClass(d.classes.focussed),C.unfocus(),t(function(){d._bUpdateSelectedStyles=!1,p.triggerHandler("blur"),d.focussed=!1},0)),e.preventDefault(),!1},d.displayElements.html.on("blur",w),d.displayElements.text.on("blur",w),d.displayElements.text.on("paste",function(e){p.triggerHandler("paste",e)}),d.queryFormatBlockState=function(e){return!d.showHtml&&e.toLowerCase()===s[0].queryCommandValue("formatBlock").toLowerCase()},d.queryCommandState=function(e){return d.showHtml?"":s[0].queryCommandState(e)},d.switchView=function(){d.showHtml=!d.showHtml,l.enabled(!1,d.displayElements.html),l.enabled(!1,d.displayElements.text),d.showHtml?t(function(){return l.enabled(!0,d.displayElements.html),l.enabled(!0,d.displayElements.text),d.displayElements.html[0].focus()},100):t(function(){return l.enabled(!0,d.displayElements.html),l.enabled(!0,d.displayElements.text),d.displayElements.text[0].focus()},100)},h.ngModel){var D=!0;m.$render=function(){if(D){D=!1;var e=d.$parent.$eval(h.ngModel);void 0!==e&&null!==e||!x||""===x||m.$setViewValue(x)}d.displayElements.forminput.val(m.$viewValue),d.html=m.$viewValue||""},p.attr("required")&&(m.$validators.required=function(e,t){var n=e||t;return!(!n||""===n.trim())})}else d.displayElements.forminput.val(x),d.html=x;if(d.$watch("html",function(e,t){e!==t&&(h.ngModel&&m.$viewValue!==e&&m.$setViewValue(e),d.displayElements.forminput.val(e))}),h.taTargetToolbars)C=o.registerEditor(d._name,d,h.taTargetToolbars.split(","));else{var A=angular.element('
    ');h.taToolbar&&A.attr("ta-toolbar",h.taToolbar),h.taToolbarClass&&A.attr("ta-toolbar-class",h.taToolbarClass),h.taToolbarGroupClass&&A.attr("ta-toolbar-group-class",h.taToolbarGroupClass),h.taToolbarButtonClass&&A.attr("ta-toolbar-button-class",h.taToolbarButtonClass),h.taToolbarActiveButtonClass&&A.attr("ta-toolbar-active-button-class",h.taToolbarActiveButtonClass),h.taFocussedClass&&A.attr("ta-focussed-class",h.taFocussedClass),p.prepend(A),e(A)(d.$parent),C=o.registerEditor(d._name,d,["textAngularToolbar"+_])}d.$on("$destroy",function(){o.unregisterEditor(d._name),angular.element(window).off("blur")}),d.$on("ta-element-select",function(e,t){C.triggerElementSelect(e,t)&&d["reApplyOnSelectorHandlerstaTextElement"+_]()}),d.$on("ta-drop-event",function(e,n,r,i){d.displayElements.text[0].focus(),i&&i.files&&i.files.length>0?(angular.forEach(i.files,function(e){try{c.when(d.fileDropHandler(e,d.wrapSelection)||d.fileDropHandler!==d.defaultFileDropHandler&&c.when(d.defaultFileDropHandler(e,d.wrapSelection))).then(function(){d["updateTaBindtaTextElement"+_]()})}catch(e){u.error(e)}}),r.preventDefault(),r.stopPropagation()):t(function(){d["updateTaBindtaTextElement"+_]()},0)}),d._bUpdateSelectedStyles=!1,angular.element(window).on("blur",function(){d._bUpdateSelectedStyles=!1,d.focussed=!1}),d.updateSelectedStyles=function(){var e;S&&t.cancel(S),void 0!==(e=r.getSelectionElement())&&e.parentNode!==d.displayElements.text[0]?C.updateSelectedStyles(angular.element(e)):C.updateSelectedStyles(),d._bUpdateSelectedStyles&&(S=t(d.updateSelectedStyles,200))},g=function(){if(!d.focussed)return void(d._bUpdateSelectedStyles=!1);d._bUpdateSelectedStyles||(d._bUpdateSelectedStyles=!0,d.$apply(function(){d.updateSelectedStyles()}))},d.displayElements.html.on("keydown",g),d.displayElements.text.on("keydown",g),v=function(){d._bUpdateSelectedStyles=!1},d.displayElements.html.on("keyup",v),d.displayElements.text.on("keyup",v),y=function(e,t){t&&angular.extend(e,t),d.$apply(function(){if(C.sendKeyCommand(e))return d._bUpdateSelectedStyles||d.updateSelectedStyles(),e.preventDefault(),!1})},d.displayElements.html.on("keypress",y),d.displayElements.text.on("keypress",y),b=function(){d._bUpdateSelectedStyles=!1,d.$apply(function(){d.updateSelectedStyles()})},d.displayElements.html.on("mouseup",b),d.displayElements.text.on("mouseup",b)}}}]),h.service("textAngularManager",["taToolExecuteAction","taTools","taRegisterTool",function(e,t,n){var r={},i={};return{registerEditor:function(n,o,a){if(!n||""===n)throw"textAngular Error: An editor requires a name";if(!o)throw"textAngular Error: An editor requires a scope";if(i[n])throw'textAngular Error: An Editor with name "'+n+'" already exists';var s=[];return angular.forEach(a,function(e){r[e]&&s.push(r[e])}),i[n]={scope:o,toolbars:a,_registerToolbar:function(e){this.toolbars.indexOf(e.name)>=0&&s.push(e)},editorFunctions:{disable:function(){angular.forEach(s,function(e){e.disabled=!0})},enable:function(){angular.forEach(s,function(e){e.disabled=!1})},focus:function(){angular.forEach(s,function(e){e._parent=o,e.disabled=!1,e.focussed=!0,o.focussed=!0})},unfocus:function(){angular.forEach(s,function(e){e.disabled=!0,e.focussed=!1}),o.focussed=!1},updateSelectedStyles:function(e){angular.forEach(s,function(t){angular.forEach(t.tools,function(n){n.activeState&&(t._parent=o,n.active=n.activeState(e))})})},sendKeyCommand:function(n){var r=!1;return(n.ctrlKey||n.metaKey||n.specialKey)&&angular.forEach(t,function(t,i){if(t.commandKeyCode&&(t.commandKeyCode===n.which||t.commandKeyCode===n.specialKey))for(var a=0;a0)for(var c=0;c"),t&&t.class?r.addClass(t.class):r.addClass(a.classes.toolbarButton),r.attr("name",n.name),r.attr("ta-button","ta-button"),r.attr("ng-disabled","isDisabled()"),r.attr("tabindex","-1"),r.attr("ng-click","executeAction()"),r.attr("ng-class","displayActiveToolClass(active)"),t&&t.tooltiptext&&r.attr("title",t.tooltiptext),t&&!t.display&&!n._display&&(r[0].innerHTML="",t.buttontext&&(r[0].innerHTML=t.buttontext),t.iconclass)){var i=angular.element(""),o=r[0].innerHTML;i.addClass(t.iconclass),r[0].innerHTML="",r.append(i),o&&""!==o&&r.append(" "+o)}return n._lastToolDefinition=angular.copy(t),e(r)(n)};a.tools={},a._parent={disabled:!0,showHtml:!1,queryFormatBlockState:function(){return!1},queryCommandState:function(){return!1}};var c={$window:o,$editor:function(){return a._parent},isDisabled:function(){return"function"!=typeof this.$eval("disabled")&&this.$eval("disabled")||this.$eval("disabled()")||"html"!==this.name&&this.$editor().showHtml||this.$parent.disabled||this.$editor().disabled},displayActiveToolClass:function(e){return e?a.classes.toolbarButtonActive:""},executeAction:i};angular.forEach(a.toolbar,function(e){var t=angular.element("
    ");t.addClass(a.classes.toolbarGroup),angular.forEach(e,function(e){a.tools[e]=angular.extend(a.$new(!0),r[e],c,{name:e}),a.tools[e].$element=u(r[e],a.tools[e]),t.append(a.tools[e].$element)}),s.append(t)}),a.updateToolDisplay=function(e,t,n){var r=a.tools[e];if(r){if(r._lastToolDefinition&&!n&&(t=angular.extend({},r._lastToolDefinition,t)),null===t.buttontext&&null===t.iconclass&&null===t.display)throw'textAngular Error: Tool Definition for updating "'+e+'" does not have a valid display/iconclass/buttontext value';null===t.buttontext&&delete t.buttontext,null===t.iconclass&&delete t.iconclass,null===t.display&&delete t.display;var i=u(t,r);r.$element.replaceWith(i),r.$element=i}},a.addTool=function(e,t,n,i){a.tools[e]=angular.extend(a.$new(!0),r[e],c,{name:e}),a.tools[e].$element=u(r[e],a.tools[e]);var o;void 0===n&&(n=a.toolbar.length-1),o=angular.element(s.children()[n]),void 0===i?(o.append(a.tools[e].$element),a.toolbar[n][a.toolbar[n].length-1]=e):(o.children().eq(i).after(a.tools[e].$element),a.toolbar[n][i]=e)},t.registerToolbar(a),a.$on("$destroy",function(){t.unregisterToolbar(a.name)})}}}])}(),define("common/text-angular",["common/rangy-core","common/rangy-selectionsaverestore","common/text-angular-sanitize","common/text-angular-setup"],function(){}),function(){"use strict";var e={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91,MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(t){switch(t.which){case e.COMMAND:case e.SHIFT:case e.CTRL:case e.ALT:return!0}return!!(t.metaKey||t.ctrlKey||t.altKey)},isFunctionKey:function(e){return(e=e.which?e.which:e)>=112&&e<=123},isVerticalMovement:function(t){return~[e.UP,e.DOWN].indexOf(t)},isHorizontalMovement:function(t){return~[e.LEFT,e.RIGHT,e.BACKSPACE,e.DELETE].indexOf(t)},toSeparator:function(t){var n={ENTER:"\n",TAB:"\t",SPACE:" "}[t];return n||(e[t]?void 0:t)}};void 0===angular.element.prototype.querySelectorAll&&(angular.element.prototype.querySelectorAll=function(e){return angular.element(this[0].querySelectorAll(e))}),void 0===angular.element.prototype.closest&&(angular.element.prototype.closest=function(e){for(var t=this[0],n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(n.bind(t)(e))return t;t=t.parentElement}return!1});var t=0,n=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,skipFocusser:!1,dropdownPosition:"auto",removeSelected:!0,resetSearchInput:!0,generateId:function(){return t++},appendToBody:!1,spinnerEnabled:!1,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var e=angular.$$minErr("ui.select");return function(){var t=e.apply(this,arguments),n=t.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(n)}}).directive("uisTranscludeAppend",function(){return{link:function(e,t,n,r,i){i(e,function(e){t.append(e)})}}}).filter("highlight",function(){function e(e){return(""+e).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(t,n){return n&&t?(""+t).replace(new RegExp(e(n),"gi"),'$&'):t}}).factory("uisOffset",["$document","$window",function(e,t){return function(n){var r=n[0].getBoundingClientRect();return{width:r.width||n.prop("offsetWidth"),height:r.height||n.prop("offsetHeight"),top:r.top+(t.pageYOffset||e[0].documentElement.scrollTop),left:r.left+(t.pageXOffset||e[0].documentElement.scrollLeft)}}}]);n.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(e,t,n,r,i){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){return t.addClass("ui-select-choices"),(t.parent().attr("theme")||e.theme)+"/choices.tpl.html"},compile:function(r,o){if(!o.repeat)throw n("repeat","Expected 'repeat' expression.");var a=o.groupBy,s=o.groupFilter;if(a){var l=r.querySelectorAll(".ui-select-choices-group");if(1!==l.length)throw n("rows","Expected 1 .ui-select-choices-group but got '{0}'.",l.length);l.attr("ng-repeat",t.getGroupNgRepeatExpression())}var u=t.parse(o.repeat),c=r.querySelectorAll(".ui-select-choices-row") -;if(1!==c.length)throw n("rows","Expected 1 .ui-select-choices-row but got '{0}'.",c.length);c.attr("ng-repeat",u.repeatExpression(a)).attr("ng-if","$select.open");var f=r.querySelectorAll(".ui-select-choices-row-inner");if(1!==f.length)throw n("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",f.length);return f.attr("uis-transclude-append",""),(i.document.addEventListener?c:f).attr("ng-click","$select.select("+u.itemName+",$select.skipFocusser,$event)"),function(t,n,i,o){o.parseRepeatAttr(i.repeat,a,s),o.disableChoiceExpression=i.uiDisableChoice,o.onHighlightCallback=i.onHighlight,o.dropdownPosition=i.position?i.position.toLowerCase():e.dropdownPosition,t.$on("$destroy",function(){c.remove()}),t.$watch("$select.search",function(e){e&&!o.open&&o.multiple&&o.activate(!1,!0),o.activeIndex=o.tagging.isActivated?-1:0,!i.minimumInputLength||o.search.length>=i.minimumInputLength?o.refresh(i.refresh):o.items=[]}),i.$observe("refreshDelay",function(){var n=t.$eval(i.refreshDelay);o.refreshDelay=void 0!==n?n:e.refreshDelay}),t.$watch("$select.open",function(e){e?r.attr("role","listbox"):r.removeAttr("role")})}}}}]),n.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function(t,n,r,i,o,a,s,l,u,c,f){function d(e,t,n){if(e.findIndex)return e.findIndex(t,n);for(var r,i=Object(e),o=i.length>>>0,a=0;a-1&&k.splice(n,1)}function g(e){return k.indexOf(e)>-1}function v(e){function t(e,t){var n=r.indexOf(e);t&&-1===n&&r.push(e),!t&&n>-1&&r.splice(n,0)}function n(e){return r.indexOf(e)>-1}if(e){var r=[];$.isLocked=function(e,r){var i=!1,o=$.selected[r];return o&&(e?(i=!!e.$eval($.lockChoiceExpression),t(o,i)):i=n(o)),i}}}function y(t){var n=!0;switch(t){case e.DOWN:!$.open&&$.multiple?$.activate(!1,!0):$.activeIndex<$.items.length-1&&$.activeIndex++;break;case e.UP:!$.open&&$.multiple?$.activate(!1,!0):($.activeIndex>0||0===$.search.length&&$.tagging.isActivated&&$.activeIndex>-1)&&$.activeIndex--;break;case e.TAB:$.multiple&&!$.open||$.select($.items[$.activeIndex],!0);break;case e.ENTER:$.open&&($.tagging.isActivated||$.activeIndex>=0)?$.select($.items[$.activeIndex],$.skipFocusser):$.activate(!1,!0);break;case e.ESC:$.close();break;default:n=!1}return n}function b(){var e=n.querySelectorAll(".ui-select-choices-content"),t=e.querySelectorAll(".ui-select-choices-row");if(t.length<1)throw s("choices","Expected multiple .ui-select-choices-row but got '{0}'.",t.length);if(!($.activeIndex<0)){var r=t[$.activeIndex],i=r.offsetTop+r.clientHeight-e[0].scrollTop,o=e[0].offsetHeight;i>o?e[0].scrollTop+=i-o:i=$.items.length?0:$.activeIndex,-1===$.activeIndex&&!1!==$.taggingLabel&&($.activeIndex=0);var o=n.querySelectorAll(".ui-select-choices-content"),a=n.querySelectorAll(".ui-select-search");if($.$animate&&$.$animate.on&&$.$animate.enabled(o[0])){var s=function(t,n){"start"===n&&0===$.items.length?($.$animate.off("removeClass",a[0],s),r(function(){$.focusSearchInput(e)})):"close"===n&&($.$animate.off("enter",o[0],s),r(function(){$.focusSearchInput(e)}))};$.items.length>0?$.$animate.on("enter",o[0],s):$.$animate.on("removeClass",a[0],s)}else r(function(){$.focusSearchInput(e),!$.tagging.isActivated&&$.items.length>1&&b()})}},$.focusSearchInput=function(e){$.search=e||$.search,$.searchInput[0].focus()},$.findGroupByName=function(e){return $.groups&&$.groups.filter(function(t){return t.name===e})[0]},$.parseRepeatAttr=function(e,n,r){function i(e){var i=t.$eval(n);if($.groups=[],angular.forEach(e,function(e){var t=angular.isFunction(i)?i(e):e[i],n=$.findGroupByName(t);n?n.items.push(e):$.groups.push({name:t,items:[e]})}),r){var o=t.$eval(r);angular.isFunction(o)?$.groups=o($.groups):angular.isArray(o)&&($.groups=h($.groups,o))}$.items=[],$.groups.forEach(function(e){$.items=$.items.concat(e.items)})}function o(e){$.items=e}$.setItemsFn=n?i:o,$.parserResult=a.parse(e),$.isGrouped=!!n,$.itemProperty=$.parserResult.itemName;var l=$.parserResult.source,c=function(){var e=l(t);t.$uisSource=Object.keys(e).map(function(t){var n={};return n[$.parserResult.keyName]=t,n.value=e[t],n})};$.parserResult.keyName&&(c(),$.parserResult.source=u("$uisSource"+$.parserResult.filters),t.$watch(l,function(e,t){e!==t&&c()},!0)),$.refreshItems=function(e){e=e||$.parserResult.source(t);var n=$.selected;if($.isEmpty()||angular.isArray(n)&&!n.length||!$.multiple||!$.removeSelected)$.setItemsFn(e);else if(void 0!==e&&null!==e){var r=e.filter(function(e){return angular.isArray(n)?n.every(function(t){return!angular.equals(e,t)}):!angular.equals(e,n)});$.setItemsFn(r)}"auto"!==$.dropdownPosition&&"up"!==$.dropdownPosition||t.calculateDropdownPos(),t.$broadcast("uis:refresh")},t.$watchCollection($.parserResult.source,function(e){if(void 0===e||null===e)$.items=[];else{if(!angular.isArray(e))throw s("items","Expected an array but got '{0}'.",e);$.refreshItems(e),angular.isDefined($.ngModel.$modelValue)&&($.ngModel.$modelValue=null)}})};var x;$.refresh=function(e){void 0!==e&&(x&&r.cancel(x),x=r(function(){var n=t.$eval(e);n&&angular.isFunction(n.then)&&!$.refreshing&&($.refreshing=!0,n.then(function(){$.refreshing=!1}))},$.refreshDelay))},$.isActive=function(e){if(!$.open)return!1;var t=$.items.indexOf(e[$.itemProperty]),n=t==$.activeIndex;return!(!n||t<0)&&(n&&!angular.isUndefined($.onHighlightCallback)&&e.$eval($.onHighlightCallback),n)};var C=function(e){return $.selected&&angular.isArray($.selected)&&$.selected.filter(function(t){return angular.equals(t,e)}).length>0},k=[];$.isDisabled=function(e){if($.open){var t=e[$.itemProperty],n=$.items.indexOf(t),r=!1;if(n>=0&&(angular.isDefined($.disableChoiceExpression)||$.multiple)){if(t.isTag)return!1;$.multiple&&(r=C(t)),!r&&angular.isDefined($.disableChoiceExpression)&&(r=!!e.$eval($.disableChoiceExpression)),m(t,r)}return r}},$.select=function(e,n,i){if(void 0===e||!g(e)){if(!$.items&&!$.search&&!$.tagging.isActivated)return;if(!e||!g(e)){if($.clickTriggeredSelect=!1,i&&("click"===i.type||"touchend"===i.type)&&e&&($.clickTriggeredSelect=!0),$.tagging.isActivated&&!1===$.clickTriggeredSelect){if(!1===$.taggingLabel)if($.activeIndex<0){if(void 0===e&&(e=void 0!==$.tagging.fct?$.tagging.fct($.search):$.search),!e||angular.equals($.items[0],e))return}else e=$.items[$.activeIndex];else if(0===$.activeIndex){if(void 0===e)return;if(void 0!==$.tagging.fct&&"string"==typeof e){if(!(e=$.tagging.fct(e)))return}else"string"==typeof e&&(e=e.replace($.taggingLabel,"").trim())}if(C(e))return void $.close(n)}p(),t.$broadcast("uis:select",e);var o={};o[$.parserResult.itemName]=e,r(function(){$.onSelectCallback(t,{$item:e,$model:$.parserResult.modelMapper(t,o)})}),$.closeOnSelect&&$.close(n)}}},$.close=function(e){$.open&&($.ngModel&&$.ngModel.$setTouched&&$.ngModel.$setTouched(),$.open=!1,p(),t.$broadcast("uis:close",e))},$.setFocus=function(){$.focus||$.focusInput[0].focus()},$.clear=function(e){$.select(void 0),e.stopPropagation(),r(function(){$.focusser[0].focus()},0,!1)},$.toggle=function(e){$.open?($.close(),e.preventDefault(),e.stopPropagation()):$.activate()},$.isLocked=function(){return!1},t.$watch(function(){return angular.isDefined($.lockChoiceExpression)&&""!==$.lockChoiceExpression},v);var E=null,S=!1;$.sizeSearchInput=function(){var e=$.searchInput[0],n=$.searchInput.parent().parent()[0],i=function(){return n.clientWidth*!!e.offsetParent},o=function(t){if(0===t)return!1;var n=t-e.offsetLeft-10;return n<50&&(n=t),$.searchInput.css("width",n+"px"),!0};$.searchInput.css("width","10px"),r(function(){null!==E||o(i())||(E=t.$watch(function(){S||(S=!0,t.$$postDigest(function(){S=!1,o(i())&&(E(),E=null)}))},angular.noop))})},$.searchInput.on("keydown",function(n){var i=n.which;~[e.ENTER,e.ESC].indexOf(i)&&(n.preventDefault(),n.stopPropagation()),t.$apply(function(){var t=!1;if(($.items.length>0||$.tagging.isActivated)&&(y(i)||$.searchEnabled||(n.preventDefault(),n.stopPropagation()),$.taggingTokens.isActivated)){for(var o=0;o<$.taggingTokens.tokens.length;o++)$.taggingTokens.tokens[o]===e.MAP[n.keyCode]&&$.search.length>0&&(t=!0);t&&r(function(){$.searchInput.triggerHandler("tagged");var t=$.search.replace(e.MAP[n.keyCode],"").trim();$.tagging.fct&&(t=$.tagging.fct(t)),t&&$.select(t,!0)})}}),e.isVerticalMovement(i)&&$.items.length>0&&b(),i!==e.ENTER&&i!==e.ESC||(n.preventDefault(),n.stopPropagation())}),$.searchInput.on("paste",function(t){var n;if(n=window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):(t.originalEvent||t).clipboardData.getData("text/plain"),(n=$.search+n)&&n.length>0)if($.taggingTokens.isActivated){for(var r=[],i=0;i<$.taggingTokens.tokens.length;i++){var o=e.toSeparator($.taggingTokens.tokens[i])||$.taggingTokens.tokens[i];if(n.indexOf(o)>-1){r=n.split(o);break}}0===r.length&&(r=[n]);var a=$.search;angular.forEach(r,function(e){var t=$.tagging.fct?$.tagging.fct(e):e;t&&$.select(t,!0)}),$.search=a||w,t.preventDefault(),t.stopPropagation()}else $.paste&&($.paste(n),$.search=w,t.preventDefault(),t.stopPropagation())}),$.searchInput.on("tagged",function(){r(function(){p()})});var _=o(function(){$.sizeSearchInput()},50);angular.element(f).bind("resize",_),t.$on("$destroy",function(){$.searchInput.off("keyup keydown tagged blur paste"),angular.element(f).off("resize",_)}),t.$watch("$select.activeIndex",function(e){e&&n.find("input").attr("aria-activedescendant","ui-select-choices-row-"+$.generatedId+"-"+e)}),t.$watch("$select.open",function(e){e||n.find("input").removeAttr("aria-activedescendant")})}]),n.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","uisOffset","$compile","$parse","$timeout",function(e,t,n,r,i,o,a){return{restrict:"EA",templateUrl:function(e,n){return(n.theme||t.theme)+(angular.isDefined(n.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",compile:function(i,s){var l=/{(.*)}\s*{(.*)}/.exec(s.ngClass);if(l){var u="{"+l[1]+", "+l[2]+"}";s.ngClass=u,i.attr("ng-class",u)}return angular.isDefined(s.multiple)?i.append("").removeAttr("multiple"):i.append(""),s.inputId&&(i.querySelectorAll("input.ui-select-search")[0].id=s.inputId),function(i,s,l,u,c){function f(e){if(h.open){if(!(window.jQuery?window.jQuery.contains(s[0],e.target):s[0].contains(e.target))&&!h.clickTriggeredSelect){var t;if(h.skipFocusser)t=!0;else{var n=["input","button","textarea","select"],r=angular.element(e.target).controller("uiSelect");t=r&&r!==h,t||(t=~n.indexOf(e.target.tagName.toLowerCase()))}h.close(t),i.$digest()}h.clickTriggeredSelect=!1}}function d(){var t=r(s);v=angular.element('
    '),v[0].style.width=t.width+"px",v[0].style.height=t.height+"px",s.after(v),y=s[0].style.width,e.find("body").append(s),s[0].style.position="absolute",s[0].style.left=t.left+"px",s[0].style.top=t.top+"px",s[0].style.width=t.width+"px"}function p(){null!==v&&(v.replaceWith(s),v=null,s[0].style.position="",s[0].style.left="",s[0].style.top="",s[0].style.width=y,h.setFocus())}var h=u[0],m=u[1];h.generatedId=t.generateId(),h.baseTitle=l.title||"Select box",h.focusserTitle=h.baseTitle+" focus",h.focusserId="focusser-"+h.generatedId,h.closeOnSelect=function(){return angular.isDefined(l.closeOnSelect)?o(l.closeOnSelect)():t.closeOnSelect}(),i.$watch("skipFocusser",function(){var e=i.$eval(l.skipFocusser);h.skipFocusser=void 0!==e?e:t.skipFocusser}),h.onSelectCallback=o(l.onSelect),h.onRemoveCallback=o(l.onRemove),h.ngModel=m,h.choiceGrouped=function(e){return h.isGrouped&&e&&e.name},l.tabindex&&l.$observe("tabindex",function(e){h.focusInput.attr("tabindex",e),s.removeAttr("tabindex")}),i.$watch(function(){return i.$eval(l.searchEnabled)},function(e){h.searchEnabled=void 0!==e?e:t.searchEnabled}),i.$watch("sortable",function(){var e=i.$eval(l.sortable);h.sortable=void 0!==e?e:t.sortable}),l.$observe("limit",function(){h.limit=angular.isDefined(l.limit)?parseInt(l.limit,10):void 0}),i.$watch("removeSelected",function(){var e=i.$eval(l.removeSelected);h.removeSelected=void 0!==e?e:t.removeSelected}),l.$observe("disabled",function(){h.disabled=void 0!==l.disabled&&l.disabled}),l.$observe("resetSearchInput",function(){var e=i.$eval(l.resetSearchInput);h.resetSearchInput=void 0===e||e}),l.$observe("paste",function(){h.paste=i.$eval(l.paste)}),l.$observe("tagging",function(){if(void 0!==l.tagging){var e=i.$eval(l.tagging);h.tagging={isActivated:!0,fct:!0!==e?e:void 0}}else h.tagging={isActivated:!1,fct:void 0}}),l.$observe("taggingLabel",function(){void 0!==l.tagging&&("false"===l.taggingLabel?h.taggingLabel=!1:h.taggingLabel=void 0!==l.taggingLabel?l.taggingLabel:"(new)")}),l.$observe("taggingTokens",function(){if(void 0!==l.tagging){var e=void 0!==l.taggingTokens?l.taggingTokens.split("|"):[",","ENTER"];h.taggingTokens={isActivated:!0,tokens:e}}}),l.$observe("spinnerEnabled",function(){var e=i.$eval(l.spinnerEnabled);h.spinnerEnabled=void 0!==e?e:t.spinnerEnabled}),l.$observe("spinnerClass",function(){var e=l.spinnerClass;h.spinnerClass=void 0!==e?l.spinnerClass:t.spinnerClass}),angular.isDefined(l.autofocus)&&a(function(){h.setFocus()}),angular.isDefined(l.focusOn)&&i.$on(l.focusOn,function(){a(function(){h.setFocus()})}),e.on("click",f),i.$on("$destroy",function(){e.off("click",f)}),c(i,function(e){var t=angular.element("
    ").append(e),r=t.querySelectorAll(".ui-select-match");if(r.removeAttr("ui-select-match"),r.removeAttr("data-ui-select-match"),1!==r.length)throw n("transcluded","Expected 1 .ui-select-match but got '{0}'.",r.length);s.querySelectorAll(".ui-select-match").replaceWith(r);var i=t.querySelectorAll(".ui-select-choices");if(i.removeAttr("ui-select-choices"),i.removeAttr("data-ui-select-choices"),1!==i.length)throw n("transcluded","Expected 1 .ui-select-choices but got '{0}'.",i.length);s.querySelectorAll(".ui-select-choices").replaceWith(i);var o=t.querySelectorAll(".ui-select-no-choice");o.removeAttr("ui-select-no-choice"),o.removeAttr("data-ui-select-no-choice"),1==o.length&&s.querySelectorAll(".ui-select-no-choice").replaceWith(o)});var g=i.$eval(l.appendToBody);(void 0!==g?g:t.appendToBody)&&(i.$watch("$select.open",function(e){e?d():p()}),i.$on("$destroy",function(){p()}));var v=null,y="",b=null;i.$watch("$select.open",function(){"auto"!==h.dropdownPosition&&"up"!==h.dropdownPosition||i.calculateDropdownPos()});var $=function(e,t){e=e||r(s),t=t||r(b),b[0].style.position="absolute",b[0].style.top=-1*t.height+"px",s.addClass("direction-up")},w=function(e,t){s.removeClass("direction-up"),e=e||r(s),t=t||r(b),b[0].style.position="",b[0].style.top=""},x=function(){a(function(){if("up"===h.dropdownPosition)$();else{s.removeClass("direction-up");var t=r(s),n=r(b),i=e[0].documentElement.scrollTop||e[0].body.scrollTop;t.top+t.height+n.height>i+e[0].documentElement.clientHeight?$(t,n):w(t,n)}b[0].style.opacity=1})},C=!1;i.calculateDropdownPos=function(){if(h.open){if(b=angular.element(s).querySelectorAll(".ui-select-dropdown"),0===b.length)return;if(""!==h.search||C||(b[0].style.opacity=0,C=!0),!r(b).height&&h.$animate&&h.$animate.on&&h.$animate.enabled(b)){var e=!0;h.$animate.on("enter",b,function(t,n){"close"===n&&e&&(x(),e=!1)})}else x()}else{if(null===b||0===b.length)return;b[0].style.opacity=0,b[0].style.position="",b[0].style.top="",s.removeClass("direction-up")}}}}}}]),n.directive("uiSelectMatch",["uiSelectConfig",function(e){function t(e,t){return e[0].hasAttribute(t)?e.attr(t):e[0].hasAttribute("data-"+t)?e.attr("data-"+t):e[0].hasAttribute("x-"+t)?e.attr("x-"+t):void 0}return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(n){n.addClass("ui-select-match");var r=n.parent();return(t(r,"theme")||e.theme)+(angular.isDefined(t(r,"multiple"))?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(t,n,r,i){function o(e){i.allowClear=!!angular.isDefined(e)&&(""===e||"true"===e.toLowerCase())}i.lockChoiceExpression=r.uiLockChoice,r.$observe("placeholder",function(t){i.placeholder=void 0!==t?t:e.placeholder}),r.$observe("allowClear",o),o(r.allowClear),i.multiple&&i.sizeSearchInput()}}}]),n.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(t,n){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function(e,t){var n,r=this,i=e.$select;angular.isUndefined(i.selected)&&(i.selected=[]),e.$evalAsync(function(){n=e.ngModel}),r.activeMatchIndex=-1,r.updateModel=function(){n.$setViewValue(Date.now()),r.refreshComponent()},r.refreshComponent=function(){i.refreshItems&&i.refreshItems(),i.sizeSearchInput&&i.sizeSearchInput()},r.removeChoice=function(n){if(i.isLocked(null,n))return!1;var o=i.selected[n],a={};return a[i.parserResult.itemName]=o,i.selected.splice(n,1),r.activeMatchIndex=-1,i.sizeSearchInput(),t(function(){i.onRemoveCallback(e,{$item:o,$model:i.parserResult.modelMapper(e,a)})}),r.updateModel(),!0},r.getPlaceholder=function(){if(!i.selected||!i.selected.length)return i.placeholder}}],controllerAs:"$selectMultiple",link:function(r,i,o,a){function s(e){return angular.isNumber(e.selectionStart)?e.selectionStart:e.value.length}function l(t){var n=s(f.searchInput[0]),r=f.selected.length,i=r-1,o=p.activeMatchIndex,a=p.activeMatchIndex+1,l=p.activeMatchIndex-1,u=o;return!(n>0||f.search.length&&t==e.RIGHT)&&(f.close(),u=function(){switch(t){case e.LEFT:return~p.activeMatchIndex?l:i;case e.RIGHT:return~p.activeMatchIndex&&o!==i?a:(f.activate(),!1);case e.BACKSPACE:return~p.activeMatchIndex?p.removeChoice(o)?l:o:i;case e.DELETE:return!!~p.activeMatchIndex&&(p.removeChoice(p.activeMatchIndex),o)}}(),f.selected.length&&!1!==u?p.activeMatchIndex=Math.min(i,Math.max(0,u)):p.activeMatchIndex=-1,!0)}function u(e){return void 0!==e&&void 0!==f.search&&e.filter(function(e){return void 0!==f.search.toUpperCase()&&void 0!==e&&e.toUpperCase()===f.search.toUpperCase()}).length>0}function c(e,t){var n=-1;if(angular.isArray(e))for(var r=angular.copy(e),i=0;i=0;i--)t={},t[f.parserResult.itemName]=f.selected[i],e=f.parserResult.modelMapper(r,t),n.unshift(e);return n}),d.$formatters.unshift(function(e){var t,n=f.parserResult&&f.parserResult.source(r,{$select:{search:""}}),i={};if(!n)return e;var o=[],a=function(e,n){if(e&&e.length){for(var a=e.length-1;a>=0;a--){if(i[f.parserResult.itemName]=e[a],t=f.parserResult.modelMapper(r,i),f.parserResult.trackByExp){var s=/(\w*)\./.exec(f.parserResult.trackByExp),l=/\.([^\s]+)/.exec(f.parserResult.trackByExp);if(s&&s.length>0&&s[1]==f.parserResult.itemName&&l&&l.length>0&&t[l[1]]==n[l[1]])return o.unshift(e[a]),!0}if(angular.equals(t,n))return o.unshift(e[a]),!0}return!1}};if(!e)return o;for(var s=e.length-1;s>=0;s--)a(f.selected,e[s])||a(n,e[s])||o.unshift(e[s]);return o}),r.$watchCollection(function(){return d.$modelValue},function(e,t){t!=e&&(angular.isDefined(d.$modelValue)&&(d.$modelValue=null),p.refreshComponent())}),d.$render=function(){if(!angular.isArray(d.$viewValue)){if(!angular.isUndefined(d.$viewValue)&&null!==d.$viewValue)throw t("multiarr","Expected model value to be array but got '{0}'",d.$viewValue);d.$viewValue=[]}f.selected=d.$viewValue,p.refreshComponent(),r.$evalAsync()},r.$on("uis:select",function(e,t){f.selected.length>=f.limit||(f.selected.push(t),p.updateModel())}),r.$on("uis:activate",function(){p.activeMatchIndex=-1}),r.$watch("$select.disabled",function(e,t){t&&!e&&f.sizeSearchInput()}),f.searchInput.on("keydown",function(t){var n=t.which;r.$apply(function(){var r=!1;e.isHorizontalMovement(n)&&(r=l(n)),r&&n!=e.TAB&&(t.preventDefault(),t.stopPropagation())})}),f.searchInput.on("keyup",function(t){if(e.isVerticalMovement(t.which)||r.$evalAsync(function(){f.activeIndex=!1===f.taggingLabel?-1:0}),f.tagging.isActivated&&f.search.length>0){if(t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||e.isVerticalMovement(t.which))return;if(f.activeIndex=!1===f.taggingLabel?-1:0,!1===f.taggingLabel)return;var n,i,o,a,s=angular.copy(f.items),l=angular.copy(f.items),d=!1,p=-1;if(void 0!==f.tagging.fct){if(o=f.$filter("filter")(s,{isTag:!0}),o.length>0&&(a=o[0]),s.length>0&&a&&(d=!0,s=s.slice(1,s.length),l=l.slice(1,l.length)),n=f.tagging.fct(f.search),l.some(function(e){return angular.equals(e,n)})||f.selected.some(function(e){return angular.equals(e,n)}))return void r.$evalAsync(function(){f.activeIndex=0,f.items=s});n&&(n.isTag=!0)}else{if(o=f.$filter("filter")(s,function(e){return e.match(f.taggingLabel)}),o.length>0&&(a=o[0]),i=s[0],void 0!==i&&s.length>0&&a&&(d=!0,s=s.slice(1,s.length),l=l.slice(1,l.length)),n=f.search+" "+f.taggingLabel,c(f.selected,f.search)>-1)return;if(u(l.concat(f.selected)))return void(d&&(s=l,r.$evalAsync(function(){f.activeIndex=0,f.items=s})));if(u(l))return void(d&&(f.items=l.slice(1,l.length)))}d&&(p=c(f.selected,n)),p>-1?s=s.slice(p+1,s.length-1):(s=[],n&&s.push(n),s=s.concat(l)),r.$evalAsync(function(){if(f.activeIndex=0,f.items=s,f.isGrouped){var e=n?s.slice(1):s;f.setItemsFn(e),n&&(f.items.unshift(n),f.groups.unshift({name:"",items:[n],tagging:!0}))}})}}),f.searchInput.on("blur",function(){n(function(){p.activeMatchIndex=-1})})}}}]),n.directive("uiSelectNoChoice",["uiSelectConfig",function(e){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){return t.addClass("ui-select-no-choice"),(t.parent().attr("theme")||e.theme)+"/no-choice.tpl.html"}}}]),n.directive("uiSelectSingle",["$timeout","$compile",function(t,n){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(r,i,o,a){var s=a[0],l=a[1];l.$parsers.unshift(function(e){var t={};return t[s.parserResult.itemName]=e,s.parserResult.modelMapper(r,t)}),l.$formatters.unshift(function(e){var t,n=s.parserResult&&s.parserResult.source(r,{$select:{search:""}}),i={};if(n){var o=function(n){return i[s.parserResult.itemName]=n,(t=s.parserResult.modelMapper(r,i))===e};if(s.selected&&o(s.selected))return s.selected;for(var a=n.length-1;a>=0;a--)if(o(n[a]))return n[a]}return e}),r.$watch("$select.selected",function(e){l.$viewValue!==e&&l.$setViewValue(e)}),l.$render=function(){s.selected=l.$viewValue},r.$on("uis:select",function(e,t){s.selected=t}),r.$on("uis:close",function(e,n){t(function(){s.focusser.prop("disabled",!1),n||s.focusser[0].focus()},0,!1)}),r.$on("uis:activate",function(){u.prop("disabled",!0)});var u=angular.element("");n(u)(r),s.focusser=u,s.focusInput=u,i.parent().append(u),u.bind("focus",function(){r.$evalAsync(function(){s.focus=!0})}),u.bind("blur",function(){r.$evalAsync(function(){s.focus=!1})}),u.bind("keydown",function(t){if(t.which===e.BACKSPACE)return t.preventDefault(),t.stopPropagation(),s.select(void 0),void r.$apply();t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||(t.which!=e.DOWN&&t.which!=e.UP&&t.which!=e.ENTER&&t.which!=e.SPACE||(t.preventDefault(),t.stopPropagation(),s.activate()),r.$digest())}),u.bind("keyup input",function(t){t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||t.which==e.ENTER||t.which===e.BACKSPACE||(s.activate(u.val()),u.val(""),r.$digest())})}}}]),n.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(e,t,n){return{require:["^^uiSelect","^ngModel"],link:function(t,r,i,o){if(null===t[i.uiSelectSort])throw n("sort","Expected a list to sort");var a=o[0],s=o[1],l=angular.extend({axis:"horizontal"},t.$eval(i.uiSelectSortOptions)),u=l.axis;t.$watch(function(){return a.sortable},function(e){e?r.attr("draggable",!0):r.removeAttr("draggable")}),r.on("dragstart",function(e){r.addClass("dragging"),(e.dataTransfer||e.originalEvent.dataTransfer).setData("text",t.$index.toString())}),r.on("dragend",function(){d("dragging")});var c,f=function(e,t){this.splice(t,0,this.splice(e,1)[0])},d=function(e){angular.forEach(a.$element.querySelectorAll("."+e),function(t){angular.element(t).removeClass(e)})},p=function(e){e.preventDefault(),("vertical"===u?e.offsetY||e.layerY||(e.originalEvent?e.originalEvent.offsetY:0):e.offsetX||e.layerX||(e.originalEvent?e.originalEvent.offsetX:0))
  • '),e.put("bootstrap/match-multiple.tpl.html",' × '),e.put("bootstrap/match.tpl.html",'
    {{$select.placeholder}}
    '),e.put("bootstrap/no-choice.tpl.html",''), -e.put("bootstrap/select-multiple.tpl.html",''),e.put("bootstrap/select.tpl.html",''),e.put("select2/choices.tpl.html",'
    '),e.put("select2/match-multiple.tpl.html",'
  • '),e.put("select2/match.tpl.html",'{{$select.placeholder}} '),e.put("select2/no-choice.tpl.html",''),e.put("select2/select-multiple.tpl.html",'
    '),e.put("select2/select.tpl.html",'
    '),e.put("selectize/choices.tpl.html",'
    '),e.put("selectize/match-multiple.tpl.html",'
    ×
    '),e.put("selectize/match.tpl.html",'
    {{$select.placeholder}}
    '),e.put("selectize/no-choice.tpl.html",'
    '),e.put("selectize/select-multiple.tpl.html",'
    '),e.put("selectize/select.tpl.html",'
    ')}]),define("common/ui-select",["common/angular"],function(){}),function(){function e(e){return e&&(e.ownerDocument||e.document||e).documentElement}function t(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}function n(e,t){return t>e?-1:e>t?1:e>=t?0:NaN}function r(e){return null===e?NaN:+e}function i(e){return!isNaN(e)}function o(e){return{left:function(t,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var o=r+i>>>1;e(t[o],n)<0?r=o+1:i=o}return r},right:function(t,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var o=r+i>>>1;e(t[o],n)>0?i=o:r=o+1}return r}}}function a(e){return e.length}function s(e){for(var t=1;e*t%1;)t*=10;return t}function l(e,t){for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}function u(){this._=Object.create(null)}function c(e){return(e+="")===pa||e[0]===ha?ha+e:e}function f(e){return(e+="")[0]===ha?e.slice(1):e}function d(e){return c(e)in this._}function p(e){return(e=c(e))in this._&&delete this._[e]}function h(){var e=[];for(var t in this._)e.push(f(t));return e}function m(){var e=0;for(var t in this._)++e;return e}function g(){for(var e in this._)return!1;return!0}function v(){this._=Object.create(null)}function y(e){return e}function b(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function $(e,t){if(t in e)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var n=0,r=ma.length;r>n;++n){var i=ma[n]+t;if(i in e)return i}}function w(){}function x(){}function C(e){function t(){for(var t,r=n,i=-1,o=r.length;++in;n++)for(var i,o=e[n],a=0,s=o.length;s>a;a++)(i=o[a])&&t(i,a,n);return e}function z(e){return va(e,Ca),e}function B(e){var t,n;return function(r,i,o){var a,s=e[o].update,l=s.length;for(o!=n&&(n=o,t=0),i>=t&&(t=i+1);!(a=s[t])&&++t0&&(e=e.slice(0,s));var u=ka.get(e);return u&&(e=u,l=G),s?t?i:r:t?w:o}function W(e,t){return function(n){var r=na.event;na.event=n,t[0]=this.__data__;try{e.apply(this,t)}finally{na.event=r}}}function G(e,t){var n=W(e,t);return function(e){var t=this,r=e.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||n.call(t,e)}}function K(n){var r=".dragsuppress-"+ ++Sa,i="click"+r,o=na.select(t(n)).on("touchmove"+r,k).on("dragstart"+r,k).on("selectstart"+r,k);if(null==Ea&&(Ea=!("onselectstart"in n)&&$(n.style,"userSelect")),Ea){var a=e(n).style,s=a[Ea];a[Ea]="none"}return function(e){if(o.on(r,null),Ea&&(a[Ea]=s),e){var t=function(){o.on(i,null)};o.on(i,function(){k(),t()},!0),setTimeout(t,0)}}}function Z(e,n){n.changedTouches&&(n=n.changedTouches[0]);var r=e.ownerSVGElement||e;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>_a){var o=t(e);if(o.scrollX||o.scrollY){r=na.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=r[0][0].getScreenCTM();_a=!(a.f||a.e),r.remove()}}return _a?(i.x=n.pageX,i.y=n.pageY):(i.x=n.clientX,i.y=n.clientY),i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}var s=e.getBoundingClientRect();return[n.clientX-s.left-e.clientLeft,n.clientY-s.top-e.clientTop]}function J(){return na.event.changedTouches[0].identifier}function Q(e){return e>0?1:0>e?-1:0}function X(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function ee(e){return e>1?0:-1>e?Da:Math.acos(e)}function te(e){return e>1?Na:-1>e?-Na:Math.asin(e)}function ne(e){return((e=Math.exp(e))-1/e)/2}function re(e){return((e=Math.exp(e))+1/e)/2}function ie(e){return((e=Math.exp(2*e))-1)/(e+1)}function oe(e){return(e=Math.sin(e/2))*e}function ae(){}function se(e,t,n){return this instanceof se?(this.h=+e,this.s=+t,void(this.l=+n)):arguments.length<2?e instanceof se?new se(e.h,e.s,e.l):we(""+e,xe,se):new se(e,t,n)}function le(e,t,n){function r(e){return e>360?e-=360:0>e&&(e+=360),60>e?o+(a-o)*e/60:180>e?a:240>e?o+(a-o)*(240-e)/60:o}function i(e){return Math.round(255*r(e))}var o,a;return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)?0:0>t?0:t>1?1:t,n=0>n?0:n>1?1:n,a=.5>=n?n*(1+t):n+t-n*t,o=2*n-a,new ve(i(e+120),i(e),i(e-120))}function ue(e,t,n){return this instanceof ue?(this.h=+e,this.c=+t,void(this.l=+n)):arguments.length<2?e instanceof ue?new ue(e.h,e.c,e.l):e instanceof fe?pe(e.l,e.a,e.b):pe((e=Ce((e=na.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new ue(e,t,n)}function ce(e,t,n){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new fe(n,Math.cos(e*=Ra)*t,Math.sin(e)*t)}function fe(e,t,n){return this instanceof fe?(this.l=+e,this.a=+t,void(this.b=+n)):arguments.length<2?e instanceof fe?new fe(e.l,e.a,e.b):e instanceof ue?ce(e.h,e.c,e.l):Ce((e=ve(e)).r,e.g,e.b):new fe(e,t,n)}function de(e,t,n){var r=(e+16)/116,i=r+t/500,o=r-n/200;return i=he(i)*za,r=he(r)*Ba,o=he(o)*Ya,new ve(ge(3.2404542*i-1.5371385*r-.4985314*o),ge(-.969266*i+1.8760108*r+.041556*o),ge(.0556434*i-.2040259*r+1.0572252*o))}function pe(e,t,n){return e>0?new ue(Math.atan2(n,t)*Ia,Math.sqrt(t*t+n*n),e):new ue(NaN,NaN,e)}function he(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function me(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function ge(e){return Math.round(255*(.00304>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function ve(e,t,n){return this instanceof ve?(this.r=~~e,this.g=~~t,void(this.b=~~n)):arguments.length<2?e instanceof ve?new ve(e.r,e.g,e.b):we(""+e,ve,le):new ve(e,t,n)}function ye(e){return new ve(e>>16,e>>8&255,255&e)}function be(e){return ye(e)+""}function $e(e){return 16>e?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function we(e,t,n){e=e.toLowerCase();var r,i,o,a=0,s=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(e))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(Ee(i[0]),Ee(i[1]),Ee(i[2]))}return(o=Ka.get(e))?t(o.r,o.g,o.b):(null==e||"#"!==e.charAt(0)||isNaN(o=parseInt(e.slice(1),16))||(4===e.length?(a=(3840&o)>>4,a|=a>>4,s=240&o,s|=s>>4,l=15&o,l|=l<<4):7===e.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),t(a,s,l))}function xe(e,t,n){var r,i,o=Math.min(e/=255,t/=255,n/=255),a=Math.max(e,t,n),s=a-o,l=(a+o)/2;return s?(i=.5>l?s/(a+o):s/(2-a-o),r=e==a?(t-n)/s+(n>t?6:0):t==a?(n-e)/s+2:(e-t)/s+4,r*=60):(r=NaN,i=l>0&&1>l?0:r),new se(r,i,l)}function Ce(e,t,n){e=ke(e),t=ke(t),n=ke(n);var r=me((.4124564*e+.3575761*t+.1804375*n)/za),i=me((.2126729*e+.7151522*t+.072175*n)/Ba);return fe(116*i-16,500*(r-i),200*(i-me((.0193339*e+.119192*t+.9503041*n)/Ya)))}function ke(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ee(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}function Se(e){return"function"==typeof e?e:function(){return e}}function _e(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Me(t,n,e,r)}}function Me(e,t,n,r){function i(){var e,t=l.status;if(!t&&De(l)||t>=200&&300>t||304===t){try{e=n.call(o,l)}catch(e){return void a.error.call(o,e)}a.load.call(o,e)}else a.error.call(o,l)}var o={},a=na.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(e)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(e){var t=na.event;na.event=e;try{a.progress.call(o,l)}finally{na.event=t}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(t=null==e?null:e+"",o):t},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return n=e,o},["get","post"].forEach(function(e){o[e]=function(){return o.send.apply(o,[e].concat(ia(arguments)))}}),o.send=function(n,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(n,e,!0),null==t||"accept"in s||(s.accept=t+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=u&&(l.responseType=u),null!=i&&o.on("error",i).on("load",function(e){i(null,e)}),a.beforesend.call(o,l),l.send(null==r?null:r),o},o.abort=function(){return l.abort(),o},na.rebind(o,a,"on"),null==r?o:o.get(Te(r))}function Te(e){return 1===e.length?function(t,n){e(null==t?n:null)}:e}function De(e){var t=e.responseType;return t&&"text"!==t?e.response:e.responseText}function Ae(){var e=Oe(),t=Ne()-e;t>24?(isFinite(t)&&(clearTimeout(Xa),Xa=setTimeout(Ae,t)),Qa=0):(Qa=1,ts(Ae))}function Oe(){var e=Date.now();for(es=Za;es;)e>=es.t&&(es.f=es.c(e-es.t)),es=es.n;return e}function Ne(){for(var e,t=Za,n=1/0;t;)t.f?t=e?e.n=t.n:Za=t.n:(t.t8?function(e){return e/n}:function(e){return e*n},symbol:e}}function Pe(e){var t=e.decimal,n=e.thousands,r=e.grouping,i=e.currency,o=r&&n?function(e,t){for(var i=e.length,o=[],a=0,s=r[0],l=0;i>0&&s>0&&(l+s+1>t&&(s=Math.max(1,t-l)),o.push(e.substring(i-=s,i+s)),!((l+=s+1)>t));)s=r[a=(a+1)%r.length];return o.reverse().join(n)}:y;return function(e){var n=rs.exec(e),r=n[1]||" ",a=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],d=n[8],p=n[9],h=1,m="",g="",v=!1,y=!0;switch(d&&(d=+d.substring(1)),(u||"0"===r&&"="===a)&&(u=r="0",a="="),p){case"n":f=!0,p="g";break;case"%":h=100,g="%",p="f";break;case"p":h=100,g="%",p="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+p.toLowerCase());case"c":y=!1;case"d":v=!0,d=0;break;case"s":h=-1,p="r"}"$"===l&&(m=i[0],g=i[1]),"r"!=p||d||(p="g"),null!=d&&("g"==p?d=Math.max(1,Math.min(21,d)):("e"==p||"f"==p)&&(d=Math.max(0,Math.min(20,d)))),p=is.get(p)||Fe;var b=u&&f;return function(e){var n=g;if(v&&e%1)return"";var i=0>e||0===e&&0>1/e?(e=-e,"-"):"-"===s?"":s;if(0>h){var l=na.formatPrefix(e,d);e=l.scale(e),n=l.symbol+g}else e*=h;e=p(e,d);var $,w,x=e.lastIndexOf(".");if(0>x){var C=y?e.lastIndexOf("e"):-1;0>C?($=e,w=""):($=e.substring(0,C),w=e.substring(C))}else $=e.substring(0,x),w=t+e.substring(x+1);!u&&f&&($=o($,1/0));var k=m.length+$.length+w.length+(b?0:i.length),E=c>k?new Array(k=c-k+1).join(r):"";return b&&($=o(E+$,E.length?c-w.length:1/0)),i+=m,e=$+w,("<"===a?i+e+E:">"===a?E+i+e:"^"===a?E.substring(0,k>>=1)+i+e+E.substring(k):i+(b?e:E+e))+n}}}function Fe(e){return e+""}function je(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Le(e,t,n){function r(t){var n=e(t),r=o(n,1);return r-t>t-n?n:r}function i(n){return t(n=e(new as(n-1)),1),n}function o(e,n){return t(e=new as(+e),n),e}function a(e,r,o){var a=i(e),s=[];if(o>1)for(;r>a;)n(a)%o||s.push(new Date(+a)),t(a,1);else for(;r>a;)s.push(new Date(+a)),t(a,1);return s}function s(e,t,n){try{as=je;var r=new je;return r._=e,a(r,t,n)}finally{as=Date}}e.floor=e,e.round=r,e.ceil=i,e.offset=o,e.range=a;var l=e.utc=Ue(e);return l.floor=l,l.round=Ue(r),l.ceil=Ue(i),l.offset=Ue(o),l.range=s,e}function Ue(e){return function(t,n){try{as=je;var r=new je;return r._=t,e(r,n)._}finally{as=Date}}}function He(e){function t(e){function t(t){for(var n,i,o,a=[],s=-1,l=0;++ss;){if(r>=u)return-1;if(37===(i=t.charCodeAt(s++))){if(a=t.charAt(s++),!(o=T[a in ls?t.charAt(s++):a])||(r=o(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(e,t,n){x.lastIndex=0;var r=x.exec(t.slice(n));return r?(e.w=C.get(r[0].toLowerCase()),n+r[0].length):-1}function i(e,t,n){$.lastIndex=0;var r=$.exec(t.slice(n));return r?(e.w=w.get(r[0].toLowerCase()),n+r[0].length):-1}function o(e,t,n){S.lastIndex=0;var r=S.exec(t.slice(n));return r?(e.m=_.get(r[0].toLowerCase()),n+r[0].length):-1}function a(e,t,n){k.lastIndex=0;var r=k.exec(t.slice(n));return r?(e.m=E.get(r[0].toLowerCase()),n+r[0].length):-1}function s(e,t,r){return n(e,M.c.toString(),t,r)}function l(e,t,r){return n(e,M.x.toString(),t,r)}function u(e,t,r){return n(e,M.X.toString(),t,r)}function c(e,t,n){var r=b.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)}var f=e.dateTime,d=e.date,p=e.time,h=e.periods,m=e.days,g=e.shortDays,v=e.months,y=e.shortMonths;t.utc=function(e){function n(e){try{as=je;var t=new as;return t._=e,r(t)}finally{as=Date}}var r=t(e);return n.parse=function(e){try{as=je;var t=r.parse(e);return t&&t._}finally{as=Date}},n.toString=r.toString,n},t.multi=t.utc.multi=st;var b=na.map(),$=Ve(m),w=ze(m),x=Ve(g),C=ze(g),k=Ve(v),E=ze(v),S=Ve(y),_=ze(y);h.forEach(function(e,t){b.set(e.toLowerCase(),t)});var M={a:function(e){return g[e.getDay()]},A:function(e){return m[e.getDay()]},b:function(e){return y[e.getMonth()]},B:function(e){return v[e.getMonth()]},c:t(f),d:function(e,t){return qe(e.getDate(),t,2)},e:function(e,t){return qe(e.getDate(),t,2)},H:function(e,t){return qe(e.getHours(),t,2)},I:function(e,t){return qe(e.getHours()%12||12,t,2)},j:function(e,t){return qe(1+os.dayOfYear(e),t,3)},L:function(e,t){return qe(e.getMilliseconds(),t,3)},m:function(e,t){return qe(e.getMonth()+1,t,2)},M:function(e,t){return qe(e.getMinutes(),t,2)},p:function(e){return h[+(e.getHours()>=12)]},S:function(e,t){return qe(e.getSeconds(),t,2)},U:function(e,t){return qe(os.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return qe(os.mondayOfYear(e),t,2)},x:t(d),X:t(p),y:function(e,t){return qe(e.getFullYear()%100,t,2)},Y:function(e,t){return qe(e.getFullYear()%1e4,t,4)},Z:ot,"%":function(){return"%"}},T={a:r,A:i,b:o,B:a,c:s,d:Xe,e:Xe,H:tt,I:tt,j:et,L:it,m:Qe,M:nt,p:c,S:rt,U:Ye,w:Be,W:We,x:l,X:u,y:Ke,Y:Ge,Z:Ze,"%":at};return t}function qe(e,t,n){var r=0>e?"-":"",i=(r?-e:e)+"",o=i.length;return r+(n>o?new Array(n-o+1).join(t)+i:i)}function Ve(e){return new RegExp("^(?:"+e.map(na.requote).join("|")+")","i")}function ze(e){for(var t=new u,n=-1,r=e.length;++n68?1900:2e3)}function Qe(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Xe(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function et(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+3));return r?(e.j=+r[0],n+r[0].length):-1}function tt(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function nt(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function rt(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function it(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ot(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=da(t)/60|0,i=da(t)%60;return n+qe(r,"0",2)+qe(i,"0",2)}function at(e,t,n){cs.lastIndex=0;var r=cs.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function st(e){for(var t=e.length,n=-1;++n=0?1:-1,s=a*n,l=Math.cos(t),u=Math.sin(t),c=o*u,f=i*l+c*Math.cos(s),d=c*a*Math.sin(s);gs.add(Math.atan2(d,f)),r=e,i=l,o=u}var t,n,r,i,o;vs.point=function(a,s){vs.point=e,r=(t=a)*Ra,i=Math.cos(s=(n=s)*Ra/2+Da/4),o=Math.sin(s)},vs.lineEnd=function(){e(t,n)}}function ht(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function mt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function gt(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function vt(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function yt(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function bt(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function $t(e){return[Math.atan2(e[1],e[0]),te(e[2])]}function wt(e,t){return da(e[0]-t[0])s;++s)i.point((n=e[s])[0],n[1]);return void i.lineEnd()}var l=new At(n,e,null,!0),u=new At(n,null,l,!1);l.o=u,o.push(l),a.push(u),l=new At(r,e,null,!1),u=new At(r,null,l,!0),l.o=u,o.push(l),a.push(u)}}),a.sort(t),Dt(o),Dt(a),o.length){for(var s=0,l=n,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,f,d=o[0];;){for(var p=d,h=!0;p.v;)if((p=p.n)===d)return;c=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(h)for(var s=0,u=c.length;u>s;++s)i.point((f=c[s])[0],f[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(h){c=p.p.z -;for(var s=c.length-1;s>=0;--s)i.point((f=c[s])[0],f[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,c=p.z,h=!h}while(!p.v);i.lineEnd()}}}function Dt(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r0){for(w||(o.polygonStart(),w=!0),o.lineStart();++a1&&2&t&&n.push(n.pop().concat(n.shift())),p.push(n.filter(Nt))}var p,h,m,g=t(o),v=i.invert(r[0],r[1]),y={point:a,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=d,p=[],h=[]},polygonEnd:function(){y.point=a,y.lineStart=l,y.lineEnd=u,p=na.merge(p);var e=Lt(v,h);p.length?(w||(o.polygonStart(),w=!0),Tt(p,It,e,n,o)):e&&(w||(o.polygonStart(),w=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),w&&(o.polygonEnd(),w=!1),p=h=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},b=Rt(),$=t(b),w=!1;return y}}function Nt(e){return e.length>1}function Rt(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,n){e.push([t,n])},lineEnd:w,buffer:function(){var n=t;return t=[],e=null,n},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function It(e,t){return((e=e.x)[0]<0?e[1]-Na-Ma:Na-e[1])-((t=t.x)[0]<0?t[1]-Na-Ma:Na-t[1])}function Pt(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?Da:-Da,l=da(o-n);da(l-Da)0?Na:-Na),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(o,r),t=0):i!==s&&l>=Da&&(da(n-i)Ma?Math.atan((Math.sin(t)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*o*a)):(t+r)/2}function jt(e,t,n,r){var i;if(null==e)i=n*Na,r.point(-Da,i),r.point(0,i),r.point(Da,i),r.point(Da,0),r.point(Da,-i),r.point(0,-i),r.point(-Da,-i),r.point(-Da,0),r.point(-Da,i);else if(da(e[0]-t[0])>Ma){var o=e[0]s;++s){var u=t[s],c=u.length;if(c)for(var f=u[0],d=f[0],p=f[1]/2+Da/4,h=Math.sin(p),m=Math.cos(p),g=1;;){g===c&&(g=0),e=u[g];var v=e[0],y=e[1]/2+Da/4,b=Math.sin(y),$=Math.cos(y),w=v-d,x=w>=0?1:-1,C=x*w,k=C>Da,E=h*b;if(gs.add(Math.atan2(E*x*Math.sin(C),m*$+E*Math.cos(C))),o+=k?w+x*Aa:w,k^d>=n^v>=n){var S=gt(ht(f),ht(e));bt(S);var _=gt(i,S);bt(_);var M=(k^w>=0?-1:1)*te(_[2]);(r>M||r===M&&(S[0]||S[1]))&&(a+=k^w>=0?1:-1)}if(!g++)break;d=v,h=b,m=$,f=e}}return(-Ma>o||Ma>o&&0>gs)^1&a}function Ut(e){function t(e,t){return Math.cos(e)*Math.cos(t)>o}function n(e){var n,o,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,d){var p,h=[f,d],m=t(f,d),g=a?m?0:i(f,d):m?i(f+(0>f?Da:-Da),d):0;if(!n&&(u=l=m)&&e.lineStart(),m!==l&&(p=r(n,h),(wt(n,p)||wt(h,p))&&(h[0]+=Ma,h[1]+=Ma,m=t(h[0],h[1]))),m!==l)c=0,m?(e.lineStart(),p=r(h,n),e.point(p[0],p[1])):(p=r(n,h),e.point(p[0],p[1]),e.lineEnd()),n=p;else if(s&&n&&a^m){var v;g&o||!(v=r(h,n,!0))||(c=0,a?(e.lineStart(),e.point(v[0][0],v[0][1]),e.point(v[1][0],v[1][1]),e.lineEnd()):(e.point(v[1][0],v[1][1]),e.lineEnd(),e.lineStart(),e.point(v[0][0],v[0][1])))}!m||n&&wt(n,h)||e.point(h[0],h[1]),n=h,l=m,o=g},lineEnd:function(){l&&e.lineEnd(),n=null},clean:function(){return c|(u&&l)<<1}}}function r(e,t,n){var r=ht(e),i=ht(t),a=[1,0,0],s=gt(r,i),l=mt(s,s),u=s[0],c=l-u*u;if(!c)return!n&&e;var f=o*l/c,d=-o*u/c,p=gt(a,s),h=yt(a,f);vt(h,yt(s,d));var m=p,g=mt(h,m),v=mt(m,m),y=g*g-v*(mt(h,h)-1);if(!(0>y)){var b=Math.sqrt(y),$=yt(m,(-g-b)/v);if(vt($,h),$=$t($),!n)return $;var w,x=e[0],C=t[0],k=e[1],E=t[1];x>C&&(w=x,x=C,C=w);var S=C-x,_=da(S-Da)S;if(!_&&k>E&&(w=k,k=E,E=w),M?_?k+E>0^$[1]<(da($[0]-x)Da^(x<=$[0]&&$[0]<=C)){var T=yt(m,(-g+b)/v);return vt(T,h),[$,$t(T)]}}}function i(t,n){var r=a?e:Da-e,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>n?i|=4:n>r&&(i|=8),i}var o=Math.cos(e),a=o>0,s=da(o)>Ma;return Ot(t,n,hn(e,6*Ra),a?[0,-e]:[-Da,e-Da])}function Ht(e,t,n,r){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,f=s.y,d=0,p=1,h=c-l,m=f-u;if(o=e-l,h||!(o>0)){if(o/=h,0>h){if(d>o)return;p>o&&(p=o)}else if(h>0){if(o>p)return;o>d&&(d=o)}if(o=n-l,h||!(0>o)){if(o/=h,0>h){if(o>p)return;o>d&&(d=o)}else if(h>0){if(d>o)return;p>o&&(p=o)}if(o=t-u,m||!(o>0)){if(o/=m,0>m){if(d>o)return;p>o&&(p=o)}else if(m>0){if(o>p)return;o>d&&(d=o)}if(o=r-u,m||!(0>o)){if(o/=m,0>m){if(o>p)return;o>d&&(d=o)}else if(m>0){if(d>o)return;p>o&&(p=o)}return d>0&&(i.a={x:l+d*h,y:u+d*m}),1>p&&(i.b={x:l+p*h,y:u+p*m}),i}}}}}}function qt(e,t,n,r){function i(r,i){return da(r[0]-e)0?0:3:da(r[0]-n)0?2:1:da(r[1]-t)0?1:0:i>0?3:2}function o(e,t){return a(e.x,t.x)}function a(e,t){var n=i(e,1),r=i(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(s){function l(e){for(var t=0,n=g.length,r=e[1],i=0;n>i;++i)for(var o,a=1,s=g[i],l=s.length,u=s[0];l>a;++a)o=s[a],u[1]<=r?o[1]>r&&X(u,o,e)>0&&++t:o[1]<=r&&X(u,o,e)<0&&--t,u=o;return 0!==t}function u(o,s,l,u){var c=0,f=0;if(null==o||(c=i(o,l))!==(f=i(s,l))||a(o,s)<0^l>0)do{u.point(0===c||3===c?e:n,c>1?r:t)}while((c=(c+l+4)%4)!==f);else u.point(s[0],s[1])}function c(i,o){return i>=e&&n>=i&&o>=t&&r>=o}function f(e,t){c(e,t)&&s.point(e,t)}function d(){T.point=h,g&&g.push(v=[]),k=!0,C=!1,w=x=NaN}function p(){m&&(h(y,b),$&&C&&_.rejoin(),m.push(_.buffer())),T.point=f,C&&s.lineEnd()}function h(e,t){e=Math.max(-As,Math.min(As,e)),t=Math.max(-As,Math.min(As,t));var n=c(e,t);if(g&&v.push([e,t]),k)y=e,b=t,$=n,k=!1,n&&(s.lineStart(),s.point(e,t));else if(n&&C)s.point(e,t);else{var r={a:{x:w,y:x},b:{x:e,y:t}};M(r)?(C||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),E=!1):n&&(s.lineStart(),s.point(e,t),E=!1)}w=e,x=t,C=n}var m,g,v,y,b,$,w,x,C,k,E,S=s,_=Rt(),M=Ht(e,t,n,r),T={point:f,lineStart:d,lineEnd:p,polygonStart:function(){s=_,m=[],g=[],E=!0},polygonEnd:function(){s=S,m=na.merge(m);var t=l([e,r]),n=E&&t,i=m.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Tt(m,o,t,u,s),s.polygonEnd()),m=g=v=null}};return T}}function Vt(e){var t=0,n=Da/3,r=an(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*Da/180,n=e[1]*Da/180):[t/Da*180,n/Da*180]},i}function zt(e,t){function n(e,t){var n=Math.sqrt(o-2*i*Math.sin(t))/i;return[n*Math.sin(e*=i),a-n*Math.cos(e)]}var r=Math.sin(e),i=(r+Math.sin(t))/2,o=1+r*(2*i-r),a=Math.sqrt(o)/i;return n.invert=function(e,t){var n=a-t;return[Math.atan2(e,n)/i,te((o-(e*e+n*n)*i*i)/(2*i))]},n}function Bt(){function e(e,t){Ns+=i*e-r*t,r=e,i=t}var t,n,r,i;js.point=function(o,a){js.point=e,t=r=o,n=i=a},js.lineEnd=function(){e(t,n)}}function Yt(e,t){Rs>e&&(Rs=e),e>Ps&&(Ps=e),Is>t&&(Is=t),t>Fs&&(Fs=t)}function Wt(){function e(e,t){a.push("M",e,",",t,o)}function t(e,t){a.push("M",e,",",t),s.point=n}function n(e,t){a.push("L",e,",",t)}function r(){s.point=e}function i(){a.push("Z")}var o=Gt(4.5),a=[],s={point:e,lineStart:function(){s.point=t},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r,s.point=e},pointRadius:function(e){return o=Gt(e),s},result:function(){if(a.length){var e=a.join("");return a=[],e}}};return s}function Gt(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function Kt(e,t){$s+=e,ws+=t,++xs}function Zt(){function e(e,r){var i=e-t,o=r-n,a=Math.sqrt(i*i+o*o);Cs+=a*(t+e)/2,ks+=a*(n+r)/2,Es+=a,Kt(t=e,n=r)}var t,n;Us.point=function(r,i){Us.point=e,Kt(t=r,n=i)}}function Jt(){Us.point=Kt}function Qt(){function e(e,t){var n=e-r,o=t-i,a=Math.sqrt(n*n+o*o);Cs+=a*(r+e)/2,ks+=a*(i+t)/2,Es+=a,a=i*e-r*t,Ss+=a*(r+e),_s+=a*(i+t),Ms+=3*a,Kt(r=e,i=t)}var t,n,r,i;Us.point=function(o,a){Us.point=e,Kt(t=r=o,n=i=a)},Us.lineEnd=function(){e(t,n)}}function Xt(e){function t(t,n){e.moveTo(t+a,n),e.arc(t,n,a,0,Aa)}function n(t,n){e.moveTo(t,n),s.point=r}function r(t,n){e.lineTo(t,n)}function i(){s.point=t}function o(){e.closePath()}var a=4.5,s={point:t,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i,s.point=t},pointRadius:function(e){return a=e,s},result:w};return s}function en(e){function t(e){return(s?r:n)(e)}function n(t){return rn(t,function(n,r){n=e(n,r),t.point(n[0],n[1])})}function r(t){function n(n,r){n=e(n,r),t.point(n[0],n[1])}function r(){b=NaN,k.point=o,t.lineStart()}function o(n,r){var o=ht([n,r]),a=e(n,r);i(b,$,y,w,x,C,b=a[0],$=a[1],y=n,w=o[0],x=o[1],C=o[2],s,t),t.point(b,$)}function a(){k.point=n,t.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(e,t){o(f=e,d=t),p=b,h=$,m=w,g=x,v=C,k.point=o}function c(){i(b,$,y,w,x,C,p,h,f,m,g,v,s,t),k.lineEnd=a,a()}var f,d,p,h,m,g,v,y,b,$,w,x,C,k={point:n,lineStart:r,lineEnd:a,polygonStart:function(){t.polygonStart(),k.lineStart=l},polygonEnd:function(){t.polygonEnd(),k.lineStart=r}};return k}function i(t,n,r,s,l,u,c,f,d,p,h,m,g,v){var y=c-t,b=f-n,$=y*y+b*b;if($>4*o&&g--){var w=s+p,x=l+h,C=u+m,k=Math.sqrt(w*w+x*x+C*C),E=Math.asin(C/=k),S=da(da(C)-1)o||da((y*D+b*A)/$-.5)>.3||a>s*p+l*h+u*m)&&(i(t,n,r,s,l,u,M,T,S,w/=k,x/=k,C,g,v),v.point(M,T),i(M,T,S,w,x,C,c,f,d,p,h,m,g,v))}}var o=.5,a=Math.cos(30*Ra),s=16;return t.precision=function(e){return arguments.length?(s=(o=e*e)>0&&16,t):Math.sqrt(o)},t}function tn(e){var t=en(function(t,n){return e([t*Ia,n*Ia])});return function(e){return sn(t(e))}}function nn(e){this.stream=e}function rn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function on(e){return an(function(){return e})()}function an(e){function t(e){return e=s(e[0]*Ra,e[1]*Ra),[e[0]*d+l,u-e[1]*d]}function n(e){return(e=s.invert((e[0]-l)/d,(u-e[1])/d))&&[e[0]*Ia,e[1]*Ia]}function r(){s=_t(a=cn(v,b,$),o);var e=o(m,g);return l=p-e[0]*d,u=h+e[1]*d,i()}function i(){return c&&(c.valid=!1,c=null),t}var o,a,s,l,u,c,f=en(function(e,t){return e=o(e,t),[e[0]*d+l,u-e[1]*d]}),d=150,p=480,h=250,m=0,g=0,v=0,b=0,$=0,w=Ds,x=y,C=null,k=null;return t.stream=function(e){return c&&(c.valid=!1),c=sn(w(a,f(x(e)))),c.valid=!0,c},t.clipAngle=function(e){return arguments.length?(w=null==e?(C=e,Ds):Ut((C=+e)*Ra),i()):C},t.clipExtent=function(e){return arguments.length?(k=e,x=e?qt(e[0][0],e[0][1],e[1][0],e[1][1]):y,i()):k},t.scale=function(e){return arguments.length?(d=+e,r()):d},t.translate=function(e){return arguments.length?(p=+e[0],h=+e[1],r()):[p,h]},t.center=function(e){return arguments.length?(m=e[0]%360*Ra,g=e[1]%360*Ra,r()):[m*Ia,g*Ia]},t.rotate=function(e){return arguments.length?(v=e[0]%360*Ra,b=e[1]%360*Ra,$=e.length>2?e[2]%360*Ra:0,r()):[v*Ia,b*Ia,$*Ia]},na.rebind(t,f,"precision"),function(){return o=e.apply(this,arguments),t.invert=o.invert&&n,r()}}function sn(e){return rn(e,function(t,n){e.point(t*Ra,n*Ra)})}function ln(e,t){return[e,t]}function un(e,t){return[e>Da?e-Aa:-Da>e?e+Aa:e,t]}function cn(e,t,n){return e?t||n?_t(dn(e),pn(t,n)):dn(e):t||n?pn(t,n):un}function fn(e){return function(t,n){return t+=e,[t>Da?t-Aa:-Da>t?t+Aa:t,n]}}function dn(e){var t=fn(e);return t.invert=fn(-e),t}function pn(e,t){function n(e,t){var n=Math.cos(t),s=Math.cos(e)*n,l=Math.sin(e)*n,u=Math.sin(t),c=u*r+s*i;return[Math.atan2(l*o-c*a,s*r-u*i),te(c*o+l*a)]}var r=Math.cos(e),i=Math.sin(e),o=Math.cos(t),a=Math.sin(t);return n.invert=function(e,t){var n=Math.cos(t),s=Math.cos(e)*n,l=Math.sin(e)*n,u=Math.sin(t),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*r+c*i),te(c*r-s*i)]},n}function hn(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,o,a,s){var l=a*t;null!=i?(i=mn(n,i),o=mn(n,o),(a>0?o>i:i>o)&&(i+=a*Aa)):(i=e+a*Aa,o=e-.5*l);for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=$t([n,-r*Math.cos(c),-r*Math.sin(c)]))[0],u[1])}}function mn(e,t){var n=ht(t);n[0]-=e,bt(n);var r=ee(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-Ma)%(2*Math.PI)}function gn(e,t,n){var r=na.range(e,t-Ma,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function vn(e,t,n){var r=na.range(e,t-Ma,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function yn(e){return e.source}function bn(e){return e.target}function $n(e,t,n,r){var i=Math.cos(t),o=Math.sin(t),a=Math.cos(r),s=Math.sin(r),l=i*Math.cos(e),u=i*Math.sin(e),c=a*Math.cos(n),f=a*Math.sin(n),d=2*Math.asin(Math.sqrt(oe(r-t)+i*a*oe(n-e))),p=1/Math.sin(d),h=d?function(e){var t=Math.sin(e*=d)*p,n=Math.sin(d-e)*p,r=n*l+t*c,i=n*u+t*f,a=n*o+t*s;return[Math.atan2(i,r)*Ia,Math.atan2(a,Math.sqrt(r*r+i*i))*Ia]}:function(){return[e*Ia,t*Ia]};return h.distance=d,h}function wn(){function e(e,i){var o=Math.sin(i*=Ra),a=Math.cos(i),s=da((e*=Ra)-t),l=Math.cos(s);Hs+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=r*o-n*a*l)*s),n*o+r*a*l),t=e,n=o,r=a}var t,n,r;qs.point=function(i,o){t=i*Ra,n=Math.sin(o*=Ra),r=Math.cos(o),qs.point=e},qs.lineEnd=function(){qs.point=qs.lineEnd=w}}function xn(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),o=e(r*i);return[o*i*Math.sin(t),o*Math.sin(n)]}return n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(e*o,r*a),Math.asin(r&&n*o/r)]},n}function Cn(e,t){function n(e,t){a>0?-Na+Ma>t&&(t=-Na+Ma):t>Na-Ma&&(t=Na-Ma);var n=a/Math.pow(i(t),o);return[n*Math.sin(o*e),a-n*Math.cos(o*e)]}var r=Math.cos(e),i=function(e){return Math.tan(Da/4+e/2)},o=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(i(t)/i(e)),a=r*Math.pow(i(e),o)/o;return o?(n.invert=function(e,t){var n=a-t,r=Q(o)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/o,2*Math.atan(Math.pow(a/r,1/o))-Na]},n):En}function kn(e,t){function n(e,t){var n=o-t;return[n*Math.sin(i*e),o-n*Math.cos(i*e)]}var r=Math.cos(e),i=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),o=r/i+e;return da(i)i;i++){for(;r>1&&X(e[n[r-2]],e[n[r-1]],e[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function An(e,t){return e[0]-t[0]||e[1]-t[1]}function On(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function Nn(e,t,n,r){var i=e[0],o=n[0],a=t[0]-i,s=r[0]-o,l=e[1],u=n[1],c=t[1]-l,f=r[1]-u,d=(s*(l-u)-f*(i-o))/(f*a-s*c);return[i+d*a,l+d*c]}function Rn(e){var t=e[0],n=e[e.length-1];return!(t[0]-n[0]||t[1]-n[1])}function In(){nr(this),this.edge=this.site=this.circle=null}function Pn(e){var t=el.pop()||new In;return t.site=e,t}function Fn(e){Wn(e),Js.remove(e),el.push(e),nr(e)}function jn(e){var t=e.circle,n=t.x,r=t.cy,i={x:n,y:r},o=e.P,a=e.N,s=[e];Fn(e);for(var l=o;l.circle&&da(n-l.circle.x)c;++c)u=s[c],l=s[c-1],Xn(u.edge,l.site,u.site,i);l=s[0],u=s[f-1],u.edge=Jn(l.site,u.site,null,i),Yn(l),Yn(u)}function Ln(e){for(var t,n,r,i,o=e.x,a=e.y,s=Js._;s;)if((r=Un(s,a)-o)>Ma)s=s.L;else{if(!((i=o-Hn(s,a))>Ma)){r>-Ma?(t=s.P,n=s):i>-Ma?(t=s,n=s.N):t=n=s;break}if(!s.R){t=s;break}s=s.R}var l=Pn(e);if(Js.insert(t,l),t||n){if(t===n)return Wn(t),n=Pn(t.site),Js.insert(l,n),l.edge=n.edge=Jn(t.site,l.site),Yn(t),void Yn(n);if(!n)return void(l.edge=Jn(t.site,l.site));Wn(t),Wn(n);var u=t.site,c=u.x,f=u.y,d=e.x-c,p=e.y-f,h=n.site,m=h.x-c,g=h.y-f,v=2*(d*g-p*m),y=d*d+p*p,b=m*m+g*g,$={x:(g*y-p*b)/v+c,y:(d*b-m*y)/v+f};Xn(n.edge,u,h,$),l.edge=Jn(u,e,null,$),n.edge=Jn(e,h,null,$),Yn(t),Yn(n)}}function Un(e,t){var n=e.site,r=n.x,i=n.y,o=i-t;if(!o)return r;var a=e.P;if(!a)return-1/0;n=a.site;var s=n.x,l=n.y,u=l-t;if(!u)return s;var c=s-r,f=1/o-1/u,d=c/u;return f?(-d+Math.sqrt(d*d-2*f*(c*c/(-2*u)-l+u/2+i-o/2)))/f+r:(r+s)/2}function Hn(e,t){var n=e.N;if(n)return Un(n,t);var r=e.site;return r.y===t?r.x:1/0}function qn(e){this.site=e,this.edges=[]}function Vn(e){for(var t,n,r,i,o,a,s,l,u,c,f=e[0][0],d=e[1][0],p=e[0][1],h=e[1][1],m=Zs,g=m.length;g--;)if((o=m[g])&&o.prepare())for(s=o.edges,l=s.length,a=0;l>a;)c=s[a].end(),r=c.x,i=c.y,u=s[++a%l].start(),t=u.x,n=u.y,(da(r-t)>Ma||da(i-n)>Ma)&&(s.splice(a,0,new er(Qn(o.site,c,da(r-f)Ma?{x:f,y:da(t-f)Ma?{x:da(n-h)Ma?{x:d,y:da(t-d)Ma?{x:da(n-p)=-Ta)){var p=l*l+u*u,h=c*c+f*f,m=(f*p-u*h)/d,g=(l*h-c*p)/d,f=g+s,v=tl.pop()||new Bn;v.arc=e,v.site=i,v.x=m+a,v.y=f+Math.sqrt(m*m+g*g),v.cy=f,e.circle=v;for(var y=null,b=Xs._;b;)if(v.yg||g>=s)return;if(d>h){if(o){if(o.y>=u)return}else o={x:g,y:l};n={x:g,y:u}}else{if(o){if(o.yr||r>1)if(d>h){if(o){if(o.y>=u)return}else o={x:(l-i)/r,y:l};n={x:(u-i)/r,y:u}}else{if(o){if(o.yp){if(o){if(o.x>=s)return}else o={x:a,y:r*a+i};n={x:s,y:r*s+i}}else{if(o){if(o.xo||f>a||r>d||i>p)){if(h=u.point){var h,m=t-u.x,g=n-u.y,v=m*m+g*g;if(l>v){var y=Math.sqrt(l=v);r=t-y,i=n-y,o=t+y,a=n+y,s=h}}for(var b=u.nodes,$=.5*(c+d),w=.5*(f+p),x=t>=$,C=n>=w,k=C<<1|x,E=k+4;E>k;++k)if(u=b[3&k])switch(3&k){case 0:e(u,c,f,$,w);break;case 1:e(u,$,f,d,w);break;case 2:e(u,c,w,$,p);break;case 3:e(u,$,w,d,p)}}}(e,r,i,o,a),s}function hr(e,t){e=na.rgb(e),t=na.rgb(t);var n=e.r,r=e.g,i=e.b,o=t.r-n,a=t.g-r,s=t.b-i;return function(e){return"#"+$e(Math.round(n+o*e))+$e(Math.round(r+a*e))+$e(Math.round(i+s*e))}}function mr(e,t){var n,r={},i={};for(n in e)n in t?r[n]=yr(e[n],t[n]):i[n]=e[n];for(n in t)n in e||(i[n]=t[n]);return function(e){for(n in r)i[n]=r[n](e);return i}}function gr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function vr(e,t){var n,r,i,o=rl.lastIndex=il.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=rl.exec(e))&&(r=il.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:gr(n,r)})),o=il.lastIndex;return or;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}function yr(e,t){for(var n,r=na.interpolators.length;--r>=0&&!(n=na.interpolators[r](e,t)););return n}function br(e,t){var n,r=[],i=[],o=e.length,a=t.length,s=Math.min(e.length,t.length);for(n=0;s>n;++n)r.push(yr(e[n],t[n]));for(;o>n;++n)i[n]=e[n];for(;a>n;++n)i[n]=t[n];return function(e){for(n=0;s>n;++n)i[n]=r[n](e);return i}}function $r(e){return function(t){return 0>=t?0:t>=1?1:e(t)}}function wr(e){return function(t){return 1-e(1-t)}}function xr(e){return function(t){return.5*(.5>t?e(2*t):2-e(2-2*t))}}function Cr(e){return e*e}function kr(e){return e*e*e}function Er(e){if(0>=e)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(.5>e?n:3*(e-t)+n-.75)}function Sr(e){return function(t){return Math.pow(t,e)}}function _r(e){return 1-Math.cos(e*Na)}function Mr(e){return Math.pow(2,10*(e-1))}function Tr(e){return 1-Math.sqrt(1-e*e)}function Dr(e,t){var n;return arguments.length<2&&(t=.45),arguments.length?n=t/Aa*Math.asin(1/e):(e=1,n=t/4),function(r){return 1+e*Math.pow(2,-10*r)*Math.sin((r-n)*Aa/t)}}function Ar(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function Or(e){return 1/2.75>e?7.5625*e*e:2/2.75>e?7.5625*(e-=1.5/2.75)*e+.75:2.5/2.75>e?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function Nr(e,t){e=na.hcl(e),t=na.hcl(t);var n=e.h,r=e.c,i=e.l,o=t.h-n,a=t.c-r,s=t.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?t.c:r),isNaN(o)?(o=0,n=isNaN(n)?t.h:n):o>180?o-=360:-180>o&&(o+=360),function(e){return ce(n+o*e,r+a*e,i+s*e)+""}}function Rr(e,t){e=na.hsl(e),t=na.hsl(t);var n=e.h,r=e.s,i=e.l,o=t.h-n,a=t.s-r,s=t.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?t.s:r),isNaN(o)?(o=0,n=isNaN(n)?t.h:n):o>180?o-=360:-180>o&&(o+=360),function(e){return le(n+o*e,r+a*e,i+s*e)+""}}function Ir(e,t){e=na.lab(e),t=na.lab(t);var n=e.l,r=e.a,i=e.b,o=t.l-n,a=t.a-r,s=t.b-i;return function(e){return de(n+o*e,r+a*e,i+s*e)+""}}function Pr(e,t){return t-=e,function(n){return Math.round(e+t*n)}}function Fr(e){var t=[e.a,e.b],n=[e.c,e.d],r=Lr(t),i=jr(t,n),o=Lr(Ur(n,t,-i))||0;t[0]*n[1]180?c+=360:c-u>180&&(u+=360),i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:gr(u,c)})):c&&r.push(r.pop()+"rotate("+c+")"),f!=d?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:gr(f,d)}):d&&r.push(r.pop()+"skewX("+d+")"),p[0]!=h[0]||p[1]!=h[1]?(n=r.push(r.pop()+"scale(",null,",",null,")"),i.push({i:n-4,x:gr(p[0],h[0])},{i:n-2,x:gr(p[1],h[1])})):(1!=h[0]||1!=h[1])&&r.push(r.pop()+"scale("+h+")"),n=i.length,function(e){for(var t,o=-1;++o=0;)n.push(i[r])}function ei(e,t){for(var n=[e],r=[];null!=(e=n.pop());)if(r.push(e),(o=e.children)&&(i=o.length))for(var i,o,a=-1;++an;++n)(t=e[n][1])>i&&(r=n,i=t);return r}function fi(e){return e.reduce(di,0)}function di(e,t){return e+t[1]}function pi(e,t){return hi(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function hi(e,t){for(var n=-1,r=+e[0],i=(e[1]-r)/t,o=[];++n<=t;)o[n]=i*n+r;return o}function mi(e){return[na.min(e),na.max(e)]}function gi(e,t){return e.value-t.value}function vi(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function yi(e,t){e._pack_next=t,t._pack_prev=e}function bi(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return.999*i*i>n*n+r*r}function $i(e){function t(e){c=Math.min(e.x-e.r,c),f=Math.max(e.x+e.r,f),d=Math.min(e.y-e.r,d),p=Math.max(e.y+e.r,p)}if((n=e.children)&&(u=n.length)){var n,r,i,o,a,s,l,u,c=1/0,f=-1/0,d=1/0,p=-1/0;if(n.forEach(wi),r=n[0],r.x=-r.r,r.y=0,t(r),u>1&&(i=n[1],i.x=i.r,i.y=0,t(i),u>2))for(o=n[2],ki(r,i,o),t(o),vi(r,o),r._pack_prev=o,vi(o,i),i=r._pack_next,a=3;u>a;a++){ki(r,i,o=n[a]);var h=0,m=1,g=1;for(s=i._pack_next;s!==i;s=s._pack_next,m++)if(bi(s,o)){h=1;break}if(1==h)for(l=r._pack_prev;l!==s._pack_prev&&!bi(l,o);l=l._pack_prev,g++);h?(g>m||m==g&&i.ra;a++)o=n[a],o.x-=v,o.y-=y,b=Math.max(b,o.r+Math.sqrt(o.x*o.x+o.y*o.y));e.r=b,n.forEach(xi)}}function wi(e){e._pack_next=e._pack_prev=e}function xi(e){delete e._pack_next,delete e._pack_prev}function Ci(e,t,n,r){var i=e.children;if(e.x=t+=r*e.x,e.y=n+=r*e.y,e.r*=r,i)for(var o=-1,a=i.length;++o=0;)t=i[o],t.z+=n,t.m+=n,n+=t.s+(r+=t.c)}function Di(e,t,n){return e.a.parent===t.parent?e.a:n}function Ai(e){return 1+na.max(e,function(e){return e.y})}function Oi(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Ni(e){var t=e.children;return t&&t.length?Ni(t[0]):e}function Ri(e){var t,n=e.children;return n&&(t=n.length)?Ri(n[t-1]):e}function Ii(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Pi(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],o=e.dy-t[0]-t[2];return 0>i&&(n+=i/2,i=0),0>o&&(r+=o/2,o=0),{x:n,y:r,dx:i,dy:o}}function Fi(e){var t=e[0],n=e[e.length-1];return n>t?[t,n]:[n,t]}function ji(e){return e.rangeExtent?e.rangeExtent():Fi(e.range())}function Li(e,t,n,r){var i=n(e[0],e[1]),o=r(t[0],t[1]);return function(e){return o(i(e))}}function Ui(e,t){var n,r=0,i=e.length-1,o=e[r],a=e[i];return o>a&&(n=r,r=i,i=n,n=o,o=a,a=n),e[r]=t.floor(o),e[i]=t.ceil(a),e}function Hi(e){return e?{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}:ml}function qi(e,t,n,r){var i=[],o=[],a=0,s=Math.min(e.length,t.length)-1;for(e[s]2?qi:Li,l=r?Vr:qr;return a=i(e,t,l,n),s=i(t,e,l,yr),o}function o(e){return a(e)}var a,s;return o.invert=function(e){return s(e)},o.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},o.range=function(e){return arguments.length?(t=e,i()):t},o.rangeRound=function(e){return o.range(e).interpolate(Pr)},o.clamp=function(e){return arguments.length?(r=e,i()):r},o.interpolate=function(e){return arguments.length?(n=e,i()):n},o.ticks=function(t){return Wi(e,t)},o.tickFormat=function(t,n){return Gi(e,t,n)},o.nice=function(t){return Bi(e,t),i()},o.copy=function(){return Vi(e,t,n,r)},i()}function zi(e,t){return na.rebind(e,t,"range","rangeRound","interpolate","clamp")}function Bi(e,t){return Ui(e,Hi(Yi(e,t)[2]))}function Yi(e,t){null==t&&(t=10);var n=Fi(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),o=t/r*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function Wi(e,t){return na.range.apply(na,Yi(e,t))}function Gi(e,t,n){var r=Yi(e,t);if(n){var i=rs.exec(n);if(i.shift(),"s"===i[8]){var o=na.formatPrefix(Math.max(da(r[0]),da(r[1])));return i[7]||(i[7]="."+Ki(o.scale(r[2]))),i[8]="f",n=na.format(i.join("")),function(e){return n(o.scale(e))+o.symbol}}i[7]||(i[7]="."+Zi(i[8],r)),n=i.join("")}else n=",."+Ki(r[2])+"f";return na.format(n)}function Ki(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}function Zi(e,t){var n=Ki(t[2]) -;return e in gl?Math.abs(n-Ki(Math.max(da(t[0]),da(t[1]))))+ +("e"!==e):n-2*("%"===e)}function Ji(e,t,n,r){function i(e){return(n?Math.log(0>e?0:e):-Math.log(e>0?0:-e))/Math.log(t)}function o(e){return n?Math.pow(t,e):-Math.pow(t,-e)}function a(t){return e(i(t))}return a.invert=function(t){return o(e.invert(t))},a.domain=function(t){return arguments.length?(n=t[0]>=0,e.domain((r=t.map(Number)).map(i)),a):r},a.base=function(n){return arguments.length?(t=+n,e.domain(r.map(i)),a):t},a.nice=function(){var t=Ui(r.map(i),n?Math:yl);return e.domain(t),r=t.map(o),a},a.ticks=function(){var e=Fi(r),a=[],s=e[0],l=e[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=t%1?2:t;if(isFinite(c-u)){if(n){for(;c>u;u++)for(var d=1;f>d;d++)a.push(o(u)*d);a.push(o(u))}else for(a.push(o(u));u++0;d--)a.push(o(u)*d);for(u=0;a[u]l;c--);a=a.slice(u,c)}return a},a.tickFormat=function(e,t){if(!arguments.length)return vl;arguments.length<2?t=vl:"function"!=typeof t&&(t=na.format(t));var r,s=Math.max(.1,e/a.ticks().length),l=n?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(e){return e/o(l(i(e)+r))<=s?t(e):""}},a.copy=function(){return Ji(e.copy(),t,n,r)},zi(a,e)}function Qi(e,t,n){function r(t){return e(i(t))}var i=Xi(t),o=Xi(1/t);return r.invert=function(t){return o(e.invert(t))},r.domain=function(t){return arguments.length?(e.domain((n=t.map(Number)).map(i)),r):n},r.ticks=function(e){return Wi(n,e)},r.tickFormat=function(e,t){return Gi(n,e,t)},r.nice=function(e){return r.domain(Bi(n,e))},r.exponent=function(a){return arguments.length?(i=Xi(t=a),o=Xi(1/t),e.domain(n.map(i)),r):t},r.copy=function(){return Qi(e.copy(),t,n)},zi(r,e)}function Xi(e){return function(t){return 0>t?-Math.pow(-t,e):Math.pow(t,e)}}function eo(e,t){function n(n){return o[((i.get(n)||("range"===t.t?i.set(n,e.push(n)):NaN))-1)%o.length]}function r(t,n){return na.range(e.length).map(function(e){return t+n*e})}var i,o,a;return n.domain=function(r){if(!arguments.length)return e;e=[],i=new u;for(var o,a=-1,s=r.length;++an?[NaN,NaN]:[n>0?s[n-1]:e[0],nt?NaN:t/o+e,[t,t+1/o]},r.copy=function(){return no(e,t,n)},i()}function ro(e,t){function n(n){return n>=n?t[na.bisect(e,n)]:void 0}return n.domain=function(t){return arguments.length?(e=t,n):e},n.range=function(e){return arguments.length?(t=e,n):t},n.invertExtent=function(n){return n=t.indexOf(n),[e[n-1],e[n]]},n.copy=function(){return ro(e,t)},n}function io(e){function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=n.map(t),t):e},t.ticks=function(t){return Wi(e,t)},t.tickFormat=function(t,n){return Gi(e,t,n)},t.copy=function(){return io(e)},t}function oo(){return 0}function ao(e){return e.innerRadius}function so(e){return e.outerRadius}function lo(e){return e.startAngle}function uo(e){return e.endAngle}function co(e){return e&&e.padAngle}function fo(e,t,n,r){return(e-n)*t-(t-r)*e>0?0:1}function po(e,t,n,r,i){var o=e[0]-t[0],a=e[1]-t[1],s=(i?r:-r)/Math.sqrt(o*o+a*a),l=s*a,u=-s*o,c=e[0]+l,f=e[1]+u,d=t[0]+l,p=t[1]+u,h=(c+d)/2,m=(f+p)/2,g=d-c,v=p-f,y=g*g+v*v,b=n-r,$=c*p-d*f,w=(0>v?-1:1)*Math.sqrt(b*b*y-$*$),x=($*v-g*w)/y,C=(-$*g-v*w)/y,k=($*v+g*w)/y,E=(-$*g+v*w)/y,S=x-h,_=C-m,M=k-h,T=E-m;return S*S+_*_>M*M+T*T&&(x=k,C=E),[[x-l,C-u],[x*n/b,C*n/b]]}function ho(e){function t(t){function a(){u.push("M",o(e(c),s))}for(var l,u=[],c=[],f=-1,d=t.length,p=Se(n),h=Se(r);++f1&&i.push("H",r[0]),i.join("")}function yo(e){for(var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];++t1){s=t[1],o=e[l],l++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u9&&(i=3*t/Math.sqrt(i),a[s]=i*n,a[s+1]=i*r));for(s=-1;++s<=l;)i=(e[Math.min(l,s+1)][0]-e[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}function Ro(e){return e.length<3?mo(e):e[0]+Co(e,No(e))}function Io(e){for(var t,n,r,i=-1,o=e.length;++ir)return c();var i=o[o.active];i&&(--o.count,delete o[o.active],i.event&&i.event.interrupt.call(e,e.__data__,i.index)),o.active=r,a.event&&a.event.start.call(e,e.__data__,t),a.tween.forEach(function(n,r){(r=r.call(e,e.__data__,t))&&m.push(r)}),d=a.ease,f=a.duration,na.timer(function(){return h.c=u(n||1)?Mt:u,1},0,s)}function u(n){if(o.active!==r)return 1;for(var i=n/f,s=d(i),l=m.length;l>0;)m[--l].call(e,s);return i>=1?(a.event&&a.event.end.call(e,e.__data__,t),c()):void 0}function c(){return--o.count?delete o[r]:delete e[n],1}var f,d,p=a.delay,h=es,m=[];return h.t=p+s,i>=p?l(i-p):void(h.c=l)},0,s)}}function Ko(e,t,n){e.attr("transform",function(e){var r=t(e);return"translate("+(isFinite(r)?r:n(e))+",0)"})}function Zo(e,t,n){e.attr("transform",function(e){var r=t(e);return"translate(0,"+(isFinite(r)?r:n(e))+")"})}function Jo(e){return e.toISOString()}function Qo(e,t,n){function r(t){return e(t)}function i(e,n){var r=e[1]-e[0],i=r/n,o=na.bisect(Vl,i);return o==Vl.length?[t.year,Yi(e.map(function(e){return e/31536e6}),n)[2]]:o?t[i/Vl[o-1]1?{floor:function(t){for(;n(t=e.floor(t));)t=Xo(t-1);return t},ceil:function(t){for(;n(t=e.ceil(t));)t=Xo(+t+1);return t}}:e))},r.ticks=function(e,t){var n=Fi(r.domain()),o=null==e?i(n,10):"number"==typeof e?i(n,e):!e.range&&[{range:e},t];return o&&(e=o[0],t=o[1]),e.range(n[0],Xo(+n[1]+1),1>t?1:t)},r.tickFormat=function(){return n},r.copy=function(){return Qo(e.copy(),t,n)},zi(r,e)}function Xo(e){return new Date(e)}function ea(e){return JSON.parse(e.responseText)}function ta(e){var t=oa.createRange();return t.selectNode(oa.body),t.createContextualFragment(e.responseText)}var na={version:"3.5.6"},ra=[].slice,ia=function(e){return ra.call(e)},oa=this.document;if(oa)try{ia(oa.documentElement.childNodes)[0].nodeType}catch(e){ia=function(e){for(var t=e.length,n=new Array(t);t--;)n[t]=e[t];return n}}if(Date.now||(Date.now=function(){return+new Date}),oa)try{oa.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var aa=this.Element.prototype,sa=aa.setAttribute,la=aa.setAttributeNS,ua=this.CSSStyleDeclaration.prototype,ca=ua.setProperty;aa.setAttribute=function(e,t){sa.call(this,e,t+"")},aa.setAttributeNS=function(e,t,n){la.call(this,e,t,n+"")},ua.setProperty=function(e,t,n){ca.call(this,e,t+"",n)}}na.ascending=n,na.descending=function(e,t){return e>t?-1:t>e?1:t>=e?0:NaN},na.min=function(e,t){var n,r,i=-1,o=e.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},na.max=function(e,t){var n,r,i=-1,o=e.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},na.extent=function(e,t){var n,r,i,o=-1,a=e.length;if(1===arguments.length){for(;++o=r){n=i=r;break}for(;++or&&(n=r),r>i&&(i=r))}else{for(;++o=r){n=i=r;break}for(;++or&&(n=r),r>i&&(i=r))}return[n,i]},na.sum=function(e,t){var n,r=0,o=e.length,a=-1;if(1===arguments.length)for(;++a1?l/(c-1):void 0},na.deviation=function(){var e=na.variance.apply(this,arguments);return e?Math.sqrt(e):e};var fa=o(n);na.bisectLeft=fa.left,na.bisect=na.bisectRight=fa.right,na.bisector=function(e){return o(1===e.length?function(t,r){return n(e(t),r)}:e)},na.shuffle=function(e,t,n){(o=arguments.length)<3&&(n=e.length,2>o&&(t=0));for(var r,i,o=n-t;o;)i=Math.random()*o--|0,r=e[o+t],e[o+t]=e[i+t],e[i+t]=r;return e},na.permute=function(e,t){for(var n=t.length,r=new Array(n);n--;)r[n]=e[t[n]];return r},na.pairs=function(e){for(var t=0,n=e.length-1,r=e[0],i=new Array(0>n?0:n);n>t;)i[t]=[r,r=e[++t]];return i},na.zip=function(){if(!(r=arguments.length))return[];for(var e=-1,t=na.min(arguments,a),n=new Array(t);++e=0;)for(r=e[i],t=r.length;--t>=0;)n[--a]=r[t];return n};var da=Math.abs;na.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("infinite range");var r,i=[],o=s(da(n)),a=-1;if(e*=o,t*=o,0>(n*=o))for(;(r=e+n*++a)>t;)i.push(r/o);else for(;(r=e+n*++a)=o.length)return r?r.call(i,a):n?a.sort(n):a;for(var l,c,f,d,p=-1,h=a.length,m=o[s++],g=new u;++p=o.length)return e;var r=[],i=a[n++];return e.forEach(function(e,i){r.push({key:e,values:t(i,n)})}),i?r.sort(function(e,t){return i(e.key,t.key)}):r}var n,r,i={},o=[],a=[];return i.map=function(t,n){return e(n,t,0)},i.entries=function(n){return t(e(na.map,n,0),0)},i.key=function(e){return o.push(e),i},i.sortKeys=function(e){return a[o.length-1]=e,i},i.sortValues=function(e){return n=e,i},i.rollup=function(e){return r=e,i},i},na.set=function(e){var t=new v;if(e)for(var n=0,r=e.length;r>n;++n)t.add(e[n]);return t},l(v,{has:d,add:function(e){return this._[c(e+="")]=!0,e},remove:p,values:h,size:m,empty:g,forEach:function(e){for(var t in this._)e.call(this,f(t))}}),na.behavior={},na.rebind=function(e,t){for(var n,r=1,i=arguments.length;++r=0&&(r=e.slice(n+1),e=e.slice(0,n)),e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(r,null);return this}},na.event=null,na.requote=function(e){return e.replace(ga,"\\$&")};var ga=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,va={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]},ya=function(e,t){return t.querySelector(e)},ba=function(e,t){return t.querySelectorAll(e)},$a=function(e,t){var n=e.matches||e[$(e,"matchesSelector")];return($a=function(e,t){return n.call(e,t)})(e,t)};"function"==typeof Sizzle&&(ya=function(e,t){return Sizzle(e,t)[0]||null},ba=Sizzle,$a=Sizzle.matchesSelector),na.selection=function(){return na.select(oa.documentElement)};var wa=na.selection.prototype=[];wa.select=function(e){var t,n,r,i,o=[];e=M(e);for(var a=-1,s=this.length;++a=0&&(n=e.slice(0,t),e=e.slice(t+1)),xa.hasOwnProperty(n)?{space:xa[n],local:e}:e}},wa.attr=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node();return e=na.ns.qualify(e),e.local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(D(t,e[t]));return this}return this.each(D(e,t))},wa.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node(),r=(e=N(e)).length,i=-1;if(t=n.classList){for(;++ii){if("string"!=typeof e){2>i&&(n="");for(r in e)this.each(P(r,e[r],n));return this}if(2>i){var o=this.node();return t(o).getComputedStyle(o,null).getPropertyValue(e)}r=""}return this.each(P(e,n,r))},wa.property=function(e,t){if(arguments.length<2){if("string"==typeof e)return this.node()[e];for(t in e)this.each(F(t,e[t]));return this}return this.each(F(e,t))},wa.text=function(e){return arguments.length?this.each("function"==typeof e?function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}:null==e?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent},wa.html=function(e){return arguments.length?this.each("function"==typeof e?function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}:null==e?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML},wa.append=function(e){return e=j(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},wa.insert=function(e,t){return e=j(e),t=M(t),this.select(function(){return this.insertBefore(e.apply(this,arguments),t.apply(this,arguments)||null)})},wa.remove=function(){return this.each(L)},wa.data=function(e,t){function n(e,n){var r,i,o,a=e.length,f=n.length,d=Math.min(a,f),p=new Array(f),h=new Array(f),m=new Array(a);if(t){var g,v=new u,y=new Array(a);for(r=-1;++rr;++r)h[r]=U(n[r]);for(;a>r;++r)m[r]=e[r]}h.update=p,h.parentNode=p.parentNode=m.parentNode=e.parentNode,s.push(h),l.push(p),c.push(m)}var r,i,o=-1,a=this.length;if(!arguments.length){for(e=new Array(a=(r=this[0]).length);++oo;o++){i.push(t=[]),t.parentNode=(n=this[o]).parentNode;for(var s=0,l=n.length;l>s;s++)(r=n[s])&&e.call(r,r.__data__,s,o)&&t.push(r)}return _(i)},wa.order=function(){for(var e=-1,t=this.length;++e=0;)(n=r[i])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},wa.sort=function(e){e=q.apply(this,arguments);for(var t=-1,n=this.length;++te;e++)for(var n=this[e],r=0,i=n.length;i>r;r++){var o=n[r];if(o)return o}return null},wa.size=function(){var e=0;return V(this,function(){++e}),e};var Ca=[];na.selection.enter=z,na.selection.enter.prototype=Ca,Ca.append=wa.append,Ca.empty=wa.empty,Ca.node=wa.node,Ca.call=wa.call,Ca.size=wa.size,Ca.select=function(e){for(var t,n,r,i,o,a=[],s=-1,l=this.length;++sr){if("string"!=typeof e){2>r&&(t=!1);for(n in e)this.each(Y(n,e[n],t));return this}if(2>r)return(r=this.node()["__on"+e])&&r._;n=!1}return this.each(Y(e,t,n))};var ka=na.map({mouseenter:"mouseover",mouseleave:"mouseout"});oa&&ka.forEach(function(e){"on"+e in oa&&ka.remove(e)});var Ea,Sa=0;na.mouse=function(e){return Z(e,E())};var _a=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;na.touch=function(e,t,n){if(arguments.length<3&&(n=t,t=E().changedTouches),t)for(var r,i=0,o=t.length;o>i;++i)if((r=t[i]).identifier===n)return Z(e,r)},na.behavior.drag=function(){function e(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function n(e,t,n,o,a){return function(){function s(){var e,n,r=t(d,m);r&&(e=r[0]-b[0],n=r[1]-b[1],h|=e|n,b=r,p({type:"drag",x:r[0]+u[0],y:r[1]+u[1],dx:e,dy:n}))}function l(){t(d,m)&&(v.on(o+g,null).on(a+g,null),y(h&&na.event.target===f),p({type:"dragend"}))}var u,c=this,f=na.event.target,d=c.parentNode,p=r.of(c,arguments),h=0,m=e(),g=".drag"+(null==m?"":"-"+m),v=na.select(n(f)).on(o+g,s).on(a+g,l),y=K(f),b=t(d,m);i?(u=i.apply(c,arguments),u=[u.x-b[0],u.y-b[1]]):u=[0,0],p({type:"dragstart"})}}var r=S(e,"drag","dragstart","dragend"),i=null,o=n(w,na.mouse,t,"mousemove","mouseup"),a=n(J,na.touch,y,"touchmove","touchend");return e.origin=function(t){return arguments.length?(i=t,e):i},na.rebind(e,r,"on")},na.touches=function(e,t){return arguments.length<2&&(t=E().touches),t?ia(t).map(function(t){var n=Z(e,t);return n.identifier=t.identifier,n}):[]};var Ma=1e-6,Ta=Ma*Ma,Da=Math.PI,Aa=2*Da,Oa=Aa-Ma,Na=Da/2,Ra=Da/180,Ia=180/Da,Pa=Math.SQRT2,Fa=2;na.interpolateZoom=function(e,t){function n(e){var t=e*y;if(v){var n=re(m),a=o/(Fa*d)*(n*ie(Pa*t+m)-ne(m));return[r+a*u,i+a*c,o*n/re(Pa*t+m)]}return[r+e*u,i+e*c,o*Math.exp(Pa*t)]}var r=e[0],i=e[1],o=e[2],a=t[0],s=t[1],l=t[2],u=a-r,c=s-i,f=u*u+c*c,d=Math.sqrt(f),p=(l*l-o*o+4*f)/(2*o*Fa*d),h=(l*l-o*o-4*f)/(2*l*Fa*d),m=Math.log(Math.sqrt(p*p+1)-p),g=Math.log(Math.sqrt(h*h+1)-h),v=g-m,y=(v||Math.log(l/o))/Pa;return n.duration=1e3*y,n},na.behavior.zoom=function(){function e(e){e.on(A,f).on(La+".zoom",p).on("dblclick.zoom",h).on(R,d)}function n(e){return[(e[0]-E.x)/E.k,(e[1]-E.y)/E.k]}function r(e){return[e[0]*E.k+E.x,e[1]*E.k+E.y]}function i(e){E.k=Math.max(M[0],Math.min(M[1],e))}function o(e,t){t=r(t),E.x+=e[0]-t[0],E.y+=e[1]-t[1]}function a(t,n,r,a){t.__chart__={x:E.x,y:E.y,k:E.k},i(Math.pow(2,a)),o(g=n,r),t=na.select(t),T>0&&(t=t.transition().duration(T)),t.call(e.event)}function s(){w&&w.domain($.range().map(function(e){return(e-E.x)/E.k}).map($.invert)),C&&C.domain(x.range().map(function(e){return(e-E.y)/E.k}).map(x.invert))}function l(e){D++||e({type:"zoomstart"})}function u(e){s(),e({type:"zoom",scale:E.k,translate:[E.x,E.y]})}function c(e){--D||(e({type:"zoomend"}),g=null)}function f(){function e(){f=1,o(na.mouse(i),p),u(s)}function r(){d.on(O,null).on(N,null),h(f&&na.event.target===a),c(s)}var i=this,a=na.event.target,s=I.of(i,arguments),f=0,d=na.select(t(i)).on(O,e).on(N,r),p=n(na.mouse(i)),h=K(i);Nl.call(i),l(s)}function d(){function e(){var e=na.touches(h);return p=E.k,e.forEach(function(e){e.identifier in g&&(g[e.identifier]=n(e))}),e}function t(){var t=na.event.target;na.select(t).on($,r).on(w,s),x.push(t);for(var n=na.event.changedTouches,i=0,o=n.length;o>i;++i)g[n[i].identifier]=null;var l=e(),u=Date.now();if(1===l.length){if(500>u-b){var c=l[0];a(h,c,g[c.identifier],Math.floor(Math.log(E.k)/Math.LN2)+1),k()}b=u}else if(l.length>1){var c=l[0],f=l[1],d=c[0]-f[0],p=c[1]-f[1];v=d*d+p*p}}function r(){var e,t,n,r,a=na.touches(h);Nl.call(h);for(var s=0,l=a.length;l>s;++s,r=null)if(n=a[s],r=g[n.identifier]){if(t)break;e=n,t=r}if(r){var c=(c=n[0]-e[0])*c+(c=n[1]-e[1])*c,f=v&&Math.sqrt(c/v);e=[(e[0]+n[0])/2,(e[1]+n[1])/2],t=[(t[0]+r[0])/2,(t[1]+r[1])/2],i(f*p)}b=null,o(e,t),u(m)}function s(){if(na.event.touches.length){for(var t=na.event.changedTouches,n=0,r=t.length;r>n;++n)delete g[t[n].identifier];for(var i in g)return void e()}na.selectAll(x).on(y,null),C.on(A,f).on(R,d),S(),c(m)}var p,h=this,m=I.of(h,arguments),g={},v=0,y=".zoom-"+na.event.changedTouches[0].identifier,$="touchmove"+y,w="touchend"+y,x=[],C=na.select(h),S=K(h);t(),l(m),C.on(A,null).on(R,t)}function p(){var e=I.of(this,arguments);y?clearTimeout(y):(Nl.call(this),m=n(g=v||na.mouse(this)),l(e)),y=setTimeout(function(){y=null,c(e)},50),k(),i(Math.pow(2,.002*ja())*E.k),o(g,m),u(e)}function h(){var e=na.mouse(this),t=Math.log(E.k)/Math.LN2;a(this,e,n(e),na.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}var m,g,v,y,b,$,w,x,C,E={x:0,y:0,k:1},_=[960,500],M=Ua,T=250,D=0,A="mousedown.zoom",O="mousemove.zoom",N="mouseup.zoom",R="touchstart.zoom",I=S(e,"zoomstart","zoom","zoomend");return La||(La="onwheel"in oa?(ja=function(){return-na.event.deltaY*(na.event.deltaMode?120:1)},"wheel"):"onmousewheel"in oa?(ja=function(){return na.event.wheelDelta},"mousewheel"):(ja=function(){return-na.event.detail},"MozMousePixelScroll")),e.event=function(e){e.each(function(){var e=I.of(this,arguments),t=E;Al?na.select(this).transition().each("start.zoom",function(){E=this.__chart__||{x:0,y:0,k:1},l(e)}).tween("zoom:zoom",function(){var n=_[0],r=_[1],i=g?g[0]:n/2,o=g?g[1]:r/2,a=na.interpolateZoom([(i-E.x)/E.k,(o-E.y)/E.k,n/E.k],[(i-t.x)/t.k,(o-t.y)/t.k,n/t.k]);return function(t){var r=a(t),s=n/r[2];this.__chart__=E={x:i-r[0]*s,y:o-r[1]*s,k:s},u(e)}}).each("interrupt.zoom",function(){c(e)}).each("end.zoom",function(){c(e)}):(this.__chart__=E,l(e),u(e),c(e))})},e.translate=function(t){return arguments.length?(E={x:+t[0],y:+t[1],k:E.k},s(),e):[E.x,E.y]},e.scale=function(t){return arguments.length?(E={x:E.x,y:E.y,k:+t},s(),e):E.k},e.scaleExtent=function(t){return arguments.length?(M=null==t?Ua:[+t[0],+t[1]],e):M},e.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],e):v},e.size=function(t){return arguments.length?(_=t&&[+t[0],+t[1]],e):_},e.duration=function(t){return arguments.length?(T=+t,e):T},e.x=function(t){return arguments.length?(w=t,$=t.copy(),E={x:0,y:0,k:1},e):w},e.y=function(t){return arguments.length?(C=t,x=t.copy(),E={x:0,y:0,k:1},e):C},na.rebind(e,I,"on")};var ja,La,Ua=[0,1/0];na.color=ae,ae.prototype.toString=function(){return this.rgb()+""},na.hsl=se;var Ha=se.prototype=new ae;Ha.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new se(this.h,this.s,this.l/e)},Ha.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new se(this.h,this.s,e*this.l)},Ha.rgb=function(){return le(this.h,this.s,this.l)},na.hcl=ue;var qa=ue.prototype=new ae;qa.brighter=function(e){return new ue(this.h,this.c,Math.min(100,this.l+Va*(arguments.length?e:1)))}, -qa.darker=function(e){return new ue(this.h,this.c,Math.max(0,this.l-Va*(arguments.length?e:1)))},qa.rgb=function(){return ce(this.h,this.c,this.l).rgb()},na.lab=fe;var Va=18,za=.95047,Ba=1,Ya=1.08883,Wa=fe.prototype=new ae;Wa.brighter=function(e){return new fe(Math.min(100,this.l+Va*(arguments.length?e:1)),this.a,this.b)},Wa.darker=function(e){return new fe(Math.max(0,this.l-Va*(arguments.length?e:1)),this.a,this.b)},Wa.rgb=function(){return de(this.l,this.a,this.b)},na.rgb=ve;var Ga=ve.prototype=new ae;Ga.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return t||n||r?(t&&i>t&&(t=i),n&&i>n&&(n=i),r&&i>r&&(r=i),new ve(Math.min(255,t/e),Math.min(255,n/e),Math.min(255,r/e))):new ve(i,i,i)},Ga.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new ve(e*this.r,e*this.g,e*this.b)},Ga.hsl=function(){return xe(this.r,this.g,this.b)},Ga.toString=function(){return"#"+$e(this.r)+$e(this.g)+$e(this.b)};var Ka=na.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Ka.forEach(function(e,t){Ka.set(e,ye(t))}),na.functor=Se,na.xhr=_e(y),na.dsv=function(e,t){function n(e,n,o){arguments.length<3&&(o=n,n=null);var a=Me(e,t,null==n?r:i(n),o);return a.row=function(e){return arguments.length?a.response(null==(n=e)?r:i(e)):n},a}function r(e){return n.parse(e.responseText)}function i(e){return function(t){return n.parse(t.responseText,e)}}function o(t){return t.map(a).join(e)}function a(e){return s.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp('["'+e+"\n]"),l=e.charCodeAt(0);return n.parse=function(e,t){var r;return n.parseRows(e,function(e,n){if(r)return r(e,n-1);var i=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");r=t?function(e,n){return t(i(e),n)}:i})},n.parseRows=function(e,t){function n(){if(c>=u)return a;if(i)return i=!1,o;var t=c;if(34===e.charCodeAt(t)){for(var n=t;n++c;){var r=e.charCodeAt(c++),s=1;if(10===r)i=!0;else if(13===r)i=!0,10===e.charCodeAt(c)&&(++c,++s);else if(r!==l)continue;return e.slice(t,c-s)}return e.slice(t)}for(var r,i,o={},a={},s=[],u=e.length,c=0,f=0;(r=n())!==a;){for(var d=[];r!==o&&r!==a;)d.push(r),r=n();t&&null==(d=t(d,f++))||s.push(d)}return s},n.format=function(t){if(Array.isArray(t[0]))return n.formatRows(t);var r=new v,i=[];return t.forEach(function(e){for(var t in e)r.has(t)||i.push(r.add(t))}),[i.map(a).join(e)].concat(t.map(function(t){return i.map(function(e){return a(t[e])}).join(e)})).join("\n")},n.formatRows=function(e){return e.map(o).join("\n")},n},na.csv=na.dsv(",","text/csv"),na.tsv=na.dsv("\t","text/tab-separated-values");var Za,Ja,Qa,Xa,es,ts=this[$(this,"requestAnimationFrame")]||function(e){setTimeout(e,17)};na.timer=function(e,t,n){var r=arguments.length;2>r&&(t=0),3>r&&(n=Date.now());var i=n+t,o={c:e,t:i,f:!1,n:null};Ja?Ja.n=o:Za=o,Ja=o,Qa||(Xa=clearTimeout(Xa),Qa=1,ts(Ae))},na.timer.flush=function(){Oe(),Ne()},na.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};var ns=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(Ie);na.formatPrefix=function(e,t){var n=0;return e&&(0>e&&(e*=-1),t&&(e=na.round(e,Re(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),ns[8+n/3]};var rs=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,is=na.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return(e=na.round(e,Re(e,t))).toFixed(Math.max(0,Math.min(20,Re(e*(1+1e-15),t))))}}),os=na.time={},as=Date;je.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ss.setUTCDate.apply(this._,arguments)},setDay:function(){ss.setUTCDay.apply(this._,arguments)},setFullYear:function(){ss.setUTCFullYear.apply(this._,arguments)},setHours:function(){ss.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ss.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ss.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ss.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ss.setUTCSeconds.apply(this._,arguments)},setTime:function(){ss.setTime.apply(this._,arguments)}};var ss=Date.prototype;os.year=Le(function(e){return e=os.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),os.years=os.year.range,os.years.utc=os.year.utc.range,os.day=Le(function(e){var t=new as(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),os.days=os.day.range,os.days.utc=os.day.utc.range,os.dayOfYear=function(e){var t=os.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,t){t=7-t;var n=os[e]=Le(function(e){return(e=os.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+7*Math.floor(t))},function(e){var n=os.year(e).getDay();return Math.floor((os.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});os[e+"s"]=n.range,os[e+"s"].utc=n.utc.range,os[e+"OfYear"]=function(e){var n=os.year(e).getDay();return Math.floor((os.dayOfYear(e)+(n+t)%7)/7)}}),os.week=os.sunday,os.weeks=os.sunday.range,os.weeks.utc=os.sunday.utc.range,os.weekOfYear=os.sundayOfYear;var ls={"-":"",_:" ",0:"0"},us=/^\s*\d+/,cs=/^%/;na.locale=function(e){return{numberFormat:Pe(e),timeFormat:He(e)}};var fs=na.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});na.format=fs.numberFormat,na.geo={},lt.prototype={s:0,t:0,add:function(e){ut(e,this.t,ds),ut(ds.s,this.s,this),this.s?this.t+=ds.t:this.s=ds.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ds=new lt;na.geo.stream=function(e,t){e&&ps.hasOwnProperty(e.type)?ps[e.type](e,t):ct(e,t)};var ps={Feature:function(e,t){ct(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++re?4*Da+e:e,vs.lineStart=vs.lineEnd=vs.point=w}};na.geo.bounds=function(){function e(e,t){b.push($=[c=e,d=e]),f>t&&(f=t),t>p&&(p=t)}function t(t,n){var r=ht([t*Ra,n*Ra]);if(v){var i=gt(v,r),o=[i[1],-i[0],0],a=gt(o,i);bt(a),a=$t(a);var l=t-h,u=l>0?1:-1,m=a[0]*Ia*u,g=da(l)>180;if(g^(m>u*h&&u*t>m)){var y=a[1]*Ia;y>p&&(p=y)}else if(m=(m+360)%360-180,g^(m>u*h&&u*t>m)){var y=-a[1]*Ia;f>y&&(f=y)}else f>n&&(f=n),n>p&&(p=n);g?h>t?s(c,t)>s(c,d)&&(d=t):s(t,d)>s(c,d)&&(c=t):d>=c?(c>t&&(c=t),t>d&&(d=t)):t>h?s(c,t)>s(c,d)&&(d=t):s(t,d)>s(c,d)&&(c=t)}else e(t,n);v=r,h=t}function n(){w.point=t}function r(){$[0]=c,$[1]=d,w.point=e,v=null}function i(e,n){if(v){var r=e-h;y+=da(r)>180?r+(r>0?360:-360):r}else m=e,g=n;vs.point(e,n),t(e,n)}function o(){vs.lineStart()}function a(){i(m,g),vs.lineEnd(),da(y)>Ma&&(c=-(d=180)),$[0]=c,$[1]=d,v=null}function s(e,t){return(t-=e)<0?t+360:t}function l(e,t){return e[0]-t[0]}function u(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:egs?(c=-(d=180),f=-(p=90)):y>Ma?p=90:-Ma>y&&(f=-90),$[0]=c,$[1]=d}};return function(e){p=d=-(c=f=1/0),b=[],na.geo.stream(e,w);var t=b.length;if(t){b.sort(l);for(var n,r=1,i=b[0],o=[i];t>r;++r)n=b[r],u(n[0],i)||u(n[1],i)?(s(i[0],n[1])>s(i[0],i[1])&&(i[1]=n[1]),s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])):o.push(i=n);for(var a,n,h=-1/0,t=o.length-1,r=0,i=o[t];t>=r;i=n,++r)n=o[r],(a=s(i[1],n[0]))>h&&(h=a,c=n[0],d=i[1])}return b=$=null,1/0===c||1/0===f?[[NaN,NaN],[NaN,NaN]]:[[c,f],[d,p]]}}(),na.geo.centroid=function(e){ys=bs=$s=ws=xs=Cs=ks=Es=Ss=_s=Ms=0,na.geo.stream(e,Ts);var t=Ss,n=_s,r=Ms,i=t*t+n*n+r*r;return Ta>i&&(t=Cs,n=ks,r=Es,Ma>bs&&(t=$s,n=ws,r=xs),i=t*t+n*n+r*r,Ta>i)?[NaN,NaN]:[Math.atan2(n,t)*Ia,te(r/Math.sqrt(i))*Ia]};var ys,bs,$s,ws,xs,Cs,ks,Es,Ss,_s,Ms,Ts={sphere:w,point:xt,lineStart:kt,lineEnd:Et,polygonStart:function(){Ts.lineStart=St},polygonEnd:function(){Ts.lineStart=kt}},Ds=Ot(Mt,Pt,jt,[-Da,-Da/2]),As=1e9;na.geo.clipExtent=function(){var e,t,n,r,i,o,a={stream:function(e){return i&&(i.valid=!1),i=o(e),i.valid=!0,i},extent:function(s){return arguments.length?(o=qt(e=+s[0][0],t=+s[0][1],n=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),a):[[e,t],[n,r]]}};return a.extent([[0,0],[960,500]])},(na.geo.conicEqualArea=function(){return Vt(zt)}).raw=zt,na.geo.albers=function(){return na.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},na.geo.albersUsa=function(){function e(e){var o=e[0],a=e[1];return t=null,n(o,a),t||(r(o,a),t)||i(o,a),t}var t,n,r,i,o=na.geo.albers(),a=na.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=na.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(e,n){t=[e,n]}};return e.invert=function(e){var t=o.scale(),n=o.translate(),r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?a:i>=.166&&.234>i&&r>=-.214&&-.115>r?s:o).invert(e)},e.stream=function(e){var t=o.stream(e),n=a.stream(e),r=s.stream(e);return{point:function(e,i){t.point(e,i),n.point(e,i),r.point(e,i)},sphere:function(){t.sphere(),n.sphere(),r.sphere()},lineStart:function(){t.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},e.precision=function(t){return arguments.length?(o.precision(t),a.precision(t),s.precision(t),e):o.precision()},e.scale=function(t){return arguments.length?(o.scale(t),a.scale(.35*t),s.scale(t),e.translate(o.translate())):o.scale()},e.translate=function(t){if(!arguments.length)return o.translate();var u=o.scale(),c=+t[0],f=+t[1];return n=o.translate(t).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,r=a.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Ma,f+.12*u+Ma],[c-.214*u-Ma,f+.234*u-Ma]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Ma,f+.166*u+Ma],[c-.115*u-Ma,f+.234*u-Ma]]).stream(l).point,e},e.scale(1070)};var Os,Ns,Rs,Is,Ps,Fs,js={point:w,lineStart:w,lineEnd:w,polygonStart:function(){Ns=0,js.lineStart=Bt},polygonEnd:function(){js.lineStart=js.lineEnd=js.point=w,Os+=da(Ns/2)}},Ls={point:Yt,lineStart:w,lineEnd:w,polygonStart:w,polygonEnd:w},Us={point:Kt,lineStart:Zt,lineEnd:Jt,polygonStart:function(){Us.lineStart=Qt},polygonEnd:function(){Us.point=Kt,Us.lineStart=Zt,Us.lineEnd=Jt}};na.geo.path=function(){function e(e){return e&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=i(o)),na.geo.stream(e,a)),o.result()}function t(){return a=null,e}var n,r,i,o,a,s=4.5;return e.area=function(e){return Os=0,na.geo.stream(e,i(js)),Os},e.centroid=function(e){return $s=ws=xs=Cs=ks=Es=Ss=_s=Ms=0,na.geo.stream(e,i(Us)),Ms?[Ss/Ms,_s/Ms]:Es?[Cs/Es,ks/Es]:xs?[$s/xs,ws/xs]:[NaN,NaN]},e.bounds=function(e){return Ps=Fs=-(Rs=Is=1/0),na.geo.stream(e,i(Ls)),[[Rs,Is],[Ps,Fs]]},e.projection=function(e){return arguments.length?(i=(n=e)?e.stream||tn(e):y,t()):n},e.context=function(e){return arguments.length?(o=null==(r=e)?new Wt:new Xt(e),"function"!=typeof s&&o.pointRadius(s),t()):r},e.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(o.pointRadius(+t),+t),e):s},e.projection(na.geo.albersUsa()).context(null)},na.geo.transform=function(e){return{stream:function(t){var n=new nn(t);for(var r in e)n[r]=e[r];return n}}},nn.prototype={point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},na.geo.projection=on,na.geo.projectionMutator=an,(na.geo.equirectangular=function(){return on(ln)}).raw=ln.invert=ln,na.geo.rotation=function(e){function t(t){return t=e(t[0]*Ra,t[1]*Ra),t[0]*=Ia,t[1]*=Ia,t}return e=cn(e[0]%360*Ra,e[1]*Ra,e.length>2?e[2]*Ra:0),t.invert=function(t){return t=e.invert(t[0]*Ra,t[1]*Ra),t[0]*=Ia,t[1]*=Ia,t},t},un.invert=ln,na.geo.circle=function(){function e(){var e="function"==typeof r?r.apply(this,arguments):r,t=cn(-e[0]*Ra,-e[1]*Ra,0).invert,i=[];return n(null,null,1,{point:function(e,n){i.push(e=t(e,n)),e[0]*=Ia,e[1]*=Ia}}),{type:"Polygon",coordinates:[i]}}var t,n,r=[0,0],i=6;return e.origin=function(t){return arguments.length?(r=t,e):r},e.angle=function(r){return arguments.length?(n=hn((t=+r)*Ra,i*Ra),e):t},e.precision=function(r){return arguments.length?(n=hn(t*Ra,(i=+r)*Ra),e):i},e.angle(90)},na.geo.distance=function(e,t){var n,r=(t[0]-e[0])*Ra,i=e[1]*Ra,o=t[1]*Ra,a=Math.sin(r),s=Math.cos(r),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*a)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)},na.geo.graticule=function(){function e(){return{type:"MultiLineString",coordinates:t()}}function t(){return na.range(Math.ceil(o/g)*g,i,g).map(d).concat(na.range(Math.ceil(u/v)*v,l,v).map(p)).concat(na.range(Math.ceil(r/h)*h,n,h).filter(function(e){return da(e%g)>Ma}).map(c)).concat(na.range(Math.ceil(s/m)*m,a,m).filter(function(e){return da(e%v)>Ma}).map(f))}var n,r,i,o,a,s,l,u,c,f,d,p,h=10,m=h,g=90,v=360,y=2.5;return e.lines=function(){return t().map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(p(l).slice(1),d(i).reverse().slice(1),p(u).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.majorExtent(t).minorExtent(t):e.minorExtent()},e.majorExtent=function(t){return arguments.length?(o=+t[0][0],i=+t[1][0],u=+t[0][1],l=+t[1][1],o>i&&(t=o,o=i,i=t),u>l&&(t=u,u=l,l=t),e.precision(y)):[[o,u],[i,l]]},e.minorExtent=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),e.precision(y)):[[r,s],[n,a]]},e.step=function(t){return arguments.length?e.majorStep(t).minorStep(t):e.minorStep()},e.majorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],e):[g,v]},e.minorStep=function(t){return arguments.length?(h=+t[0],m=+t[1],e):[h,m]},e.precision=function(t){return arguments.length?(y=+t,c=gn(s,a,90),f=vn(r,n,y),d=gn(u,l,90),p=vn(o,i,y),e):y},e.majorExtent([[-180,-90+Ma],[180,90-Ma]]).minorExtent([[-180,-80-Ma],[180,80+Ma]])},na.geo.greatArc=function(){function e(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),n||i.apply(this,arguments)]}}var t,n,r=yn,i=bn;return e.distance=function(){return na.geo.distance(t||r.apply(this,arguments),n||i.apply(this,arguments))},e.source=function(n){return arguments.length?(r=n,t="function"==typeof n?null:n,e):r},e.target=function(t){return arguments.length?(i=t,n="function"==typeof t?null:t,e):i},e.precision=function(){return arguments.length?e:0},e},na.geo.interpolate=function(e,t){return $n(e[0]*Ra,e[1]*Ra,t[0]*Ra,t[1]*Ra)},na.geo.length=function(e){return Hs=0,na.geo.stream(e,qs),Hs};var Hs,qs={sphere:w,point:w,lineStart:wn,lineEnd:w,polygonStart:w,polygonEnd:w},Vs=xn(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(na.geo.azimuthalEqualArea=function(){return on(Vs)}).raw=Vs;var zs=xn(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},y);(na.geo.azimuthalEquidistant=function(){return on(zs)}).raw=zs,(na.geo.conicConformal=function(){return Vt(Cn)}).raw=Cn,(na.geo.conicEquidistant=function(){return Vt(kn)}).raw=kn;var Bs=xn(function(e){return 1/e},Math.atan);(na.geo.gnomonic=function(){return on(Bs)}).raw=Bs,En.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-Na]},(na.geo.mercator=function(){return Sn(En)}).raw=En;var Ys=xn(function(){return 1},Math.asin);(na.geo.orthographic=function(){return on(Ys)}).raw=Ys;var Ws=xn(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(na.geo.stereographic=function(){return on(Ws)}).raw=Ws,_n.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Na]},(na.geo.transverseMercator=function(){var e=Sn(_n),t=e.center,n=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return e?n([e[0],e[1],e.length>2?e[2]+90:90]):(e=n(),[e[0],e[1],e[2]-90])},n([0,0,90])}).raw=_n,na.geom={},na.geom.hull=function(e){function t(e){if(e.length<3)return[];var t,i=Se(n),o=Se(r),a=e.length,s=[],l=[];for(t=0;a>t;t++)s.push([+i.call(this,e[t],t),+o.call(this,e[t],t),t]);for(s.sort(An),t=0;a>t;t++)l.push([s[t][0],-s[t][1]]);var u=Dn(s),c=Dn(l),f=c[0]===u[0],d=c[c.length-1]===u[u.length-1],p=[];for(t=u.length-1;t>=0;--t)p.push(e[s[u[t]][2]]);for(t=+f;t=r&&u.x<=o&&u.y>=i&&u.y<=a?[[r,a],[o,a],[o,i],[r,i]]:[]).point=e[s]}),t}function n(e){return e.map(function(e,t){return{x:Math.round(o(e,t)/Ma)*Ma,y:Math.round(a(e,t)/Ma)*Ma,i:t}})}var r=Mn,i=Tn,o=r,a=i,s=nl;return e?t(e):(t.links=function(e){return ar(n(e)).edges.filter(function(e){return e.l&&e.r}).map(function(t){return{source:e[t.l.i],target:e[t.r.i]}})},t.triangles=function(e){var t=[];return ar(n(e)).cells.forEach(function(n,r){for(var i,o=n.site,a=n.edges.sort(zn),s=-1,l=a.length,u=a[l-1].edge,c=u.l===o?u.r:u.l;++s=u,d=r>=c,p=d<<1|f;e.leaf=!1,e=e.nodes[p]||(e.nodes[p]=fr()),f?i=u:s=u,d?a=c:l=c,o(e,t,n,r,i,a,s,l)}var c,f,d,p,h,m,g,v,y,b=Se(s),$=Se(l);if(null!=t)m=t,g=n,v=r,y=i;else if(v=y=-(m=g=1/0),f=[],d=[],h=e.length,a)for(p=0;h>p;++p)c=e[p],c.xv&&(v=c.x),c.y>y&&(y=c.y),f.push(c.x),d.push(c.y);else for(p=0;h>p;++p){var w=+b(c=e[p],p),x=+$(c,p);m>w&&(m=w),g>x&&(g=x),w>v&&(v=w),x>y&&(y=x),f.push(w),d.push(x)}var C=v-m,k=y-g;C>k?y=g+C:v=m+k;var E=fr();if(E.add=function(e){o(E,e,+b(e,++p),+$(e,p),m,g,v,y)},E.visit=function(e){dr(e,E,m,g,v,y)},E.find=function(e){return pr(E,e[0],e[1],m,g,v,y)},p=-1,null==t){for(;++p=0?e.slice(0,t):e,r=t>=0?e.slice(t+1):"in";return n=al.get(n)||ol,r=sl.get(r)||y,$r(r(n.apply(null,ra.call(arguments,1))))},na.interpolateHcl=Nr,na.interpolateHsl=Rr,na.interpolateLab=Ir,na.interpolateRound=Pr,na.transform=function(e){var t=oa.createElementNS(na.ns.prefix.svg,"g");return(na.transform=function(e){if(null!=e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate()}return new Fr(n?n.matrix:ll)})(e)},Fr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ll={a:1,b:0,c:0,d:1,e:0,f:0};na.interpolateTransform=Hr,na.layout={},na.layout.bundle=function(){return function(e){for(var t=[],n=-1,r=e.length;++ns*s/g){if(h>l){var u=t.charge/l;e.px-=o*u,e.py-=a*u}return!0}if(t.point&&l&&h>l){var u=t.pointCharge/l;e.px-=o*u,e.py-=a*u}}return!t.charge}}function t(e){e.px=na.event.x,e.py=na.event.y,s.resume()}var n,r,i,o,a,s={},l=na.dispatch("start","tick","end"),u=[1,1],c=.9,f=ul,d=cl,p=-30,h=fl,m=.1,g=.64,v=[],b=[];return s.tick=function(){if((r*=.99)<.005)return l.end({type:"end",alpha:r=0}),!0;var t,n,s,f,d,h,g,y,$,w=v.length,x=b.length;for(n=0;x>n;++n)s=b[n],f=s.source,d=s.target,y=d.x-f.x,$=d.y-f.y,(h=y*y+$*$)&&(h=r*o[n]*((h=Math.sqrt(h))-i[n])/h,y*=h,$*=h,d.x-=y*(g=f.weight/(d.weight+f.weight)),d.y-=$*g,f.x+=y*(g=1-g),f.y+=$*g);if((g=r*m)&&(y=u[0]/2,$=u[1]/2,n=-1,g))for(;++n0?e:0:e>0&&(l.start({type:"start",alpha:r=e}),na.timer(s.tick)),s):r},s.start=function(){function e(e,r){if(!n){for(n=new Array(l),s=0;l>s;++s)n[s]=[];for(s=0;c>s;++s){var i=b[s];n[i.source.index].push(i.target),n[i.target.index].push(i.source)}}for(var o,a=n[t],s=-1,u=a.length;++st;++t)(r=v[t]).index=t,r.weight=0;for(t=0;c>t;++t)r=b[t],"number"==typeof r.source&&(r.source=v[r.source]),"number"==typeof r.target&&(r.target=v[r.target]),++r.source.weight,++r.target.weight;for(t=0;l>t;++t)r=v[t],isNaN(r.x)&&(r.x=e("x",h)),isNaN(r.y)&&(r.y=e("y",m)), -isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(i=[],"function"==typeof f)for(t=0;c>t;++t)i[t]=+f.call(this,b[t],t);else for(t=0;c>t;++t)i[t]=f;if(o=[],"function"==typeof d)for(t=0;c>t;++t)o[t]=+d.call(this,b[t],t);else for(t=0;c>t;++t)o[t]=d;if(a=[],"function"==typeof p)for(t=0;l>t;++t)a[t]=+p.call(this,v[t],t);else for(t=0;l>t;++t)a[t]=p;return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){return n||(n=na.behavior.drag().origin(y).on("dragstart.force",Wr).on("drag.force",t).on("dragend.force",Gr)),arguments.length?void this.on("mouseover.force",Kr).on("mouseout.force",Zr).call(n):n},na.rebind(s,l,"on")};var ul=20,cl=1,fl=1/0;na.layout.hierarchy=function(){function e(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(u=n.call(e,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)a.push(c=u[l]),c.parent=o,c.depth=o.depth+1;r&&(o.value=0),o.children=u}else r&&(o.value=+r.call(e,o,o.depth)||0),delete o.children;return ei(i,function(e){var n,i;t&&(n=e.children)&&n.sort(t),r&&(i=e.parent)&&(i.value+=e.value)}),s}var t=ri,n=ti,r=ni;return e.sort=function(n){return arguments.length?(t=n,e):t},e.children=function(t){return arguments.length?(n=t,e):n},e.value=function(t){return arguments.length?(r=t,e):r},e.revalue=function(t){return r&&(Xr(t,function(e){e.children&&(e.value=0)}),ei(t,function(t){var n;t.children||(t.value=+r.call(e,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)})),t},e},na.layout.partition=function(){function e(t,n,r,i){var o=t.children;if(t.x=n,t.y=t.depth*i,t.dx=r,t.dy=i,o&&(a=o.length)){var a,s,l,u=-1;for(r=t.value?r/t.value:0;++uf?-1:1),h=(f-l*p)/na.sum(u),m=na.range(l),g=[];return null!=n&&m.sort(n===dl?function(e,t){return u[t]-u[e]}:function(e,t){return n(a[e],a[t])}),m.forEach(function(e){g[e]={data:a[e],value:s=u[e],startAngle:c,endAngle:c+=s*h+p,padAngle:d}}),g}var t=Number,n=dl,r=0,i=Aa,o=0;return e.value=function(n){return arguments.length?(t=n,e):t},e.sort=function(t){return arguments.length?(n=t,e):n},e.startAngle=function(t){return arguments.length?(r=t,e):r},e.endAngle=function(t){return arguments.length?(i=t,e):i},e.padAngle=function(t){return arguments.length?(o=t,e):o},e};var dl={};na.layout.stack=function(){function e(s,l){if(!(d=s.length))return s;var u=s.map(function(n,r){return t.call(e,n,r)}),c=u.map(function(t){return t.map(function(t,n){return[o.call(e,t,n),a.call(e,t,n)]})}),f=n.call(e,c,l);u=na.permute(u,f),c=na.permute(c,f);var d,p,h,m,g=r.call(e,c,l),v=u[0].length;for(h=0;v>h;++h)for(i.call(e,u[0][h],m=g[h],c[0][h][1]),p=1;d>p;++p)i.call(e,u[p][h],m+=c[p-1][h][1],c[p][h][1]);return s}var t=y,n=li,r=ui,i=si,o=oi,a=ai;return e.values=function(n){return arguments.length?(t=n,e):t},e.order=function(t){return arguments.length?(n="function"==typeof t?t:pl.get(t)||li,e):n},e.offset=function(t){return arguments.length?(r="function"==typeof t?t:hl.get(t)||ui,e):r},e.x=function(t){return arguments.length?(o=t,e):o},e.y=function(t){return arguments.length?(a=t,e):a},e.out=function(t){return arguments.length?(i=t,e):i},e};var pl=na.map({"inside-out":function(e){var t,n,r=e.length,i=e.map(ci),o=e.map(fi),a=na.range(r).sort(function(e,t){return i[e]-i[t]}),s=0,l=0,u=[],c=[];for(t=0;r>t;++t)n=a[t],l>s?(s+=o[n],u.push(n)):(l+=o[n],c.push(n));return c.reverse().concat(u)},reverse:function(e){return na.range(e.length).reverse()},default:li}),hl=na.map({silhouette:function(e){var t,n,r,i=e.length,o=e[0].length,a=[],s=0,l=[];for(n=0;o>n;++n){for(t=0,r=0;i>t;t++)r+=e[t][n][1];r>s&&(s=r),a.push(r)}for(n=0;o>n;++n)l[n]=(s-a[n])/2;return l},wiggle:function(e){var t,n,r,i,o,a,s,l,u,c=e.length,f=e[0],d=f.length,p=[];for(p[0]=l=u=0,n=1;d>n;++n){for(t=0,i=0;c>t;++t)i+=e[t][n][1];for(t=0,o=0,s=f[n][0]-f[n-1][0];c>t;++t){for(r=0,a=(e[t][n][1]-e[t][n-1][1])/(2*s);t>r;++r)a+=(e[r][n][1]-e[r][n-1][1])/s;o+=a*e[t][n][1]}p[n]=l-=i?o/i*s:0,u>l&&(u=l)}for(n=0;d>n;++n)p[n]-=u;return p},expand:function(e){var t,n,r,i=e.length,o=e[0].length,a=1/i,s=[];for(n=0;o>n;++n){for(t=0,r=0;i>t;t++)r+=e[t][n][1];if(r)for(t=0;i>t;t++)e[t][n][1]/=r;else for(t=0;i>t;t++)e[t][n][1]=a}for(n=0;o>n;++n)s[n]=0;return s},zero:ui});na.layout.histogram=function(){function e(e,o){for(var a,s,l=[],u=e.map(n,this),c=r.call(this,u,o),f=i.call(this,c,u,o),o=-1,d=u.length,p=f.length-1,h=t?1:1/d;++o0)for(o=-1;++o=c[0]&&s<=c[1]&&(a=l[na.bisect(f,s,1,p)-1],a.y+=h,a.push(e[o]));return l}var t=!0,n=Number,r=mi,i=pi;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=Se(t),e):r},e.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return hi(e,t)}:Se(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},na.layout.pack=function(){function e(e,o){var a=n.call(this,e,o),s=a[0],l=i[0],u=i[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,ei(s,function(e){e.r=+c(e.value)}),ei(s,$i),r){var f=r*(t?1:Math.max(2*s.r/l,2*s.r/u))/2;ei(s,function(e){e.r+=f}),ei(s,$i),ei(s,function(e){e.r-=f})}return Ci(s,l/2,u/2,t?1:1/Math.max(2*s.r/l,2*s.r/u)),a}var t,n=na.layout.hierarchy().sort(gi),r=0,i=[1,1];return e.size=function(t){return arguments.length?(i=t,e):i},e.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,e):t},e.padding=function(t){return arguments.length?(r=+t,e):r},Qr(e,n)},na.layout.tree=function(){function e(e,i){var c=a.call(this,e,i),f=c[0],d=t(f);if(ei(d,n),d.parent.m=-d.z,Xr(d,r),u)Xr(f,o);else{var p=f,h=f,m=f;Xr(f,function(e){e.xh.x&&(h=e),e.depth>m.depth&&(m=e)});var g=s(p,h)/2-p.x,v=l[0]/(h.x+s(h,p)/2+g),y=l[1]/(m.depth||1);Xr(f,function(e){e.x=(e.x+g)*v,e.y=e.depth*y})}return c}function t(e){for(var t,n={A:null,children:[e]},r=[n];null!=(t=r.pop());)for(var i,o=t.children,a=0,s=o.length;s>a;++a)r.push((o[a]=i={_:o[a],parent:t,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return n.children[0]}function n(e){var t=e.children,n=e.parent.children,r=e.i?n[e.i-1]:null;if(t.length){Ti(e);var o=(t[0].z+t[t.length-1].z)/2;r?(e.z=r.z+s(e._,r._),e.m=e.z-o):e.z=o}else r&&(e.z=r.z+s(e._,r._));e.parent.A=i(e,r,e.parent.A||n[0])}function r(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function i(e,t,n){if(t){for(var r,i=e,o=e,a=t,l=i.parent.children[0],u=i.m,c=o.m,f=a.m,d=l.m;a=_i(a),i=Si(i),a&&i;)l=Si(l),o=_i(o),o.a=e,r=a.z+f-i.z-u+s(a._,i._),r>0&&(Mi(Di(a,e,n),e,r),u+=r,c+=r),f+=a.m,u+=i.m,d+=l.m,c+=o.m;a&&!_i(o)&&(o.t=a,o.m+=f-c),i&&!Si(l)&&(l.t=i,l.m+=u-d,n=e)}return n}function o(e){e.x*=l[0],e.y=e.depth*l[1]}var a=na.layout.hierarchy().sort(null).value(null),s=Ei,l=[1,1],u=null;return e.separation=function(t){return arguments.length?(s=t,e):s},e.size=function(t){return arguments.length?(u=null==(l=t)?o:null,e):u?null:l},e.nodeSize=function(t){return arguments.length?(u=null==(l=t)?null:o,e):u?l:null},Qr(e,a)},na.layout.cluster=function(){function e(e,o){var a,s=t.call(this,e,o),l=s[0],u=0;ei(l,function(e){var t=e.children;t&&t.length?(e.x=Oi(t),e.y=Ai(t)):(e.x=a?u+=n(e,a):0,e.y=0,a=e)});var c=Ni(l),f=Ri(l),d=c.x-n(c,f)/2,p=f.x+n(f,c)/2;return ei(l,i?function(e){e.x=(e.x-l.x)*r[0],e.y=(l.y-e.y)*r[1]}:function(e){e.x=(e.x-d)/(p-d)*r[0],e.y=(1-(l.y?e.y/l.y:1))*r[1]}),s}var t=na.layout.hierarchy().sort(null).value(null),n=Ei,r=[1,1],i=!1;return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(i=null==(r=t),e):i?null:r},e.nodeSize=function(t){return arguments.length?(i=null!=(r=t),e):i?r:null},Qr(e,t)},na.layout.treemap=function(){function e(e,t){for(var n,r,i=-1,o=e.length;++it?0:t),n.area=isNaN(r)||0>=r?0:r}function t(n){var o=n.children;if(o&&o.length){var a,s,l,u=f(n),c=[],d=o.slice(),h=1/0,m="slice"===p?u.dx:"dice"===p?u.dy:"slice-dice"===p?1&n.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(e(d,u.dx*u.dy/n.value),c.area=0;(l=d.length)>0;)c.push(a=d[l-1]),c.area+=a.area,"squarify"!==p||(s=r(c,m))<=h?(d.pop(),h=s):(c.area-=c.pop().area,i(c,m,u,!1),m=Math.min(u.dx,u.dy),c.length=c.area=0,h=1/0);c.length&&(i(c,m,u,!0),c.length=c.area=0),o.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var o,a=f(t),s=r.slice(),l=[];for(e(s,a.dx*a.dy/t.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(i(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);r.forEach(n)}}function r(e,t){for(var n,r=e.area,i=0,o=1/0,a=-1,s=e.length;++an&&(o=n),n>i&&(i=n));return r*=r,t*=t,r?Math.max(t*i*h/r,r/(t*o*h)):1/0}function i(e,t,n,r){var i,o=-1,a=e.length,s=n.x,u=n.y,c=t?l(e.area/t):0;if(t==n.dx){for((r||c>n.dy)&&(c=n.dy);++on.dx)&&(c=n.dx);++on&&(t=1),1>n&&(e=0),function(){var n,r,i;do{n=2*Math.random()-1,r=2*Math.random()-1,i=n*n+r*r}while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=na.random.normal.apply(na,arguments);return function(){return Math.exp(e())}},bates:function(e){var t=na.random.irwinHall(e);return function(){return t()/e}},irwinHall:function(e){return function(){for(var t=0,n=0;e>n;n++)t+=Math.random();return t}}},na.scale={};var ml={floor:y,ceil:y};na.scale.linear=function(){return Vi([0,1],[0,1],yr,!1)};var gl={s:1,g:1,p:1,r:1,e:1};na.scale.log=function(){return Ji(na.scale.linear().domain([0,1]),10,!0,[1,10])};var vl=na.format(".0e"),yl={floor:function(e){return-Math.ceil(-e)},ceil:function(e){return-Math.floor(-e)}};na.scale.pow=function(){return Qi(na.scale.linear(),1,[0,1])},na.scale.sqrt=function(){return na.scale.pow().exponent(.5)},na.scale.ordinal=function(){return eo([],{t:"range",a:[[]]})},na.scale.category10=function(){return na.scale.ordinal().range(bl)},na.scale.category20=function(){return na.scale.ordinal().range($l)},na.scale.category20b=function(){return na.scale.ordinal().range(wl)},na.scale.category20c=function(){return na.scale.ordinal().range(xl)};var bl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(be),$l=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(be),wl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(be),xl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(be);na.scale.quantile=function(){return to([],[])},na.scale.quantize=function(){return no(0,1,[0,1])},na.scale.threshold=function(){return ro([.5],[0,1])},na.scale.identity=function(){return io([0,1])},na.svg={},na.svg.arc=function(){function e(){var e=Math.max(0,+n.apply(this,arguments)),u=Math.max(0,+r.apply(this,arguments)),c=a.apply(this,arguments)-Na,f=s.apply(this,arguments)-Na,d=Math.abs(f-c),p=c>f?0:1;if(e>u&&(h=u,u=e,e=h),d>=Oa)return t(u,p)+(e?t(e,1-p):"")+"Z";var h,m,g,v,y,b,$,w,x,C,k,E,S=0,_=0,M=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=o===Cl?Math.sqrt(e*e+u*u):+o.apply(this,arguments),p||(_*=-1),u&&(_=te(g/u*Math.sin(v))),e&&(S=te(g/e*Math.sin(v)))),u){y=u*Math.cos(c+_),b=u*Math.sin(c+_),$=u*Math.cos(f-_),w=u*Math.sin(f-_);var T=Math.abs(f-c-2*_)<=Da?0:1;if(_&&fo(y,b,$,w)===p^T){var D=(c+f)/2;y=u*Math.cos(D),b=u*Math.sin(D),$=w=null}}else y=b=0;if(e){x=e*Math.cos(f-S),C=e*Math.sin(f-S),k=e*Math.cos(c+S),E=e*Math.sin(c+S);var A=Math.abs(c-f+2*S)<=Da?0:1;if(S&&fo(x,C,k,E)===1-p^A){var O=(c+f)/2;x=e*Math.cos(O),C=e*Math.sin(O),k=E=null}}else x=C=0;if((h=Math.min(Math.abs(u-e)/2,+i.apply(this,arguments)))>.001){m=u>e^p?0:1;var N=null==k?[x,C]:null==$?[y,b]:Nn([y,b],[k,E],[$,w],[x,C]),R=y-N[0],I=b-N[1],P=$-N[0],F=w-N[1],j=1/Math.sin(Math.acos((R*P+I*F)/(Math.sqrt(R*R+I*I)*Math.sqrt(P*P+F*F)))/2),L=Math.sqrt(N[0]*N[0]+N[1]*N[1]);if(null!=$){var U=Math.min(h,(u-L)/(j+1)),H=po(null==k?[x,C]:[k,E],[y,b],u,U,p),q=po([$,w],[x,C],u,U,p);h===U?M.push("M",H[0],"A",U,",",U," 0 0,",m," ",H[1],"A",u,",",u," 0 ",1-p^fo(H[1][0],H[1][1],q[1][0],q[1][1]),",",p," ",q[1],"A",U,",",U," 0 0,",m," ",q[0]):M.push("M",H[0],"A",U,",",U," 0 1,",m," ",q[0])}else M.push("M",y,",",b);if(null!=k){var V=Math.min(h,(e-L)/(j-1)),z=po([y,b],[k,E],e,-V,p),B=po([x,C],null==$?[y,b]:[$,w],e,-V,p);h===V?M.push("L",B[0],"A",V,",",V," 0 0,",m," ",B[1],"A",e,",",e," 0 ",p^fo(B[1][0],B[1][1],z[1][0],z[1][1]),",",1-p," ",z[1],"A",V,",",V," 0 0,",m," ",z[0]):M.push("L",B[0],"A",V,",",V," 0 0,",m," ",z[0])}else M.push("L",x,",",C)}else M.push("M",y,",",b),null!=$&&M.push("A",u,",",u," 0 ",T,",",p," ",$,",",w),M.push("L",x,",",C),null!=k&&M.push("A",e,",",e," 0 ",A,",",1-p," ",k,",",E);return M.push("Z"),M.join("")}function t(e,t){return"M0,"+e+"A"+e+","+e+" 0 1,"+t+" 0,"+-e+"A"+e+","+e+" 0 1,"+t+" 0,"+e}var n=ao,r=so,i=oo,o=Cl,a=lo,s=uo,l=co;return e.innerRadius=function(t){return arguments.length?(n=Se(t),e):n},e.outerRadius=function(t){return arguments.length?(r=Se(t),e):r},e.cornerRadius=function(t){return arguments.length?(i=Se(t),e):i},e.padRadius=function(t){return arguments.length?(o=t==Cl?Cl:Se(t),e):o},e.startAngle=function(t){return arguments.length?(a=Se(t),e):a},e.endAngle=function(t){return arguments.length?(s=Se(t),e):s},e.padAngle=function(t){return arguments.length?(l=Se(t),e):l},e.centroid=function(){var e=(+n.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-Na;return[Math.cos(t)*e,Math.sin(t)*e]},e};var Cl="auto";na.svg.line=function(){return ho(y)};var kl=na.map({linear:mo,"linear-closed":go,step:vo,"step-before":yo,"step-after":bo,basis:Eo,"basis-open":So,"basis-closed":_o,bundle:Mo,cardinal:xo,"cardinal-open":$o,"cardinal-closed":wo,monotone:Ro});kl.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var El=[0,2/3,1/3,0],Sl=[0,1/3,2/3,0],_l=[0,1/6,2/3,1/6];na.svg.line.radial=function(){var e=ho(Io);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},yo.reverse=bo,bo.reverse=yo,na.svg.area=function(){return Po(y)},na.svg.area.radial=function(){var e=Po(Io);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},na.svg.chord=function(){function e(e,s){var l=t(this,o,e,s),u=t(this,a,e,s);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(n(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+r(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function t(e,t,n,r){var i=t.call(e,n,r),o=s.call(e,i,r),a=l.call(e,i,r)-Na,c=u.call(e,i,r)-Na;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function n(e,t){return e.a0==t.a0&&e.a1==t.a1}function r(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Da)+",1 "+t}function i(e,t,n,r){return"Q 0,0 "+r}var o=yn,a=bn,s=Fo,l=lo,u=uo;return e.radius=function(t){return arguments.length?(s=Se(t),e):s},e.source=function(t){return arguments.length?(o=Se(t),e):o},e.target=function(t){return arguments.length?(a=Se(t),e):a},e.startAngle=function(t){return arguments.length?(l=Se(t),e):l},e.endAngle=function(t){return arguments.length?(u=Se(t),e):u},e},na.svg.diagonal=function(){function e(e,i){var o=t.call(this,e,i),a=n.call(this,e,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var t=yn,n=bn,r=jo;return e.source=function(n){return arguments.length?(t=Se(n),e):t},e.target=function(t){return arguments.length?(n=Se(t),e):n},e.projection=function(t){return arguments.length?(r=t,e):r},e},na.svg.diagonal.radial=function(){var e=na.svg.diagonal(),t=jo,n=e.projection;return e.projection=function(e){return arguments.length?n(Lo(t=e)):t},e},na.svg.symbol=function(){function e(e,r){return(Ml.get(t.call(this,e,r))||qo)(n.call(this,e,r))}var t=Ho,n=Uo;return e.type=function(n){return arguments.length?(t=Se(n),e):t},e.size=function(t){return arguments.length?(n=Se(t),e):n},e};var Ml=na.map({circle:qo,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Dl)),n=t*Dl;return"M0,"+-t+"L"+n+",0 0,"+t+" "+-n+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Tl),n=t*Tl/2;return"M0,"+n+"L"+t+","+-n+" "+-t+","+-n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Tl),n=t*Tl/2;return"M0,"+-n+"L"+t+","+n+" "+-t+","+n+"Z"}});na.svg.symbolTypes=Ml.keys();var Tl=Math.sqrt(3),Dl=Math.tan(30*Ra);wa.transition=function(e){for(var t,n,r=Al||++Il,i=Wo(e),o=[],a=Ol||{time:Date.now(),ease:Er,delay:0,duration:250},s=-1,l=this.length;++so;o++){i.push(t=[]);for(var n=this[o],s=0,l=n.length;l>s;s++)(r=n[s])&&e.call(r,r.__data__,s,o)&&t.push(r)}return zo(i,this.namespace,this.id)},Rl.tween=function(e,t){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(e):V(this,null==t?function(t){t[r][n].tween.remove(e)}:function(i){i[r][n].tween.set(e,t)})},Rl.attr=function(e,t){function n(){this.removeAttribute(s)}function r(){this.removeAttributeNS(s.space,s.local)}function i(e){return null==e?n:(e+="",function(){var t,n=this.getAttribute(s);return n!==e&&(t=a(n,e),function(e){this.setAttribute(s,t(e))})})}function o(e){return null==e?r:(e+="",function(){var t,n=this.getAttributeNS(s.space,s.local);return n!==e&&(t=a(n,e),function(e){this.setAttributeNS(s.space,s.local,t(e))})})}if(arguments.length<2){for(t in e)this.attr(t,e[t]);return this}var a="transform"==e?Hr:yr,s=na.ns.qualify(e);return Bo(this,"attr."+e,t,s.local?o:i)},Rl.attrTween=function(e,t){function n(e,n){var r=t.call(this,e,n,this.getAttribute(i));return r&&function(e){this.setAttribute(i,r(e))}}function r(e,n){var r=t.call(this,e,n,this.getAttributeNS(i.space,i.local));return r&&function(e){this.setAttributeNS(i.space,i.local,r(e))}}var i=na.ns.qualify(e);return this.tween("attr."+e,i.local?r:n)},Rl.style=function(e,n,r){function i(){this.style.removeProperty(e)}function o(n){return null==n?i:(n+="",function(){var i,o=t(this).getComputedStyle(this,null).getPropertyValue(e);return o!==n&&(i=yr(o,n),function(t){this.style.setProperty(e,i(t),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof e){2>a&&(n="");for(r in e)this.style(r,e[r],n);return this}r=""}return Bo(this,"style."+e,n,o)},Rl.styleTween=function(e,n,r){function i(i,o){var a=n.call(this,i,o,t(this).getComputedStyle(this,null).getPropertyValue(e));return a&&function(t){this.style.setProperty(e,a(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+e,i)},Rl.text=function(e){return Bo(this,"text",e,Yo)},Rl.remove=function(){var e=this.namespace;return this.each("end.transition",function(){var t;this[e].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Rl.ease=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].ease:("function"!=typeof e&&(e=na.ease.apply(na,arguments)),V(this,function(r){r[n][t].ease=e}))},Rl.delay=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].delay:V(this,"function"==typeof e?function(r,i,o){r[n][t].delay=+e.call(r,r.__data__,i,o)}:(e=+e,function(r){r[n][t].delay=e}))},Rl.duration=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].duration:V(this,"function"==typeof e?function(r,i,o){r[n][t].duration=Math.max(1,e.call(r,r.__data__,i,o))}:(e=Math.max(1,e),function(r){r[n][t].duration=e}))},Rl.each=function(e,t){var n=this.id,r=this.namespace;if(arguments.length<2){var i=Ol,o=Al;try{Al=n,V(this,function(t,i,o){Ol=t[r][n],e.call(t,t.__data__,i,o)})}finally{Ol=i,Al=o}}else V(this,function(i){var o=i[r][n];(o.event||(o.event=na.dispatch("start","end","interrupt"))).on(e,t)});return this},Rl.transition=function(){for(var e,t,n,r,i=this.id,o=++Il,a=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(e=[]);for(var t=this[l],c=0,f=t.length;f>c;c++)(n=t[c])&&(r=n[a][i],Go(n,c,a,o,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),e.push(n)}return zo(s,a,o)},na.svg.axis=function(){function e(e){e.each(function(){var e,u=na.select(this),c=this.__chart__||n,f=this.__chart__=n.copy(),d=null==l?f.ticks?f.ticks.apply(f,s):f.domain():l,p=null==t?f.tickFormat?f.tickFormat.apply(f,s):y:t,h=u.selectAll(".tick").data(d,f),m=h.enter().insert("g",".domain").attr("class","tick").style("opacity",Ma),g=na.transition(h.exit()).style("opacity",Ma).remove(),v=na.transition(h.order()).style("opacity",1),b=Math.max(i,0)+a,$=ji(f),w=u.selectAll(".domain").data([0]),x=(w.enter().append("path").attr("class","domain"),na.transition(w));m.append("line"),m.append("text");var C,k,E,S,_=m.select("line"),M=v.select("line"),T=h.select("text").text(p),D=m.select("text"),A=v.select("text"),O="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(e=Ko,C="x",E="y",k="x2",S="y2",T.attr("dy",0>O?"0em":".71em").style("text-anchor","middle"),x.attr("d","M"+$[0]+","+O*o+"V0H"+$[1]+"V"+O*o)):(e=Zo,C="y",E="x",k="y2",S="x2",T.attr("dy",".32em").style("text-anchor",0>O?"end":"start"),x.attr("d","M"+O*o+","+$[0]+"H0V"+$[1]+"H"+O*o)),_.attr(S,O*i),D.attr(E,O*b),M.attr(k,0).attr(S,O*i),A.attr(C,0).attr(E,O*b),f.rangeBand){var N=f,R=N.rangeBand()/2;c=f=function(e){return N(e)+R}}else c.rangeBand?c=f:g.call(e,f,c);m.call(e,c,f),v.call(e,f,f)})}var t,n=na.scale.linear(),r=Pl,i=6,o=6,a=3,s=[10],l=null;return e.scale=function(t){return arguments.length?(n=t,e):n},e.orient=function(t){return arguments.length?(r=t in Fl?t+"":Pl,e):r},e.ticks=function(){return arguments.length?(s=arguments,e):s},e.tickValues=function(t){return arguments.length?(l=t,e):l},e.tickFormat=function(n){return arguments.length?(t=n,e):t},e.tickSize=function(t){var n=arguments.length;return n?(i=+t,o=+arguments[n-1],e):i},e.innerTickSize=function(t){return arguments.length?(i=+t,e):i},e.outerTickSize=function(t){return arguments.length?(o=+t,e):o},e.tickPadding=function(t){return arguments.length?(a=+t,e):a},e.tickSubdivide=function(){return arguments.length&&e},e};var Pl="bottom",Fl={top:1,right:1,bottom:1,left:1};na.svg.brush=function(){function e(t){t.each(function(){var t=na.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),a=t.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=t.selectAll(".resize").data(m,y);s.exit().remove(),s.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return jl[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",e.empty()?"none":null);var l,f=na.transition(t),d=na.transition(a);u&&(l=ji(u),d.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),c&&(l=ji(c),d.attr("y",l[0]).attr("height",l[1]-l[0]),i(f)),n(f)})}function n(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+f[+/e$/.test(e)]+","+d[+/^s/.test(e)]+")"})}function r(e){e.select(".extent").attr("x",f[0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function i(e){e.select(".extent").attr("y",d[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==na.event.keyCode&&(T||(b=null,A[0]-=f[1],A[1]-=d[1],T=2),k())}function m(){32==na.event.keyCode&&2==T&&(A[0]+=f[1],A[1]+=d[1],T=0,k())}function g(){var e=na.mouse(w),t=!1;$&&(e[0]+=$[0],e[1]+=$[1]),T||(na.event.altKey?(b||(b=[(f[0]+f[1])/2,(d[0]+d[1])/2]),A[0]=f[+(e[0]c?(i=r,r=c):i=c),m[0]!=r||m[1]!=i?(n?s=null:a=null,m[0]=r,m[1]=i,!0):void 0}function y(){g(),E.style("pointer-events","all").selectAll(".resize").style("display",e.empty()?"none":null),na.select("body").style("cursor",null),O.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),D(),C({type:"brushend"})}var b,$,w=this,x=na.select(na.event.target),C=l.of(w,arguments),E=na.select(w),S=x.datum(),_=!/^(n|s)$/.test(S)&&u,M=!/^(e|w)$/.test(S)&&c,T=x.classed("extent"),D=K(w),A=na.mouse(w),O=na.select(t(w)).on("keydown.brush",o).on("keyup.brush",m);if(na.event.changedTouches?O.on("touchmove.brush",g).on("touchend.brush",y):O.on("mousemove.brush",g).on("mouseup.brush",y),E.interrupt().selectAll("*").interrupt(),T)A[0]=f[0]-A[0],A[1]=d[0]-A[1];else if(S){var N=+/w$/.test(S),R=+/^n/.test(S);$=[f[1-N]-A[0],d[1-R]-A[1]],A[0]=f[N],A[1]=d[R]}else na.event.altKey&&(b=A.slice());E.style("pointer-events","none").selectAll(".resize").style("display",null),na.select("body").style("cursor",x.style("cursor")),C({type:"brushstart"}),g()}var a,s,l=S(e,"brushstart","brush","brushend"),u=null,c=null,f=[0,0],d=[0,0],p=!0,h=!0,m=Ll[0];return e.event=function(e){e.each(function(){var e=l.of(this,arguments),t={x:f,y:d,i:a,j:s},n=this.__chart__||t;this.__chart__=t,Al?na.select(this).transition().each("start.brush",function(){a=n.i,s=n.j,f=n.x,d=n.y,e({type:"brushstart"})}).tween("brush:brush",function(){var n=br(f,t.x),r=br(d,t.y);return a=s=null,function(i){f=t.x=n(i),d=t.y=r(i),e({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=t.i,s=t.j,e({type:"brush",mode:"resize"}),e({type:"brushend"})}):(e({type:"brushstart"}),e({type:"brush",mode:"resize"}),e({type:"brushend"}))})},e.x=function(t){return arguments.length?(u=t,m=Ll[!u<<1|!c],e):u},e.y=function(t){return arguments.length?(c=t,m=Ll[!u<<1|!c],e):c},e.clamp=function(t){return arguments.length?(u&&c?(p=!!t[0],h=!!t[1]):u?p=!!t:c&&(h=!!t),e):u&&c?[p,h]:u?p:c?h:null},e.extent=function(t){var n,r,i,o,l;return arguments.length?(u&&(n=t[0],r=t[1],c&&(n=n[0],r=r[0]),a=[n,r],u.invert&&(n=u(n),r=u(r)),n>r&&(l=n,n=r,r=l),(n!=f[0]||r!=f[1])&&(f=[n,r])),c&&(i=t[0],o=t[1],u&&(i=i[1],o=o[1]),s=[i,o],c.invert&&(i=c(i),o=c(o)),i>o&&(l=i,i=o,o=l),(i!=d[0]||o!=d[1])&&(d=[i,o])),e):(u&&(a?(n=a[0],r=a[1]):(n=f[0],r=f[1],u.invert&&(n=u.invert(n),r=u.invert(r)),n>r&&(l=n,n=r,r=l))),c&&(s?(i=s[0],o=s[1]):(i=d[0],o=d[1],c.invert&&(i=c.invert(i),o=c.invert(o)),i>o&&(l=i,i=o,o=l))),u&&c?[[n,i],[r,o]]:u?[n,r]:c&&[i,o])},e.clear=function(){return e.empty()||(f=[0,0],d=[0,0],a=s=null),e},e.empty=function(){return!!u&&f[0]==f[1]||!!c&&d[0]==d[1]},na.rebind(e,l,"on")};var jl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ll=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ul=os.format=fs.timeFormat,Hl=Ul.utc,ql=Hl("%Y-%m-%dT%H:%M:%S.%LZ");Ul.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Jo:ql,Jo.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Jo.toString=ql.toString,os.second=Le(function(e){return new as(1e3*Math.floor(e/1e3))},function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))},function(e){return e.getSeconds()}),os.seconds=os.second.range,os.seconds.utc=os.second.utc.range,os.minute=Le(function(e){return new as(6e4*Math.floor(e/6e4))},function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))},function(e){return e.getMinutes()}),os.minutes=os.minute.range,os.minutes.utc=os.minute.utc.range,os.hour=Le(function(e){var t=e.getTimezoneOffset()/60;return new as(36e5*(Math.floor(e/36e5-t)+t))},function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))},function(e){return e.getHours()}),os.hours=os.hour.range,os.hours.utc=os.hour.utc.range,os.month=Le(function(e){return e=os.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),os.months=os.month.range,os.months.utc=os.month.utc.range;var Vl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],zl=[[os.second,1],[os.second,5],[os.second,15],[os.second,30],[os.minute,1],[os.minute,5],[os.minute,15],[os.minute,30],[os.hour,1],[os.hour,3],[os.hour,6],[os.hour,12],[os.day,1],[os.day,2],[os.week,1],[os.month,1],[os.month,3],[os.year,1]],Bl=Ul.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Mt]]),Yl={range:function(e,t,n){return na.range(Math.ceil(e/n)*n,+t,n).map(Xo)},floor:y,ceil:y};zl.year=os.year,os.scale=function(){return Qo(na.scale.linear(),zl,Bl)};var Wl=zl.map(function(e){return[e[0].utc,e[1]]}),Gl=Hl.multi([[".%L",function(e){ -return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Mt]]);Wl.year=os.year.utc,os.scale.utc=function(){return Qo(na.scale.linear(),Wl,Gl)},na.text=_e(function(e){return e.responseText}),na.json=function(e,t){return Me(e,"application/json",ea,t)},na.html=function(e,t){return Me(e,"text/html",ta,t)},na.xml=_e(function(e){return e.responseXML}),"function"==typeof define&&define.amd?define("common/d3",na):"object"==typeof module&&module.exports&&(module.exports=na),this.d3=na}(),function(){function e(e,t){if(e!==t){var n=null===e,r=e===$,i=e===e,o=null===t,a=t===$,s=t===t;if(e>t&&!o||!i||n&&!a&&s||r&&s)return 1;if(e=e&&9<=e&&13>=e||32==e||160==e||5760==e||6158==e||8192<=e&&(8202>=e||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}function m(e,t){for(var n=-1,r=e.length,i=-1,o=[];++n=I&&gi&&ci?new Ue(t):null,u=t.length;l&&(a=He,s=!1,t=l);e:for(;++oa(t,l,0)&&i.push(l);return i}function st(e,t){var n=!0;return Ri(e,function(e,r,i){return n=!!t(e,r,i)}),n}function lt(e,t,n,r){var i=r,o=i;return Ri(e,function(e,a,s){a=+t(e,a,s),(n(a,i)||a===r&&a===o)&&(i=a,o=e)}),o}function ut(e,t){var n=[];return Ri(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function ct(e,t,n,r){var i;return n(e,function(e,n,o){return t(e,n,o)?(i=r?n:e,!1):void 0}),i}function ft(e,t,n,r){r||(r=[]);for(var i=-1,o=e.length;++it&&(t=-t>i?0:i+t),n=n===$||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0,n=Ur(i);++r=u)break e;o=r[o],i*="asc"===o||!0===o?1:-1;break e}i=t.b-n.b}return i})}function Ot(e,t){var n=0;return Ri(e,function(e,r,i){n+=+t(e,r,i)||0}),n}function Nt(e,t){var r=-1,i=xn(),o=e.length,a=i===n,s=a&&o>=I,l=s&&gi&&ci?new Ue(void 0):null,u=[];l?(i=He,a=!1):(s=!1,l=t?[]:u);e:for(;++ri(l,f,0)&&((t||s)&&l.push(f),u.push(c))}return u}function Rt(e,t){for(var n=-1,r=t.length,i=Ur(r);++n>>1,a=e[o];(n?a<=t:ai?$:o,i=1);++r=I)return t.plant(r).value();for(var i=0,e=n?o[i].apply(this,e):r;++iarguments.length;return"function"==typeof r&&o===$&&Mo(n)?e(n,r,i,a):_t(n,$n(r,o,4),i,a,t)}}function fn(e,t,n,r,i,o,a,s,l,u){function c(){for(var b=arguments.length,w=b,k=Ur(b);w--;)k[w]=arguments[w];if(r&&(k=Ht(k,r,i)),o&&(k=qt(k,o,a)),h||v){var w=c.placeholder,E=m(k,w),b=b-E.length;if(bt?0:t)):[]}function zn(e,t,n){var r=e?e.length:0;return r?((n?An(e,t,n):null==t)&&(t=1),t=r-(+t||0),Mt(e,0,0>t?0:t)):[]}function Bn(e){return e?e[0]:$}function Yn(e,t,r){var i=e?e.length:0;if(!i)return-1;if("number"==typeof r)r=0>r?wi(i+r,0):r;else if(r)return r=Ft(e,t),rn?wi(i+n,0):n||0,"string"==typeof e||!Mo(e)&&wr(e)?n<=i&&-1t?0:+t||0,r);++n=e&&(t=$),n}}function lr(e,t,n){function r(t,n){n&&ai(n),l=d=p=$,t&&(h=ho(),u=e.apply(f,s),d||l||(s=f=$))}function i(){var e=t-(ho()-c);0>=e||e>t?r(p,l):d=fi(i,e)}function o(){r(g,d)}function a(){if(s=arguments,c=ho(),f=this,p=g&&(d||!v),!1===m)var n=v&&!d;else{l||v||(h=c);var r=m-(c-h),a=0>=r||r>m;a?(l&&(l=ai(l)),h=c,u=e.apply(f,s)):l||(l=fi(o,r))}return a&&d?d=ai(d):d||t===m||(d=fi(i,t)),n&&(a=!0,u=e.apply(f,s)),!a||d||l||(s=f=$),u}var s,l,u,c,f,d,p,h=0,m=!1,g=!0;if("function"!=typeof e)throw new Kr(j);if(t=0>t?0:+t||0,!0===n)var v=!0,g=!1;else gr(n)&&(v=!!n.leading,m="maxWait"in n&&wi(+n.maxWait||0,t),g="trailing"in n?!!n.trailing:g);return a.cancel=function(){d&&ai(d),l&&ai(l),h=0,l=d=p=$},a}function ur(e,t){function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;return o.has(i)?o.get(i):(r=e.apply(this,r),n.cache=o.set(i,r),r)}if("function"!=typeof e||t&&"function"!=typeof t)throw new Kr(j);return n.cache=new ur.Cache,n}function cr(e,t){if("function"!=typeof e)throw new Kr(j);return t=wi(t===$?e.length-1:+t||0,0),function(){for(var n=arguments,r=-1,i=wi(n.length-t,0),o=Ur(i);++rt}function dr(e){return p(e)&&Tn(e)&&ei.call(e,"callee")&&!ui.call(e,"callee")}function pr(e,t,n,r){return r=(n="function"==typeof n?Lt(n,r,3):$)?n(e,t):$,r===$?vt(e,t,n):!!r}function hr(e){return p(e)&&"string"==typeof e.message&&ni.call(e)==z}function mr(e){return gr(e)&&ni.call(e)==B}function gr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function vr(e){return null!=e&&(mr(e)?ii.test(Xr.call(e)):p(e)&&Se.test(e))}function yr(e){return"number"==typeof e||p(e)&&ni.call(e)==Y}function br(e){var t;if(!p(e)||ni.call(e)!=W||dr(e)||!(ei.call(e,"constructor")||"function"!=typeof(t=e.constructor)||t instanceof t))return!1;var n;return dt(e,function(e,t){n=t}),n===$||ei.call(e,n)}function $r(e){return gr(e)&&ni.call(e)==G}function wr(e){return"string"==typeof e||p(e)&&ni.call(e)==K}function xr(e){return p(e)&&Rn(e.length)&&!!Ne[ni.call(e)]}function Cr(e,t){return e(t=+t)||!e||!bi(t))return n;do{t%2&&(n+=e),t=vi(t/2),e+=e}while(t);return n}function Or(e,t,n){var r=e;return(e=i(e))?(n?An(r,t,n):null==t)?e.slice(g(e),v(e)+1):(t+="",e.slice(o(e,t),a(e,t)+1)):e}function Nr(e,t,n){return n&&An(e,t,n)&&(t=$),e=i(e),e.match(t||Ae)||[]}function Rr(e,t,n){return n&&An(e,t,n)&&(t=$),p(e)?Pr(e):rt(e,t)}function Ir(e){return e}function Pr(e){return $t(it(e,!0))}function Fr(e,t,n){if(null==n){var r=gr(t),i=r?Lo(t):$;((i=i&&i.length?mt(t,i):$)?i.length:r)||(i=!1,n=t,t=e,e=this)}i||(i=mt(t,Lo(t)));var o=!0,r=-1,a=mr(e),s=i.length;!1===n?o=!1:gr(n)&&"chain"in n&&(o=n.chain);for(;++r=N)return n}else e=0;return ji(n,r)}}(),qi=cr(function(e,t){return p(e)&&Tn(e)?at(e,ft(t,!1,!0)):[]}),Vi=en(),zi=en(!0),Bi=cr(function(e){for(var t=e.length,r=t,i=Ur(c),o=xn(),a=o===n,s=[];r--;){var l=e[r]=Tn(l=e[r])?l:[];i[r]=a&&120<=l.length&&gi&&ci?new Ue(r&&l):null}var a=e[0],u=-1,c=a?a.length:0,f=i[0];e:for(;++u(f?He(f,l):o(s,l,0))){for(r=t;--r;){var d=i[r];if(0>(d?He(d,l):o(e[r],l,0)))continue e}f&&f.push(l),s.push(l)}return s}),Yi=cr(function(t,n){n=ft(n);var r=tt(t,n);return Et(t,n.sort(e)),r}),Wi=mn(),Gi=mn(!0),Ki=cr(function(e){return Nt(ft(e,!1,!0))}),Zi=cr(function(e,t){return Tn(e)?at(e,t):[]}),Ji=cr(Zn),Qi=cr(function(e){var t=e.length,n=2--e?t.apply(this,arguments):void 0}},Ie.ary=function(e,t,n){return n&&An(e,t,n)&&(t=$),t=e&&null==t?e.length:wi(+t||0,0),gn(e,T,$,$,$,$,t)},Ie.assign=Do,Ie.at=eo,Ie.before=sr,Ie.bind=mo,Ie.bindAll=go,Ie.bindKey=vo,Ie.callback=Rr,Ie.chain=Xn,Ie.chunk=function(e,t,n){t=(n?An(e,t,n):null==t)?1:wi(vi(t)||1,1),n=0;for(var r=e?e.length:0,i=-1,o=Ur(mi(r/t));nn&&(n=-n>i?0:i+n),r=r===$||r>i?i:+r||0,0>r&&(r+=i),i=n>r?0:r>>>0,n>>>=0;nt?0:t)):[]},Ie.takeRight=function(e,t,n){var r=e?e.length:0;return r?((n?An(e,t,n):null==t)&&(t=1),t=r-(+t||0),Mt(e,0>t?0:t)):[]},Ie.takeRightWhile=function(e,t,n){return e&&e.length?It(e,$n(t,n,3),!1,!0):[]},Ie.takeWhile=function(e,t,n){return e&&e.length?It(e,$n(t,n,3)):[]},Ie.tap=function(e,t,n){return t.call(n,e),e},Ie.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Kr(j);return!1===n?r=!1:gr(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),lr(e,t,{leading:r,maxWait:+t,trailing:i})},Ie.thru=er,Ie.times=function(e,t,n){if(1>(e=vi(e))||!bi(e))return[];var r=-1,i=Ur(xi(e,4294967295));for(t=Lt(t,n,1);++rr?i[r]=t(r):t(r);return i},Ie.toArray=kr,Ie.toPlainObject=Er,Ie.transform=function(e,t,n,r){var i=Mo(e)||xr(e);return t=$n(t,r,4),null==n&&(i||gr(e)?(r=e.constructor,n=i?Mo(e)?new r:[]:Ni(mr(r)?r.prototype:$)):n={}),(i?Ve:pt)(e,function(e,r,i){return t(n,e,r,i)}),n},Ie.union=Ki,Ie.uniq=Kn,Ie.unzip=Zn,Ie.unzipWith=Jn,Ie.values=Tr,Ie.valuesIn=function(e){return Rt(e,_r(e))},Ie.where=function(e,t){return nr(e,$t(t))},Ie.without=Zi,Ie.wrap=function(e,t){return t=null==t?Ir:t,gn(t,_,$,[e],[])},Ie.xor=function(){for(var e=-1,t=arguments.length;++en?0:+n||0,r),0<=(n-=t.length)&&e.indexOf(t,n)==n},Ie.escape=function(e){return(e=i(e))&&de.test(e)?e.replace(ce,u):e},Ie.escapeRegExp=function(e){return(e=i(e))&&$e.test(e)?e.replace(be,c):e||"(?:)"},Ie.every=tr,Ie.find=no,Ie.findIndex=Vi,Ie.findKey=No,Ie.findLast=ro,Ie.findLastIndex=zi,Ie.findLastKey=Ro,Ie.findWhere=function(e,t){return no(e,$t(t))},Ie.first=Bn,Ie.floor=ea,Ie.get=function(e,t,n){return e=null==e?$:gt(e,Hn(t),t+""),e===$?n:e},Ie.gt=fr,Ie.gte=function(e,t){return e>=t},Ie.has=function(e,t){if(null==e)return!1;var n=ei.call(e,t);if(!n&&!On(t)){if(t=Hn(t),null==(e=1==t.length?e:gt(e,Mt(t,0,-1))))return!1;t=Wn(t),n=ei.call(e,t)}return n||Rn(e.length)&&Dn(t,e.length)&&(Mo(e)||dr(e))},Ie.identity=Ir,Ie.includes=rr,Ie.indexOf=Yn,Ie.inRange=function(e,t,n){return t=+t||0,n===$?(n=t,t=0):n=+n||0,e>=xi(t,n)&&en?wi(r+n,0):xi(n||0,r-1))+1;else if(n)return i=Ft(e,t,!0)-1,e=e[i],(t===t?t===e:e!==e)?i:-1;if(t!==t)return d(e,i,!0);for(;i--;)if(e[i]===t)return i;return-1},Ie.lt=Cr,Ie.lte=function(e,t){return e<=t},Ie.max=ta,Ie.min=na,Ie.noConflict=function(){return Ye._=ri,this},Ie.noop=jr,Ie.now=ho,Ie.pad=function(e,t,n){e=i(e),t=+t;var r=e.length;return rn?0:+n||0,e.length),e.lastIndexOf(t,n)==n},Ie.sum=function(e,t,n){if(n&&An(e,t,n)&&(t=$),t=$n(t,n,3),1==t.length){e=Mo(e)?e:Ln(e),n=e.length;for(var r=0;n--;)r+=+t(e[n])||0;e=r}else e=Ot(e,t);return e},Ie.template=function(e,t,n){var r=Ie.templateSettings;n&&An(e,t,n)&&(t=n=$),e=i(e),t=Xe(et({},n||t),r,Qe),n=Xe(et({},t.imports),r.imports,Qe);var o,a,s=Lo(n),l=Rt(n,s),u=0;n=t.interpolate||Te;var c="__p+='";n=Wr((t.escape||Te).source+"|"+n.source+"|"+(n===me?Ce:Te).source+"|"+(t.evaluate||Te).source+"|$","g");var d="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(e.replace(n,function(t,n,r,i,s,l){return r||(r=i),c+=e.slice(u,l).replace(De,f),n&&(o=!0,c+="'+__e("+n+")+'"),s&&(a=!0,c+="';"+s+";\n__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),u=l+t.length,t}),c+="';",(t=t.variable)||(c="with(obj){"+c+"}"),c=(a?c.replace(ae,""):c).replace(se,"$1").replace(le,"$1;"),c="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(a?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}",t=Zo(function(){return Vr(s,d+"return "+c).apply($,l)}),t.source=c,hr(t))throw t;return t},Ie.trim=Or,Ie.trimLeft=function(e,t,n){var r=e;return(e=i(e))?e.slice((n?An(r,t,n):null==t)?g(e):o(e,t+"")):e},Ie.trimRight=function(e,t,n){var r=e;return(e=i(e))?(n?An(r,t,n):null==t)?e.slice(0,v(e)+1):e.slice(0,a(e,t+"")+1):e},Ie.trunc=function(e,t,n){n&&An(e,t,n)&&(t=$);var r=A;if(n=O,null!=t)if(gr(t)){var o="separator"in t?t.separator:o,r="length"in t?+t.length||0:r;n="omission"in t?i(t.omission):n}else r=+t||0;if(e=i(e),r>=e.length)return e;if(1>(r-=n.length))return n;if(t=e.slice(0,r),null==o)return t+n;if($r(o)){if(e.slice(r).search(o)){var a,s=e.slice(0,r);for(o.global||(o=Wr(o.source,(ke.exec(o)||"")+"g")),o.lastIndex=0;e=o.exec(s);)a=e.index;t=t.slice(0,null==a?r:a)}}else e.indexOf(o,r)!=r&&-1<(o=t.lastIndexOf(o))&&(t=t.slice(0,o));return t+n},Ie.unescape=function(e){return(e=i(e))&&fe.test(e)?e.replace(ue,y):e},Ie.uniqueId=function(e){var t=++ti;return i(e)+t},Ie.words=Nr,Ie.all=tr,Ie.any=ar,Ie.contains=rr,Ie.eq=pr,Ie.detect=no,Ie.foldl=co,Ie.foldr=fo,Ie.head=Bn,Ie.include=rr,Ie.inject=co,Fr(Ie,function(){var e={};return pt(Ie,function(t,n){Ie.prototype[n]||(e[n]=t)}),e}(),!1),Ie.sample=or,Ie.prototype.sample=function(e){return this.__chain__||null!=e?this.thru(function(t){return or(t,e)}):or(this.value())},Ie.VERSION=w,Ve("bind bindKey curry curryRight partial partialRight".split(" "),function(e){Ie[e].placeholder=Ie}),Ve(["drop","take"],function(e,t){je.prototype[e]=function(n){var r=this.__filtered__;if(r&&!t)return new je(this);n=null==n?1:wi(vi(n)||0,0);var i=this.clone();return r?i.__takeCount__=xi(i.__takeCount__,n):i.__views__.push({size:n,type:e+(0>i.__dir__?"Right":"")}),i},je.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Ve(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n!=F;je.prototype[e]=function(e,t){var i=this.clone();return i.__iteratees__.push({iteratee:$n(e,t,1),type:n}),i.__filtered__=i.__filtered__||r,i}}),Ve(["first","last"],function(e,t){var n="take"+(t?"Right":"");je.prototype[e]=function(){return this[n](1).value()[0]}}),Ve(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");je.prototype[e]=function(){return this.__filtered__?new je(this):this[n](1)}}),Ve(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?$t:Lr;je.prototype[e]=function(e){return this[n](r(e))}}),je.prototype.compact=function(){return this.filter(Ir)},je.prototype.reject=function(e,t){return e=$n(e,t,1),this.filter(function(t){return!e(t)})},je.prototype.slice=function(e,t){e=null==e?0:+e||0;var n=this;return n.__filtered__&&(0t)?new je(n):(0>e?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==$&&(t=+t||0,n=0>t?n.dropRight(-t):n.take(t-e)),n)},je.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},je.prototype.toArray=function(){return this.take(_i)},pt(je.prototype,function(e,t){var n=/^(?:filter|map|reject)|While$/.test(t),r=/^(?:first|last)$/.test(t),i=Ie[r?"take"+("last"==t?"Right":""):t];i&&(Ie.prototype[t]=function(){function t(e){return r&&a?i(e,1)[0]:i.apply($,Ke([e],o))}var o=r?[1]:arguments,a=this.__chain__,s=this.__wrapped__,l=!!this.__actions__.length,u=s instanceof je,c=o[0],f=u||Mo(s);return f&&n&&"function"==typeof c&&1!=c.length&&(u=f=!1),c={func:er,args:[t],thisArg:$},l=u&&!l,r&&!a?l?(s=s.clone(),s.__actions__.push(c),e.call(s)):i.call($,this.value())[0]:!r&&f?(s=l?s:new je(this),s=e.apply(s,o),s.__actions__.push(c),new Fe(s,a)):this.thru(t)})}),Ve("join pop push replace shift sort splice split unshift".split(" "),function(e){var t=(/^(?:replace|split)$/.test(e)?Qr:Zr)[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:join|pop|replace|shift)$/.test(e);Ie.prototype[e]=function(){var e=arguments;return r&&!this.__chain__?t.apply(this.value(),e):this[n](function(n){return t.apply(n,e)})}}),pt(je.prototype,function(e,t){var n=Ie[t];if(n){var r=n.name+"";(Oi[r]||(Oi[r]=[])).push({name:t,func:n})}}),Oi[fn($,C).name]=[{name:"wrapper",func:$}],je.prototype.clone=function(){var e=new je(this.__wrapped__);return e.__actions__=qe(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=qe(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=qe(this.__views__),e},je.prototype.reverse=function(){if(this.__filtered__){var e=new je(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},je.prototype.value=function(){var e,t=this.__wrapped__.value(),n=this.__dir__,r=Mo(t),i=0>n,o=r?t.length:0;e=o;for(var a=this.__views__,s=0,l=-1,u=a.length;++l"'`]/g,fe=RegExp(ue.source),de=RegExp(ce.source),pe=/<%-([\s\S]+?)%>/g,he=/<%([\s\S]+?)%>/g,me=/<%=([\s\S]+?)%>/g,ge=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,ve=/^\w*$/,ye=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,be=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,$e=RegExp(be.source),we=/[\u0300-\u036f\ufe20-\ufe23]/g,xe=/\\(\\)?/g,Ce=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ke=/\w*$/,Ee=/^0[xX]/,Se=/^\[object .+?Constructor\]$/,_e=/^\d+$/,Me=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Te=/($^)/,De=/['\n\r\u2028\u2029\\]/g,Ae=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),Oe="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout isFinite parseFloat parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap".split(" "),Ne={};Ne[J]=Ne[Q]=Ne[X]=Ne[ee]=Ne[te]=Ne[ne]=Ne[re]=Ne[ie]=Ne[oe]=!0,Ne[U]=Ne[H]=Ne[Z]=Ne[q]=Ne[V]=Ne[z]=Ne[B]=Ne["[object Map]"]=Ne[Y]=Ne[W]=Ne[G]=Ne["[object Set]"]=Ne[K]=Ne["[object WeakMap]"]=!1;var Re={};Re[U]=Re[H]=Re[Z]=Re[q]=Re[V]=Re[J]=Re[Q]=Re[X]=Re[ee]=Re[te]=Re[Y]=Re[W]=Re[G]=Re[K]=Re[ne]=Re[re]=Re[ie]=Re[oe]=!0,Re[z]=Re[B]=Re["[object Map]"]=Re["[object Set]"]=Re["[object WeakMap]"]=!1;var Ie={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Pe={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Fe={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},je={function:!0,object:!0},Le={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},He=je[typeof exports]&&exports&&!exports.nodeType&&exports,qe=je[typeof module]&&module&&!module.nodeType&&module,Ve=je[typeof self]&&self&&self.Object&&self,ze=je[typeof window]&&window&&window.Object&&window,Be=qe&&qe.exports===He&&He,Ye=He&&qe&&"object"==typeof global&&global&&global.Object&&global||ze!==(this&&this.window)&&ze||Ve||this,We=b();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Ye._=We,define("common/lodash",[],function(){return We})):He&&qe?Be?(qe.exports=We)._=We:He._=We:Ye._=We}.call(this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("common/moment",t):e.moment=t()}(this,function(){"use strict";function e(){return Yn.apply(null,arguments)}function t(e){return"[object Array]"===Object.prototype.toString.call(e)}function n(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function r(e,t){var n,r=[];for(n=0;n0)for(n in Gn)r=Gn[n],i=t[r],f(i)||(e[r]=i);return e}function p(t){d(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),!1===Kn&&(Kn=!0,e.updateOffset(this),Kn=!1)}function h(e){return e instanceof p||null!=e&&null!=e._isAMomentObject}function m(e){return 0>e?Math.ceil(e):Math.floor(e)}function g(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=m(t)),n}function v(e,t,n){var r,i=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),a=0;for(r=0;i>r;r++)(n&&e[r]!==t[r]||!n&&g(e[r])!==g(t[r]))&&a++;return a+o}function y(){}function b(e){return e?e.toLowerCase().replace("_","-"):e}function $(e){for(var t,n,r,i,o=0;o0;){if(r=w(i.slice(0,t).join("-")))return r;if(n&&n.length>=t&&v(i,n,!0)>=t-1)break;t--}o++}return null}function w(e){var t=null;if(!Zn[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=Wn._abbr,require("./locale/"+e),x(t)}catch(e){}return Zn[e]}function x(e,t){var n;return e&&(n=f(t)?k(e):C(e,t))&&(Wn=n),Wn._abbr}function C(e,t){return null!==t?(t.abbr=e,Zn[e]=Zn[e]||new y,Zn[e].set(t),x(e),Zn[e]):(delete Zn[e],null)}function k(e){var n;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Wn;if(!t(e)){if(n=w(e))return n;e=[e]}return $(e)}function E(e,t){var n=e.toLowerCase();Jn[n]=Jn[n+"s"]=Jn[t]=e}function S(e){return"string"==typeof e?Jn[e]||Jn[e.toLowerCase()]:void 0}function _(e){var t,n,r={};for(n in e)i(e,n)&&(t=S(n))&&(r[t]=e[n]);return r}function M(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function T(t,n){return function(r){return null!=r?(A(this,t,r),e.updateOffset(this,n),this):D(this,t)}}function D(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function A(e,t,n){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](n)}function O(e,t){var n;if("object"==typeof e)for(n in e)this.set(n,e[n]);else if(e=S(e),M(this[e]))return this[e](t);return this}function N(e,t,n){var r=""+Math.abs(e),i=t-r.length;return(e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}function R(e,t,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),e&&(tr[e]=i),t&&(tr[t[0]]=function(){return N(i.apply(this,arguments),t[1],t[2])}),n&&(tr[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function I(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function P(e){var t,n,r=e.match(Qn);for(t=0,n=r.length;n>t;t++)tr[r[t]]?r[t]=tr[r[t]]:r[t]=I(r[t]);return function(i){var o="";for(t=0;n>t;t++)o+=r[t]instanceof Function?r[t].call(i,e):r[t];return o}}function F(e,t){return e.isValid()?(t=j(t,e.localeData()),er[t]=er[t]||P(t),er[t](e)):e.localeData().invalidDate()}function j(e,t){function n(e){return t.longDateFormat(e)||e}var r=5;for(Xn.lastIndex=0;r>=0&&Xn.test(e);)e=e.replace(Xn,n),Xn.lastIndex=0,r-=1;return e}function L(e,t,n){br[e]=M(t)?t:function(e,r){return e&&n?n:t}}function U(e,t){return i(br,e)?br[e](t._strict,t._locale):new RegExp(H(e))}function H(e){return q(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,r,i){return t||n||r||i}))}function q(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function V(e,t){var n,r=t;for("string"==typeof e&&(e=[e]),"number"==typeof t&&(r=function(e,n){n[t]=g(e)}),n=0;nr;r++){if(i=a([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}}function Z(e,t){var n;return e.isValid()?"string"==typeof t&&"number"!=typeof(t=e.localeData().monthsParse(t))?e:(n=Math.min(e.date(),Y(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e):e}function J(t){return null!=t?(Z(this,t),e.updateOffset(this,!0),this):D(this,"Month")}function Q(){return Y(this.year(),this.month())}function X(e){return this._monthsParseExact?(i(this,"_monthsRegex")||te.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex}function ee(e){return this._monthsParseExact?(i(this,"_monthsRegex")||te.call(this),e?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex}function te(){function e(e,t){return t.length-e.length}var t,n,r=[],i=[],o=[];for(t=0;12>t;t++)n=a([2e3,t]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(r.sort(e),i.sort(e),o.sort(e),t=0;12>t;t++)r[t]=q(r[t]),i[t]=q(i[t]),o[t]=q(o[t]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")$","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")$","i")}function ne(e){var t,n=e._a;return n&&-2===l(e).overflow&&(t=n[xr]<0||n[xr]>11?xr:n[Cr]<1||n[Cr]>Y(n[wr],n[xr])?Cr:n[kr]<0||n[kr]>24||24===n[kr]&&(0!==n[Er]||0!==n[Sr]||0!==n[_r])?kr:n[Er]<0||n[Er]>59?Er:n[Sr]<0||n[Sr]>59?Sr:n[_r]<0||n[_r]>999?_r:-1,l(e)._overflowDayOfYear&&(wr>t||t>Cr)&&(t=Cr),l(e)._overflowWeeks&&-1===t&&(t=Mr),l(e)._overflowWeekday&&-1===t&&(t=Tr),l(e).overflow=t),e}function re(t){!1===e.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function ie(e,t){var n=!0;return o(function(){return n&&(re(e+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),n=!1),t.apply(this,arguments)},t)}function oe(e,t){Ir[e]||(re(t),Ir[e]=!0)}function ae(e){var t,n,r,i,o,a,s=e._i,u=Pr.exec(s)||Fr.exec(s);if(u){for(l(e).iso=!0,t=0,n=Lr.length;n>t;t++)if(Lr[t][1].exec(u[1])){i=Lr[t][0],r=!1!==Lr[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=Ur.length;n>t;t++)if(Ur[t][1].exec(u[3])){o=(u[2]||" ")+Ur[t][0];break}if(null==o)return void(e._isValid=!1)}if(!r&&null!=o)return void(e._isValid=!1);if(u[4]){if(!jr.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(o||"")+(a||""),we(e)}else e._isValid=!1}function se(t){var n=Hr.exec(t._i);return null!==n?void(t._d=new Date(+n[1])):(ae(t),void(!1===t._isValid&&(delete t._isValid,e.createFromInputFallback(t))))}function le(e,t,n,r,i,o,a){var s=new Date(e,t,n,r,i,o,a);return 100>e&&e>=0&&isFinite(s.getFullYear())&&s.setFullYear(e),s}function ue(e){var t=new Date(Date.UTC.apply(null,arguments));return 100>e&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function ce(e){return fe(e)?366:365}function fe(e){return e%4==0&&e%100!=0||e%400==0}function de(){return fe(this.year())}function pe(e,t,n){var r=7+t-n;return-(7+ue(e,0,r).getUTCDay()-t)%7+r-1}function he(e,t,n,r,i){var o,a,s=(7+n-r)%7,l=pe(e,r,i),u=1+7*(t-1)+s+l;return 0>=u?(o=e-1,a=ce(o)+u):u>ce(e)?(o=e+1,a=u-ce(e)):(o=e,a=u),{year:o,dayOfYear:a}}function me(e,t,n){var r,i,o=pe(e.year(),t,n),a=Math.floor((e.dayOfYear()-o-1)/7)+1;return 1>a?(i=e.year()-1,r=a+ge(i,t,n)):a>ge(e.year(),t,n)?(r=a-ge(e.year(),t,n),i=e.year()+1):(i=e.year(),r=a),{week:r,year:i}}function ge(e,t,n){var r=pe(e,t,n),i=pe(e+1,t,n);return(ce(e)-r+i)/7}function ve(e,t,n){return null!=e?e:null!=t?t:n}function ye(t){var n=new Date(e.now());return t._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function be(e){var t,n,r,i,o=[];if(!e._d){for(r=ye(e),e._w&&null==e._a[Cr]&&null==e._a[xr]&&$e(e),e._dayOfYear&&(i=ve(e._a[wr],r[wr]),e._dayOfYear>ce(i)&&(l(e)._overflowDayOfYear=!0),n=ue(i,0,e._dayOfYear),e._a[xr]=n.getUTCMonth(),e._a[Cr]=n.getUTCDate()),t=0;3>t&&null==e._a[t];++t)e._a[t]=o[t]=r[t];for(;7>t;t++)e._a[t]=o[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[kr]&&0===e._a[Er]&&0===e._a[Sr]&&0===e._a[_r]&&(e._nextDay=!0,e._a[kr]=0),e._d=(e._useUTC?ue:le).apply(null,o),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[kr]=24)}}function $e(e){var t,n,r,i,o,a,s,u;t=e._w,null!=t.GG||null!=t.W||null!=t.E?(o=1,a=4,n=ve(t.GG,e._a[wr],me(Te(),1,4).year),r=ve(t.W,1),(1>(i=ve(t.E,1))||i>7)&&(u=!0)):(o=e._locale._week.dow,a=e._locale._week.doy,n=ve(t.gg,e._a[wr],me(Te(),o,a).year),r=ve(t.w,1),null!=t.d?(0>(i=t.d)||i>6)&&(u=!0):null!=t.e?(i=t.e+o,(t.e<0||t.e>6)&&(u=!0)):i=o),1>r||r>ge(n,o,a)?l(e)._overflowWeeks=!0:null!=u?l(e)._overflowWeekday=!0:(s=he(n,r,i,o,a),e._a[wr]=s.year,e._dayOfYear=s.dayOfYear)}function we(t){if(t._f===e.ISO_8601)return void ae(t);t._a=[],l(t).empty=!0;var n,r,i,o,a,s=""+t._i,u=s.length,c=0;for(i=j(t._f,t._locale).match(Qn)||[],n=0;n0&&l(t).unusedInput.push(a),s=s.slice(s.indexOf(r)+r.length),c+=r.length),tr[o]?(r?l(t).empty=!1:l(t).unusedTokens.push(o),B(o,r,t)):t._strict&&!r&&l(t).unusedTokens.push(o);l(t).charsLeftOver=u-c,s.length>0&&l(t).unusedInput.push(s),!0===l(t).bigHour&&t._a[kr]<=12&&t._a[kr]>0&&(l(t).bigHour=void 0),t._a[kr]=xe(t._locale,t._a[kr],t._meridiem),be(t),ne(t)}function xe(e,t,n){var r;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?(r=e.isPM(n),r&&12>t&&(t+=12),r||12!==t||(t=0),t):t}function Ce(e){var t,n,r,i,a;if(0===e._f.length)return l(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;ia)&&(r=a,n=t));o(e,n||t)}function ke(e){if(!e._d){var t=_(e._i);e._a=r([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),be(e)}}function Ee(e){var t=new p(ne(Se(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function Se(e){var r=e._i,i=e._f;return e._locale=e._locale||k(e._l),null===r||void 0===i&&""===r?c({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),h(r)?new p(ne(r)):(t(i)?Ce(e):i?we(e):n(r)?e._d=r:_e(e),u(e)||(e._d=null),e))}function _e(i){var o=i._i;void 0===o?i._d=new Date(e.now()):n(o)?i._d=new Date(+o):"string"==typeof o?se(i):t(o)?(i._a=r(o.slice(0),function(e){return parseInt(e,10)}),be(i)):"object"==typeof o?ke(i):"number"==typeof o?i._d=new Date(o):e.createFromInputFallback(i)}function Me(e,t,n,r,i){var o={};return"boolean"==typeof n&&(r=n,n=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=i,o._l=n,o._i=e,o._f=t,o._strict=r,Ee(o)}function Te(e,t,n,r){return Me(e,t,n,r,!1)}function De(e,n){var r,i;if(1===n.length&&t(n[0])&&(n=n[0]),!n.length)return Te();for(r=n[0],i=1;ie&&(e=-e,n="-"),n+N(~~(e/60),2)+t+N(~~e%60,2)})}function Pe(e,t){var n=(t||"").match(e)||[],r=n[n.length-1]||[],i=(r+"").match(Yr)||["-",0,0],o=60*i[1]+g(i[2]);return"+"===i[0]?o:-o}function Fe(t,r){var i,o;return r._isUTC?(i=r.clone(),o=(h(t)||n(t)?+t:+Te(t))-+i,i._d.setTime(+i._d+o),e.updateOffset(i,!1),i):Te(t).local()}function je(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Le(t,n){var r,i=this._offset||0;return this.isValid()?null!=t?("string"==typeof t?t=Pe(gr,t):Math.abs(t)<16&&(t*=60),!this._isUTC&&n&&(r=je(this)),this._offset=t,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==t&&(!n||this._changeInProgress?tt(this,Ze(t-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?i:je(this):null!=t?this:NaN}function Ue(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function He(e){return this.utcOffset(0,e)}function qe(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(je(this),"m")),this}function Ve(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Pe(mr,this._i)),this}function ze(e){return!!this.isValid()&&(e=e?Te(e).utcOffset():0,(this.utcOffset()-e)%60==0)}function Be(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ye(){if(!f(this._isDSTShifted))return this._isDSTShifted;var e={};if(d(e,this),e=Se(e),e._a){var t=e._isUTC?a(e._a):Te(e._a);this._isDSTShifted=this.isValid()&&v(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function We(){return!!this.isValid()&&!this._isUTC}function Ge(){return!!this.isValid()&&this._isUTC}function Ke(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ze(e,t){var n,r,o,a=e,s=null;return Re(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(a={},t?a[t]=e:a.milliseconds=e):(s=Wr.exec(e))?(n="-"===s[1]?-1:1,a={y:0,d:g(s[Cr])*n,h:g(s[kr])*n,m:g(s[Er])*n,s:g(s[Sr])*n,ms:g(s[_r])*n}):(s=Gr.exec(e))?(n="-"===s[1]?-1:1,a={y:Je(s[2],n),M:Je(s[3],n),d:Je(s[4],n),h:Je(s[5],n),m:Je(s[6],n),s:Je(s[7],n),w:Je(s[8],n)}):null==a?a={}:"object"==typeof a&&("from"in a||"to"in a)&&(o=Xe(Te(a.from),Te(a.to)),a={},a.ms=o.milliseconds,a.M=o.months),r=new Ne(a),Re(e)&&i(e,"_locale")&&(r._locale=e._locale),r}function Je(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Qe(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Xe(e,t){var n;return e.isValid()&&t.isValid()?(t=Fe(t,e),e.isBefore(t)?n=Qe(e,t):(n=Qe(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function et(e,t){return function(n,r){var i,o;return null===r||isNaN(+r)||(oe(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),o=n,n=r,r=o),n="string"==typeof n?+n:n,i=Ze(n,r),tt(this,i,e),this}}function tt(t,n,r,i){var o=n._milliseconds,a=n._days,s=n._months;t.isValid()&&(i=null==i||i,o&&t._d.setTime(+t._d+o*r),a&&A(t,"Date",D(t,"Date")+a*r),s&&Z(t,D(t,"Month")+s*r),i&&e.updateOffset(t,a||s))}function nt(e,t){var n=e||Te(),r=Fe(n,this).startOf("day"),i=this.diff(r,"days",!0),o=-6>i?"sameElse":-1>i?"lastWeek":0>i?"lastDay":1>i?"sameDay":2>i?"nextDay":7>i?"nextWeek":"sameElse",a=t&&(M(t[o])?t[o]():t[o]);return this.format(a||this.localeData().calendar(o,this,Te(n)))}function rt(){return new p(this)}function it(e,t){var n=h(e)?e:Te(e);return!(!this.isValid()||!n.isValid())&&(t=S(f(t)?"millisecond":t),"millisecond"===t?+this>+n:+n<+this.clone().startOf(t))}function ot(e,t){var n=h(e)?e:Te(e);return!(!this.isValid()||!n.isValid())&&(t=S(f(t)?"millisecond":t),"millisecond"===t?+n>+this:+this.clone().endOf(t)<+n)}function at(e,t,n){return this.isAfter(e,n)&&this.isBefore(t,n)}function st(e,t){var n,r=h(e)?e:Te(e);return!(!this.isValid()||!r.isValid())&&(t=S(t||"millisecond"),"millisecond"===t?+this==+r:(n=+r,+this.clone().startOf(t)<=n&&n<=+this.clone().endOf(t)))}function lt(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function ut(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function ct(e,t,n){var r,i,o,a;return this.isValid()?(r=Fe(e,this),r.isValid()?(i=6e4*(r.utcOffset()-this.utcOffset()),t=S(t),"year"===t||"month"===t||"quarter"===t?(a=ft(this,r),"quarter"===t?a/=3:"year"===t&&(a/=12)):(o=this-r,a="second"===t?o/1e3:"minute"===t?o/6e4:"hour"===t?o/36e5:"day"===t?(o-i)/864e5:"week"===t?(o-i)/6048e5:o),n?a:m(a)):NaN):NaN}function ft(e,t){var n,r,i=12*(t.year()-e.year())+(t.month()-e.month()),o=e.clone().add(i,"months");return 0>t-o?(n=e.clone().add(i-1,"months"),r=(t-o)/(o-n)):(n=e.clone().add(i+1,"months"),r=(t-o)/(n-o)),-(i+r)}function dt(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function pt(){var e=this.clone().utc();return 0o&&(t=o),Lt.call(this,e,t,n,r,i))}function Lt(e,t,n,r,i){var o=he(e,t,n,r,i),a=ue(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function Ut(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function Ht(e){return me(e,this._week.dow,this._week.doy).week}function qt(){return this._week.dow}function Vt(){return this._week.doy}function zt(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Bt(e){var t=me(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function Yt(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function Wt(e,n){return t(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(n)?"format":"standalone"][e.day()]}function Gt(e){return this._weekdaysShort[e.day()]}function Kt(e){return this._weekdaysMin[e.day()]}function Zt(e,t,n){var r,i,o;for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;7>r;r++){if(i=Te([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}}function Jt(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=Yt(e,this.localeData()),this.add(e-t,"d")):t}function Qt(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function Xt(e){return this.isValid()?null==e?this.day()||7:this.day(this.day()%7?e:e-7):null!=e?this:NaN}function en(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function tn(){return this.hours()%12||12}function nn(e,t){R(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function rn(e,t){return t._meridiemParse}function on(e){return"p"===(e+"").toLowerCase().charAt(0)}function an(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}function sn(e,t){t[_r]=g(1e3*("0."+e))}function ln(){return this._isUTC?"UTC":""}function un(){return this._isUTC?"Coordinated Universal Time":""}function cn(e){return Te(1e3*e)}function fn(){return Te.apply(null,arguments).parseZone()}function dn(e,t,n){var r=this._calendar[e];return M(r)?r.call(t,n):r}function pn(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])}function hn(){return this._invalidDate}function mn(e){return this._ordinal.replace("%d",e)}function gn(e){return e}function vn(e,t,n,r){var i=this._relativeTime[n];return M(i)?i(e,t,n,r):i.replace(/%d/i,e)}function yn(e,t){var n=this._relativeTime[e>0?"future":"past"];return M(n)?n(t):n.replace(/%s/i,t)}function bn(e){var t,n;for(n in e)t=e[n],M(t)?this[n]=t:this["_"+n]=t;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function $n(e,t,n,r){var i=k(),o=a().set(r,t);return i[n](o,e)}function wn(e,t,n,r,i){if("number"==typeof e&&(t=e,e=void 0),e=e||"",null!=t)return $n(e,t,n,i);var o,a=[];for(o=0;r>o;o++)a[o]=$n(e,o,n,i);return a}function xn(e,t){return wn(e,t,"months",12,"month")}function Cn(e,t){return wn(e,t,"monthsShort",12,"month")}function kn(e,t){return wn(e,t,"weekdays",7,"day")}function En(e,t){return wn(e,t,"weekdaysShort",7,"day")}function Sn(e,t){return wn(e,t,"weekdaysMin",7,"day")}function _n(){var e=this._data;return this._milliseconds=gi(this._milliseconds),this._days=gi(this._days),this._months=gi(this._months),e.milliseconds=gi(e.milliseconds),e.seconds=gi(e.seconds),e.minutes=gi(e.minutes),e.hours=gi(e.hours),e.months=gi(e.months),e.years=gi(e.years),this}function Mn(e,t,n,r){var i=Ze(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Tn(e,t){return Mn(this,e,t,1)}function Dn(e,t){return Mn(this,e,t,-1)}function An(e){return 0>e?Math.floor(e):Math.ceil(e)}function On(){var e,t,n,r,i,o=this._milliseconds,a=this._days,s=this._months,l=this._data;return o>=0&&a>=0&&s>=0||0>=o&&0>=a&&0>=s||(o+=864e5*An(Rn(s)+a),a=0,s=0),l.milliseconds=o%1e3,e=m(o/1e3),l.seconds=e%60,t=m(e/60),l.minutes=t%60,n=m(t/60),l.hours=n%24,a+=m(n/24),i=m(Nn(a)),s+=i,a-=An(Rn(i)),r=m(s/12),s%=12,l.days=a,l.months=s,l.years=r,this}function Nn(e){return 4800*e/146097}function Rn(e){return 146097*e/4800}function In(e){var t,n,r=this._milliseconds;if("month"===(e=S(e))||"year"===e)return t=this._days+r/864e5,n=this._months+Nn(t),"month"===e?n:n/12;switch(t=this._days+Math.round(Rn(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}}function Pn(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*g(this._months/12)}function Fn(e){return function(){return this.as(e)}}function jn(e){return e=S(e),this[e+"s"]()}function Ln(e){return function(){return this._data[e]}}function Un(){return m(this.days()/7)}function Hn(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function qn(e,t,n){var r=Ze(e).abs(),i=Oi(r.as("s")),o=Oi(r.as("m")),a=Oi(r.as("h")),s=Oi(r.as("d")),l=Oi(r.as("M")),u=Oi(r.as("y")),c=i=o&&["m"]||o=a&&["h"]||a=s&&["d"]||s=l&&["M"]||l=u&&["y"]||["yy",u];return c[2]=t,c[3]=+e>0,c[4]=n,Hn.apply(null,c)}function Vn(e,t){return void 0!==Ni[e]&&(void 0===t?Ni[e]:(Ni[e]=t,!0))}function zn(e){var t=this.localeData(),n=qn(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)}function Bn(){var e,t,n,r=Ri(this._milliseconds)/1e3,i=Ri(this._days),o=Ri(this._months);e=m(r/60),t=m(e/60),r%=60,e%=60,n=m(o/12),o%=12;var a=n,s=o,l=i,u=t,c=e,f=r,d=this.asSeconds();return d?(0>d?"-":"")+"P"+(a?a+"Y":"")+(s?s+"M":"")+(l?l+"D":"")+(u||c||f?"T":"")+(u?u+"H":"")+(c?c+"M":"")+(f?f+"S":""):"P0D"}var Yn,Wn,Gn=e.momentProperties=[],Kn=!1,Zn={},Jn={},Qn=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Xn=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,er={},tr={},nr=/\d/,rr=/\d\d/,ir=/\d{3}/,or=/\d{4}/,ar=/[+-]?\d{6}/,sr=/\d\d?/,lr=/\d\d\d\d?/,ur=/\d\d\d\d\d\d?/,cr=/\d{1,3}/,fr=/\d{1,4}/,dr=/[+-]?\d{1,6}/,pr=/\d+/,hr=/[+-]?\d+/,mr=/Z|[+-]\d\d:?\d\d/gi,gr=/Z|[+-]\d\d(?::?\d\d)?/gi,vr=/[+-]?\d+(\.\d{1,3})?/,yr=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,br={},$r={},wr=0,xr=1,Cr=2,kr=3,Er=4,Sr=5,_r=6,Mr=7,Tr=8;R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),R("MMMM",0,0,function(e){return this.localeData().months(this,e)}),E("month","M"),L("M",sr),L("MM",sr,rr),L("MMM",function(e,t){return t.monthsShortRegex(e)}),L("MMMM",function(e,t){return t.monthsRegex(e)}),V(["M","MM"],function(e,t){t[xr]=g(e)-1}),V(["MMM","MMMM"],function(e,t,n,r){var i=n._locale.monthsParse(e,r,n._strict);null!=i?t[xr]=i:l(n).invalidMonth=e});var Dr=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Ar="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Or="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Nr=yr,Rr=yr,Ir={};e.suppressDeprecationWarnings=!1;var Pr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Fr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,jr=/Z|[+-]\d\d(?::?\d\d)?/,Lr=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Ur=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Hr=/^\/?Date\((\-?\d+)/i;e.createFromInputFallback=ie("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),R("Y",0,0,function(){var e=this.year();return 9999>=e?""+e:"+"+e}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),E("year","y"),L("Y",hr),L("YY",sr,rr),L("YYYY",fr,or),L("YYYYY",dr,ar),L("YYYYYY",dr,ar),V(["YYYYY","YYYYYY"],wr),V("YYYY",function(t,n){n[wr]=2===t.length?e.parseTwoDigitYear(t):g(t)}),V("YY",function(t,n){n[wr]=e.parseTwoDigitYear(t)}),V("Y",function(e,t){t[wr]=parseInt(e,10)}),e.parseTwoDigitYear=function(e){return g(e)+(g(e)>68?1900:2e3)};var qr=T("FullYear",!1);e.ISO_8601=function(){};var Vr=ie("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var e=Te.apply(null,arguments);return this.isValid()&&e.isValid()?this>e?this:e:c()}),zr=ie("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var e=Te.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:c()}),Br=function(){return Date.now?Date.now():+new Date};Ie("Z",":"),Ie("ZZ",""),L("Z",gr),L("ZZ",gr),V(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Pe(gr,e)});var Yr=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Wr=/(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Gr=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ze.fn=Ne.prototype;var Kr=et(1,"add"),Zr=et(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Jr=ie("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Nt("gggg","weekYear"),Nt("ggggg","weekYear"),Nt("GGGG","isoWeekYear"),Nt("GGGGG","isoWeekYear"),E("weekYear","gg"),E("isoWeekYear","GG"),L("G",hr),L("g",hr),L("GG",sr,rr),L("gg",sr,rr),L("GGGG",fr,or),L("gggg",fr,or),L("GGGGG",dr,ar),L("ggggg",dr,ar),z(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,r){t[r.substr(0,2)]=g(e)}),z(["gg","GG"],function(t,n,r,i){n[i]=e.parseTwoDigitYear(t)}),R("Q",0,"Qo","quarter"),E("quarter","Q"),L("Q",nr),V("Q",function(e,t){t[xr]=3*(g(e)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),E("week","w"),E("isoWeek","W"),L("w",sr),L("ww",sr,rr),L("W",sr),L("WW",sr,rr),z(["w","ww","W","WW"],function(e,t,n,r){t[r.substr(0,1)]=g(e)});var Qr={dow:0,doy:6};R("D",["DD",2],"Do","date"),E("date","D"),L("D",sr),L("DD",sr,rr),L("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),V(["D","DD"],Cr),V("Do",function(e,t){t[Cr]=g(e.match(sr)[0],10)});var Xr=T("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),R("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),R("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),E("day","d"),E("weekday","e"),E("isoWeekday","E"),L("d",sr),L("e",sr),L("E",sr),L("dd",yr),L("ddd",yr),L("dddd",yr),z(["dd","ddd","dddd"],function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:l(n).invalidWeekday=e}),z(["d","e","E"],function(e,t,n,r){t[r]=g(e)});var ei="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ti="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ni="Su_Mo_Tu_We_Th_Fr_Sa".split("_");R("DDD",["DDDD",3],"DDDo","dayOfYear"),E("dayOfYear","DDD"),L("DDD",cr),L("DDDD",ir),V(["DDD","DDDD"],function(e,t,n){n._dayOfYear=g(e)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,tn),R("hmm",0,0,function(){return""+tn.apply(this)+N(this.minutes(),2)}),R("hmmss",0,0,function(){return""+tn.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),nn("a",!0),nn("A",!1),E("hour","h"),L("a",rn),L("A",rn),L("H",sr),L("h",sr),L("HH",sr,rr),L("hh",sr,rr),L("hmm",lr),L("hmmss",ur),L("Hmm",lr),L("Hmmss",ur),V(["H","HH"],kr),V(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),V(["h","hh"],function(e,t,n){t[kr]=g(e),l(n).bigHour=!0}),V("hmm",function(e,t,n){var r=e.length-2;t[kr]=g(e.substr(0,r)),t[Er]=g(e.substr(r)),l(n).bigHour=!0}),V("hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[kr]=g(e.substr(0,r)),t[Er]=g(e.substr(r,2)),t[Sr]=g(e.substr(i)),l(n).bigHour=!0}),V("Hmm",function(e,t,n){var r=e.length-2;t[kr]=g(e.substr(0,r)),t[Er]=g(e.substr(r))}),V("Hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[kr]=g(e.substr(0,r)),t[Er]=g(e.substr(r,2)),t[Sr]=g(e.substr(i))});var ri=/[ap]\.?m?\.?/i,ii=T("Hours",!0);R("m",["mm",2],0,"minute"),E("minute","m"),L("m",sr),L("mm",sr,rr),V(["m","mm"],Er);var oi=T("Minutes",!1);R("s",["ss",2],0,"second"),E("second","s"),L("s",sr),L("ss",sr,rr),V(["s","ss"],Sr);var ai=T("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),E("millisecond","ms"),L("S",cr,nr),L("SS",cr,rr),L("SSS",cr,ir);var si;for(si="SSSS";si.length<=9;si+="S")L(si,pr);for(si="S";si.length<=9;si+="S")V(si,sn);var li=T("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var ui=p.prototype;ui.add=Kr,ui.calendar=nt,ui.clone=rt,ui.diff=ct,ui.endOf=xt,ui.format=ht,ui.from=mt,ui.fromNow=gt,ui.to=vt,ui.toNow=yt,ui.get=O,ui.invalidAt=At,ui.isAfter=it,ui.isBefore=ot,ui.isBetween=at,ui.isSame=st,ui.isSameOrAfter=lt,ui.isSameOrBefore=ut,ui.isValid=Tt,ui.lang=Jr,ui.locale=bt,ui.localeData=$t,ui.max=zr,ui.min=Vr,ui.parsingFlags=Dt,ui.set=O,ui.startOf=wt,ui.subtract=Zr,ui.toArray=St,ui.toObject=_t,ui.toDate=Et,ui.toISOString=pt,ui.toJSON=Mt,ui.toString=dt,ui.unix=kt,ui.valueOf=Ct,ui.creationData=Ot,ui.year=qr,ui.isLeapYear=de,ui.weekYear=Rt,ui.isoWeekYear=It,ui.quarter=ui.quarters=Ut,ui.month=J,ui.daysInMonth=Q,ui.week=ui.weeks=zt,ui.isoWeek=ui.isoWeeks=Bt,ui.weeksInYear=Ft,ui.isoWeeksInYear=Pt,ui.date=Xr,ui.day=ui.days=Jt,ui.weekday=Qt,ui.isoWeekday=Xt,ui.dayOfYear=en,ui.hour=ui.hours=ii,ui.minute=ui.minutes=oi,ui.second=ui.seconds=ai,ui.millisecond=ui.milliseconds=li,ui.utcOffset=Le,ui.utc=He,ui.local=qe,ui.parseZone=Ve,ui.hasAlignedHourOffset=ze,ui.isDST=Be,ui.isDSTShifted=Ye,ui.isLocal=We,ui.isUtcOffset=Ge,ui.isUtc=Ke,ui.isUTC=Ke,ui.zoneAbbr=ln,ui.zoneName=un,ui.dates=ie("dates accessor is deprecated. Use date instead.",Xr),ui.months=ie("months accessor is deprecated. Use month instead",J),ui.years=ie("years accessor is deprecated. Use year instead",qr),ui.zone=ie("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Ue);var ci=ui,fi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},di={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},pi=/\d{1,2}/,hi={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},mi=y.prototype;mi._calendar=fi,mi.calendar=dn,mi._longDateFormat=di,mi.longDateFormat=pn,mi._invalidDate="Invalid date",mi.invalidDate=hn,mi._ordinal="%d",mi.ordinal=mn,mi._ordinalParse=pi,mi.preparse=gn,mi.postformat=gn,mi._relativeTime=hi,mi.relativeTime=vn,mi.pastFuture=yn,mi.set=bn,mi.months=W,mi._months=Ar,mi.monthsShort=G,mi._monthsShort=Or,mi.monthsParse=K,mi._monthsRegex=Rr,mi.monthsRegex=ee,mi._monthsShortRegex=Nr,mi.monthsShortRegex=X,mi.week=Ht,mi._week=Qr,mi.firstDayOfYear=Vt,mi.firstDayOfWeek=qt,mi.weekdays=Wt,mi._weekdays=ei,mi.weekdaysMin=Kt,mi._weekdaysMin=ni,mi.weekdaysShort=Gt,mi._weekdaysShort=ti,mi.weekdaysParse=Zt,mi.isPM=on,mi._meridiemParse=ri,mi.meridiem=an,x("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===g(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),e.lang=ie("moment.lang is deprecated. Use moment.locale instead.",x),e.langData=ie("moment.langData is deprecated. Use moment.localeData instead.",k);var gi=Math.abs,vi=Fn("ms"),yi=Fn("s"),bi=Fn("m"),$i=Fn("h"),wi=Fn("d"),xi=Fn("w"),Ci=Fn("M"),ki=Fn("y"),Ei=Ln("milliseconds"),Si=Ln("seconds"),_i=Ln("minutes"),Mi=Ln("hours"),Ti=Ln("days"),Di=Ln("months"),Ai=Ln("years"),Oi=Math.round,Ni={s:45,m:45,h:22,d:26,M:11},Ri=Math.abs,Ii=Ne.prototype;return Ii.abs=_n,Ii.add=Tn,Ii.subtract=Dn,Ii.as=In,Ii.asMilliseconds=vi,Ii.asSeconds=yi,Ii.asMinutes=bi,Ii.asHours=$i,Ii.asDays=wi,Ii.asWeeks=xi,Ii.asMonths=Ci,Ii.asYears=ki,Ii.valueOf=Pn,Ii._bubble=On,Ii.get=jn,Ii.milliseconds=Ei,Ii.seconds=Si,Ii.minutes=_i,Ii.hours=Mi,Ii.days=Ti,Ii.weeks=Un,Ii.months=Di,Ii.years=Ai,Ii.humanize=zn,Ii.toISOString=Bn,Ii.toString=Bn,Ii.toJSON=Bn,Ii.locale=bt,Ii.localeData=$t,Ii.toIsoString=ie("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Bn),Ii.lang=Jr,R("X",0,0,"unix"),R("x",0,0,"valueOf"),L("x",hr),L("X",vr),V("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),V("x",function(e,t,n){n._d=new Date(g(e))}),e.version="2.11.1",function(e){Yn=e}(Te),e.fn=ci,e.min=Ae,e.max=Oe,e.now=Br,e.utc=a,e.unix=cn,e.months=xn,e.isDate=n,e.locale=x,e.invalid=c,e.duration=Ze,e.isMoment=h,e.weekdays=kn,e.parseZone=fn,e.localeData=k,e.isDuration=Re,e.monthsShort=Cn,e.weekdaysMin=Sn,e.defineLocale=C,e.weekdaysShort=En,e.normalizeUnits=S,e.relativeTimeThreshold=Vn,e.prototype=ci,e}),define("common/bundles/vendors",["common/require","common/angular","common/angularAnimate","common/angularBootstrap","common/angular-file-upload","common/angulartics","common/angulartics-google-tag-manager","common/angularMocks","common/angularResource","common/angularRoute","common/angularXeditable","common/text-angular","common/ui-select","common/d3","common/lodash","common/moment"],function(){}),define("common/modules/apis",["common/angular"],function(e){"use strict";return e.module("common.apis",[])}),define("common/services/api",["common/angular","common/lodash","common/modules/apis"],function(e,t,n){"use strict";n.factory("api",["$cacheFactory","$log","$http","$httpParamSerializer","$q","$timeout",function(n,r,i,o,a,s){function l(e){return e.data.is_error?(r.error(e.data),a.reject(e.data.error_message)):e.data}function u(e){var n={options:{limit:0}};return JSON.stringify(t.merge(n,e||{}))}r.debug("api");return{extend:function(t){return e.extend(Object.create(this),t)},getAll:function(e,n,i,o,s,l,u){return r.debug("api.all"),n=n||{},l=l||"get",a.all([function(){var r=t.assign({},n,s||{},{options:t.assign({},n.options,{sort:o||"id DESC"})});return i&&(r.options.offset=(i.page-1)*i.size,r.options.limit=i.size),this.sendGET(e,l,r,u)}.bind(this)(),function(){if(!i)return a.resolve();var r=t.assign({},n,{return:"id"});return r=t.omit(r,function(e,n){return t.startsWith(n,"api.")}),this.sendGET(e,l,r,u)}.bind(this)()]).then(function(e){var n=e[0],r=i?e[1]:n;return{list:n.values,total:r.count,allIds:t.compact(r.values.map(function(e){return e.id})).join(",")}})},mockGET:function(e,t){var n=a.defer();return s(function(){n.resolve(e)},t||0),n.promise},mockPOST:function(e,t){return this.mockGET.apply(this,arguments)},sendGET:function(e,t,r,a){var s={action:t,entity:e,json:u(r),sequential:1};return!1===a&&n.get("$http").remove("/civicrm/ajax/rest?"+o(s)),i({method:"GET",url:"/civicrm/ajax/rest",cache:!0,responseType:"json",params:s}).then(l)},sendPOST:function(e,t,n){return r.debug("api.sendPOST"),i({method:"POST",url:"/civicrm/ajax/rest",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},responseType:"json",data:{json:u(n),sequential:1,entity:e,action:t},transformRequest:o}).then(l)}}}])}),define("common/services/api/appraisal",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("api.appraisal",["$log","api",function(e,t){return e.debug("api.appraisal"),t.extend({all:function(t,n,r){return e.debug("api.appraisal.api"),this.getAll("Appraisal",t,n,r)},create:function(t){return e.debug("api.appraisal.create"),this.sendPOST("Appraisal","create",t).then(function(e){return e.values[0]})},find:function(t){return e.debug("api.appraisal.find"),this.sendGET("Appraisal","get",{id:""+t},!1).then(function(e){return e.values[0]})}})}])}),define("common/services/api/option-group",["common/lodash","common/modules/apis","common/services/api"],function(e,t){"use strict";t.factory("api.optionGroup",["$log","api",function(t,n){function r(t){return t.values.map(function(t){var n=e.clone(t);return n.option_group_name=n["option_group_id.name"],delete n["option_group_id.name"],n})}function i(t){return e.transform(t,function(e,t){var n=t.option_group_name;e[n]=e[n]||[],e[n].push(t)})}return t.debug("api.optionGroup"),n.extend({valuesOf:function(t,n){var o=e.isArray(t);return this.sendGET("OptionValue","get",{"option_group_id.name":{IN:o?t:[t]},is_active:"1",return:["option_group_id.name","option_group_id","id","name","label","value","weight","is_active","is_reserved"]},n).then(r).then(function(e){return o?i(e):e})}})}])}),define("common/services/api/appraisal-cycle",["common/lodash","common/modules/apis","common/services/api","common/services/api/option-group"],function(e,t){"use strict";t.factory("api.appraisal-cycle",["$q","$log","api","api.optionGroup",function(t,n,r,i){return n.debug("api.appraisal-cycle"),r.extend({all:function(e,t,r){return n.debug("api.appraisal-cycle.all"),this.getAll("AppraisalCycle",e,t,r,{"api.AppraisalCycle.getappraisalsperstep":{}})},create:function(t){return n.debug("api.appraisal-cycle.create"),this.sendPOST("AppraisalCycle","create",e.assign(t,{"api.AppraisalCycle.getappraisalsperstep":{}})).then(function(e){return e.values[0]})},find:function(e){n.debug("api.appraisal-cycle.find");var t={id:""+e,"api.AppraisalCycle.getappraisalsperstep":{}};return this.sendGET("AppraisalCycle","get",t,!1).then(function(e){return e.values[0]})},grades:function(){return n.debug("grades"),this.mockGET([{label:1,value:17},{label:2,value:74},{label:3,value:90},{label:4,value:30}])},statuses:function(){return n.debug("api.appraisal-cycle.statuses"),i.valuesOf("appraisal_status")},statusOverview:function(e){return n.debug("api.appraisal-cycle.statusOverview"),this.sendGET("AppraisalCycle","getstatusoverview",e).then(function(e){return e.values})},update:function(t){ -return n.debug("api.appraisal-cycle.update"),this.sendPOST("AppraisalCycle","create",e.assign(t,{"api.AppraisalCycle.getappraisalsperstep":{}})).then(function(e){return e.values[0]})},total:function(e){return n.debug("api.appraisal-cycle.total"),this.sendGET("AppraisalCycle","getcount",e||{}).then(function(e){return e.result})},types:function(){return n.debug("api.appraisal-cycle.types"),i.valuesOf("appraisal_cycle_type")}})}])}),define("common/services/api/contact-job-role-api.api",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("ContactJobRoleAPI",["$log","api",function(e,t){return e.debug("ContactJobRoleAPI"),t.extend({all:function(t,n,r,i){return e.debug("ContactJobRoleAPI.all()"),this.getAll("ContactHrJobRoles",t,n,r,i)}})}])}),define("common/bundles/apis",["common/services/api/appraisal","common/services/api/appraisal-cycle","common/services/api/contact-job-role-api.api","common/services/api/option-group"],function(){}),define("common/modules/services",["common/angular","common/angular-file-upload"],function(e){"use strict";return e.module("common.services",["angularFileUpload"])}),define("common/services/before-hash-query-params.service",["common/lodash","common/modules/services"],function(e,t){"use strict";t.factory("beforeHashQueryParams",["$log","$window",function(t,n){function r(e){var t=e||n.location.href,r=o(t);return-1===r.indexOf("?")?{}:i(a(r))}function i(t){return t.length?e.transform(t,function(e,t){var n=t.split("=");n[0]&&(e[n[0]]=n[1]?decodeURI(n[1]):null)},{}):{}}function o(e){var t=e.indexOf("#");return e.substring(0,-1!==t?t:e.length)}function a(e){var t=e.indexOf("?");return e.substr(t+1).split("&")}return t.debug("Service: beforeHashQueryParams"),{parse:r}}])}),function(e){define("common/services/check-permissions",["common/lodash","common/modules/services"],function(t,n){"use strict";n.factory("checkPermissions",["$q",function(n){return function(r){return r=t.isArray(r)?r:[r],n.resolve(r.every(function(t){return e.checkPerm(t)}))}}])})}(CRM),function(e){define("common/services/crm-ang.service",["common/lodash","common/modules/services"],function(t,n){"use strict";function r(t,n){return e.loadForm(t,n)}n.factory("crmAngService",function(){return{loadForm:r}})})}(CRM),define("common/services/detect-device.service",["common/modules/services"],function(e){"use strict";e.factory("detectDevice",[function(){return{isMobile:function(){return document.getElementsByTagName("body")[0].classList.contains("mobile")}}}])}),define("common/services/dom-event-trigger",["common/modules/services"],function(e){"use strict";!function(t){e.factory("DOMEventTrigger",function(){return function(e,n){t(document).trigger(e,n)}})}(CRM.$)}),define("common/services/file-mime-types",["common/lodash","common/modules/services"],function(e,t){"use strict";t.factory("fileMimeTypes",["$q",function(e){var t={txt:"plain",png:"png",jpeg:"jpeg",bmp:"bmp",gif:"gif",pdf:"pdf",doc:"msword",docx:"vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"vnd.ms-excel",xlsx:"vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"vnd.ms-powerpoint",pptx:"vnd.openxmlformats-officedocument.presentationml.presentation"};return{getMimeTypeFor:function(n){return e.resolve(t[n])}}}])}),define("common/services/file-upload",["common/modules/services","common/lodash","common/angular-file-upload"],function(e,t){"use strict";e.factory("FileUpload",["$q","$log","FileUploader",function(e,n,r){function i(e){throw new Error(e+" missing from parameter")}function o(e,t,r,i){n.error(" ===== Item Error: "+r+" ======"),n.error(" ===== - item ======"),n.error(e),n.error(" ===== - response ======"),n.error(t),n.error(" ===== - headers ======"),n.error(i)}function a(e){return t.defaults(e,{allowedMimeTypes:{txt:"plain",png:"png",jpeg:"jpeg",bmp:"bmp",gif:"gif",pdf:"pdf"},url:"/civicrm/ajax/attachment",queueLimit:1})}return{uploader:function(n){var s,l,u,c=[];return n?(n=a(n),s=new r({url:n.url,queueLimit:+n.queueLimit,onCompleteItem:function(e,t){c.push(t)},onCompleteAll:function(){u.resolve(c)},onErrorItem:function(e){o.apply(null,arguments),u.reject("Could not upload file: "+e.file.name)},formData:[{entity_table:n.entityTable||i("entityTable"),crm_attachment_token:n.crmAttachmentToken||i("crmAttachmentToken")}],filters:[{name:"fileFormatFilter",fn:function(e){var r=e.type.slice(e.type.lastIndexOf("/")+1);return t.includes(t.values(n.allowedMimeTypes),r)}}]}),s.uploadAll=function(){return l=s.uploadAll,function(n){return u=e.defer(),s.onBeforeUploadItem=function(e){t.each(n,function(n,r){var i={};i[t.snakeCase(r)]=n,e.formData.push(i)})},l.apply(s),u.promise}}(),s):i("custom settings")}}}])}),define("common/services/file.service",["common/modules/services"],function(e){"use strict";e.factory("fileService",["$http","$window","$log",function(e,t,n){return n.debug("Service: fileService"),{openFile:function(n){return e.get(n.url,{responseType:"arraybuffer"}).success(function(e){var r=new Blob([e],{type:n.fileType});t.navigator.msSaveOrOpenBlob?t.navigator.msSaveOrOpenBlob(r,n.name):t.open(URL.createObjectURL(r),"_blank")})}}}])}),define("common/services/hr-settings",["common/modules/services"],function(e){"use strict";e.factory("HR_settings",function(){return{DATE_FORMAT:null}})}),function(e){define("common/services/notification.service",["common/lodash","common/modules/services"],function(t,n){"use strict";n.factory("notificationService",function(){return t(["alert","success","info","error"]).map(function(t){return[t,function(n,r,i){return e.alert(r,n,t,i)}]}).zipObject().value()})})}(CRM),define("common/services/pub-sub",["common/modules/services"],function(e){"use strict";var t=Object.create(null);e.factory("pubSub",["$rootScope",function(e){return{subscribe:function(n,r){var i;return t[n]=t[n]||[],r.$rootScope=e,i=t[n].push(r)-1,{remove:function(){delete t[n][i]}}},publish:function(e,n){t[e]&&(n=void 0!=n?n:{},t[e].forEach(function(e){e.$rootScope.$applyAsync(function(){e(n)})}))}}}])}),define("common/bundles/services",["common/services/before-hash-query-params.service","common/services/check-permissions","common/services/crm-ang.service","common/services/detect-device.service","common/services/dom-event-trigger","common/services/file-mime-types","common/services/file-upload","common/services/file.service","common/services/hr-settings","common/services/notification.service","common/services/pub-sub"],function(){}),define("common/modules/components",["common/angular"],function(e){return e.module("common.components",[])}),define("common/components/heatmap.component",["common/lodash","common/moment","common/modules/components"],function(e,t,n){function r(){function n(e){e.values&&(u(),l(),c())}function r(){return Object.values(d.values).filter(function(e){return!1!==e})}function i(e,t){return e.reduce(function(e,n){return Math.abs(n.value-t)');r(n,t),e.after(n)}function r(e,n){function r(){n.isOpen=!0,n.$apply()}t.isMobile()||(e.on("click",r),n.$on("$destroy",function(){e.off("click",r)}))}var i=e[0],o=i.compile;return i.compile=function(){var e=o.apply(this,arguments);return function(t,i,o){e.apply(this,arguments),n(i,t),r(i,t)}},e}]}),define("common/decorators/uib-datepicker-mobile-version.decorator",["common/moment","common/services/detect-device.service"],function(e){"use strict";return["$delegate","detectDevice",function(t,n){function r(t){return t?e(t).format("Y-MM-DD"):""}var i=t[0],o=i.compile;return i.require=["ngModel","uibDatepickerPopup"],i.compile=function(){var e=o.apply(this,arguments);return function(t,i,o,a){n.isMobile()?(i.prop("type","date"),o.ngReadonly=!1,a[0].$formatters.push(function(e){return r(e)}),t.$watch("datepickerOptions.minDate",function(e){o.$set("min",r(e))}),t.$watch("datepickerOptions.maxDate",function(e){o.$set("max",r(e))})):e.apply(this,arguments)}},t}]}),define("common/decorators/xeditable-disable-calendar-icon.decorator",[],function(){"use strict";return["$delegate",function(e){var t=e[0],n=t.compile;return t.compile=function(){var e=n.apply(this,arguments);return function(t,n,r){e.apply(this,arguments),r.eShowCalendarButton=!1}},e}]}),define("common/decorators/ui-bootstrap/uib-tabset",[],function(){"use strict";return["$delegate",function(e){return e[0].bindToController.customHeaderClass="@",e}]}),define("common/decorators/ui-bootstrap/uib-modal.decorator",["common/angular"],function(e){"use strict";return["$delegate","$document",function(e,t){function n(){var e,n=t.find("body, html");return n.addClass("chr_scroll-lock"),e=r.apply(this,arguments),e.closed.then(function(){t.find(".modal-dialog").length||n.removeClass("chr_scroll-lock")}),e}var r=e.open;return e.open=n,e}]}),define("common/decorators/uib-tooltip.decorator",["common/angular","common/angularBootstrap"],function(e){"use strict";var t,n;return["$delegate","$document","$timeout",function(r,i,o){return t=i,n=o,function(){var i=r.apply(this,arguments),o=i.compile,a="ontouchstart"in t[0].documentElement,s=a?"touchend touchcancel":"click";return i.compile=function(r,i){return function(l,u,c,f){function d(){g=e.element('
    '),u.css({position:"relative"}),g.css({position:"absolute",height:"100%",width:"100%","z-index":1,top:0,left:0}),u.append(g)}function p(){a?(g.on("touchend touchcancel",function(){m("source",!0,50),!l.open&&h()}),t.find("body").on("touchend touchcancel",function(e){e.target!==g[0]&&(m("source",!1,0),m("tooltip",!1,0))}),g.on("click",function(e){e.stopPropagation()})):(u.on("mouseenter",function(){m("source",!0,0),!l.open&&h()}),u.on("mouseleave",function(){m("source",!1,100)}),u.on("click",function(){m("source",!1,0),m("tooltip",!1,0)}))}function h(){var e;n(function(){e=t.find(".tooltip-clickable-template:visible:last"),a||(e.on("mouseenter",function(){m("tooltip",!0,0)}),e.on("mouseleave",function(){m("tooltip",!1,100)})),e.on(s,function(){m("source",!1,0),m("tooltip",!1,0)})})}function m(e,t,r){n(function(){l[e+"_hovered"]=t,l.open=l.source_hovered||l.tooltip_hovered,u.trigger("custom"+(l.open?"Show":"Hide")),a&&g[l.open?"hide":"show"]()},r)}var g,v=u.attr("uib-tooltip-clickable");v&&function(){c.tooltipTrigger="customShow",c.tooltipAnimation=!1}(),o(r,i)(l,u,c,f),v&&function(){a&&d(),p()}()}},i}}]}),define("common/modules/templates",["common/angular"],function(e){"use strict";return e.module("common.templates",[]).run(["$templateCache",function(e){e.put("dialog.html",'\n\n\n'),e.put("help-text.html",'\n \n \n\n'),e.put("loading.html",'
    \n
    \n
    \n
    \n'),e.put("time-amount-picker.html",'
    \n
    \n \n \n
    \n h\n
    \n \n \n
    \n m\n
    \n'),e.put("timepicker-select.html",'\n\n'),e.put("civihr-ui-select/choices.tpl.html",'
      \n
    • \n
      \n
        \n
      • \n
        \n
      • \n
      \n
    • \n
    \n'),e.put("civihr-ui-select/match-multiple.tpl.html",'\n
  • \n \n \n
  • \n
    \n'),e.put("civihr-ui-select/match.tpl.html",'\n {{$select.contactList ? \'-select-\' : $select.placeholder}}\n \n \n \n\n'),e.put("civihr-ui-select/select-contacts-multiple.tpl.html",'
    \n
    \n
      \n \n
    • \n \n
    • \n
    \n\n \n\n \n
    \n
    \n'),e.put("civihr-ui-select/select-contacts.tpl.html",'
    \n
    \n \n
    \n'),e.put("civihr-ui-select/select-multiple.tpl.html",'
    \n
    \n
      \n \n
    • \n \n
    • \n
    \n \n
    \n
    \n'),e.put("civihr-ui-select/select.tpl.html",'
    \n
    \n \n
    \n'),e.put("components/heatmap.html",'
      \n
    • \n {{day.name.short}}\n
    • \n
    \n'),e.put("components/notification-badge.html",'\n {{badge.count}}\n\n\n'),e.put("contact-actions/contact-actions.html",'
    \n \n \n
    \n'),e.put("contact-actions/modals/form.html",'\n \n \n \n\n')}])}),define("common/modules/controllers",["common/angular","common/angularBootstrap","common/modules/apis"],function(e){"use strict";return e.module("common.controllers",["ui.bootstrap","common.apis"])}),define("common/modules/directives",["common/angular","common/decorators/ui-select-focus.decorator","common/decorators/uib-datepicker-calendar-icon.decorator","common/decorators/uib-datepicker-mobile-version.decorator","common/decorators/xeditable-disable-calendar-icon.decorator","common/decorators/ui-bootstrap/uib-tabset","common/decorators/ui-bootstrap/uib-modal.decorator","common/decorators/uib-tooltip.decorator","common/angularBootstrap","common/angularXeditable","common/ui-select","common/modules/templates","common/modules/controllers","common/modules/services","common/modules/apis"],function(e,t,n,r,i,o,a,s){"use strict";return e.module("common.directives",["common.templates","common.controllers","ui.select","ui.bootstrap","xeditable"]).config(["$provide","$uibTooltipProvider",function(e,l){l.setTriggers({customShow:"customHide"}),e.decorator("uibDatepickerPopupDirective",r),e.decorator("uibDatepickerPopupDirective",n),e.decorator("uibTabsetDirective",o),e.decorator("$uibModal",a),e.decorator("editableBsdateDirective",i),e.decorator("uiSelectDirective",t),e.decorator("$uibTooltip",s)}]).run(["$templateCache",function(e){var t="uib/template/tabs/tabset.html",n=jQuery(e.get(t));n.find("ul").addClass("{{tabset.customHeaderClass}}"),e.put(t,n.wrap("
    ").parent().html())}])}),define("common/services/api/contact-actions",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("api.contactActions",["$q","api",function(e,t){function n(e,n){return t.sendGET(e,"getoptions",{field:n,context:"search"}).then(function(e){return e.values})}function r(e){return t.sendGET("UFField","get",{uf_group_id:e,is_active:!0}).then(function(e){return e.values})}function i(n,r){return e(function(e,i){if(r.contact_type=n,r.email)return t.sendGET("CustomField","get",{return:["id"],custom_group_id:"Emergency_Contacts",name:"email"}).then(function(t){r["custom_"+t.id]=r.email,delete r.email,e()});e()}).then(function(){return t.sendPOST("Contact","create",r).then(function(e){return e.values[0]})})}return t.extend({getOptions:{forContactType:function(){return n.call(this,"Contact","contact_type")},forGroup:function(){return n.call(this,"GroupContact","group_id")},forTag:function(){return n.call(this,"EntityTag","tag_id")},forStateProvince:function(){return n.call(this,"Address","state_province_id")},forCountry:function(){return n.call(this,"Address","country_id")},forGender:function(){return n.call(this,"Contact","gender_id")},forDeceased:function(){return n.call(this,"Contact","is_deceased")}},save:{newIndividual:function(e){return i.call(this,"Individual",e)},newOrganization:function(e){return i.call(this,"Organization",e)},newHousehold:function(e){return i.call(this,"Household",e)}},getFormFields:{forNewIndividual:function(){return r.call(this,"new_individual")},forNewOrganization:function(){return r.call(this,"new_organization")},forNewHousehold:function(){return r.call(this,"new_household")}}})}])}),define("common/controllers/contact-actions/modal-ctrl",[],function(){"use strict";return function(e,t){this.errorMsg="",this.loading=!0,this.formFields=[],this.init=function(e){e().then(function(e){this.loading=!1,this.formFields=e}.bind(this)).catch(function(){this.loading=!1,this.errorMsg="Error while loading form fields"}.bind(this))},this.cancel=function(){t.dismiss("cancel")},this.save=function(n,r){this.loading=!0,n(this.formFields.reduce(function(e,t){return e[t.field_name]=t.value,e},{})).then(function(n){this.loading=!1,e.$broadcast(r,n),t.dismiss("cancel")}.bind(this)).catch(function(){this.loading=!1,this.errorMsg="Error while saving data"}.bind(this))}} -}),define("common/controllers/contact-actions/new-individual-ctrl",["common/modules/controllers","common/controllers/contact-actions/modal-ctrl","common/services/api/contact-actions"],function(e,t){"use strict";function n(e,n,r){var i=this;t.call(i,e,n),i.title="New Individual",i.init(r.getFormFields.forNewIndividual),i.submit=function(){i.save(r.save.newIndividual,"newIndividualCreated")}}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,e.controller("NewIndividualModalCtrl",["$rootScope","$uibModalInstance","api.contactActions",n])}),define("common/controllers/contact-actions/new-household-ctrl",["common/modules/controllers","common/controllers/contact-actions/modal-ctrl","common/services/api/contact-actions"],function(e,t){"use strict";function n(e,n,r){var i=this;t.call(i,e,n),i.title="New Household",i.init(r.getFormFields.forNewHousehold),i.submit=function(){i.save(r.save.newHousehold,"newHouseholdCreated")}}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,e.controller("NewHouseholdModalCtrl",["$rootScope","$uibModalInstance","api.contactActions",n])}),define("common/controllers/contact-actions/new-organization-ctrl",["common/modules/controllers","common/controllers/contact-actions/modal-ctrl","common/services/api/contact-actions"],function(e,t){"use strict";function n(e,n,r){var i=this;t.call(i,e,n),i.title="New Organization",i.init(r.getFormFields.forNewOrganization),i.submit=function(){i.save(r.save.newOrganization,"newOrganizationCreated")}}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,e.controller("NewOrganizationModalCtrl",["$rootScope","$uibModalInstance","api.contactActions",n])}),define("common/controllers/contact-actions/contact-actions-ctrl",["common/modules/controllers","common/services/api/contact-actions","common/controllers/contact-actions/new-individual-ctrl","common/controllers/contact-actions/new-household-ctrl","common/controllers/contact-actions/new-organization-ctrl"],function(e){"use strict";e.controller("ContactActionsCtrl",["$scope","$rootElement","$uibModal","api.contactActions",function(e,t,n,r){var i=this;e.$watch(function(){return i.refineSearch.selected},function(t,n){t!==n&&e.$emit("contactRefineSearch",{field:t.field?t.field.label:null,option:t.option?t.option.value:null})},!0),i.refineSearch={selected:{field:null,option:null},availableFields:[{label:"Contact Type",getOptions:r.getOptions.forContactType},{label:"Group",getOptions:r.getOptions.forGroup},{label:"Tag",getOptions:r.getOptions.forTag},{label:"State / Province",getOptions:r.getOptions.forStateProvince},{label:"Country",getOptions:r.getOptions.forCountry},{label:"Gender",getOptions:r.getOptions.forGender},{label:"Deceased",getOptions:r.getOptions.forDeceased}],availableOptions:{refresh:function(){i.refineSearch.selected.field?(this.options=null,i.refineSearch.selected.field.getOptions().then(function(e){this.options=e}.bind(this))):this.options=[]},options:[]}},i.showNewIndividualModal=function(){n.open({appendTo:t.children().eq(0),controller:"NewIndividualModalCtrl",controllerAs:"$ctrl",bindToController:!0,templateUrl:"contact-actions/modals/form.html"})},i.showNewHouseholdModal=function(){n.open({appendTo:t.children().eq(0),controller:"NewHouseholdModalCtrl",controllerAs:"$ctrl",bindToController:!0,templateUrl:"contact-actions/modals/form.html"})},i.showNewOrganizationModal=function(){n.open({appendTo:t.children().eq(0),controller:"NewOrganizationModalCtrl",controllerAs:"$ctrl",bindToController:!0,templateUrl:"contact-actions/modals/form.html"})}}])}),define("common/directives/prevent-animations",["common/modules/directives"],function(e){"use strict";e.directive("preventAnimations",["$animate",function(e){return{restrict:"A",link:function(t,n,r){e.enabled(n,!1)}}}])}),define("common/directives/loading",["common/modules/directives","common/directives/prevent-animations"],function(e){"use strict";e.directive("crmLoading",["$templateCache",function(e){return{scope:{show:"="},restrict:"E",replace:!0,transclude:!0,template:e.get("loading.html")}}])}),define("common/directives/contact-actions/contact-actions",["common/modules/directives","common/controllers/contact-actions/contact-actions-ctrl","common/directives/loading"],function(e){"use strict";e.directive("contactActions",[function(){return{restrict:"E",templateUrl:"contact-actions/contact-actions.html",controller:"ContactActionsCtrl",controllerAs:"$ctrl",link:function(e,t,n){e.$ctrl.refineSearchVisible=t.parent().parent()[0].hasAttribute("refine-search")}}}])}),define("common/directives/help-text.directive",["common/lodash","common/moment","common/modules/directives","common/services/notification.service"],function(e,t,n){function r(e,t){function n(){var n=e.getHelpText();t.info(e.title||r,n)}var r="Help";this.displayHelpText=n}function i(e,t,n){function r(){return t.find(".help-text").html()}e.getHelpText=r}n.directive("helpText",["$templateCache",function(e){return{restrict:"E",scope:{title:"@?"},transclude:!0,controller:r,controllerAs:"helpText",template:e.get("help-text.html"),link:i}}]),r.$inject=["$scope","notificationService"]}),define("common/directives/scroll-shadows.directive",["common/angular","common/modules/directives"],function(e,t){"use strict";function n(t,n,r){function i(){u(),a(),l(),s()}function o(){var e=f.width(),t=p+"__shadows--show-left",n=p+"__shadows--show-right",r=d.scrollLeft(),i=d.width();if(e<=i)return void d.removeClass(t+" "+n);d[r>0?"addClass":"removeClass"](t),d[r
    ').parent(),d=f.wrap('
    ').parent(),d.wrap('
    ')}var f,d,p="chr_scroll-shadows";!function(){c(),i(),o()}()}t.directive("scrollShadows",[function(){return{restrict:"A",controller:n}}]),n.$inject=["$element","$scope","$window"]}),define("common/directives/timepicker-select.directive",["common/moment","common/modules/directives"],function(e,t){"use strict";function n(t){function n(){var n=+t.timepickerSelectInterval||1,i=e.duration(t.timepickerSelectTimeFrom||"00:00"),o=e.duration(t.timepickerSelectTimeTo||"23:59");for(r.options=[];i.asMinutes()<=o.asMinutes();){var a=e.utc(i.asMilliseconds());r.options.push(a.format("HH:mm")),i.add(n,"minutes")}}var r=this;r.placeholder=t.timepickerSelectPlaceholder,r.options=[],t.$watchGroup(["timepickerSelectTimeFrom","timepickerSelectTimeTo","timepickerSelectInterval"],function(){n()})}t.directive("timepickerSelect",["$templateCache",function(e){return{scope:{timepickerSelectPlaceholder:"@",timepickerSelectTimeFrom:"<",timepickerSelectTimeTo:"<",timepickerSelectInterval:"<"},restrict:"A",controllerAs:"selector",controller:["$scope",n],template:e.get("timepicker-select.html")}}]),n.$inject=["$scope"]}),define("common/directives/time-amount-picker.directive",["common/lodash","common/modules/directives"],function(e,t){"use strict";function n(t){function n(){var e=Math.floor(c);for(d.hoursOptions=[];e<=f;)d.hoursOptions.push(e),e++}function r(){var e,t,n,r=0;for(d.minutesOptions=[];r<60;)t=+d.selectedHours===Math.floor(c)&&rf%1*60,e=t||n,!e&&d.minutesOptions.push(r),r+=u;l()}function i(){u=+t.interval||1,c=isNaN(+t.minAmount)?0:+t.minAmount,f=isNaN(+t.maxAmount)?24:+t.maxAmount,n(),r()}function o(){""!==d.selectedHours&&""!==d.selectedMinutes&&(t.value=+d.selectedHours+d.selectedMinutes/60)}function a(){t.$watch("disabled",function(e){d.disabled=e}),t.$watch("value",function(){s(),i()}),t.$watchGroup(["minAmount","maxAmount","interval"],function(){i()})}function s(){void 0!==t.value&&(d.selectedHours=""+Math.floor(t.value),d.selectedMinutes=""+Math.floor(t.value%1*60)),o()}function l(){d.selectedMinutese.last(d.minutesOptions)&&(d.selectedMinutes=""+e.last(d.minutesOptions))}var u,c,f,d=this;d.hoursOptions=[],d.minutesOptions=[],d.selectedHours="",d.selectedMinutes="",d.buildMinutesOptions=r,d.calculateSelectedValue=o,function(){s(),i(),a()}()}t.directive("timeAmountPicker",["$templateCache",function(e){return{scope:{minAmount:".75?Math.floor(.25*Math.ceil(e/.25))+"h":"",n=e%1&&e%1<=.75&&e%1>0?.25*Math.ceil(e%1/.25)*60+"m":"",r+t+(t&&n?" ":"")+n)}};return function(t,n){var r=void 0===t?0:parseFloat(t);if(isNaN(r))throw new Error("Value must be a number or a numeric string: "+t);return e[n](r)}})}),define("common/bundles/filters",["common/filters/time-unit-applier.filter"],function(){}),define("common/decorators/angular-date/datepicker-popup",["common/lodash"],function(e){return["$delegate","HR_settings",function(t,n){"use strict";var r=t[0].link;return t[0].compile=function(){return function(t,i,o,a){o.uibDatepickerPopup=o.uibDatepickerPopup||n.DATE_FORMAT||"yyyy-MM-dd",o.showButtonBar=o.showButtonBar||!1,t.datepickerOptions=e.assign({formatDayHeader:"E",showWeeks:!1,startingDay:1},t.datepickerOptions),r.apply(this,arguments)}},t}]}),define("common/decorators/angular-date/date-filter",[],function(){"use strict";return["$delegate",function(e){var t=e;return function(){if("E"===arguments[1]){var e=Array.prototype.slice.call(arguments);return e[1]="EEE",t.apply(this,e)[0]}return t.apply(this,arguments)}}]}),function(e){define("common/modules/angular-date",["common/angular","common/decorators/angular-date/datepicker-popup","common/decorators/angular-date/date-filter","common/modules/services","common/angularBootstrap","common/modules/templates"],function(t,n,r){"use strict";function i(t){var n="uib/template/datepicker/"+t+".html",r=o.get(n);r=r.replace(/glyphicon glyphicon-chevron-(left|right)/gm,"fa fa-chevron-$1"),"day"===t&&(r=function(t){return e(t).find('th[ng-if="showWeeks"]').parent().css({"border-top":"1px solid #DDD"}),e(t).prop("outerHTML")}(e.parseHTML(r))),o.put(n,r)}var o;return t.module("common.angularDate",["common.services","ui.bootstrap","common.templates"]).config(["$provide",function(e){e.decorator("uibDatepickerPopupDirective",n),e.decorator("dateFilter",r)}]).run(["$templateCache",function(e){o=e,["day","month","year"].forEach(i)}])})}(CRM.$),define("common/services/angular-date/date-format",["common/angular","common/modules/angular-date","common/services/hr-settings"],function(e,t){"use strict";t.factory("DateFormat",["$q","HR_settings",function(e,t){return{dateFormat:null,getDateFormat:function(){return this.dateFormat?e.when(this.dateFormat):e.when("dd/MM/yyyy").catch(function(){return"yyyy-MM-dd"}).then(function(e){return t.DATE_FORMAT=e,this.dateFormat=e,e}.bind(this))}}}])}),define("common/filters/angular-date/format-date",["common/moment","common/modules/angular-date","common/services/hr-settings"],function(e,t){"use strict";t.filter("formatDate",["HR_settings",function(t){var n=["DD-MM-YYYY","DD-MM-YYYY HH:mm:ss","YYYY-MM-DD","YYYY-MM-DD HH:mm:ss","DD/MM/YYYY","x","YYYY-MM-DD HH:mm:ss"];return function(r,i,o){var a,s=i||t.DATE_FORMAT||"YYYY-MM-DD",l=e(0);return r instanceof Date&&(r=e(r).format("YYYY-MM-DD HH:mm:ss")),a=e(r,n,!0),a.isValid()&&!a.isSame(l)?i===Date?a.toDate():a.format(s.toUpperCase())+("hours"===o?" "+a.format("HH:mm"):""):"Unspecified"}}])}),define("common/directives/angular-date/date-input",["common/modules/angular-date","common/filters/angular-date/format-date"],function(e){"use strict";e.directive("dateInput",["$filter",function(e){return{require:"ngModel",link:function(t,n,r,i){function o(t){var n=e("formatDate")(t);return n="Unspecified"==n?"":n}i.$formatters.push(o),i.$parsers=[]}}}])}),define("common/bundles/angular-date",["common/services/angular-date/date-format","common/filters/angular-date/format-date","common/directives/angular-date/date-input"],function(){}),define("common/modules/routers/compu-ng-route",["common/angular","common/angularRoute"],function(e){"use strict";return e.module("compuNgRoute",["ngRoute"]).config(["$routeProvider",function(t){var n=t.when;t.resolveForAll=function(e){return t.commonResolve=e,t},t.when=function(r,i){return e.extend(i.resolve||{},t.commonResolve||{}),n.call(t,r,i)}}])}),"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(e,t,n){"use strict";function r(e,t){return L(new(L(function(){},{prototype:e})),t)}function i(e){return j(arguments,function(t){t!==e&&j(t,function(t,n){e.hasOwnProperty(n)||(e[n]=t)})}),e}function o(e,t){var n=[];for(var r in e.path){if(e.path[r]!==t.path[r])break;n.push(e.path[r])}return n}function a(e){if(Object.keys)return Object.keys(e);var t=[];return j(e,function(e,n){t.push(n)}),t}function s(e,t){if(Array.prototype.indexOf)return e.indexOf(t,Number(arguments[2])||0);var n=e.length>>>0,r=Number(arguments[2])||0;for(0>(r=0>r?Math.ceil(r):Math.floor(r))&&(r+=n);n>r;r++)if(r in e&&e[r]===t)return r;return-1}function l(e,t,n,r){var i,l=o(n,r),u={},c=[];for(var f in l)if(l[f].params&&(i=a(l[f].params),i.length))for(var d in i)s(c,i[d])>=0||(c.push(i[d]),u[i[d]]=e[i[d]]);return L({},u,t)}function u(e,t,n){if(!n){n=[];for(var r in e)n.push(r)}for(var i=0;i "));if(y[n]=r,I(e))g.push(n,[function(){return t.get(e)}],u);else{var i=t.annotate(e);j(i,function(e){e!==n&&l.hasOwnProperty(e)&&p(l[e],e)}),g.push(n,e,i)}v.pop(),y[n]=o}}function h(e){return P(e)&&e.then&&e.$$promises}if(!P(l))throw new Error("'invocables' must be an object");var m=a(l||{}),g=[],v=[],y={};return j(l,p),l=v=y=null,function(r,o,a){function s(){--b||($||i(y,o.$$values),p.$$values=y,p.$$promises=p.$$promises||!0,delete p.$$inheritedValues,u.resolve(y))}function l(e){p.$$failure=e,u.reject(e)}if(h(r)&&a===n&&(a=o,o=r,r=null),r){if(!P(r))throw new Error("'locals' must be an object")}else r=c;if(o){if(!h(o))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else o=f;var u=e.defer(),p=u.promise,v=p.$$promises={},y=L({},r),b=1+g.length/3,$=!1;if(N(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i(y,d(o.$$inheritedValues,m)),L(v,o.$$promises),o.$$values?($=i(y,d(o.$$values,m)),p.$$inheritedValues=d(o.$$values,m),s()):(o.$$inheritedValues&&(p.$$inheritedValues=d(o.$$inheritedValues,m)),o.then(s,l));for(var w=0,x=g.length;x>w;w+=3)r.hasOwnProperty(g[w])?s():function(n,i,o){function u(e){f.reject(e),l(e)}function c(){if(!N(p.$$failure))try{f.resolve(t.invoke(i,a,y)),f.promise.then(function(e){y[n]=e,s()},u)}catch(e){u(e)}}var f=e.defer(),d=0;j(o,function(e){v.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&(d++,v[e].then(function(t){y[e]=t,--d||c()},u))}),d||c(),v[n]=f.promise}(g[w],g[w+1],g[w+2]);return p}},this.resolve=function(e,t,n,r){return this.study(e)(t,n,r)}}function g(e,t,n){this.fromConfig=function(e,t,n){return N(e.template)?this.fromString(e.template,t):N(e.templateUrl)?this.fromUrl(e.templateUrl,t):N(e.templateProvider)?this.fromProvider(e.templateProvider,t,n):null},this.fromString=function(e,t){return R(e)?e(t):e},this.fromUrl=function(n,r){return R(n)&&(n=n(r)),null==n?null:e.get(n,{cache:t,headers:{Accept:"text/html"}}).then(function(e){return e.data})},this.fromProvider=function(e,t,r){return n.invoke(e,null,r||{params:t})}}function v(e,t,i){function o(t,n,r,i){if(g.push(t),h[t])return h[t];if(!/^\w+(-+\w+)*(?:\[\])?$/.test(t))throw new Error("Invalid parameter name '"+t+"' in pattern '"+e+"'");if(m[t])throw new Error("Duplicate parameter name '"+t+"' in pattern '"+e+"'");return m[t]=new H.Param(t,n,r,i),m[t]}function a(e,t,n,r){var i=["",""],o=e.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!t)return o;switch(n){case!1:i=["(",")"+(r?"?":"")];break;case!0:i=["?(",")?"];break;default:i=["("+n+"|",")?"]}return o+i[0]+t+i[1]}function s(i,o){var a,s,l,u,c;return a=i[2]||i[3],c=t.params[a],l=e.substring(d,i.index),s=o?i[4]:i[4]||("*"==i[1]?".*":null),u=H.type(s||"string")||r(H.type("string"),{pattern:new RegExp(s,t.caseInsensitive?"i":n)}),{id:a,regexp:s,segment:l,type:u,cfg:c}}t=L({params:{}},P(t)?t:{});var l,u=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,c=/([:]?)([\w\[\]-]+)|\{([\w\[\]-]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,f="^",d=0,p=this.segments=[],h=i?i.params:{},m=this.params=i?i.params.$$new():new H.ParamSet,g=[];this.source=e;for(var v,y,b;(l=u.exec(e))&&(v=s(l,!1),!(v.segment.indexOf("?")>=0));)y=o(v.id,v.type,v.cfg,"path"),f+=a(v.segment,y.type.pattern.source,y.squash,y.isOptional),p.push(v.segment),d=u.lastIndex;b=e.substring(d);var $=b.indexOf("?");if($>=0){var w=this.sourceSearch=b.substring($);if(b=b.substring(0,$),this.sourcePath=e.substring(0,d+$),w.length>0)for(d=0;l=c.exec(w);)v=s(l,!0),y=o(v.id,v.type,v.cfg,"search"),d=u.lastIndex}else this.sourcePath=e,this.sourceSearch="";f+=a(b)+(!1===t.strict?"/?":"")+"$",p.push(b),this.regexp=new RegExp(f,t.caseInsensitive?"i":n),this.prefix=p[0],this.$$paramNames=g}function y(e){L(this,e)}function b(){function e(e){return null!=e?e.toString().replace(/\//g,"%2F"):e}function i(e){return null!=e?e.toString().replace(/%2F/g,"/"):e}function o(){return{strict:m,caseInsensitive:d}}function l(e){return R(e)||F(e)&&R(e[e.length-1])}function u(){for(;x.length;){var e=x.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");t.extend($[e.name],f.invoke(e.def))}}function c(e){L(this,e||{})}H=this;var f,d=!1,m=!0,g=!1,$={},w=!0,x=[],C={string:{encode:e,decode:i,is:function(e){return null==e||!N(e)||"string"==typeof e},pattern:/[^\/]*/},int:{encode:e,decode:function(e){return parseInt(e,10)},is:function(e){return N(e)&&this.decode(e.toString())===e},pattern:/\d+/},bool:{encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:function(e){return!0===e||!1===e},pattern:/0|1/},date:{encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):n},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):n},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return this.is(e)&&this.is(t)&&e.toISOString()===t.toISOString()},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:{encode:t.toJson,decode:t.fromJson,is:t.isObject,equals:t.equals,pattern:/[^\/]*/},any:{encode:t.identity,decode:t.identity,equals:t.equals,pattern:/.*/}};b.$$getDefaultValue=function(e){if(!l(e.value))return e.value;if(!f)throw new Error("Injectable functions cannot be called at configuration time");return f.invoke(e.value)},this.caseInsensitive=function(e){return N(e)&&(d=e),d},this.strictMode=function(e){return N(e)&&(m=e),m},this.defaultSquashPolicy=function(e){if(!N(e))return g;if(!0!==e&&!1!==e&&!I(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return g=e,e},this.compile=function(e,t){return new v(e,L(o(),t))},this.isMatcher=function(e){if(!P(e))return!1;var t=!0;return j(v.prototype,function(n,r){R(n)&&(t=t&&N(e[r])&&R(e[r]))}),t},this.type=function(e,t,n){if(!N(t))return $[e];if($.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return $[e]=new y(L({name:e},t)),n&&(x.push({name:e,def:n}),w||u()),this},j(C,function(e,t){$[t]=new y(L({name:t},e))}),$=r($,{}),this.$get=["$injector",function(e){return f=e,w=!1,u(),j(C,function(e,t){$[t]||($[t]=new y(e))}),this}],this.Param=function(e,t,r,i){function o(){if(!f)throw new Error("Injectable functions cannot be called at configuration time");var e=f.invoke(r.$$fn);if(null!==e&&e!==n&&!d.type.is(e))throw new Error("Default value ("+e+") for parameter '"+d.id+"' is not an instance of Type ("+d.type.name+")");return e}function u(e){function t(e){return function(t){return t.from===e}}return e=function(e){var n=h(p(d.replace,t(e)),function(e){return e.to});return n.length?n[0]:e}(e),N(e)?d.type.$normalize(e):o()}function c(){return"{Param:"+e+" "+t+" squash: '"+b+"' optional: "+v+"}"}var d=this;r=function(e){var t=P(e)?a(e):[];return-1===s(t,"value")&&-1===s(t,"type")&&-1===s(t,"squash")&&-1===s(t,"array")&&(e={value:e}),e.$$fn=l(e.value)?e.value:function(){return e.value},e}(r),t=function(t,n,r){if(t.type&&n)throw new Error("Param '"+e+"' has two type configurations.");return n||(t.type?t.type instanceof y?t.type:new y(t.type):"config"===r?$.any:$.string)}(r,t,i);var m=function(){var t={array:"search"===i&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return L(t,n,r).array}();t=m?t.$asArray(m,"search"===i):t,"string"!==t.name||m||"path"!==i||r.value!==n||(r.value="");var v=r.value!==n,b=function(e,t){var n=e.squash;if(!t||!1===n)return!1;if(!N(n)||null==n)return g;if(!0===n||I(n))return n;throw new Error("Invalid squash policy: '"+n+"'. Valid policies: false, true, or arbitrary string")}(r,v),w=function(e,t,r,i){var o,a,l=[{from:"",to:r||t?n:""},{from:null,to:r||t?n:""}];return o=F(e.replace)?e.replace:[],I(i)&&o.push({from:i,to:n}),a=h(o,function(e){return e.from}),p(l,function(e){return-1===s(a,e.from)}).concat(o)}(r,m,v,b);L(this,{id:e,type:t,location:i,array:m,squash:b,replace:w,isOptional:v,value:u,dynamic:n,config:r,toString:c})},c.prototype={$$new:function(){return r(this,L(new c,{$$parent:this}))},$$keys:function(){for(var e=[],t=[],n=this,r=a(c.prototype);n;)t.push(n),n=n.$$parent;return t.reverse(),j(t,function(t){j(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return j(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return j(r.$$keys(),function(i){var o=e&&e[i],a=t&&t[i];r[i].type.equals(o,a)||(n=!1)}),n},$$validates:function(e){var r,i,o,a,s,l=this.$$keys();for(r=0;ri;i++)if(t(u[i]))return;c&&t(c)}}function p(){return l=l||i.$on("$locationChangeSuccess",d)}var h,m=a.baseHref(),g=r.url();return f||p(),{sync:function(){d()},listen:function(){return p()},update:function(e){return e?void(g=r.url()):void(r.url()!==g&&(r.url(g),r.replace()))},push:function(e,t,i){var o=e.format(t||{});null!==o&&t&&t["#"]&&(o+="#"+t["#"]),r.url(o),h=i&&i.$$avoidResync?r.url():n,i&&i.replace&&r.replace()},href:function(n,i,o){if(!n.validates(i))return null;var a=e.html5Mode();t.isObject(a)&&(a=a.enabled);var l=n.format(i);if(o=o||{},a||null===l||(l="#"+e.hashPrefix()+l),null!==l&&i&&i["#"]&&(l+="#"+i["#"]),l=s(l,a,o.absolute),!o.absolute||!l)return l;var u=!a&&l?"/":"",c=r.port();return c=80===c||443===c?"":":"+c,[r.protocol(),"://",r.host(),c,u,l].join("")}}}var l,u=[],c=null,f=!1;this.rule=function(e){if(!R(e))throw new Error("'rule' must be a function");return u.push(e),this},this.otherwise=function(e){if(I(e)){var t=e;e=function(){return t}}else if(!R(e))throw new Error("'rule' must be a function");return c=e,this},this.when=function(e,t){var n,s=I(t);if(I(e)&&(e=r.compile(e)),!s&&!R(t)&&!F(t))throw new Error("invalid 'handler' in when()");var l={matcher:function(e,t){return s&&(n=r.compile(t),t=["$match",function(e){return n.format(e)}]),L(function(n,r){return a(n,t,e.exec(r.path(),r.search()))},{prefix:I(e.prefix)?e.prefix:""})},regex:function(e,t){if(e.global||e.sticky)throw new Error("when() RegExp must not be global or sticky");return s&&(n=t,t=["$match",function(e){return o(n,e)}]),L(function(n,r){return a(n,t,e.exec(r.path()))},{prefix:i(e)})}},u={matcher:r.isMatcher(e),regex:e instanceof RegExp};for(var c in u)if(u[c])return this.rule(l[c](e,t));throw new Error("invalid 'what' in when()")},this.deferIntercept=function(e){e===n&&(e=!0),f=e},this.$get=s,s.$inject=["$location","$rootScope","$injector","$browser"]}function w(e,i){function o(e){return 0===e.indexOf(".")||0===e.indexOf("^")}function d(e,t){if(!e)return n;var r=I(e),i=r?e:e.name;if(o(i)){if(!t)throw new Error("No reference point given for path '"+i+"'");t=d(t);for(var a=i.split("."),s=0,l=a.length,u=t;l>s;s++)if(""!==a[s]||0!==s){if("^"!==a[s])break;if(!u.parent)throw new Error("Path '"+i+"' not valid for state '"+t.name+"'");u=u.parent}else u=t;a=a.slice(s).join("."),i=u.name+(u.name&&a?".":"")+a}var c=E[i];return!c||!r&&(r||c!==e&&c.self!==e)?n:c}function p(e,t){S[e]||(S[e]=[]),S[e].push(t)}function m(e){for(var t=S[e]||[];t.length;)g(t.shift())}function g(t){t=r(t,{self:t,resolve:t.resolve||{},toString:function(){return this.name}});var n=t.name;if(!I(n)||n.indexOf("@")>=0)throw new Error("State must have a valid name");if(E.hasOwnProperty(n))throw new Error("State '"+n+"'' is already defined");var i=-1!==n.indexOf(".")?n.substring(0,n.lastIndexOf(".")):I(t.parent)?t.parent:P(t.parent)&&I(t.parent.name)?t.parent.name:"";if(i&&!E[i])return p(i,t.self);for(var o in M)R(M[o])&&(t[o]=M[o](t,M.$delegates[o]));return E[n]=t,!t[_]&&t.url&&e.when(t.url,["$match","$stateParams",function(e,n){k.$current.navigable==t&&u(e,n)||k.transitionTo(t,e,{inherit:!0,location:!1})}]),m(n),t}function v(e){return e.indexOf("*")>-1}function y(e){for(var t=e.split("."),n=k.$current.name.split("."),r=0,i=t.length;i>r;r++)"*"===t[r]&&(n[r]="*");return"**"===t[0]&&(n=n.slice(s(n,t[1])),n.unshift("**")),"**"===t[t.length-1]&&(n.splice(s(n,t[t.length-2])+1,Number.MAX_VALUE),n.push("**")),t.length==n.length&&n.join("")===t.join("")}function b(e,t){return I(e)&&!N(t)?M[e]:R(t)&&I(e)?(M[e]&&!M.$delegates[e]&&(M.$delegates[e]=M[e]),M[e]=t,this):this}function $(e,t){return P(e)?t=e:t.name=e,g(t),this}function w(e,i,o,s,f,p,m,g,b){function $(t,n,r,o){var a=e.$broadcast("$stateNotFound",t,n,r);if(a.defaultPrevented)return m.update(),T;if(!a.retry)return null;if(o.$retry)return m.update(),D;var s=k.transition=i.when(a.retry);return s.then(function(){return s!==k.transition?S:(t.options.$retry=!0,k.transitionTo(t.to,t.toParams,t.options))},function(){return T}),m.update(),s}function w(e,n,r,a,l,u){function d(){var n=[];return j(e.views,function(r,i){var a=r.resolve&&r.resolve!==e.resolve?r.resolve:{};a.$template=[function(){return o.load(i,{view:r,locals:l.globals,params:p,notify:u.notify})||""}],n.push(f.resolve(a,l.globals,l.resolve,e).then(function(n){if(R(r.controllerProvider)||F(r.controllerProvider)){var o=t.extend({},a,l.globals);n.$$controller=s.invoke(r.controllerProvider,null,o)}else n.$$controller=r.controller;n.$$state=e,n.$$controllerAs=r.controllerAs,l[i]=n}))}),i.all(n).then(function(){return l.globals})}var p=r?n:c(e.params.$$keys(),n),h={$stateParams:p};l.resolve=f.resolve(e.resolve,h,l.resolve,e);var m=[l.resolve.then(function(e){l.globals=e})];return a&&m.push(a),i.all(m).then(d).then(function(e){return l})}var S=i.reject(new Error("transition superseded")),M=i.reject(new Error("transition prevented")),T=i.reject(new Error("transition aborted")),D=i.reject(new Error("transition failed"));return C.locals={resolve:null,globals:{$stateParams:{}}},k={params:{},current:C.self,$current:C,transition:null},k.reload=function(e){return k.transitionTo(k.current,p,{reload:e||!0,inherit:!1,notify:!0})},k.go=function(e,t,n){return k.transitionTo(e,t,L({inherit:!0,relative:k.$current},n))},k.transitionTo=function(t,n,o){n=n||{},o=L({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},o||{});var a,u=k.$current,f=k.params,h=u.path,g=d(t,o.relative),v=n["#"];if(!N(g)){var y={to:t,toParams:n,options:o},b=$(y,u.self,f,o);if(b)return b;if(t=y.to,n=y.toParams,o=y.options,g=d(t,o.relative),!N(g)){if(!o.relative)throw new Error("No such state '"+t+"'");throw new Error("Could not resolve '"+t+"' from state '"+o.relative+"'")}}if(g[_])throw new Error("Cannot transition to abstract state '"+t+"'");if(o.inherit&&(n=l(p,n||{},k.$current,g)),!g.params.$$validates(n))return D;n=g.params.$$values(n),t=g;var E=t.path,T=0,A=E[T],O=C.locals,R=[];if(o.reload){if(I(o.reload)||P(o.reload)){if(P(o.reload)&&!o.reload.name)throw new Error("Invalid reload state object");var F=!0===o.reload?h[0]:d(o.reload);if(o.reload&&!F)throw new Error("No such reload state '"+(I(o.reload)?o.reload:o.reload.name)+"'");for(;A&&A===h[T]&&A!==F;)O=R[T]=A.locals,T++,A=E[T]}}else for(;A&&A===h[T]&&A.ownParams.$$equals(n,f);)O=R[T]=A.locals,T++,A=E[T];if(x(t,n,u,f,O,o))return v&&(n["#"]=v),k.params=n,U(k.params,p),o.location&&t.navigable&&t.navigable.url&&(m.push(t.navigable.url,n,{$$avoidResync:!0,replace:"replace"===o.location}),m.update(!0)),k.transition=null,i.when(k.current);if(n=c(t.params.$$keys(),n||{}),o.notify&&e.$broadcast("$stateChangeStart",t.self,n,u.self,f).defaultPrevented)return e.$broadcast("$stateChangeCancel",t.self,n,u.self,f),m.update(),M;for(var j=i.when(O),H=T;H=T;r--)a=h[r],a.self.onExit&&s.invoke(a.self.onExit,a.self,a.locals.globals),a.locals=null;for(r=T;r=0?i:i+"@"+(o?o.state.name:"")}function _(e,t){var n,r=e.match(/^\s*({[^}]*})\s*$/);if(r&&(e=t+"("+r[1]+")"),!(n=e.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/))||4!==n.length)throw new Error("Invalid state ref '"+e+"'");return{state:n[1],paramExpr:n[3]||null}}function M(e){var t=e.parent().inheritedData("$uiView");return t&&t.state&&t.state.name?t.state:void 0}function T(e,n){var r=["location","inherit","reload","absolute"];return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(i,o,a,s){var l=_(a.uiSref,e.current.name),u=null,c=M(o)||e.$current,f="[object SVGAnimatedString]"===Object.prototype.toString.call(o.prop("href"))?"xlink:href":"href",d=null,p="A"===o.prop("tagName").toUpperCase(),h="FORM"===o[0].nodeName,m=h?"action":f,g=!0,v={relative:c,inherit:!0},y=i.$eval(a.uiSrefOpts)||{};t.forEach(r,function(e){e in y&&(v[e]=y[e])});var b=function(n){if(n&&(u=t.copy(n)),g){d=e.href(l.state,u,v);var r=s[1]||s[0];return r&&r.$$addStateInfo(l.state,u),null===d?(g=!1,!1):void a.$set(m,d)}};l.paramExpr&&(i.$watch(l.paramExpr,function(e,t){e!==u&&b(e)},!0),u=t.copy(i.$eval(l.paramExpr))),b(),h||o.bind("click",function(t){if(!((t.which||t.button)>1||t.ctrlKey||t.metaKey||t.shiftKey||o.attr("target"))){var r=n(function(){e.go(l.state,u,v)});t.preventDefault();var i=p&&!d?1:0;t.preventDefault=function(){i--<=0&&n.cancel(r)}}})}}}function D(e,t,n){return{restrict:"A",controller:["$scope","$element","$attrs",function(t,r,i){function o(){a()?r.addClass(l):r.removeClass(l)}function a(){for(var e=0;er;r++){o=a[r];var c=this.params[o],f=n[r+1];for(i=0;ir;r++)o=a[r],u[o]=this.params[o].value(t[o]);return u},v.prototype.parameters=function(e){return N(e)?this.params[e]||null:this.$$paramNames},v.prototype.validates=function(e){return this.params.$$validates(e)},v.prototype.format=function(e){function t(e){return encodeURIComponent(e).replace(/-/g,function(e){return"%5C%"+e.charCodeAt(0).toString(16).toUpperCase()})}e=e||{};var n=this.segments,r=this.parameters(),i=this.params;if(!this.validates(e))return null;var o,a=!1,s=n.length-1,l=r.length,u=n[0];for(o=0;l>o;o++){var c=s>o,f=r[o],d=i[f],p=d.value(e[f]),m=d.isOptional&&d.type.equals(d.value(),p),g=!!m&&d.squash,v=d.type.encode(p);if(c){var y=n[o+1];if(!1===g)null!=v&&(u+=F(v)?h(v,t).join("-"):encodeURIComponent(v)),u+=y;else if(!0===g){var b=u.match(/\/$/)?/\/?(.*)/:/(.*)/;u+=y.match(b)[1]}else I(g)&&(u+=g+y)}else{if(null==v||m&&!1!==g)continue;F(v)||(v=[v]),v=h(v,encodeURIComponent).join("&"+f+"="),u+=(a?"&":"?")+f+"="+v,a=!0}}return u},y.prototype.is=function(e,t){return!0},y.prototype.encode=function(e,t){return e},y.prototype.decode=function(e,t){return e},y.prototype.equals=function(e,t){return e==t},y.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},y.prototype.pattern=/.*/,y.prototype.toString=function(){return"{Type:"+this.name+"}"},y.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},y.prototype.$asArray=function(e,t){function r(e,t){function r(e,t){return function(){return e[t].apply(e,arguments)}}function i(e){return F(e)?e:N(e)?[e]:[]}function o(e){switch(e.length){case 0:return n;case 1:return"auto"===t?e[0]:e;default:return e}}function a(e){return!e}function s(e,t){return function(n){n=i(n);var r=h(n,e);return!0===t?0===p(r,a).length:o(r)}}this.encode=s(r(e,"encode")),this.decode=s(r(e,"decode")),this.is=s(r(e,"is"),!0),this.equals=function(e){return function(t,n){var r=i(t),o=i(n);if(r.length!==o.length)return!1;for(var a=0;a=":n(e.from)}:{"<=":n(e.to)}}function s(t){return t?(t=this.compactFilters(t),e.transform(t,function(e,t,n){t.from||t.to?e[n]=a(t):t.in||t.nin?e[n]=l(t):e[n]=t},{})):null}function l(e){return e.in?{IN:e.in}:{"NOT IN":e.nin}}return{compactFilters:r,extend:i,processFilters:s}})}),define("common/models/contact-job-role.model",["common/modules/models","common/models/model","common/instances/contact-job-role-instance.instance","common/services/api/contact-job-role-api.api"],function(e){"use strict";e.factory("ContactJobRole",["$log","Model","ContactJobRoleAPI","ContactJobRoleInstance",function(e,t,n,r){return e.debug("ContactJobRole"),t.extend({all:function(e){return n.all(e).then(function(e){return e.list.map(function(e){return r.init(e,!0)})})}})}])}),define("common/models/instances/group-instance",["common/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("GroupInstance",["ModelInstance",function(e){var t=["id","name","title","description"];return e.extend({fromAPIFilter:function(e,n,r){_.includes(t,r)&&(e[r]=this[r])}})}])}),define("common/mocks/module",["common/angular"],function(e){"use strict";return e.module("common.mocks",[])}),define("common/mocks/services/api/group-mock",["common/lodash","common/mocks/module"],function(e,t){"use strict";t.factory("api.group.mock",["$q",function(t){function n(e){var n=t.defer();return n.resolve(e),n.promise}return{all:function(e,t,r){var i,o,a;return i=r||this.mockedGroups().list,e&&(i=i.filter(function(t){return Object.keys(e).every(function(n){return t[n]===e[n]})})),t&&(o=(t.page-1)*t.size,a=o+t.size,i=i.slice(o,a)),n({list:i,total:i.length,allIds:i.map(function(e){return e.id}).join(",")})},find:function(e,t){return n(t||this.mockedGroups().list.filter(function(t){return t.id===e})[0])},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedGroups:function(){return{total:5,list:[{id:"1",name:"Administrators",title:"Administrators",description:"Contacts in this group are assigned Administrator role permissions.",is_active:"1",visibility:"User and User Admin Only",group_type:["1"],is_hidden:"0",is_reserved:"0"},{id:"2",name:"Newsletter Subscribers",title:"Newsletter Subscribers",is_active:'"1',visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"3",name:"Summer Program Volunteers",title:"Summer Program Volunteers",is_active:"1",visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"4",name:"Advisory Board",title:"Advisory Board",is_active:"1",visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"5",name:"Case_Resources",title:"Case Resources",description:"Contacts in this group are listed with their phone number and email when viewing case. You also can send copies of case activities to these contacts.",is_active:"1",visibility:"User and User Admin Only",where_clause:"...",select_tables:"...",where_tables:"...",group_type:"2",is_hidden:"0",is_reserved:"0"}]}}}}])}),define("common/mocks/data/contact.data",[],function(){return{all:{is_error:0,version:3,count:26,values:[{id:"1",contact_id:"1",display_name:"Dr. Kiara Jensen-Parker",email:"kh.jensen-parker@testing.info",contact_type:"Individual"},{id:"2",contact_id:"2",display_name:"jacobc82@lol.co.pl",email:"cruz.v.jacob@spamalot.com",contact_type:"Individual"},{id:"3",contact_id:"3",display_name:"Mei Müller-Nielsen",email:"mz.mller-nielsen75@infomail.co.pl",contact_type:"Individual"},{id:"4",contact_id:"4",display_name:"Ms. Brigette Deforest",email:"deforest.p.brigette9@fakemail.info",contact_type:"Individual"},{id:"5",contact_id:"5",display_name:"robertsc@testing.net",email:"clintr56@mymail.org",contact_type:"Individual"},{id:"6",contact_id:"6",display_name:"Dr. Allen Samuels Sr.",email:"samuelsa@mymail.org",contact_type:"Individual"},{id:"7",contact_id:"7",display_name:"Mei Wilson",email:"wilson.u.mei59@sample.org",contact_type:"Individual"},{id:"8",contact_id:"8",display_name:"Dr. Betty Díaz",email:"dazb@sample.co.nz",contact_type:"Individual"},{id:"9",contact_id:"9",display_name:"Bob Jones-Dimitrov",email:"bobj@testmail.biz",contact_type:"Individual"},{id:"10",contact_id:"10",display_name:"Truman Samuels III",email:"trumans@spamalot.org",contact_type:"Individual"},{id:"11",contact_id:"11",display_name:"Iris Wagner",email:"iwagner75@notmail.info",contact_type:"Individual"},{id:"12",contact_id:"12",display_name:"Mr. Rosario McReynolds",email:"rosariomcreynolds@testmail.org",contact_type:"Individual"},{id:"13",contact_id:"13",display_name:"Shad Jones-Dimitrov III",email:"shadj@lol.net",contact_type:"Individual"},{id:"14",contact_id:"14",display_name:"Toby Cruz Sr.",email:"",contact_type:"Individual"},{id:"15",contact_id:"15",display_name:"lareedaz61@testing.com",email:"lareedaz61@testing.com",contact_type:"Individual"},{id:"16",contact_id:"16",display_name:"Dr. Jay Deforest",email:"jayd@fishmail.org",contact_type:"Individual"},{id:"17",contact_id:"17",display_name:"Mr. Norris Cruz",email:"norriscruz@spamalot.info",contact_type:"Individual"},{id:"18",contact_id:"18",display_name:"herminiac@fishmail.com",email:"herminiac@fishmail.com",contact_type:"Individual"},{id:"19",contact_id:"19",display_name:"Ashley Terrell",email:"terrell.ashley@testmail.info",contact_type:"Individual"},{id:"20",contact_id:"20",display_name:"Kandace Parker-Díaz",email:"parker-daz.kandace67@fishmail.co.uk",contact_type:"Individual"},{id:"21",contact_id:"21",display_name:"Nicole Samuels",email:"ng.samuels@testmail.net",contact_type:"Individual"},{id:"22",contact_id:"22",display_name:"Dr. Kandace Wattson",email:"kandacewattson@testing.info",contact_type:"Individual"},{id:"23",contact_id:"23",display_name:"Brittney Cruz",email:"cruz.brittney@spamalot.co.nz",contact_type:"Individual"},{id:"24",contact_id:"24",display_name:"Shauna Olsen",email:"",contact_type:"Individual"},{id:"202",contact_id:"202",display_name:"civihr_staff@compucorp.co.uk",email:"civihr_staff@compucorp.co.uk",contact_type:"Individual"},{id:"203",contact_id:"203",display_name:"civihr_manager@compucorp.co.uk",email:"civihr_manager@compucorp.co.uk",contact_type:"Individual"}]}}}),define("common/mocks/services/api/contact-mock",["common/lodash","common/mocks/module","common/mocks/data/contact.data"],function(e,t,n){"use strict";t.factory("api.contact.mock",["$q",function(t){function r(e){var n=t.defer();return n.resolve(e),n.promise}return{all:function(t,i,o,a,s){var l,u,c;return l=s||n.all.values,t&&(l=l.filter(function(n){return Object.keys(t).every(function(r){return null===t[r]||("display_name"===r?new RegExp(t[r],"i").test(n[r]):t[r].IN?e.includes(t[r].IN,n[r]):n[r]===t[r])})})),i&&(u=(i.page-1)*i.size,c=u+i.size,l=l.slice(u,c)),r({list:l,total:l.length,allIds:l.map(function(e){return e.id}).join(",")})},find:function(e,t){return r(t||n.all.values.filter(function(t){return t.id===e})[0])},leaveManagees:function(){return r(this.mockedContacts().list)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedContacts:function(){var e=n.all.values;return{total:e.length,list:e.map(function(e){return e})}}}}])}),define("common/mocks/services/api/group-contact-mock",["common/lodash","common/mocks/module","common/mocks/services/api/contact-mock","common/mocks/services/api/group-mock"],function(e,t){"use strict";t.factory("api.group-contact.mock",["$q","api.contact.mock","api.group.mock",function(t,n,r){function i(t){return e.sample(t)}function o(e){var n=t.defer();return n.resolve(e),n.promise}var a=n.mockedContacts().list,s=r.mockedGroups().list;return{all:function(e,t,n){var r,i,a;return r=n||this.mockedGroupsContacts.list,e&&(r=r.filter(function(t){return Object.keys(e).every(function(n){return t[n]===e[n]})})),t&&(i=(t.page-1)*t.size,a=i+t.size,r=r.slice(i,a)),o({list:r,total:r.length,allIds:r.map(function(e){return e.id}).join(",")})},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedGroupsContacts:{total:a.length,list:function(){var e=1;return a.map(function(t){return{id:""+e++,group_id:i(s).id,contact_id:t.id,status:"Added"}})}()}}}])}),define("common/models/group",["common/modules/models","common/models/model","common/models/instances/group-instance","common/mocks/services/api/group-mock","common/mocks/services/api/group-contact-mock"],function(e){"use strict";e.factory("Group",["Model","api.group.mock","api.group-contact.mock","GroupInstance",function(e,t,n,r){return e.extend({all:function(e,n){return t.all(this.processFilters(e),n).then(function(e){return e.list=e.list.map(function(e){return r.init(e,!0)}),e})},find:function(e){return t.find(e).then(function(e){return r.init(e,!0)})},contactIdsOf:function(e){return n.all({group_id:e}).then(function(e){return e.list.map(function(e){return e.contact_id})})}})}])}),define("common/models/instances/job-role-instance",["common/lodash","common/moment","common/modules/models-instances","common/models/instances/instance"],function(e,t,n){"use strict";n.factory("JobRoleInstance",["ModelInstance","HR_settings",function(n,r){return n.extend({fromAPIFilter:function(n,i,o){var a=r.DATE_FORMAT.toUpperCase();e.endsWith(o,"_date")?n[o]=t(this[o],"YYYY-MM-DD HH:mm:ss").format(a):"api.HRJobContract.getsingle"===o?(n.contact_id=this[o].contact_id,n.job_contract_id=this[o].id):n[o]=this[o]},toAPIFilter:function(n,i,o){var a=["contact_id","job_contract_id"],s=r.DATE_FORMAT.toUpperCase();if(e.endsWith(o,"_date"))n[o]=t(this[o],s).format("YYYY-MM-DD HH:mm:ss");else{if(e.includes(a,o))return;n[o]=this[o]}}})}])}),define("common/services/api/job-role",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("api.job-role",["$log","api",function(e,t){return e.debug("api.jobRole"),t.extend({all:function(t,n,r,i){return e.debug("api.jobRole.api"),this.getAll("HrJobRoles",t,n,r,i)},find:function(t){return e.debug("api.jobRole.find"),this.sendGET("HRJobRole","get",{id:""+t},!1).then(function(e){return e.values[0]})}})}])}),define("common/models/job-role",["common/modules/models","common/models/model","common/models/instances/job-role-instance","common/services/api/job-role"],function(e){"use strict";e.factory("JobRole",["Model","api.job-role","JobRoleInstance",function(e,t,n){return e.extend({all:function(e,r){return t.all(this.processFilters(e),r).then(function(e){return e.list=e.list.map(function(e){return n.init(e,!0)}),e})},find:function(e){return t.find(e).then(function(e){return n.init(e,!0)})}})}])}),define("common/services/api/contact",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("api.contact",["$log","api",function(e,t){return e.debug("api.contact"),t.extend({all:function(t,n,r,i){return e.debug("api.contact.api"),this.getAll("Contact",t,n,r,i)},find:function(t){return e.debug("api.contact.find"),this.sendGET("Contact","get",{id:""+t},!1).then(function(e){return e.values[0]})},leaveManagees:function(t,n){return e.debug("api.contact.leaveManagees"),n=_.assign({},n,{managed_by:t}),this.sendGET("Contact","getleavemanagees",n).then(function(e){return e.values})}})}])}),define("common/models/instances/contact-instance",["common/modules/models-instances","common/models/instances/instance","common/services/api/contact"],function(e){"use strict";e.factory("ContactInstance",["ModelInstance","api.contact",function(e,t){return e.extend({leaveManagees:function(e){return t.leaveManagees(this.id,e)}})}])}),define("common/models/contact",["common/lodash","common/modules/models","common/models/model","common/models/contact-job-role.model","common/models/group","common/models/job-role","common/models/instances/contact-instance","common/services/api/contact"],function(e,t){"use strict";t.factory("Contact",["$q","Model","api.contact","Group","JobRole","ContactJobRole","ContactInstance",function(t,n,r,i,o,a,s){function l(t,n){return!e.isEmpty(e.intersection(e.keys(t),n))}function u(e){return a.all(e).then(function(e){return e.map(function(e){return e.contact_id})})}function c(t,n){return e(t).omit(d).omit(p).assign({id:{in:e.intersection.apply(null,n)}}).value()}function f(n){var r=t.defer(),o=[];return n=this.compactFilters(n),l(n,p)&&o.push(u(e.pick(n,p))),l(n,d)&&o.push(i.contactIdsOf(n.group_id)),e.isEmpty(o)?r.resolve(this.processFilters(n)):t.all(o).then(function(e){n=c(n,e),r.resolve(this.processFilters(n))}.bind(this)),r.promise}var d=["group_id"],p=["region","department","level_type","location"];return n.extend({all:function(e,t,n,i){return f.call(this,e).then(function(e){return e&&e.id&&!e.id.IN.length?{list:[]}:r.all(e,t,n,i)}).then(function(e){return e.list=e.list.map(function(e){return s.init(e,!0)}),e})},find:function(e){return r.find(e).then(function(e){return s.init(e,!0)})},leaveManagees:function(e,t){return f.call(this,t).then(function(t){return t&&t.id&&!t.id.IN.length?[]:r.leaveManagees(e,t)})}})}])}),define("common/models/instances/contract-instance",["common/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("ContractInstance",["ModelInstance",function(e){return e.extend({})}])}),define("common/services/api/contract",["common/lodash","common/modules/apis","common/services/api"],function(e,t){"use strict";t.factory("api.contract",["$log","api",function(t,n){function r(t){var n=e.clone(t);return n.info=n["api.HRJobContract.getfulldetails"],delete n["api.HRJobContract.getfulldetails"],n}return t.debug("api.contract"),n.extend({all:function(e){return t.debug("ContractAPI.all"),e=e||{},e["api.HRJobContract.getfulldetails"]={jobcontract_id:"$value.id"},e.deleted=0,this.sendGET("HRJobContract","get",e,!1).then(function(e){return e.values}).then(function(e){return e=e.map(r)})}})}])}),define("common/models/contract",["common/modules/models","common/models/model","common/models/instances/contract-instance","common/services/api/contract"],function(e){"use strict";e.factory("Contract",["$log","Model","api.contract","ContractInstance",function(e,t,n,r){return e.debug("Contract"),t.extend({all:function(e){return n.all(e).then(function(e){return e.map(function(e){return r.init(e,!0)})})}})}])}),define("common/models/option-group",["common/modules/models","common/models/model","common/services/api/option-group"],function(e){"use strict";e.factory("OptionGroup",["Model","api.optionGroup",function(e,t){return e.extend({valuesOf:function(e,n){return t.valuesOf(e,n)}})}])}),function(e,t){define("common/models/session.model",["common/modules/models","common/models/model"],function(n){"use strict";n.factory("Session",["$log","$q","Model",function(n,r,i){return n.debug("Session"),i.extend({get:function(){var n={contactId:e.vars.session?e.vars.session.contact_id:t.settings.currentCiviCRMUserId};if(!n.contactId)throw new Error("Session Error: *Logged In Contact Id* is not defined");return r.resolve(n)}})}])})}(CRM,window.Drupal),define("common/bundles/models",["common/instances/contact-job-role-instance.instance","common/models/model","common/models/contact","common/models/contact-job-role.model","common/models/contract","common/models/group","common/models/job-role","common/models/option-group","common/models/session.model","common/models/instances/instance","common/models/instances/contact-instance","common/models/instances/contract-instance","common/models/instances/group-instance","common/models/instances/job-role-instance"],function(){}),define("common/services/dialog/dialog",["common/lodash","common/modules/services"],function(e,t){"use strict";function n(t,n,r){function i(i){var o;if(!e.isObject(i))throw new Error("Dialog Service: Options passed should be an object");return o=n.children(),t.open({appendTo:o.length?o.eq(0):n,size:"sm",controller:"DialogController",template:r.get("dialog.html"),resolve:{options:function(){return i}}}).result}return{open:i}}t.factory("dialog",n),n.$inject=["$uibModal","$rootElement","$templateCache"]}),define("common/controllers/dialog/dialog-ctrl",["common/lodash","common/modules/controllers"],function(e,t){"use strict";function n(t,n,r,i){function o(t){e.assign(n,e.defaultsDeep(t,{title:"CiviHR",msg:"",copyConfirm:"",copyCancel:"",classConfirm:"btn-primary",loading:!1}))}function a(){r.close(!1)}function s(){n.loading=!0,r.closed.then(n.onCloseAfterConfirm),t.resolve().then(n.onConfirm).then(function(){r.close(!0)})}n.cancel=a,n.confirm=s,function(){o(i),i.optionsPromise&&i.optionsPromise().then(function(e){o(e)})}()}t.controller("DialogController",n),n.$inject=["$q","$scope","$uibModalInstance","options"]}),define("common/modules/dialog",["common/angular","common/services/dialog/dialog","common/controllers/dialog/dialog-ctrl","common/angularBootstrap","common/directives/loading","common/modules/templates"],function(e){"use strict";return e.module("common.dialog",["ui.bootstrap","common.directives","common.templates"])}),define("common/decorators/xeditable-civi/editable-directive-factory",[],function(){"use strict";return["$delegate",function(e){return function(t){var n=e(t);return n.compile=function(e){var t,r=e[0].attributes.getNamedItem("ng-href");return e.append(''),r&&(t=angular.element(""),t.text("Follow link"),t.attr(r.nodeName,r.value), -t.attr("ng-click","$event.stopPropagation();"),t.addClass("editable-link"),e.append(t),e.addClass("editable-with-link")),{post:n.link}},n}}]}),define("common/directives/xeditable-civi/editable-ta",[],function(){"use strict";return["editableDirectiveFactory","$timeout",function(e,t){var n,r;return r=e({directiveName:"editableTa",inputTpl:"",render:function(){this.parent.render.call(this),this.inputEl.parent().parent().removeClass("form-inline"),this.inputEl.addClass("editable-ta"),this.inputEl.attr("ng-model","ta.$data"),this.inputEl.attr("ta-toolbar",this.attrs.eTaToolbar||'[["bold","italics","underline","strikeThrough","ul","ol","undo","redo","clear"]]'),t(function(){this.inputEl.find("textarea").hide()}.bind(this),0)},save:function(){this.scope.$data=this.scope.ta.$data,this.parent.save.call(this)},setLocalValue:function(){this.parent.setLocalValue.call(this),this.scope.ta.$data=this.scope.$data}}),n=r.link,r.link=function(e,t,r,i){return e.ta={},n(e,t,r,i)},r}]}),define("common/modules/xeditable-civi",["common/angular","common/decorators/xeditable-civi/editable-directive-factory","common/directives/xeditable-civi/editable-ta","common/angularXeditable","common/text-angular"],function(e,t,n){"use strict";return e.module("xeditable-civi",["xeditable","textAngular"]).directive("editableTa",n)}); +function validElementString(e){try{return 0!==angular.element(e).length}catch(e){return!1}}function registerTextAngularTool(e,t){if(!e||""===e||taTools.hasOwnProperty(e))throw"textAngular Error: A unique name is required for a Tool Definition";if(t.display&&(""===t.display||!validElementString(t.display))||!t.display&&!t.buttontext&&!t.iconclass)throw'textAngular Error: Tool Definition for "'+e+'" does not have a valid display/iconclass/buttontext value';taTools[e]=t}function stripHtmlToText(e){var t=document.createElement("DIV");t.innerHTML=e;var n=t.textContent||t.innerText||"";return n.replace("​",""),n=n.trim()}function getDomFromHtml(e){var t=document.createElement("DIV");return t.innerHTML=e,t}!function(e){"use strict";function t(e){if(!b(e))return dr;y(e.objectMaxDepth)&&(dr.objectMaxDepth=n(e.objectMaxDepth)?e.objectMaxDepth:NaN),y(e.urlErrorParamsEnabled)&&A(e.urlErrorParamsEnabled)&&(dr.urlErrorParamsEnabled=e.urlErrorParamsEnabled)}function n(e){return C(e)&&0--n)return"...";var r,i=t.$$hashKey;if(k(e)){r=0;for(var o=e.length;r
    ").append(e).html();try{return e[0].nodeType===Pr?mr(t):t.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(e,t){return"<"+mr(t)})}catch(e){return mr(t)}}function K(e){try{return decodeURIComponent(e)}catch(e){}}function Z(e){var t={};return o((e||"").split("&"),function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),n=e.indexOf("="),-1!==n&&(r=e.substring(0,n),i=e.substring(n+1)),r=K(r),y(r)&&(i=!y(i)||K(i),hr.call(t,r)?k(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))}),t}function J(e){var t=[];return o(e,function(e,n){k(e)?o(e,function(e){t.push(Q(n,!0)+(!0===e?"":"="+Q(e,!0)))}):t.push(Q(n,!0)+(!0===e?"":"="+Q(e,!0)))}),t.length?t.join("&"):""}function X(e){return Q(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Q(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}function ee(e,t){var n,r,i=Or.length;for(r=0;r protocol indicates an extension, document.location.href does not match."))}function ne(t,n,r){b(r)||(r={}),r=c({strictDi:!1},r);var i=function(){if(t=ur(t),t.injector()){var i=t[0]===e.document?"document":G(t);throw xr("btstrpd",i.replace(//,">"))}return n=n||[],n.unshift(["$provide",function(e){e.value("$rootElement",t)}]),r.debugInfoEnabled&&n.push(["$compileProvider",function(e){e.debugInfoEnabled(!0)}]),n.unshift("ng"),i=Ge(n,r.strictDi),i.invoke(["$rootScope","$rootElement","$compile","$injector",function(e,t,n,r){e.$apply(function(){t.data("$injector",r),n(t)(e)})}]),i},a=/^NG_ENABLE_DEBUG_INFO!/,s=/^NG_DEFER_BOOTSTRAP!/;if(e&&a.test(e.name)&&(r.debugInfoEnabled=!0,e.name=e.name.replace(a,"")),e&&!s.test(e.name))return i();e.name=e.name.replace(s,""),Cr.resumeBootstrap=function(e){return o(e,function(e){n.push(e)}),i()},_(Cr.resumeDeferredBootstrap)&&Cr.resumeDeferredBootstrap()}function re(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function ie(e){if(!(e=Cr.element(e).injector()))throw xr("test");return e.get("$$testability")}function oe(e,t){return t=t||"_",e.replace(Rr,function(e,n){return(n?t:"")+e.toLowerCase()})}function ae(e,t,n){if(!e)throw xr("areq",t||"?",n||"required");return e}function se(e,t,n){return n&&k(e)&&(e=e[e.length-1]),ae(_(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function le(e,t){if("hasOwnProperty"===e)throw xr("badname",t)}function ue(e,t,n){if(!t)return e;t=t.split(".");for(var r,i=e,o=t.length,a=0;a")+r[2],r=r[0];r--;)n=n.lastChild;a=j(a,n.childNodes),n=i.firstChild,n.textContent=""}else a.push(t.createTextNode(e));return i.textContent="",i.innerHTML="",o(a,function(e){i.appendChild(e)}),i}function be(t){if(t instanceof be)return t;var n;if(x(t)&&(t=_r(t),n=!0),!(this instanceof be)){if(n&&"<"!==t.charAt(0))throw Vr("nosel");return new be(t)}if(n){n=e.document;var r;t=(r=Br.exec(t))?[n.createElement(r[1])]:(r=ye(t,n))?r.childNodes:[],Oe(this,t)}else _(t)?Fe(t):Oe(this,t)}function we(e){return e.cloneNode(!0)}function xe(e,t){!t&&$e(e)&&ur.cleanData([e]),e.querySelectorAll&&ur.cleanData(e.querySelectorAll("*"))}function Ce(e){for(var t in e)return!1;return!0}function Ee(e){var t=e.ng339,n=t&&Fr[t],r=n&&n.events,n=n&&n.data;n&&!Ce(n)||r&&!Ce(r)||(delete Fr[t],e.ng339=void 0)}function ke(e,t,n,r){if(y(r))throw Vr("offargs");var i=(r=_e(e))&&r.events,a=r&&r.handle;if(a){if(t){var s=function(t){var r=i[t];y(n)&&P(r||[],n),y(n)&&r&&0u&&this.remove(p.key),t}},get:function(e){if(u",t=ke.firstChild.attributes;var r=t[0];t.removeNamedItem(r.name),r.value=n,e.attributes.setNamedItem(r)}function V(e,t){try{e.addClass(t)}catch(e){}}function B(e,t,n,r,i){e instanceof ur||(e=ur(e));var o=z(e,t,e,n,r,i);B.$$addScopeClass(e);var a=null;return function(t,n,r){if(!e)throw gi("multilink");ae(t,"scope"),i&&i.needsNewScope&&(t=t.$parent.$new()),r=r||{};var s=r.parentBoundTranscludeFn,l=r.transcludeControllers;if(r=r.futureParentElement,s&&s.$$boundTransclude&&(s=s.$$boundTransclude),a||(a=(r=r&&r[0])&&"foreignobject"!==I(r)&&br.call(r).match(/SVG/)?"svg":"html"),r="html"!==a?ur(he(a,ur("
    ").append(e).html())):n?Zr.clone.call(e):e,l)for(var u in l)r.data("$"+u+"Controller",l[u].instance);return B.$$addScopeInfo(r,t),n&&n(r,t),o&&o(t,r,r,s),n||(e=o=null),r}}function z(e,t,n,r,i,o){function a(e,n,r,i){var o,a,s,l,u,c,p;if(f)for(p=Array(n.length),l=0;lm.priority)break;if((w=m.scope)&&(m.templateUrl||(b(w)?(de("new/isolated scope",S||C,m,R), +S=m):de("new/isolated scope",S,m,R)),C=C||m),g=m.name,!L&&(m.replace&&(m.templateUrl||m.template)||m.transclude&&!m.$$tlb)){for(w=U+1;L=t[w++];)if(L.transclude&&!L.$$tlb||L.replace&&(L.templateUrl||L.template)){F=!0;break}L=!0}if(!m.templateUrl&&m.controller&&(E=E||fe(),de("'"+g+"' controller",E[g],m,R),E[g]=m),w=m.transclude)if(A=!0,m.$$tlb||(de("transclusion",T,m,R),T=m),"element"===w)N=!0,x=m.priority,v=R,R=r.$$element=ur(B.$$createComment(g,r[g])),n=R[0],ve(s,vr.call(v,0),n),P=Q(F,v,a,x,l&&l.name,{nonTlbTranscludeDirective:T});else{var Y=fe();if(b(w)){v=e.document.createDocumentFragment();var W=fe(),Z=fe();o(w,function(e,t){var n="?"===e.charAt(0);e=n?e.substring(1):e,W[e]=t,Y[t]=null,Z[t]=n}),o(R.contents(),function(t){var n=W[ot(I(t))];n?(Z[n]=!0,Y[n]=Y[n]||e.document.createDocumentFragment(),Y[n].appendChild(t)):v.appendChild(t)}),o(Z,function(e,t){if(!e)throw gi("reqslot",t)});for(var ee in Y)Y[ee]&&(Y[ee]=Q(F,Y[ee].childNodes,a));v=v.childNodes}else v=ur(we(n)).contents();R.empty(),P=Q(F,v,a,void 0,void 0,{needsNewScope:m.$$isolateScope||m.$$newScope}),P.$$slots=Y}if(m.template)if(O=!0,de("template",M,m,R),M=m,w=_(m.template)?m.template(R,r):m.template,w=Ae(w),m.replace){if(l=m,v=zr.test(w)?st(he(m.templateNamespace,_r(w))):[],n=v[0],1!==v.length||1!==n.nodeType)throw gi("tplrt",g,"");ve(s,R,n),q={$attr:{}},w=K(n,[],q);var ie=t.splice(U+1,t.length-(U+1));(S||C)&&re(w,S,C),t=t.concat(w).concat(ie),le(r,q),q=t.length}else R.html(w);if(m.templateUrl)O=!0,de("template",M,m,R),M=m,m.replace&&(l=m),h=ue(t.splice(U,t.length-U),R,r,s,A&&P,u,f,{controllerDirectives:E,newScopeDirective:C!==m&&C,newIsolateScopeDirective:S,templateDirective:M,nonTlbTranscludeDirective:T}),q=t.length;else if(m.compile)try{y=m.compile(R,r,P);var oe=m.$$originalDirective||m;_(y)?p(null,H(oe,y),V,z):y&&p(H(oe,y.pre),H(oe,y.post),V,z)}catch(e){i(e,G(R))}m.terminal&&(h.terminal=!0,x=Math.max(x,m.priority))}return h.scope=C&&!0===C.scope,h.transcludeOnThisElement=A,h.templateOnThisElement=O,h.transclude=P,d.hasElementTranscludeDirective=N,h}function te(e,t,n,r){var i;if(x(t)){var a=t.match(v);t=t.substring(a[0].length);var s=a[1]||a[3],a="?"===a[2];if("^^"===s?n=n.parent():i=(i=r&&r[t])&&i.instance,!i){var l="$"+t+"Controller";i=s?n.inheritedData(l):n.data(l)}if(!i&&!a)throw gi("ctreq",t,e)}else if(k(t))for(i=[],s=0,a=t.length;sn.priority)&&-1!==n.restrict.indexOf(i)){if(s&&(n=p(n,{$$start:s,$$end:u})),!n.$$bindings){var h=c=n,m=n.name,g={isolateScope:null,bindToController:null};if(b(h.scope)&&(!0===h.bindToController?(g.bindToController=r(h.scope,m,!0),g.isolateScope={}):g.isolateScope=r(h.scope,m,!1)),b(h.bindToController)&&(g.bindToController=r(h.bindToController,m,!0)),g.bindToController&&!h.controller)throw gi("noctrl",m);c=c.$$bindings=g,b(c.isolateScope)&&(n.$$isolateBindings=c.isolateScope)}e.push(n),c=n}}return c}function se(e){if(l.hasOwnProperty(e))for(var n=t.get(e+"Directive"),r=0,i=n.length;r"+n+"",r.childNodes[0].childNodes;default:return n}}function me(e,t){if("srcdoc"===t)return C.HTML;var n=I(e);return"src"===t||"ngSrc"===t?-1===["img","video","audio","source","track"].indexOf(n)?C.RESOURCE_URL:C.MEDIA_URL:"xlinkHref"===t?"image"===n?C.MEDIA_URL:"a"===n?C.URL:C.RESOURCE_URL:"form"===n&&"action"===t||"base"===n&&"href"===t||"link"===n&&"href"===t?C.RESOURCE_URL:"a"!==n||"href"!==t&&"ngHref"!==t?void 0:C.URL}function ge(e,t,r,i,o){var a=me(e,i),s=d[i]||o,l=n(r,!o,a,s);if(l){if("multiple"===i&&"select"===I(e))throw gi("selmulti",G(e));if(w.test(i))throw gi("nodomevents");t.push({priority:100,compile:function(){return{pre:function(e,t,o){t=o.$$observers||(o.$$observers=fe());var u=o[i];u!==r&&(l=u&&n(u,!0,a,s),r=u),l&&(o[i]=l(e),(t[i]||(t[i]=[])).$$inter=!0,(o.$$observers&&o.$$observers[i].$$scope||e).$watch(l,function(e,t){"class"===i&&e!==t?o.$updateClass(e,t):o.$set(i,e)}))}}}})}}function ve(t,n,r){var i,o,a=n[0],s=n.length,l=a.parentNode;if(t)for(i=0,o=t.length;i=t)return e;for(;t--;){var n=e[t];(8===n.nodeType||n.nodeType===Pr&&""===n.nodeValue.trim())&&$r.call(e,t,1)}return e}function lt(e,t){if(t&&x(t))return t;if(x(e)){var n=wi.exec(e);if(n)return n[3]}}function ut(){var e={};this.has=function(t){return e.hasOwnProperty(t)},this.register=function(t,n){le(t,"controller"),b(t)?c(e,t):e[t]=n},this.$get=["$injector",function(t){function n(e,t,n,i){if(!e||!b(e.$scope))throw r("$controller")("noscp",i,t);e.$scope[t]=n}return function(r,i,o,a){var s,l,u;if(o=!0===o,a&&x(a)&&(u=a),x(r)){if(!(a=r.match(wi)))throw bi("ctrlfmt",r);if(l=a[1],u=u||a[3],!(r=e.hasOwnProperty(l)?e[l]:ue(i.$scope,l,!0)))throw bi("ctrlreg",l);se(r,l,!0)}return o?(o=(k(r)?r[r.length-1]:r).prototype,s=Object.create(o||null),u&&n(i,u,s,l||r.name),c(function(){var e=t.invoke(r,s,i,l);return e!==s&&(b(e)||_(e))&&(s=e,u&&n(i,u,s,l||r.name)),s},{instance:s,identifier:u})):(s=t.instantiate(r,i,l),u&&n(i,u,s,l||r.name),s)}}]}function ct(){this.$get=["$window",function(e){return ur(e.document)}]}function ft(){this.$get=["$document","$rootScope",function(e,t){function n(){i=r.hidden}var r=e[0],i=r&&r.hidden;return e.on("visibilitychange",n),t.$on("$destroy",function(){e.off("visibilitychange",n)}),function(){return i}}]}function dt(){this.$get=["$log",function(e){return function(t,n){e.error.apply(e,arguments)}}]}function pt(e){return b(e)?E(e)?e.toISOString():V(e):e}function ht(){this.$get=function(){return function(e){if(!e)return"";var t=[];return a(e,function(e,n){null===e||$(e)||_(e)||(k(e)?o(e,function(e){t.push(Q(n)+"="+Q(pt(e)))}):t.push(Q(n)+"="+Q(pt(e))))}),t.join("&")}}}function mt(){this.$get=function(){return function(e){function t(e,r,i){k(e)?o(e,function(e,n){t(e,r+"["+(b(e)?n:"")+"]")}):b(e)&&!E(e)?a(e,function(e,n){t(e,r+(i?"":"[")+n+(i?"":"]"))}):(_(e)&&(e=e()),n.push(Q(r)+"="+(null==e?"":Q(pt(e)))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function gt(e,t){if(x(e)){var n=e.replace(_i,"").trim();if(n){var r,i=t("Content-Type"),i=i&&0===i.indexOf(Ci);if((r=i)||(r=(r=n.match(ki))&&Si[r[0]].test(n)),r)try{e=B(n)}catch(t){if(!i)return e;throw Mi("baddata",e,t)}}}return e}function vt(e){var t,n=fe();return x(e)?o(e.split("\n"),function(e){t=e.indexOf(":");var r=mr(_r(e.substr(0,t)));e=_r(e.substr(t+1)),r&&(n[r]=n[r]?n[r]+", "+e:e)}):b(e)&&o(e,function(e,t){var r=mr(t),i=_r(e);r&&(n[r]=n[r]?n[r]+", "+i:i)}),n}function $t(e){var t;return function(n){return t||(t=vt(e)),n?(n=t[mr(n)],void 0===n&&(n=null),n):t}}function yt(e,t,n,r){return _(r)?r(e,t,n):(o(r,function(r){e=r(e,t,n)}),e)}function bt(){var e=this.defaults={transformResponse:[gt],transformRequest:[function(e){return b(e)&&"[object File]"!==br.call(e)&&"[object Blob]"!==br.call(e)&&"[object FormData]"!==br.call(e)?V(e):e}],headers:{common:{Accept:"application/json, text/plain, */*"},post:he(Ei),put:he(Ei),patch:he(Ei)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer",jsonpCallbackParam:"callback"},t=!1;this.useApplyAsync=function(e){return y(e)?(t=!!e,this):t};var n=this.interceptors=[],i=this.xsrfWhitelistedOrigins=[];this.$get=["$browser","$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector","$sce",function(a,s,l,u,f,d,p,m){function g(t){function n(e,t){for(var n=0,r=t.length;ne?t:d.reject(t)}if(!b(t))throw r("$http")("badreq",t);if(!x(m.valueOf(t.url)))throw r("$http")("badreq",t.url);var l=c({method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse,paramSerializer:e.paramSerializer,jsonpCallbackParam:e.jsonpCallbackParam},t);l.headers=function(t){var n,r,o,a=e.headers,s=c({},t.headers),a=c({},a.common,a[mr(t.method)]);e:for(n in a){r=mr(n);for(o in s)if(mr(o)===r)continue e;s[n]=a[n]}return i(s,he(t))}(t),l.method=gr(l.method),l.paramSerializer=x(l.paramSerializer)?p.get(l.paramSerializer):l.paramSerializer,a.$$incOutstandingRequestCount();var u=[],f=[];return t=d.resolve(l),o(S,function(e){(e.request||e.requestError)&&u.unshift(e.request,e.requestError),(e.response||e.responseError)&&f.push(e.response,e.responseError)}),t=n(t,u),t=t.then(function(t){var n=t.headers,r=yt(t.data,$t(n),void 0,t.transformRequest);return $(r)&&o(n,function(e,t){"content-type"===mr(t)&&delete n[t]}),$(t.withCredentials)&&!$(e.withCredentials)&&(t.withCredentials=e.withCredentials),v(t,r).then(s,s)}),t=n(t,f),t=t.finally(function(){a.$$completeOutstandingRequest(h)})}function v(n,r){function i(e){if(e){var n={};return o(e,function(e,r){n[r]=function(n){function r(){e(n)}t?f.$applyAsync(r):f.$$phase?r():f.$apply(r)}}),n}}function a(e,n,r,i,o){function a(){u(n,e,r,i,o)}h&&(200<=e&&300>e?h.put(O,[e,n,vt(r),i,o]):h.remove(O)),t?f.$applyAsync(a):(a(),f.$$phase||f.$apply())}function u(e,t,r,i,o){t=-1<=t?t:0,(200<=t&&300>t?S.resolve:S.reject)({data:e,status:t,headers:$t(r),config:n,statusText:i,xhrStatus:o})}function c(e){u(e.data,e.status,he(e.headers()),e.statusText,e.xhrStatus)}function p(){var e=g.pendingRequests.indexOf(n);-1!==e&&g.pendingRequests.splice(e,1)}var h,v,S=d.defer(),T=S.promise,D=n.headers,A="jsonp"===mr(n.method),O=n.url;return A?O=m.getTrustedResourceUrl(O):x(O)||(O=m.valueOf(O)),O=w(O,n.paramSerializer(n.params)),A&&(O=C(O,n.jsonpCallbackParam)),g.pendingRequests.push(n),T.then(p,p),!n.cache&&!e.cache||!1===n.cache||"GET"!==n.method&&"JSONP"!==n.method||(h=b(n.cache)?n.cache:b(e.cache)?e.cache:E),h&&(v=h.get(O),y(v)?v&&_(v.then)?v.then(c,c):k(v)?u(v[1],v[0],he(v[2]),v[3],v[4]):u(v,200,{},"OK","complete"):h.put(O,T)),$(v)&&((v=M(n.url)?l()[n.xsrfCookieName||e.xsrfCookieName]:void 0)&&(D[n.xsrfHeaderName||e.xsrfHeaderName]=v),s(n.method,O,r,a,D,n.timeout,n.withCredentials,n.responseType,i(n.eventHandlers),i(n.uploadEventHandlers))),T}function w(e,t){return 0=l&&(v.resolve(m),h($.$$intervalId),delete a[$.$$intervalId]),g||e.$apply()},s),a[$.$$intervalId]=v,$}var a={};return o.cancel=function(e){if(!e)return!1;if(!e.hasOwnProperty("$$intervalId"))throw Di("badprom");if(!a.hasOwnProperty(e.$$intervalId))return!1;e=e.$$intervalId;var n=a[e];return n.promise.$$state.pur=!0,n.reject("canceled"),t.clearInterval(e),delete a[e],!0},o}]}function St(e){e=e.split("/");for(var t=e.length;t--;)e[t]=X(e[t].replace(/%2F/g,"/"));return e.join("/")}function _t(e,t){var n=hn(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=d(n.port)||Ni[n.protocol]||null}function Mt(e,t,n){if(Ii.test(e))throw Ri("badpath",e);var r="/"!==e.charAt(0);r&&(e="/"+e),e=hn(e);for(var r=(r&&"/"===e.pathname.charAt(0)?e.pathname.substring(1):e.pathname).split("/"),i=r.length;i--;)r[i]=decodeURIComponent(r[i]),n&&(r[i]=r[i].replace(/\//g,"%2F"));n=r.join("/"),t.$$path=n,t.$$search=Z(e.search),t.$$hash=decodeURIComponent(e.hash),t.$$path&&"/"!==t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function Tt(e,t){return e.slice(0,t.length)===t}function Dt(e,t){if(Tt(t,e))return t.substr(e.length)}function At(e){var t=e.indexOf("#");return-1===t?e:e.substr(0,t)}function Ot(e){return e.replace(/(#.+)|#$/,"$1")}function Nt(e,t,n){this.$$html5=!0,n=n||"",_t(e,this),this.$$parse=function(e){var n=Dt(t,e);if(!x(n))throw Ri("ipthprfx",e,t);Mt(n,this,!0),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=J(this.$$search),n=this.$$hash?"#"+X(this.$$hash):"";this.$$url=St(this.$$path)+(e?"?"+e:"")+n,this.$$absUrl=t+this.$$url.substr(1),this.$$urlUpdatedByLocation=!0},this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return y(o=Dt(e,r))?(a=o,a=n&&y(o=Dt(n,o))?t+(Dt("/",o)||o):e+a):y(o=Dt(t,r))?a=t+o:t===r+"/"&&(a=t),a&&this.$$parse(a),!!a}}function Rt(e,t,n){_t(e,this),this.$$parse=function(r){var i,o=Dt(e,r)||Dt(t,r);$(o)||"#"!==o.charAt(0)?this.$$html5?i=o:(i="",$(o)&&(e=r,this.replace())):(i=Dt(n,o),$(i)&&(i=o)),Mt(i,this,!1),r=this.$$path;var o=e,a=/^\/[A-Z]:(\/.*)/;Tt(i,o)&&(i=i.replace(o,"")),a.exec(i)||(r=(i=a.exec(r))?i[1]:r),this.$$path=r,this.$$compose()},this.$$compose=function(){var t=J(this.$$search),r=this.$$hash?"#"+X(this.$$hash):"";this.$$url=St(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+(this.$$url?n+this.$$url:""),this.$$urlUpdatedByLocation=!0},this.$$parseLinkUrl=function(t,n){return At(e)===At(t)&&(this.$$parse(t),!0)}}function It(e,t,n){this.$$html5=!0,Rt.apply(this,arguments),this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return e===At(r)?o=r:(a=Dt(t,r))?o=e+n+a:t===r+"/"&&(o=t),o&&this.$$parse(o),!!o},this.$$compose=function(){var t=J(this.$$search),r=this.$$hash?"#"+X(this.$$hash):"";this.$$url=St(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+n+this.$$url,this.$$urlUpdatedByLocation=!0}}function Pt(e){return function(){return this[e]}}function Lt(e,t){return function(n){return $(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function Ft(){var e="!",t={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(t){return y(t)?(e=t,this):e},this.html5Mode=function(e){return A(e)?(t.enabled=e,this):b(e)?(A(e.enabled)&&(t.enabled=e.enabled),A(e.requireBase)&&(t.requireBase=e.requireBase),(A(e.rewriteLinks)||x(e.rewriteLinks))&&(t.rewriteLinks=e.rewriteLinks),this):t},this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(n,r,i,o,a){function s(e,t,n){var i=u.url(),o=u.$$state;try{r.url(e,t,n),u.$$state=r.state()}catch(e){throw u.url(i),u.$$state=o,e}}function l(e,t){n.$broadcast("$locationChangeSuccess",u.absUrl(),e,u.$$state,t)}var u,c;c=r.baseHref();var f,d=r.url();if(t.enabled){if(!c&&t.requireBase)throw Ri("nobase");f=d.substring(0,d.indexOf("/",d.indexOf("//")+2))+(c||"/"),c=i.history?Nt:It}else f=At(d),c=Rt;var p=f.substr(0,At(f).lastIndexOf("/")+1);u=new c(f,p,"#"+e),u.$$parseLinkUrl(d,d),u.$$state=r.state();var h=/^\s*(javascript|mailto):/i;o.on("click",function(e){var i=t.rewriteLinks;if(i&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&2!==e.which&&2!==e.button){for(var a=ur(e.target);"a"!==I(a[0]);)if(a[0]===o[0]||!(a=a.parent())[0])return;if(!x(i)||!$(a.attr(i))){var i=a.prop("href"),s=a.attr("href")||a.attr("xlink:href");b(i)&&"[object SVGAnimatedString]"===i.toString()&&(i=hn(i.animVal).href),h.test(i)||!i||a.attr("target")||e.isDefaultPrevented()||!u.$$parseLinkUrl(i,s)||(e.preventDefault(),u.absUrl()!==r.url()&&n.$apply())}}}),Ot(u.absUrl())!==Ot(d)&&r.url(u.absUrl(),!0);var m=!0;return r.onUrlChange(function(e,t){Tt(e,p)?(n.$evalAsync(function(){var r,i=u.absUrl(),o=u.$$state;e=Ot(e),u.$$parse(e),u.$$state=t,r=n.$broadcast("$locationChangeStart",e,i,t,o).defaultPrevented,u.absUrl()===e&&(r?(u.$$parse(i),u.$$state=o,s(i,!1,o)):(m=!1,l(i,o)))}),n.$$phase||n.$digest()):a.location.href=e}),n.$watch(function(){if(m||u.$$urlUpdatedByLocation){u.$$urlUpdatedByLocation=!1;var e=Ot(r.url()),t=Ot(u.absUrl()),o=r.state(),a=u.$$replace,c=e!==t||u.$$html5&&i.history&&o!==u.$$state;(m||c)&&(m=!1,n.$evalAsync(function(){var t=u.absUrl(),r=n.$broadcast("$locationChangeStart",t,e,u.$$state,o).defaultPrevented;u.absUrl()===t&&(r?(u.$$parse(e),u.$$state=o):(c&&s(t,a,o===u.$$state?null:u.$$state),l(e,o)))}))}u.$$replace=!1}),u}]}function Ut(){var e=!0,t=this;this.debugEnabled=function(t){return y(t)?(e=t,this):e},this.$get=["$window",function(n){function r(e){return S(e)&&(e.stack&&a?e=e.message&&-1===e.stack.indexOf(e.message)?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function i(e){var t=n.console||{},i=t[e]||t.log||h;return function(){var e=[];return o(arguments,function(t){e.push(r(t))}),Function.prototype.apply.call(i,t,e)}}var a=lr||/\bEdge\//.test(n.navigator&&n.navigator.userAgent);return{log:i("log"),info:i("info"),warn:i("warn"),error:i("error"),debug:function(){var n=i("debug");return function(){e&&n.apply(t,arguments)}}()}}]}function jt(e){return e+""}function Ht(e,t){return void 0!==e?e:t}function qt(e,t){return void 0===e?t:void 0===t?e:e+t}function Vt(e,t){switch(e.type){case qi.MemberExpression:if(e.computed)return!1;break;case qi.UnaryExpression:return 1;case qi.BinaryExpression:return"+"!==e.operator&&1;case qi.CallExpression:return!1}return void 0===t?Vi:t}function Bt(e,t,n){var r,i,a=e.isPure=Vt(e,n);switch(e.type){case qi.Program:r=!0,o(e.body,function(e){Bt(e.expression,t,a),r=r&&e.expression.constant}),e.constant=r;break;case qi.Literal:e.constant=!0,e.toWatch=[];break;case qi.UnaryExpression:Bt(e.argument,t,a),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case qi.BinaryExpression:Bt(e.left,t,a),Bt(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case qi.LogicalExpression:Bt(e.left,t,a),Bt(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case qi.ConditionalExpression:Bt(e.test,t,a),Bt(e.alternate,t,a),Bt(e.consequent,t,a),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case qi.Identifier:e.constant=!1,e.toWatch=[e];break;case qi.MemberExpression:Bt(e.object,t,a),e.computed&&Bt(e.property,t,a),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=e.constant?[]:[e];break;case qi.CallExpression:r=n=!!e.filter&&!t(e.callee.name).$stateful,i=[],o(e.arguments,function(e){Bt(e,t,a),r=r&&e.constant,i.push.apply(i,e.toWatch)}),e.constant=r,e.toWatch=n?i:[e];break;case qi.AssignmentExpression:Bt(e.left,t,a),Bt(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case qi.ArrayExpression:r=!0,i=[],o(e.elements,function(e){Bt(e,t,a),r=r&&e.constant,i.push.apply(i,e.toWatch)}),e.constant=r,e.toWatch=i;break;case qi.ObjectExpression:r=!0,i=[],o(e.properties,function(e){Bt(e.value,t,a),r=r&&e.value.constant,i.push.apply(i,e.value.toWatch),e.computed&&(Bt(e.key,t,!1),r=r&&e.key.constant,i.push.apply(i,e.key.toWatch))}),e.constant=r,e.toWatch=i;break;case qi.ThisExpression:e.constant=!1,e.toWatch=[];break;case qi.LocalsExpression:e.constant=!1,e.toWatch=[]}}function zt(e){if(1===e.length){e=e[0].expression;var t=e.toWatch;return 1!==t.length?t:t[0]!==e?t:void 0}}function Yt(e){return e.type===qi.Identifier||e.type===qi.MemberExpression}function Wt(e){if(1===e.body.length&&Yt(e.body[0].expression))return{type:qi.AssignmentExpression,left:e.body[0].expression,right:{type:qi.NGValueParameter},operator:"="}}function Gt(e){this.$filter=e}function Kt(e){this.$filter=e}function Zt(e,t,n){this.ast=new qi(e,n),this.astCompiler=n.csp?new Kt(t):new Gt(t)}function Jt(e){return _(e.valueOf)?e.valueOf():Fi.call(e)}function Xt(){var e,t,n=fe(),r={true:!0,false:!1,null:null,undefined:void 0};this.addLiteral=function(e,t){r[e]=t},this.setIdentifierFns=function(n,r){return e=n,t=r,this},this.$get=["$filter",function(i){function a(e,t){var r,o;switch(typeof e){case"string":return o=e=e.trim(),r=n[o],r||(r=new Hi(v),r=new Zt(r,i,v).parse(e),n[o]=d(r)),g(r,t);case"function":return g(e,t);default:return g(h,t)}}function s(e,t,n){return null==e||null==t?e===t:!("object"==typeof e&&"object"==typeof(e=Jt(e))&&!n)&&(e===t||e!==e&&t!==t)}function l(e,t,n,r,i){var o,a=r.inputs;if(1===a.length){var l=s,a=a[0];return e.$watch(function(e){var t=a(e);return s(t,l,a.isPure)||(o=r(e,void 0,void 0,[t]),l=t&&Jt(t)),o},t,n,i)}for(var u=[],c=[],f=0,d=a.length;f=n.$$state.status&&i&&i.length&&e(function(){for(var e,n,o=0,a=i.length;oe)for(t in c++,o)hr.call(r,t)||(m--,delete o[t])}else o!==r&&(o=r,c++);return c}}n.$$pure=l(e).literal,n.$stateful=!n.$$pure;var r,o,a,s=this,u=1$&&(m=4-$,w[m]||(w[m]=[]),w[m].push({msg:_(e.exp)?"fn: "+(e.exp.name||e.exp.toString()):e.exp,newVal:i,oldVal:o}))}catch(e){r(e)}if(!(f=!h.$$suspended&&h.$$watchersCount&&h.$$childHead||h!==b&&h.$$nextSibling))for(;h!==b&&!(f=h.$$nextSibling);)h=h.$parent}while(h=f);if((d||C.length)&&!$--)throw x.$$phase=null,n("infdig",t,w)}while(d||C.length);for(x.$$phase=null;Slr)throw zi("iequirks");var r=he(Yi);r.isEnabled=function(){return e},r.trustAs=n.trustAs,r.getTrusted=n.getTrusted,r.valueOf=n.valueOf,e||(r.trustAs=r.getTrusted=function(e,t){return t},r.valueOf=m),r.parseAs=function(e,n){var i=t(n);return i.literal&&i.constant?i:t(n,function(t){return r.getTrusted(e,t)})};var i=r.parseAs,a=r.getTrusted,s=r.trustAs;return o(Yi,function(e,t){var n=mr(t);r[("parse_as_"+n).replace(Wi,ge)]=function(t){return i(e,t)},r[("get_trusted_"+n).replace(Wi,ge)]=function(t){return a(e,t)},r[("trust_as_"+n).replace(Wi,ge)]=function(t){return s(e,t)}}),r}]}function cn(){this.$get=["$window","$document",function(e,t){var n={},r=!((!e.nw||!e.nw.process)&&e.chrome&&(e.chrome.app&&e.chrome.app.runtime||!e.chrome.app&&e.chrome.runtime&&e.chrome.runtime.id))&&e.history&&e.history.pushState,i=d((/android (\d+)/.exec(mr((e.navigator||{}).userAgent))||[])[1]),o=/Boxee/i.test((e.navigator||{}).userAgent),a=t[0]||{},s=a.body&&a.body.style,l=!1,u=!1;return s&&(l=!!("transition"in s||"webkitTransition"in s),u=!!("animation"in s||"webkitAnimation"in s)),{history:!(!r||4>i||o),hasEvent:function(e){if("input"===e&&lr)return!1;if($(n[e])){var t=a.createElement("div");n[e]="on"+e in t}return n[e]},csp:Tr(),transitions:l,animations:u,android:i}}]}function fn(){var e;this.httpOptions=function(t){return t?(e=t,this):e},this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(t,n,r,i,o){function a(s,l){a.totalPendingRequests++,x(s)&&!$(n.get(s))||(s=o.getTrustedResourceUrl(s));var u=r.defaults&&r.defaults.transformResponse;return k(u)?u=u.filter(function(e){return e!==gt}):u===gt&&(u=null),r.get(s,c({cache:n,transformResponse:u},e)).finally(function(){a.totalPendingRequests--}).then(function(e){return n.put(s,e.data)},function(e){return l||(e=Gi("tpload",s,e.status,e.statusText),t(e)),i.reject(e)})}return a.totalPendingRequests=0,a}]}function dn(){this.$get=["$rootScope","$browser","$location",function(e,t,n){return{findBindings:function(e,t,n){e=e.getElementsByClassName("ng-binding");var r=[];return o(e,function(e){var i=Cr.element(e).data("$binding");i&&o(i,function(i){n?new RegExp("(^|\\s)"+Mr(t)+"(\\s|\\||$)").test(i)&&r.push(e):-1!==i.indexOf(t)&&r.push(e)})}),r},findModels:function(e,t,n){for(var r=["ng-","data-ng-","ng\\:"],i=0;in&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):0>n&&(n=e.length),r=0;e.charAt(r)===eo;r++);if(r===(o=e.length))t=[0],n=1;else{for(o--;e.charAt(o)===eo;)o--;for(n-=r,t=[],i=0;r<=o;r++,i++)t[i]=+e.charAt(r)}return n>Xi&&(t=t.splice(0,Xi-1),a=n-1,n=1),{d:t,e:a,i:n}}function Mn(e,t,n,r){var i=e.d,o=i.length-e.i;if(t=$(t)?Math.min(Math.max(n,o),r):+t,n=t+e.i,r=i[n],0n-1){for(r=0;r>n;r--)i.unshift(0),e.i++;i.unshift(1),e.i++}else i[n-1]++;for(;os;)l.unshift(0),s++;for(0=t.lgSize&&s.unshift(l.splice(-t.lgSize,l.length).join(""));l.length>t.gSize;)s.unshift(l.splice(-t.gSize,l.length).join(""));l.length&&s.unshift(l.join("")),l=s.join(n),o.length&&(l+=r+o.join("")),i&&(l+="e+"+i)}return 0>e&&!a?t.negPre+l+t.negSuf:t.posPre+l+t.posSuf}function Dn(e,t,n,r){var i="";for((0>e||r&&0>=e)&&(r?e=1-e:(e=-e,i="-")),e=""+e;e.length-n)&&(o+=n),0===o&&-12===n&&(o=12),Dn(o,t,r,i)}}function On(e,t,n){return function(r,i){var o=r["get"+e]();return i[gr((n?"STANDALONE":"")+(t?"SHORT":"")+e)][o]}}function Nn(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(4>=t?5:12)-t)}function Rn(e){return function(t){var n=Nn(t.getFullYear());return t=+new Date(t.getFullYear(),t.getMonth(),t.getDate()+(4-t.getDay()))-+n,t=1+Math.round(t/6048e5),Dn(t,e)}}function In(e,t){return 0>=e.getFullYear()?t.ERAS[0]:t.ERAS[1]}function Pn(e){function t(e){var t;if(t=e.match(n)){e=new Date(0);var r=0,i=0,o=t[8]?e.setUTCFullYear:e.setFullYear,a=t[8]?e.setUTCHours:e.setHours;t[9]&&(r=d(t[9]+t[10]),i=d(t[9]+t[11])),o.call(e,d(t[1]),d(t[2])-1,d(t[3])),r=d(t[4]||0)-r,i=d(t[5]||0)-i,o=d(t[6]||0),t=Math.round(1e3*parseFloat("0."+(t[7]||0))),a.call(e,r,i,o,t)}return e}var n=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,r,i){var a,s,l="",u=[];if(r=r||"mediumDate",r=e.DATETIME_FORMATS[r]||r,x(n)&&(n=ro.test(n)?d(n):t(n)),C(n)&&(n=new Date(n)),!E(n)||!isFinite(n.getTime()))return n;for(;r;)(s=no.exec(r))?(u=j(u,s,1),r=u.pop()):(u.push(r),r=null);var c=n.getTimezoneOffset();return i&&(c=z(i,c),n=W(n,i,!0)),o(u,function(t){a=to[t],l+=a?a(n,e.DATETIME_FORMATS,c):"''"===t?"'":t.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),l}}function Ln(){return function(e,t){return $(t)&&(t=2),V(e,t)}}function Fn(){return function(e,t,n){return t=1/0===Math.abs(Number(t))?Number(t):d(t),kr(t)?e:(C(e)&&(e=e.toString()),i(e)?(n=!n||isNaN(n)?0:d(n),n=0>n?Math.max(0,e.length+n):n,0<=t?Un(e,n,n+t):0===n?Un(e,t,e.length):Un(e,Math.max(0,n+t),n)):e)}}function Un(e,t,n){return x(e)?e.slice(t,n):vr.call(e,t,n)}function jn(e){function t(t){return t.map(function(t){var n=1,r=m;if(_(t))r=t;else if(x(t)&&("+"!==t.charAt(0)&&"-"!==t.charAt(0)||(n="-"===t.charAt(0)?-1:1,t=t.substring(1)),""!==t&&(r=e(t),r.constant)))var i=r(),r=function(e){return e[i]};return{get:r,descending:n}})}function n(e){switch(typeof e){case"number":case"boolean":case"string":return!0;default:return!1}}function o(e,t){var n=0,r=e.type,i=t.type;if(r===i){var i=e.value,o=t.value;"string"===r?(i=i.toLowerCase(),o=o.toLowerCase()):"object"===r&&(b(i)&&(i=e.index),b(o)&&(o=t.index)),i!==o&&(n=it||37<=t&&40>=t||c(e,this,this.value)}),i.hasEvent("paste")&&t.on("paste cut drop",c)}t.on("change",u),xo[a]&&r.$$hasNativeValidators&&a===n.type&&t.on("keydown wheel mousedown",function(e){if(!l){var t=this.validity,n=t.badInput,r=t.typeMismatch;l=o.defer(function(){l=null,t.badInput===n&&t.typeMismatch===r||u(e)})}}),r.$render=function(){var e=r.$isEmpty(r.$viewValue)?"":r.$viewValue;t.val()!==e&&t.val(e)}}function Gn(e,t){return function(n,r){var i,a;if(E(n))return n;if(x(n)){if('"'===n.charAt(0)&&'"'===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),po.test(n))return new Date(n);if(e.lastIndex=0,i=e.exec(n))return i.shift(),a=r?{yyyy:r.getFullYear(),MM:r.getMonth()+1,dd:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds(),sss:r.getMilliseconds()/1e3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},o(i,function(e,n){na.yyyy&&i.setFullYear(a.yyyy),i}return NaN}}function Kn(e,t,n,r){return function(i,o,a,s,l,u,c){function f(e){return e&&!(e.getTime&&e.getTime()!==e.getTime())}function d(e){return y(e)&&!E(e)?p(e)||void 0:e}function p(e,t){var r=s.$options.getOption("timezone");m&&m!==r&&(t=Y(t,z(m)));var i=n(e,t);return!isNaN(i)&&r&&(i=W(i,r)),i}Zn(i,o,a,s,e),Wn(i,o,a,s,l,u);var h,m;if(s.$parsers.push(function(n){return s.$isEmpty(n)?null:t.test(n)?p(n,h):void(s.$$parserName=e)}),s.$formatters.push(function(e){if(e&&!E(e))throw Wo("datefmt",e);if(f(e)){h=e;var t=s.$options.getOption("timezone");return t&&(m=t,h=W(h,t,!0)),c("date")(e,r,t)}return m=h=null,""}),y(a.min)||a.ngMin){var g;s.$validators.min=function(e){return!f(e)||$(g)||n(e)>=g},a.$observe("min",function(e){g=d(e),s.$validate()})}if(y(a.max)||a.ngMax){var v;s.$validators.max=function(e){return!f(e)||$(v)||n(e)<=v},a.$observe("max",function(e){v=d(e),s.$validate()})}}}function Zn(e,t,n,r,i){(r.$$hasNativeValidators=b(t[0].validity))&&r.$parsers.push(function(e){var n=t.prop("validity")||{};if(!n.badInput&&!n.typeMismatch)return e;r.$$parserName=i})}function Jn(e){e.$parsers.push(function(t){return e.$isEmpty(t)?null:go.test(t)?parseFloat(t):void(e.$$parserName="number")}),e.$formatters.push(function(t){if(!e.$isEmpty(t)){if(!C(t))throw Wo("numfmt",t);t=t.toString()}return t})}function Xn(e){return y(e)&&!C(e)&&(e=parseFloat(e)),kr(e)?void 0:e}function Qn(e){var t=e.toString(),n=t.indexOf(".");return-1===n?-1e&&(e=/e-(\d+)$/.exec(t))?Number(e[1]):0:t.length-n-1}function er(e,t,n){e=Number(e);var r=(0|e)!==e,i=(0|t)!==t,o=(0|n)!==n;if(r||i||o){var a=r?Qn(e):0,s=i?Qn(t):0,l=o?Qn(n):0,a=Math.max(a,s,l),a=Math.pow(10,a);e*=a,t*=a,n*=a,r&&(e=Math.round(e)),i&&(t=Math.round(t)),o&&(n=Math.round(n))}return 0==(e-t)%n}function tr(e,t,n,r,i){if(y(r)){if(e=e(r),!e.constant)throw Wo("constexpr",n,r);return e(t)}return i}function nr(e,t){function n(e,t){if(!e||!e.length)return[];if(!t||!t.length)return e;var n=[],r=0;e:for(;r(?:<\/\1>|)$/,zr=/<|&#?\w+;/,Yr=/<([\w:-]+)/,Wr=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Gr={option:[1,'"],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};Gr.optgroup=Gr.option,Gr.tbody=Gr.tfoot=Gr.colgroup=Gr.caption=Gr.thead,Gr.th=Gr.td;var Kr=e.Node.prototype.contains||function(e){return!!(16&this.compareDocumentPosition(e))},Zr=be.prototype={ready:Fe,toString:function(){var e=[];return o(this,function(t){e.push(""+t)}),"["+e.join(", ")+"]"},eq:function(e){return ur(0<=e?this[e]:this[this.length+e])},length:0,push:yr,sort:[].sort,splice:[].splice},Jr={};o("multiple selected checked disabled readOnly required open".split(" "),function(e){Jr[mr(e)]=e});var Xr={};o("input select option textarea button form details".split(" "),function(e){Xr[e]=!0});var Qr={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};o({data:Me,removeData:Se,hasData:function(e){for(var t in Fr[e.ng339])return!0;return!1},cleanData:function(e){for(var t=0,n=e.length;t/,ii=/^[^(]*\(\s*([^)]*)\)/m,oi=/,/,ai=/^\s*(_?)(\S+?)\1\s*$/,si=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,li=r("$injector");Ge.$$annotate=function(e,t,n){var r;if("function"==typeof e){if(!(r=e.$inject)){if(r=[],e.length){if(t)throw x(n)&&n||(n=e.name||We(e)),li("strictdi",n);t=Ye(e),o(t[1].split(oi),function(e){e.replace(ai,function(e,t,n){r.push(n)})})}e.$inject=r}}else k(e)?(t=e.length-1,se(e[t],"fn"),r=e.slice(0,t)):se(e,"fn",!0);return r};var ui=r("$animate"),ci=function(){this.$get=h},fi=function(){var e=new ti,t=[];this.$get=["$$AnimateRunner","$rootScope",function(n,r){function i(e,t,n){var r=!1;return t&&(t=x(t)?t.split(" "):k(t)?t:[],o(t,function(t){t&&(r=!0,e[t]=n)})),r}function a(){o(t,function(t){var n=e.get(t);if(n){var r=Je(t.attr("class")),i="",a="";o(n,function(e,t){e!==!!r[t]&&(e?i+=(i.length?" ":"")+t:a+=(a.length?" ":"")+t)}),o(t,function(e){i&&Ae(e,i),a&&De(e,a)}),e.delete(t)}}),t.length=0}return{enabled:h,on:h,off:h,pin:h,push:function(o,s,l,u){return u&&u(),l=l||{},l.from&&o.css(l.from),l.to&&o.css(l.to),(l.addClass||l.removeClass)&&(s=l.addClass,u=l.removeClass,l=e.get(o)||{},s=i(l,s,!0),u=i(l,u,!1),(s||u)&&(e.set(o,l),t.push(o),1===t.length&&r.$$postDigest(a))),o=new n,o.complete(),o}}}]},di=["$provide",function(e){var t=this,n=null,r=null;this.$$registeredAnimations=Object.create(null),this.register=function(n,r){if(n&&"."!==n.charAt(0))throw ui("notcsel",n);var i=n+"-animation";t.$$registeredAnimations[n.substr(1)]=i,e.factory(i,r)},this.customFilter=function(e){return 1===arguments.length&&(r=_(e)?e:null),r},this.classNameFilter=function(e){if(1===arguments.length&&(n=e instanceof RegExp?e:null)&&/[(\s|\/)]ng-animate[(\s|\/)]/.test(n.toString()))throw n=null,ui("nongcls","ng-animate");return n},this.$get=["$$animateQueue",function(e){function t(e,t,n){if(n){var r;e:{for(r=0;r <= >= && || ! = |".split(" "),function(e){Ui[e]=!0});var ji={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Hi=function(e){this.options=e};Hi.prototype={constructor:Hi,lex:function(e){for(this.text=e,this.index=0,this.tokens=[];this.index=e&&"string"==typeof e},isWhitespace:function(e){return" "===e||"\r"===e||"\t"===e||"\n"===e||"\v"===e||" "===e},isIdentifierStart:function(e){return this.options.isIdentifierStart?this.options.isIdentifierStart(e,this.codePointAt(e)):this.isValidIdentifierStart(e)},isValidIdentifierStart:function(e){return"a"<=e&&"z">=e||"A"<=e&&"Z">=e||"_"===e||"$"===e},isIdentifierContinue:function(e){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(e,this.codePointAt(e)):this.isValidIdentifierContinue(e)},isValidIdentifierContinue:function(e,t){return this.isValidIdentifierStart(e,t)||this.isNumber(e)},codePointAt:function(e){return 1===e.length?e.charCodeAt(0):(e.charCodeAt(0)<<10)+e.charCodeAt(1)-56613888},peekMultichar:function(){var e=this.text.charAt(this.index),t=this.peek();if(!t)return e;var n=e.charCodeAt(0),r=t.charCodeAt(0);return 55296<=n&&56319>=n&&56320<=r&&57343>=r?e+t:e},isExpOperator:function(e){return"-"===e||"+"===e||this.isNumber(e)},throwError:function(e,t,n){throw n=n||this.index,t=y(t)?"s "+t+"-"+this.index+" ["+this.text.substring(t,n)+"]":" "+n,Li("lexerr",e,t,this.text)},readNumber:function(){for(var e="",t=this.index;this.index","<=",">=");)t={type:qi.BinaryExpression,operator:e.text,left:t,right:this.additive()};return t},additive:function(){for(var e,t=this.multiplicative();e=this.expect("+","-");)t={type:qi.BinaryExpression,operator:e.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t={type:qi.BinaryExpression,operator:e.text,left:t,right:this.unary()};return t},unary:function(){var e;return(e=this.expect("+","-","!"))?{type:qi.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e;this.expect("(")?(e=this.filterChain(),this.consume(")")):this.expect("[")?e=this.arrayDeclaration():this.expect("{")?e=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?e=L(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:qi.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError("not a primary expression",this.peek());for(var t;t=this.expect("(","[",".");)"("===t.text?(e={type:qi.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(")")):"["===t.text?(e={type:qi.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume("]")):"."===t.text?e={type:qi.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return e},filter:function(e){e=[e];for(var t={type:qi.CallExpression,callee:this.identifier(),arguments:e,filter:!0};this.expect(":");)e.push(this.expression());return t},parseArguments:function(){var e=[];if(")"!==this.peekToken().text)do{e.push(this.filterChain())}while(this.expect(","));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError("is not a valid identifier",e),{type:qi.Identifier,name:e.text}},constant:function(){return{type:qi.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if("]"!==this.peekToken().text)do{if(this.peek("]"))break;e.push(this.expression())}while(this.expect(","));return this.consume("]"),{type:qi.ArrayExpression,elements:e}},object:function(){var e,t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;e={type:qi.Property,kind:"init"},this.peek().constant?(e.key=this.constant(),e.computed=!1,this.consume(":"),e.value=this.expression()):this.peek().identifier?(e.key=this.identifier(),e.computed=!1,this.peek(":")?(this.consume(":"),e.value=this.expression()):e.value=e.key):this.peek("[")?(this.consume("["),e.key=this.expression(),this.consume("]"),e.computed=!0,this.consume(":"),e.value=this.expression()):this.throwError("invalid key",this.peek()),t.push(e)}while(this.expect(","));return this.consume("}"),{type:qi.ObjectExpression,properties:t}},throwError:function(e,t){throw Li("syntax",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw Li("ueoe",this.text);var t=this.expect(e);return t||this.throwError("is unexpected, expecting ["+e+"]",this.peek()),t},peekToken:function(){if(0===this.tokens.length)throw Li("ueoe",this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){e=this.tokens[e];var o=e.text;if(o===t||o===n||o===r||o===i||!(t||n||r||i))return e}return!1},expect:function(e,t,n,r){return!!(e=this.peek(e,t,n,r))&&(this.tokens.shift(),e)},selfReferential:{this:{type:qi.ThisExpression},$locals:{type:qi.LocalsExpression}}};var Vi=2;Gt.prototype={compile:function(e){var t=this;this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},Bt(e,t.$filter);var n,r="";return this.stage="assign",(n=Wt(e))&&(this.state.computing="assign",r=this.nextId(),this.recurse(n,r),this.return_(r),r="fn.assign="+this.generateFunction("assign","s,v,l")),n=zt(e.body),t.stage="inputs",o(n,function(e,n){var r="fn"+n;t.state[r]={vars:[],body:[],own:{}},t.state.computing=r;var i=t.nextId();t.recurse(e,i),t.return_(i),t.state.inputs.push({name:r,isPure:e.isPure}),e.watchId=n}),this.state.computing="fn",this.stage="main",this.recurse(e),e='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+r+this.watchFns()+"return fn;",e=new Function("$filter","getStringValue","ifDefined","plus",e)(this.$filter,jt,Ht,qt),this.state=this.stage=void 0,e},USE:"use",STRICT:"strict",watchFns:function(){var e=[],t=this.state.inputs,n=this;return o(t,function(t){e.push("var "+t.name+"="+n.generateFunction(t.name,"s")),t.isPure&&e.push(t.name,".isPure="+JSON.stringify(t.isPure)+";")}),t.length&&e.push("fn.inputs=["+t.map(function(e){return e.name}).join(",")+"];"),e.join("")},generateFunction:function(e,t){return"function("+t+"){"+this.varsPrefix(e)+this.body(e)+"};"},filterPrefix:function(){var e=[],t=this;return o(this.state.filters,function(n,r){e.push(n+"=$filter("+t.escape(r)+")")}),e.length?"var "+e.join(",")+";":""},varsPrefix:function(e){return this.state[e].vars.length?"var "+this.state[e].vars.join(",")+";":""},body:function(e){return this.state[e].body.join("")},recurse:function(e,t,n,r,i,a){var s,l,u,c,f,d=this;if(r=r||h,!a&&y(e.watchId))t=t||this.nextId(),this.if_("i",this.lazyAssign(t,this.computedMember("i",e.watchId)),this.lazyRecurse(e,t,n,r,i,!0));else switch(e.type){case qi.Program:o(e.body,function(t,n){d.recurse(t.expression,void 0,void 0,function(e){l=e}),n!==e.body.length-1?d.current().body.push(l,";"):d.return_(l)});break;case qi.Literal:c=this.escape(e.value),this.assign(t,c),r(t||c);break;case qi.UnaryExpression:this.recurse(e.argument,void 0,void 0,function(e){l=e}),c=e.operator+"("+this.ifDefined(l,0)+")",this.assign(t,c),r(c);break;case qi.BinaryExpression:this.recurse(e.left,void 0,void 0,function(e){s=e}),this.recurse(e.right,void 0,void 0,function(e){l=e}),c="+"===e.operator?this.plus(s,l):"-"===e.operator?this.ifDefined(s,0)+e.operator+this.ifDefined(l,0):"("+s+")"+e.operator+"("+l+")",this.assign(t,c),r(c);break;case qi.LogicalExpression:t=t||this.nextId(),d.recurse(e.left,t),d.if_("&&"===e.operator?t:d.not(t),d.lazyRecurse(e.right,t)),r(t);break;case qi.ConditionalExpression:t=t||this.nextId(),d.recurse(e.test,t),d.if_(t,d.lazyRecurse(e.alternate,t),d.lazyRecurse(e.consequent,t)),r(t);break;case qi.Identifier:t=t||this.nextId(),n&&(n.context="inputs"===d.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",e.name)+"?l:s"),n.computed=!1,n.name=e.name),d.if_("inputs"===d.stage||d.not(d.getHasOwnProperty("l",e.name)),function(){d.if_("inputs"===d.stage||"s",function(){i&&1!==i&&d.if_(d.isNull(d.nonComputedMember("s",e.name)),d.lazyAssign(d.nonComputedMember("s",e.name),"{}")),d.assign(t,d.nonComputedMember("s",e.name))})},t&&d.lazyAssign(t,d.nonComputedMember("l",e.name))),r(t);break;case qi.MemberExpression:s=n&&(n.context=this.nextId())||this.nextId(),t=t||this.nextId(),d.recurse(e.object,s,void 0,function(){d.if_(d.notNull(s),function(){e.computed?(l=d.nextId(),d.recurse(e.property,l),d.getStringValue(l),i&&1!==i&&d.if_(d.not(d.computedMember(s,l)),d.lazyAssign(d.computedMember(s,l),"{}")),c=d.computedMember(s,l),d.assign(t,c),n&&(n.computed=!0,n.name=l)):(i&&1!==i&&d.if_(d.isNull(d.nonComputedMember(s,e.property.name)),d.lazyAssign(d.nonComputedMember(s,e.property.name),"{}")),c=d.nonComputedMember(s,e.property.name),d.assign(t,c),n&&(n.computed=!1,n.name=e.property.name))},function(){d.assign(t,"undefined")}),r(t)},!!i);break;case qi.CallExpression:t=t||this.nextId(),e.filter?(l=d.filter(e.callee.name),u=[],o(e.arguments,function(e){var t=d.nextId();d.recurse(e,t),u.push(t)}),c=l+"("+u.join(",")+")",d.assign(t,c),r(t)):(l=d.nextId(),s={},u=[],d.recurse(e.callee,l,s,function(){d.if_(d.notNull(l),function(){o(e.arguments,function(t){d.recurse(t,e.constant?void 0:d.nextId(),void 0,function(e){u.push(e)})}),c=s.name?d.member(s.context,s.name,s.computed)+"("+u.join(",")+")":l+"("+u.join(",")+")",d.assign(t,c)},function(){d.assign(t,"undefined")}),r(t)}));break;case qi.AssignmentExpression:l=this.nextId(),s={},this.recurse(e.left,void 0,s,function(){d.if_(d.notNull(s.context),function(){d.recurse(e.right,l),c=d.member(s.context,s.name,s.computed)+e.operator+l,d.assign(t,c),r(t||c)})},1);break;case qi.ArrayExpression:u=[],o(e.elements,function(t){d.recurse(t,e.constant?void 0:d.nextId(),void 0,function(e){u.push(e)})}),c="["+u.join(",")+"]",this.assign(t,c),r(t||c);break;case qi.ObjectExpression:u=[],f=!1,o(e.properties,function(e){e.computed&&(f=!0)}),f?(t=t||this.nextId(),this.assign(t,"{}"),o(e.properties,function(e){e.computed?(s=d.nextId(),d.recurse(e.key,s)):s=e.key.type===qi.Identifier?e.key.name:""+e.key.value,l=d.nextId(),d.recurse(e.value,l),d.assign(d.member(t,s,e.computed),l)})):(o(e.properties,function(t){d.recurse(t.value,e.constant?void 0:d.nextId(),void 0,function(e){u.push(d.escape(t.key.type===qi.Identifier?t.key.name:""+t.key.value)+":"+e)})}),c="{"+u.join(",")+"}",this.assign(t,c)),r(t||c);break;case qi.ThisExpression:this.assign(t,"s"),r(t||"s");break;case qi.LocalsExpression:this.assign(t,"l"),r(t||"l");break;case qi.NGValueParameter:this.assign(t,"v"),r(t||"v")}},getHasOwnProperty:function(e,t){var n=e+"."+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+"&&("+this.escape(t)+" in "+e+")")),r[n]},assign:function(e,t){if(e)return this.current().body.push(e,"=",t,";"),e},filter:function(e){return this.state.filters.hasOwnProperty(e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return"ifDefined("+e+","+this.escape(t)+")"},plus:function(e,t){return"plus("+e+","+t+")"},return_:function(e){this.current().body.push("return ",e,";")},if_:function(e,t,n){if(!0===e)t();else{var r=this.current().body;r.push("if(",e,"){"),t(),r.push("}"),n&&(r.push("else{"),n(),r.push("}"))}},not:function(e){return"!("+e+")"},isNull:function(e){return e+"==null"},notNull:function(e){return e+"!=null"},nonComputedMember:function(e,t){var n=/[^$_a-zA-Z0-9]/g;return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?e+"."+t:e+'["'+t.replace(n,this.stringEscapeFn)+'"]'},computedMember:function(e,t){return e+"["+t+"]"},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},getStringValue:function(e){this.assign(e,"getStringValue("+e+")")},lazyRecurse:function(e,t,n,r,i,o){var a=this;return function(){a.recurse(e,t,n,r,i,o)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if(x(e))return"'"+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(C(e))return e.toString();if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(void 0===e)return"undefined";throw Li("esc")},nextId:function(e,t){var n="v"+this.state.nextId++;return e||this.current().vars.push(n+(t?"="+t:"")),n},current:function(){return this.state[this.state.computing]}},Kt.prototype={compile:function(e){var t=this;Bt(e,t.$filter);var n,r;(n=Wt(e))&&(r=this.recurse(n)),n=zt(e.body);var i;n&&(i=[],o(n,function(e,n){var r=t.recurse(e);r.isPure=e.isPure,e.input=r,i.push(r),e.watchId=n}));var a=[];return o(e.body,function(e){a.push(t.recurse(e.expression))}),e=0===e.body.length?h:1===e.body.length?a[0]:function(e,t){var n;return o(a,function(r){n=r(e,t)}),n},r&&(e.assign=function(e,t,n){return r(e,n,t)}),i&&(e.inputs=i),e},recurse:function(e,t,n){var r,i,a,s=this;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case qi.Literal:return this.value(e.value,t);case qi.UnaryExpression:return i=this.recurse(e.argument),this["unary"+e.operator](i,t);case qi.BinaryExpression:case qi.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this["binary"+e.operator](r,i,t);case qi.ConditionalExpression:return this["ternary?:"](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case qi.Identifier:return s.identifier(e.name,t,n);case qi.MemberExpression:return r=this.recurse(e.object,!1,!!n),e.computed||(i=e.property.name),e.computed&&(i=this.recurse(e.property)), +e.computed?this.computedMember(r,i,t,n):this.nonComputedMember(r,i,t,n);case qi.CallExpression:return a=[],o(e.arguments,function(e){a.push(s.recurse(e))}),e.filter&&(i=this.$filter(e.callee.name)),e.filter||(i=this.recurse(e.callee,!0)),e.filter?function(e,n,r,o){for(var s=[],l=0;l":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)>t(r,i,o,a),n?{value:r}:r}},"binary<=":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)<=t(r,i,o,a),n?{value:r}:r}},"binary>=":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)>=t(r,i,o,a),n?{value:r}:r}},"binary&&":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)&&t(r,i,o,a),n?{value:r}:r}},"binary||":function(e,t,n){return function(r,i,o,a){return r=e(r,i,o,a)||t(r,i,o,a),n?{value:r}:r}},"ternary?:":function(e,t,n,r){return function(i,o,a,s){return i=e(i,o,a,s)?t(i,o,a,s):n(i,o,a,s),r?{value:i}:i}},value:function(e,t){return function(){return t?{context:void 0,name:void 0,value:e}:e}},identifier:function(e,t,n){return function(r,i,o,a){return r=i&&e in i?i:r,n&&1!==n&&r&&null==r[e]&&(r[e]={}),i=r?r[e]:void 0,t?{context:r,name:e,value:i}:i}},computedMember:function(e,t,n,r){return function(i,o,a,s){var l,u,c=e(i,o,a,s);return null!=c&&(l=t(i,o,a,s),l+="",r&&1!==r&&c&&!c[l]&&(c[l]={}),u=c[l]),n?{context:c,name:l,value:u}:u}},nonComputedMember:function(e,t,n,r){return function(i,o,a,s){return i=e(i,o,a,s),r&&1!==r&&i&&null==i[t]&&(i[t]={}),o=null!=i?i[t]:void 0,n?{context:i,name:t,value:o}:o}},inputs:function(e,t){return function(n,r,i,o){return o?o[t]:e(n,r,i)}}},Zt.prototype={constructor:Zt,parse:function(e){e=this.getAst(e);var t=this.astCompiler.compile(e.ast),n=e.ast;return t.literal=0===n.body.length||1===n.body.length&&(n.body[0].expression.type===qi.Literal||n.body[0].expression.type===qi.ArrayExpression||n.body[0].expression.type===qi.ObjectExpression),t.constant=e.ast.constant,t.oneTime=e.oneTime,t},getAst:function(e){var t=!1;return e=e.trim(),":"===e.charAt(0)&&":"===e.charAt(1)&&(t=!0,e=e.substring(2)),{ast:this.ast.ast(e),oneTime:t}}};var Bi,zi=r("$sce"),Yi={HTML:"html",CSS:"css",MEDIA_URL:"mediaUrl",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Wi=/_([a-z])/g,Gi=r("$templateRequest"),Ki=r("$timeout"),Zi=e.document.createElement("a"),Ji=hn(e.location.href);$n.$inject=["$document"],bn.$inject=["$provide"];var Xi=22,Qi=".",eo="0";kn.$inject=["$locale"],Sn.$inject=["$locale"];var to={yyyy:An("FullYear",4,0,!1,!0),yy:An("FullYear",2,0,!0,!0),y:An("FullYear",1,0,!1,!0),MMMM:On("Month"),MMM:On("Month",!0),MM:An("Month",2,1),M:An("Month",1,1),LLLL:On("Month",!1,!0),dd:An("Date",2),d:An("Date",1),HH:An("Hours",2),H:An("Hours",1),hh:An("Hours",2,-12),h:An("Hours",1,-12),mm:An("Minutes",2),m:An("Minutes",1),ss:An("Seconds",2),s:An("Seconds",1),sss:An("Milliseconds",3),EEEE:On("Day"),EEE:On("Day",!0),a:function(e,t){return 12>e.getHours()?t.AMPMS[0]:t.AMPMS[1]},Z:function(e,t,n){return e=-1*n,e=(0<=e?"+":"")+(Dn(Math[0=e.getFullYear()?t.ERANAMES[0]:t.ERANAMES[1]}},no=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,ro=/^-?\d+$/;Pn.$inject=["$locale"];var io=g(mr),oo=g(gr);jn.$inject=["$parse"];var ao=g({restrict:"E",compile:function(e,t){if(!t.href&&!t.xlinkHref)return function(e,t){if("a"===t[0].nodeName.toLowerCase()){var n="[object SVGAnimatedString]"===br.call(t.prop("href"))?"xlink:href":"href";t.on("click",function(e){t.attr(n)||e.preventDefault()})}}}}),so={};o(Jr,function(e,t){function n(e,n,i){e.$watch(i[r],function(e){i.$set(t,!!e)})}if("multiple"!==e){var r=ot("ng-"+t),i=n;"checked"===e&&(i=function(e,t,i){i.ngModel!==i[r]&&n(e,t,i)}),so[r]=function(){return{restrict:"A",priority:100,link:i}}}}),o(Qr,function(e,t){so[t]=function(){return{priority:100,link:function(e,n,r){if("ngPattern"===t&&"/"===r.ngPattern.charAt(0)&&(n=r.ngPattern.match(pr)))return void r.$set("ngPattern",new RegExp(n[1],n[2]));e.$watch(r[t],function(e){r.$set(t,e)})}}}}),o(["src","srcset","href"],function(e){var t=ot("ng-"+e);so[t]=function(){return{priority:99,link:function(n,r,i){var o=e,a=e;"href"===e&&"[object SVGAnimatedString]"===br.call(r.prop("href"))&&(a="xlinkHref",i.$attr[a]="xlink:href",o=null),i.$observe(t,function(t){t?(i.$set(a,t),lr&&o&&r.prop(o,i[a])):"href"===e&&i.$set(a,null)})}}}});var lo={$addControl:h,$$renameControl:function(e,t){e.$name=t},$removeControl:h,$setValidity:h,$setDirty:h,$setPristine:h,$setSubmitted:h,$$setSubmitted:h};qn.$inject=["$element","$attrs","$scope","$animate","$interpolate"],qn.prototype={$rollbackViewValue:function(){o(this.$$controls,function(e){e.$rollbackViewValue()})},$commitViewValue:function(){o(this.$$controls,function(e){e.$commitViewValue()})},$addControl:function(e){le(e.$name,"input"),this.$$controls.push(e),e.$name&&(this[e.$name]=e),e.$$parentForm=this},$$renameControl:function(e,t){var n=e.$name;this[n]===e&&delete this[n],this[t]=e,e.$name=t},$removeControl:function(e){e.$name&&this[e.$name]===e&&delete this[e.$name],o(this.$pending,function(t,n){this.$setValidity(n,null,e)},this),o(this.$error,function(t,n){this.$setValidity(n,null,e)},this),o(this.$$success,function(t,n){this.$setValidity(n,null,e)},this),P(this.$$controls,e),e.$$parentForm=lo},$setDirty:function(){this.$$animate.removeClass(this.$$element,zo),this.$$animate.addClass(this.$$element,Yo),this.$dirty=!0,this.$pristine=!1,this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,zo,Yo+" ng-submitted"),this.$dirty=!1,this.$pristine=!0,this.$submitted=!1,o(this.$$controls,function(e){e.$setPristine()})},$setUntouched:function(){o(this.$$controls,function(e){e.$setUntouched()})},$setSubmitted:function(){for(var e=this;e.$$parentForm&&e.$$parentForm!==lo;)e=e.$$parentForm;e.$$setSubmitted()},$$setSubmitted:function(){this.$$animate.addClass(this.$$element,"ng-submitted"),this.$submitted=!0,o(this.$$controls,function(e){e.$$setSubmitted&&e.$$setSubmitted()})}},Bn({clazz:qn,set:function(e,t,n){var r=e[t];r?-1===r.indexOf(n)&&r.push(n):e[t]=[n]},unset:function(e,t,n){var r=e[t];r&&(P(r,n),0===r.length&&delete e[t])}});var uo=function(e){return["$timeout","$parse",function(t,n){function r(e){return""===e?n('this[""]').assign:n(e).assign||h}return{name:"form",restrict:e?"EAC":"E",require:["form","^^?form"],controller:qn,compile:function(n,i){n.addClass(zo).addClass(Vo);var o=i.name?"name":!(!e||!i.ngForm)&&"ngForm";return{pre:function(e,n,i,a){var s=a[0];if(!("action"in i)){var l=function(t){e.$apply(function(){s.$commitViewValue(),s.$setSubmitted()}),t.preventDefault()};n[0].addEventListener("submit",l),n.on("$destroy",function(){t(function(){n[0].removeEventListener("submit",l)},0,!1)})}(a[1]||s.$$parentForm).$addControl(s);var u=o?r(s.$name):h;o&&(u(e,s),i.$observe(o,function(t){s.$name!==t&&(u(e,void 0),s.$$parentForm.$$renameControl(s,t),(u=r(s.$name))(e,s))})),n.on("$destroy",function(){s.$$parentForm.$removeControl(s),u(e,void 0),c(s,lo)})}}}}}]},co=uo(),fo=uo(!0),po=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,ho=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:\/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,mo=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,go=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,vo=/^(\d{4,})-(\d{2})-(\d{2})$/,$o=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,yo=/^(\d{4,})-W(\d\d)$/,bo=/^(\d{4,})-(\d\d)$/,wo=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,xo=fe();o(["date","datetime-local","month","time","week"],function(e){xo[e]=!0});var Co={text:function(e,t,n,r,i,o){Wn(e,t,n,r,i,o),Yn(r)},date:Kn("date",vo,Gn(vo,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":Kn("datetimelocal",$o,Gn($o,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:Kn("time",wo,Gn(wo,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:Kn("week",yo,function(e,t){if(E(e))return e;if(x(e)){yo.lastIndex=0;var n=yo.exec(e);if(n){var r=+n[1],i=+n[2],o=n=0,a=0,s=0,l=Nn(r),i=7*(i-1);return t&&(n=t.getHours(),o=t.getMinutes(),a=t.getSeconds(),s=t.getMilliseconds()),new Date(r,0,l.getDate()+i,n,o,a,s)}}return NaN},"yyyy-Www"),month:Kn("month",bo,Gn(bo,["yyyy","MM"]),"yyyy-MM"),number:function(e,t,n,r,i,o){Zn(e,t,n,r,"number"),Jn(r),Wn(e,t,n,r,i,o);var a,s;if((y(n.min)||n.ngMin)&&(r.$validators.min=function(e,t){return r.$isEmpty(t)||$(a)||t>=a},n.$observe("min",function(e){a=Xn(e),r.$validate()})),(y(n.max)||n.ngMax)&&(r.$validators.max=function(e,t){return r.$isEmpty(t)||$(s)||t<=s},n.$observe("max",function(e){s=Xn(e),r.$validate()})),y(n.step)||n.ngStep){var l;r.$validators.step=function(e,t){return r.$isEmpty(t)||$(l)||er(t,a||0,l)},n.$observe("step",function(e){l=Xn(e),r.$validate()})}},url:function(e,t,n,r,i,o){Wn(e,t,n,r,i,o),Yn(r),r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||ho.test(n)}},email:function(e,t,n,r,i,o){Wn(e,t,n,r,i,o),Yn(r),r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||mo.test(n)}},radio:function(e,t,n,r){var i=!n.ngTrim||"false"!==_r(n.ngTrim);$(n.name)&&t.attr("name",++Er),t.on("change",function(e){var o;t[0].checked&&(o=n.value,i&&(o=_r(o)),r.$setViewValue(o,e&&e.type))}),r.$render=function(){var e=n.value;i&&(e=_r(e)),t[0].checked=e===r.$viewValue},n.$observe("value",r.$render)},range:function(e,t,n,r,i,o){function a(e,r){t.attr(e,n[e]),n.$observe(e,r)}function s(e){f=Xn(e),kr(r.$modelValue)||(c?(e=t.val(),f>e&&(e=f,t.val(e)),r.$setViewValue(e)):r.$validate())}function l(e){d=Xn(e),kr(r.$modelValue)||(c?(e=t.val(),d=f},a("min",s)),i&&(r.$validators.max=c?function(){return!0}:function(e,t){return r.$isEmpty(t)||$(d)||t<=d},a("max",l)),o&&(r.$validators.step=c?function(){return!h.stepMismatch}:function(e,t){return r.$isEmpty(t)||$(p)||er(t,f||0,p)},a("step",u))},checkbox:function(e,t,n,r,i,o,a,s){var l=tr(s,e,"ngTrueValue",n.ngTrueValue,!0),u=tr(s,e,"ngFalseValue",n.ngFalseValue,!1);t.on("change",function(e){r.$setViewValue(t[0].checked,e&&e.type)}),r.$render=function(){t[0].checked=r.$viewValue},r.$isEmpty=function(e){return!1===e},r.$formatters.push(function(e){return U(e,l)}),r.$parsers.push(function(e){return e?l:u})},hidden:h,button:h,submit:h,reset:h,file:h},Eo=["$browser","$sniffer","$filter","$parse",function(e,t,n,r){return{restrict:"E",require:["?ngModel"],link:{pre:function(i,o,a,s){s[0]&&(Co[mr(a.type)]||Co.text)(i,o,a,s[0],t,e,n,r)}}}}],ko=/^(true|false|\d+)$/,So=function(){function e(e,t,n){var r=y(n)?n:9===lr?"":null;e.prop("value",r),t.$set("value",n)}return{restrict:"A",priority:100,compile:function(t,n){return ko.test(n.ngValue)?function(t,n,r){t=t.$eval(r.ngValue),e(n,r,t)}:function(t,n,r){t.$watch(r.ngValue,function(t){e(n,r,t)})}}}},_o=["$compile",function(e){return{restrict:"AC",compile:function(t){return e.$$addBindingClass(t),function(t,n,r){e.$$addBindingInfo(n,r.ngBind),n=n[0],t.$watch(r.ngBind,function(e){n.textContent=de(e)})}}}}],Mo=["$interpolate","$compile",function(e,t){return{compile:function(n){return t.$$addBindingClass(n),function(n,r,i){n=e(r.attr(i.$attr.ngBindTemplate)),t.$$addBindingInfo(r,n.expressions),r=r[0],i.$observe("ngBindTemplate",function(e){r.textContent=$(e)?"":e})}}}}],To=["$sce","$parse","$compile",function(e,t,n){return{restrict:"A",compile:function(r,i){var o=t(i.ngBindHtml),a=t(i.ngBindHtml,function(t){return e.valueOf(t)});return n.$$addBindingClass(r),function(t,r,i){n.$$addBindingInfo(r,i.ngBindHtml),t.$watch(a,function(){var n=o(t);r.html(e.getTrustedHtml(n)||"")})}}}}],Do=g({restrict:"A",require:"ngModel",link:function(e,t,n,r){r.$viewChangeListeners.push(function(){e.$eval(n.ngChange)})}}),Ao=nr("",!0),Oo=nr("Odd",0),No=nr("Even",1),Ro=Hn({compile:function(e,t){t.$set("ngCloak",void 0),e.removeClass("ng-cloak")}}),Io=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Po={},Lo={blur:!0,focus:!0};o("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(e){var t=ot("ng-"+e);Po[t]=["$parse","$rootScope",function(n,r){return{restrict:"A",compile:function(i,o){var a=n(o[t]);return function(t,n){n.on(e,function(n){var i=function(){a(t,{$event:n})};Lo[e]&&r.$$phase?t.$evalAsync(i):t.$apply(i)})}}}}]});var Fo=["$animate","$compile",function(e,t){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(n,r,i,o,a){var s,l,u;n.$watch(i.ngIf,function(n){n?l||a(function(n,o){l=o,n[n.length++]=t.$$createComment("end ngIf",i.ngIf),s={clone:n},e.enter(n,r.parent(),r)}):(u&&(u.remove(),u=null),l&&(l.$destroy(),l=null),s&&(u=ce(s.clone),e.leave(u).done(function(e){!1!==e&&(u=null)}),s=null))})}}}],Uo=["$templateRequest","$anchorScroll","$animate",function(e,t,n){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Cr.noop,compile:function(r,i){var o=i.ngInclude||i.src,a=i.onload||"",s=i.autoscroll;return function(r,i,l,u,c){var f,d,p,h=0,m=function(){d&&(d.remove(),d=null),f&&(f.$destroy(),f=null),p&&(n.leave(p).done(function(e){!1!==e&&(d=null)}),d=p,p=null)};r.$watch(o,function(o){var l=function(e){!1===e||!y(s)||s&&!r.$eval(s)||t()},d=++h;o?(e(o,!0).then(function(e){if(!r.$$destroyed&&d===h){var t=r.$new();u.template=e,e=c(t,function(e){m(),n.enter(e,null,i).done(l)}),f=t,p=e,f.$emit("$includeContentLoaded",o),r.$eval(a)}},function(){r.$$destroyed||d!==h||(m(),r.$emit("$includeContentError",o))}),r.$emit("$includeContentRequested",o)):(m(),u.template=null)})}}}}],jo=["$compile",function(t){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(n,r,i,o){br.call(r[0]).match(/SVG/)?(r.empty(),t(ye(o.template,e.document).childNodes)(n,function(e){r.append(e)},{futureParentElement:r})):(r.html(o.template),t(r.contents())(n))}}}],Ho=Hn({priority:450,compile:function(){return{pre:function(e,t,n){e.$eval(n.ngInit)}}}}),qo=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(e,t,n,r){var i=n.ngList||", ",a="false"!==n.ngTrim,s=a?_r(i):i;r.$parsers.push(function(e){if(!$(e)){var t=[];return e&&o(e.split(s),function(e){e&&t.push(a?_r(e):e)}),t}}),r.$formatters.push(function(e){if(k(e))return e.join(i)}),r.$isEmpty=function(e){return!e||!e.length}}}},Vo="ng-valid",Bo="ng-invalid",zo="ng-pristine",Yo="ng-dirty",Wo=r("ngModel");rr.$inject="$scope $exceptionHandler $attrs $element $parse $animate $timeout $q $interpolate".split(" "),rr.prototype={$$initGetterSetters:function(){if(this.$options.getOption("getterSetter")){var e=this.$$parse(this.$$attr.ngModel+"()"),t=this.$$parse(this.$$attr.ngModel+"($$$p)");this.$$ngModelGet=function(t){var n=this.$$parsedNgModel(t);return _(n)&&(n=e(t)),n},this.$$ngModelSet=function(e,n){_(this.$$parsedNgModel(e))?t(e,{$$$p:n}):this.$$parsedNgModelAssign(e,n)}}else if(!this.$$parsedNgModel.assign)throw Wo("nonassign",this.$$attr.ngModel,G(this.$$element))},$render:h,$isEmpty:function(e){return $(e)||""===e||null===e||e!==e},$$updateEmptyClasses:function(e){this.$isEmpty(e)?(this.$$animate.removeClass(this.$$element,"ng-not-empty"),this.$$animate.addClass(this.$$element,"ng-empty")):(this.$$animate.removeClass(this.$$element,"ng-empty"),this.$$animate.addClass(this.$$element,"ng-not-empty"))},$setPristine:function(){this.$dirty=!1,this.$pristine=!0,this.$$animate.removeClass(this.$$element,Yo),this.$$animate.addClass(this.$$element,zo)},$setDirty:function(){this.$dirty=!0,this.$pristine=!1,this.$$animate.removeClass(this.$$element,zo),this.$$animate.addClass(this.$$element,Yo),this.$$parentForm.$setDirty()},$setUntouched:function(){this.$touched=!1,this.$untouched=!0,this.$$animate.setClass(this.$$element,"ng-untouched","ng-touched")},$setTouched:function(){this.$touched=!0,this.$untouched=!1,this.$$animate.setClass(this.$$element,"ng-touched","ng-untouched")},$rollbackViewValue:function(){this.$$timeout.cancel(this.$$pendingDebounce),this.$viewValue=this.$$lastCommittedViewValue,this.$render()},$validate:function(){if(!kr(this.$modelValue)){var e=this.$$lastCommittedViewValue,t=this.$$rawModelValue,n=this.$valid,r=this.$modelValue,i=this.$options.getOption("allowInvalid"),o=this;this.$$runValidators(t,e,function(e){i||n===e||(o.$modelValue=e?t:void 0,o.$modelValue!==r&&o.$$writeModelToScope())})}},$$runValidators:function(e,t,n){function r(e,t){a===s.$$currentValidationRunId&&s.$setValidity(e,t)}function i(e){a===s.$$currentValidationRunId&&n(e)}this.$$currentValidationRunId++;var a=this.$$currentValidationRunId,s=this;!function(){var e=s.$$parserName;return $(s.$$parserValid)?(r(e,null),!0):(s.$$parserValid||(o(s.$validators,function(e,t){r(t,null)}),o(s.$asyncValidators,function(e,t){r(t,null)})),r(e,s.$$parserValid),s.$$parserValid)}()?i(!1):function(){var n=!0;return o(s.$validators,function(i,o){var a=Boolean(i(e,t));n=n&&a,r(o,a)}),!!n||(o(s.$asyncValidators,function(e,t){r(t,null)}),!1)}()?function(){var n=[],a=!0;o(s.$asyncValidators,function(i,o){var s=i(e,t);if(!s||!_(s.then))throw Wo("nopromise",s);r(o,void 0),n.push(s.then(function(){r(o,!0)},function(){a=!1,r(o,!1)}))}),n.length?s.$$q.all(n).then(function(){i(a)},h):i(!0)}():i(!1)},$commitViewValue:function(){var e=this.$viewValue;this.$$timeout.cancel(this.$$pendingDebounce),(this.$$lastCommittedViewValue!==e||""===e&&this.$$hasNativeValidators)&&(this.$$updateEmptyClasses(e),this.$$lastCommittedViewValue=e,this.$pristine&&this.$setDirty(),this.$$parseAndValidate())},$$parseAndValidate:function(){var e=this.$$lastCommittedViewValue,t=this;if(this.$$parserValid=!$(e)||void 0,this.$setValidity(this.$$parserName,null),this.$$parserName="parse",this.$$parserValid)for(var n=0;ni||r.$isEmpty(t)||t.length<=i}}}}},xa=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){if(r){var i=0;n.$observe("minlength",function(e){i=d(e)||0,r.$validate()}),r.$validators.minlength=function(e,t){return r.$isEmpty(t)||t.length>=i}}}}};e.angular.bootstrap?e.console&&console.log("WARNING: Tried to load AngularJS more than once."):(function(){var t;if(!Ir){var n=Dr();(cr=$(n)?e.jQuery:n?e[n]:void 0)&&cr.fn.on?(ur=cr,c(cr.fn,{scope:Zr.scope,isolateScope:Zr.isolateScope,controller:Zr.controller,injector:Zr.injector,inheritedData:Zr.inheritedData})):ur=be,t=ur.cleanData,ur.cleanData=function(e){for(var n,r,i=0;null!=(r=e[i]);i++)(n=ur._data(r).events)&&n.$destroy&&ur(r).triggerHandler("$destroy");t(e)},Cr.element=ur,Ir=!0}}(),function(n){c(n,{errorHandlingConfig:t,bootstrap:ne,copy:L,extend:c,merge:f,equals:U,element:ur,forEach:o,injector:Ge,noop:h,bind:H,toJson:V,fromJson:B,identity:m,isUndefined:$,isDefined:y,isString:x,isFunction:_,isObject:b,isNumber:C,isElement:N,isArray:k,version:Lr,isDate:E,callbacks:{$$counter:0},getTestability:ie,reloadWithDebugInfo:re,$$minErr:r,$$csp:Tr,$$encodeUriSegment:X,$$encodeUriQuery:Q,$$lowercase:mr,$$stringify:de,$$uppercase:gr}),fr=pe(e),fr("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:on}),e.provider("$compile",rt).directive({a:ao,input:Eo,textarea:Eo,form:co,script:ha,select:va,option:$a,ngBind:_o,ngBindHtml:To,ngBindTemplate:Mo,ngClass:Ao,ngClassEven:No,ngClassOdd:Oo,ngCloak:Ro,ngController:Io,ngForm:fo,ngHide:sa,ngIf:Fo,ngInclude:Uo,ngInit:Ho,ngNonBindable:Xo,ngPluralize:na,ngRef:ia,ngRepeat:oa,ngShow:aa,ngStyle:la,ngSwitch:ua,ngSwitchWhen:ca,ngSwitchDefault:fa,ngOptions:ta,ngTransclude:pa,ngModel:Ko,ngList:qo,ngChange:Do,pattern:ba,ngPattern:ba,required:ya,ngRequired:ya,minlength:xa,ngMinlength:xa,maxlength:wa,ngMaxlength:wa,ngValue:So,ngModelOptions:Jo}).directive({ngInclude:jo}).directive(so).directive(Po),e.provider({$anchorScroll:Ke,$animate:di,$animateCss:mi,$$animateJs:ci,$$animateQueue:fi,$$AnimateRunner:hi,$$animateAsyncRun:pi,$browser:et,$cacheFactory:tt,$controller:ut,$document:ct,$$isDocumentHidden:ft,$exceptionHandler:dt,$filter:bn,$$forceReflow:xi,$interpolate:Et,$interval:kt,$http:bt,$httpParamSerializer:ht,$httpParamSerializerJQLike:mt,$httpBackend:xt,$xhrFactory:wt,$jsonpCallbacks:Ai,$location:Ft,$log:Ut,$parse:Xt,$rootScope:rn,$q:Qt,$$q:en,$sce:un,$sceDelegate:ln,$sniffer:cn,$templateCache:nt,$templateRequest:fn,$$testability:dn,$timeout:pn,$window:vn,$$rAF:nn,$$jqLite:Ve,$$Map:ni,$$cookieReader:yn})}]).info({angularVersion:"1.7.2"})}(Cr),Cr.module("ngLocale",[],["$provide",function(e){function t(e){e+="";var t=e.indexOf(".");return-1==t?0:e.length-t-1}e.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a",short:"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-¤",negSuf:"",posPre:"¤",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(e,n){var r=0|e,i=n;return void 0===i&&(i=Math.min(t(e),3)),Math.pow(10,i),1==r&&0==i?"one":"other"}})}]),ur(function(){te(e.document,ne)}))}(window),!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(''),define("common/angular",function(e){return function(){return e.angular}}(this)),function(e,t){"use strict";function n(e,t,n){if(!e)throw K("areq",t||"?",n||"required");return e}function r(e,t){return e||t?e?t?(P(e)&&(e=e.join(" ")),P(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function i(e){var t={};return e&&(e.to||e.from)&&(t.to=e.to,t.from=e.from),t}function o(e,t,n){var r="";return e=P(e)?e:e&&H(e)&&e.length?e.split(/\s+/):[],I(e,function(e,i){e&&0=e&&(e=i,i=0,n.push(o),o=[]),o.push(a.fn),a.children.forEach(function(e){i++,r.push(e)}),e--}return o.length&&n.push(o),n}(r)}var u=[],p=c(e);return function(a,c,h){function m(e){e=e.hasAttribute("ng-animate-ref")?[e]:e.querySelectorAll("[ng-animate-ref]");var t=[];return I(e,function(e){var n=e.getAttribute("ng-animate-ref");n&&n.length&&t.push(e)}),t}function g(e){var t=[],n={};I(e,function(e,r){var i=v(e.element),o=0<=["enter","move"].indexOf(e.event),i=e.structural?m(i):[];if(i.length){var a=o?"to":"from";I(i,function(e){var t=e.getAttribute("ng-animate-ref");n[t]=n[t]||{},n[t][a]={animationID:r,element:V(e)}})}else t.push(e)});var r={},i={};return I(n,function(n,o){var a=n.from,s=n.to;if(a&&s){var l=e[a.animationID],u=e[s.animationID],c=a.animationID.toString();if(!i[c]){var f=i[c]={structural:!0,beforeStart:function(){l.beforeStart(),u.beforeStart()},close:function(){l.close(),u.close()},classes:$(l.classes,u.classes),from:l,to:u,anchors:[]};f.classes.length?t.push(f):(t.push(l),t.push(u))}i[c].anchors.push({out:a.element,in:s.element})}else a=a?a.animationID:s.animationID,s=a.toString(),r[s]||(r[s]=!0,t.push(e[a]))}),t}function $(e,t){e=e.split(" "),t=t.split(" ");for(var n=[],r=0;r=ee&&t>=te&&(K=!0,m()))}function U(){function t(){if(!V){if(C(!1),I(ie,function(e){q.style[e[0]]=e[1]}),R(e,j),r.addClass(e,pe),ye.recalculateTimingStyles){if(de=q.getAttribute("class")+" "+fe,he=$(q,de),ve=_(q,de,he),$e=ve.maxDelay,Q=Math.max($e,0),0===(te=ve.maxDuration))return void m();ye.hasTransitions=0l.expectedEndTime)?s.cancel(l.timer):i.push(m)}a&&(o=s(n,o,!1),i[0]={timer:o,expectedEndTime:t},i.push(m),e.data("$$animateCss",i)),se.length&&e.on(se.join(" "),F),j.to&&(j.cleanupStyles&&M(H,q,Object.keys(j.to)),h(e,j))}}function n(){var t=e.data("$$animateCss");if(t){for(var n=1;n1){g[r].element.data(v,n.direction);var u=m.getCurrentIndex();angular.isNumber(u)&&g[u].element&&g[u].element.data(v,n.direction),e.$currentTransition=!0,i.on("addClass",g[r].element,function(t,n){if("close"===n&&(e.$currentTransition=null,i.off("addClass",t),y.length)){var r=y.pop().slide,a=r.index,l=a>m.getCurrentIndex()?"next":"prev";o(),s(r,a,l)}})}e.active=n.index,$=n.index,a(r),f()}}function l(e){for(var t=0;t0&&(p=n(d,t))}function d(){var t=+e.interval;h&&!isNaN(t)&&t>0&&g.length?e.next():e.pause()}var p,h,m=this,g=m.slides=e.slides=[],v="uib-slideDirection",$=e.active,y=[],b=!1;m.addSlide=function(t,n){g.push({slide:t,element:n}),g.sort(function(e,t){return+e.slide.index-+t.slide.index}),(t.index===e.active||1===g.length&&!angular.isNumber(e.active))&&(e.$currentTransition&&(e.$currentTransition=null),$=t.index,e.active=t.index,a($),m.select(g[l(t)]),1===g.length&&e.play())},m.getCurrentIndex=function(){for(var e=0;e0&&$===n?n>=g.length?($=g.length-1,e.active=$,a($),m.select(g[g.length-1])):($=n,e.active=$,a($),m.select(g[n])):$>n&&($--,e.active=$),0===g.length&&($=null,e.active=null,o())},m.select=e.select=function(t,n){var r=l(t.slide);void 0===n&&(n=r>m.getCurrentIndex()?"next":"prev"),t.slide.index===$||e.$currentTransition?t&&t.slide.index!==$&&e.$currentTransition&&y.push(g[r]):s(t.slide,r,n)},e.indexOfSlide=function(e){return+e.slide.index},e.isActive=function(t){return e.active===t.slide.index},e.isPrevDisabled=function(){return 0===e.active&&e.noWrap()},e.isNextDisabled=function(){return e.active===g.length-1&&e.noWrap()},e.pause=function(){e.noPause||(h=!1,u())},e.play=function(){h||(h=!0,f())},e.$on("$destroy",function(){b=!0,u()}),e.$watch("noTransition",function(e){i.enabled(t,!e)}),e.$watch("interval",f),e.$watchCollection("slides",c),e.$watch("active",function(e){if(angular.isNumber(e)&&$!==e){for(var t=0;t-1){var a=!1;e=e.split("");for(var s=o;s-1){e=e.split(""),i[o]="("+r.regex+")",e[o]="$";for(var a=o+1,s=o+r.key.length;a28?29===n&&(e%4==0&&e%100!=0||e%400==0):3!==t&&5!==t&&8!==t&&10!==t||n<31)}function a(e){return parseInt(e,10)}function s(e,t){return e&&t?f(e,t):e}function l(e,t){return e&&t?f(e,t,!0):e}function u(e,t){e=e.replace(/:/g,"");var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return isNaN(n)?t:n}function c(e,t){return e=new Date(e.getTime()),e.setMinutes(e.getMinutes()+t),e}function f(e,t,n){n=n?-1:1;var r=e.getTimezoneOffset();return c(e,n*(u(t,r)-r))}var d,p,h=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;this.init=function(){d=t.id,this.parsers={},this.formatters={},p=[{key:"yyyy",regex:"\\d{4}",apply:function(e){this.year=+e},formatter:function(e){var t=new Date;return t.setFullYear(Math.abs(e.getFullYear())),n(t,"yyyy")}},{key:"yy",regex:"\\d{2}",apply:function(e){e=+e,this.year=e<69?e+2e3:e+1900},formatter:function(e){var t=new Date;return t.setFullYear(Math.abs(e.getFullYear())),n(t,"yy")}},{key:"y",regex:"\\d{1,4}",apply:function(e){this.year=+e},formatter:function(e){var t=new Date;return t.setFullYear(Math.abs(e.getFullYear())),n(t,"y")}},{key:"M!",regex:"0?[1-9]|1[0-2]",apply:function(e){this.month=e-1},formatter:function(e){return/^[0-9]$/.test(e.getMonth())?n(e,"MM"):n(e,"M")}},{key:"MMMM",regex:t.DATETIME_FORMATS.MONTH.join("|"),apply:function(e){this.month=t.DATETIME_FORMATS.MONTH.indexOf(e)},formatter:function(e){return n(e,"MMMM")}},{key:"MMM",regex:t.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(e){this.month=t.DATETIME_FORMATS.SHORTMONTH.indexOf(e)},formatter:function(e){return n(e,"MMM")}},{key:"MM",regex:"0[1-9]|1[0-2]",apply:function(e){this.month=e-1},formatter:function(e){return n(e,"MM")}},{key:"M",regex:"[1-9]|1[0-2]",apply:function(e){this.month=e-1},formatter:function(e){return n(e,"M")}},{key:"d!",regex:"[0-2]?[0-9]{1}|3[0-1]{1}",apply:function(e){this.date=+e},formatter:function(e){return/^[1-9]$/.test(e.getDate())?n(e,"dd"):n(e,"d")}},{key:"dd",regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(e){this.date=+e},formatter:function(e){return n(e,"dd")}},{key:"d",regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(e){this.date=+e},formatter:function(e){return n(e,"d")}},{key:"EEEE",regex:t.DATETIME_FORMATS.DAY.join("|"),formatter:function(e){return n(e,"EEEE")}},{key:"EEE",regex:t.DATETIME_FORMATS.SHORTDAY.join("|"),formatter:function(e){return n(e,"EEE")}},{key:"HH",regex:"(?:0|1)[0-9]|2[0-3]",apply:function(e){this.hours=+e},formatter:function(e){return n(e,"HH")}},{key:"hh",regex:"0[0-9]|1[0-2]",apply:function(e){this.hours=+e},formatter:function(e){return n(e,"hh")}},{key:"H",regex:"1?[0-9]|2[0-3]",apply:function(e){this.hours=+e},formatter:function(e){return n(e,"H")}},{key:"h",regex:"[0-9]|1[0-2]",apply:function(e){this.hours=+e},formatter:function(e){return n(e,"h")}},{key:"mm",regex:"[0-5][0-9]",apply:function(e){this.minutes=+e},formatter:function(e){return n(e,"mm")}},{key:"m",regex:"[0-9]|[1-5][0-9]",apply:function(e){this.minutes=+e},formatter:function(e){return n(e,"m")}},{key:"sss",regex:"[0-9][0-9][0-9]",apply:function(e){this.milliseconds=+e},formatter:function(e){return n(e,"sss")}},{key:"ss",regex:"[0-5][0-9]",apply:function(e){this.seconds=+e},formatter:function(e){return n(e,"ss")}},{key:"s",regex:"[0-9]|[1-5][0-9]",apply:function(e){this.seconds=+e},formatter:function(e){return n(e,"s")}},{key:"a",regex:t.DATETIME_FORMATS.AMPMS.join("|"),apply:function(e){12===this.hours&&(this.hours=0),"PM"===e&&(this.hours+=12)},formatter:function(e){return n(e,"a")}},{key:"Z",regex:"[+-]\\d{4}",apply:function(e){var t=e.match(/([+-])(\d{2})(\d{2})/),n=t[1],r=t[2],i=t[3];this.hours+=a(n+r),this.minutes+=a(n+i)},formatter:function(e){return n(e,"Z")}},{key:"ww",regex:"[0-4][0-9]|5[0-3]",formatter:function(e){return n(e,"ww")}},{key:"w",regex:"[0-9]|[1-4][0-9]|5[0-3]",formatter:function(e){return n(e,"w")}},{key:"GGGG",regex:t.DATETIME_FORMATS.ERANAMES.join("|").replace(/\s/g,"\\s"),formatter:function(e){return n(e,"GGGG")}},{key:"GGG",regex:t.DATETIME_FORMATS.ERAS.join("|"),formatter:function(e){return n(e,"GGG")}},{key:"GG",regex:t.DATETIME_FORMATS.ERAS.join("|"),formatter:function(e){return n(e,"GG")}},{key:"G",regex:t.DATETIME_FORMATS.ERAS.join("|"),formatter:function(e){return n(e,"G")}}]},this.init(),this.filter=function(e,n){if(!angular.isDate(e)||isNaN(e)||!n)return"";n=t.DATETIME_FORMATS[n]||n,t.id!==d&&this.init(),this.formatters[n]||(this.formatters[n]=i(n,"formatter"));var r=this.formatters[n],o=r.map,a=n;return o.reduce(function(t,n,r){var i=a.match(new RegExp("(.*)"+n.key));i&&angular.isString(i[1])&&(t+=i[1],a=a.replace(i[1]+n.key,""));var s=r===o.length-1?a:"";return n.apply?t+n.apply.call(null,e)+s:t+s},"")},this.parse=function(n,r,a){if(!angular.isString(n)||!r)return n;r=t.DATETIME_FORMATS[r]||r,r=r.replace(h,"\\$&"),t.id!==d&&this.init(),this.parsers[r]||(this.parsers[r]=i(r,"apply"));var s=this.parsers[r],l=s.regex,u=s.map,c=n.match(l),f=!1;if(c&&c.length){var p,m;angular.isDate(a)&&!isNaN(a.getTime())?p={year:a.getFullYear(),month:a.getMonth(),date:a.getDate(),hours:a.getHours(),minutes:a.getMinutes(),seconds:a.getSeconds(),milliseconds:a.getMilliseconds()}:(a&&e.warn("dateparser:","baseDate is not a valid date"),p={year:1900,month:0,date:1,hours:0,minutes:0,seconds:0,milliseconds:0});for(var g=1,v=c.length;gd.modes.indexOf(d[t]))&&(e.datepickerMode=d[t],e.datepickerOptions.datepickerMode=d[t])}):d[t]=e[t]=s[t]||null}}),e.uniqueId="datepicker-"+e.$id+"-"+Math.floor(1e4*Math.random()),e.disabled=angular.isDefined(t.disabled)||!1,angular.isDefined(t.ngDisabled)&&m.push(e.$parent.$watch(t.ngDisabled,function(t){e.disabled=t,d.refreshView()})),e.isActive=function(t){return 0===d.compare(t.date,d.activeDate)&&(e.activeDateId=t.uid,!0)},this.init=function(t){p=t,h=t.$options||s.ngModelOptions,e.datepickerOptions.initDate?(d.activeDate=c.fromTimezone(e.datepickerOptions.initDate,h.timezone)||new Date,e.$watch("datepickerOptions.initDate",function(e){e&&(p.$isEmpty(p.$modelValue)||p.$invalid)&&(d.activeDate=c.fromTimezone(e,h.timezone),d.refreshView())})):d.activeDate=new Date;var n=p.$modelValue?new Date(p.$modelValue):new Date;this.activeDate=isNaN(n)?c.fromTimezone(new Date,h.timezone):c.fromTimezone(n,h.timezone),p.$render=function(){d.render()}},this.render=function(){if(p.$viewValue){var e=new Date(p.$viewValue);!isNaN(e)?this.activeDate=c.fromTimezone(e,h.timezone):u||o.error('Datepicker directive: "ng-model" value must be a Date object')}this.refreshView()},this.refreshView=function(){if(this.element){e.selectedDt=null,this._refreshView(),e.activeDt&&(e.activeDateId=e.activeDt.uid);var t=p.$viewValue?new Date(p.$viewValue):null;t=c.fromTimezone(t,h.timezone),p.$setValidity("dateDisabled",!t||this.element&&!this.isDisabled(t))}},this.createDateObject=function(t,n){var r=p.$viewValue?new Date(p.$viewValue):null;r=c.fromTimezone(r,h.timezone);var i=new Date;i=c.fromTimezone(i,h.timezone);var o=this.compare(t,i),a={date:t,label:c.filter(t,n),selected:r&&0===this.compare(t,r),disabled:this.isDisabled(t),past:o<0,current:0===o,future:o>0,customClass:this.customClass(t)||null};return r&&0===this.compare(t,r)&&(e.selectedDt=a),d.activeDate&&0===this.compare(a.date,d.activeDate)&&(e.activeDt=a),a},this.isDisabled=function(t){return e.disabled||this.minDate&&this.compare(t,this.minDate)<0||this.maxDate&&this.compare(t,this.maxDate)>0||e.dateDisabled&&e.dateDisabled({date:t,mode:e.datepickerMode})},this.customClass=function(t){return e.customClass({date:t,mode:e.datepickerMode})},this.split=function(e,t){for(var n=[];e.length>0;)n.push(e.splice(0,t));return n},e.select=function(t){if(e.datepickerMode===d.minMode){var n=p.$viewValue?c.fromTimezone(new Date(p.$viewValue),h.timezone):new Date(0,0,0,0,0,0,0);n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n=c.toTimezone(n,h.timezone),p.$setViewValue(n),p.$render()}else d.activeDate=t,f(d.modes[d.modes.indexOf(e.datepickerMode)-1]),e.$emit("uib:datepicker.mode");e.$broadcast("uib:datepicker.focus")},e.move=function(e){var t=d.activeDate.getFullYear()+e*(d.step.years||0),n=d.activeDate.getMonth()+e*(d.step.months||0);d.activeDate.setFullYear(t,n,1),d.refreshView()},e.toggleMode=function(t){t=t||1,e.datepickerMode===d.maxMode&&1===t||e.datepickerMode===d.minMode&&-1===t||(f(d.modes[d.modes.indexOf(e.datepickerMode)+t]),e.$emit("uib:datepicker.mode"))},e.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var g=function(){d.element[0].focus()};e.$on("uib:datepicker.focus",g),e.keydown=function(t){var n=e.keys[t.which];if(n&&!t.shiftKey&&!t.altKey&&!e.disabled)if(t.preventDefault(),d.shortcutPropagation||t.stopPropagation(),"enter"===n||"space"===n){if(d.isDisabled(d.activeDate))return;e.select(d.activeDate)}else!t.ctrlKey||"up"!==n&&"down"!==n?(d.handleKeyDown(n,t),d.refreshView()):e.toggleMode("up"===n?1:-1)},e.$on("$destroy",function(){for(;m.length;)m.shift()()})}]).controller("UibDaypickerController",["$scope","$element","dateFilter",function(e,t,n){function r(e,t){return 1!==t||e%4!=0||e%100==0&&e%400!=0?o[t]:29}function i(e){var t=new Date(e);t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t)/864e5)/7)+1}var o=[31,28,31,30,31,30,31,31,30,31,30,31];this.step={months:1},this.element=t,this.init=function(t){angular.extend(t,this),e.showWeeks=t.showWeeks,t.refreshView()},this.getDates=function(e,t){for(var n,r=new Array(t),i=new Date(e),o=0;o0?7-a:-a,l=new Date(o);s>0&&l.setDate(1-s);for(var u=this.getDates(l,42),c=0;c<42;c++)u[c]=angular.extend(this.createDateObject(u[c],this.formatDay),{secondary:u[c].getMonth()!==r,uid:e.uniqueId+"-"+c});e.labels=new Array(7);for(var f=0;f<7;f++)e.labels[f]={abbr:n(u[f].date,this.formatDayHeader),full:n(u[f].date,"EEEE")};if(e.title=n(this.activeDate,this.formatDayTitle),e.rows=this.split(u,7),e.showWeeks){e.weekNumbers=[];for(var d=(11-this.startingDay)%7,p=e.rows.length,h=0;h
    ');e.find("body").append(a),n=a[0].offsetWidth-a[0].clientWidth,n=isFinite(n)?n:0,a.remove()}return n},scrollbarPadding:function(e){e=this.getRawNode(e);var n=t.getComputedStyle(e),r=this.parseStyle(n.paddingRight),i=this.parseStyle(n.paddingBottom),o=this.scrollParent(e,!1,!0),s=this.scrollbarWidth(o,a.test(o.tagName));return{scrollbarWidth:s,widthOverflow:o.scrollWidth>o.clientWidth,right:r+s,originalRight:r,heightOverflow:o.scrollHeight>o.clientHeight,bottom:i+s,originalBottom:i}},isScrollable:function(e,n){e=this.getRawNode(e);var r=n?i.hidden:i.normal,o=t.getComputedStyle(e);return r.test(o.overflow+o.overflowY+o.overflowX)},scrollParent:function(n,r,o){n=this.getRawNode(n);var a=r?i.hidden:i.normal,s=e[0].documentElement,l=t.getComputedStyle(n);if(o&&a.test(l.overflow+l.overflowY+l.overflowX))return n;var u="absolute"===l.position,c=n.parentElement||s;if(c===s||"fixed"===l.position)return s;for(;c.parentElement&&c!==s;){var f=t.getComputedStyle(c);if(u&&"static"!==f.position&&(u=!1),!u&&a.test(f.overflow+f.overflowY+f.overflowX))break;c=c.parentElement}return c},position:function(n,r){n=this.getRawNode(n);var i=this.offset(n);if(r){var o=t.getComputedStyle(n);i.top-=this.parseStyle(o.marginTop),i.left-=this.parseStyle(o.marginLeft)}var a=this.offsetParent(n),s={top:0,left:0};return a!==e[0].documentElement&&(s=this.offset(a),s.top+=a.clientTop-a.scrollTop,s.left+=a.clientLeft-a.scrollLeft),{width:Math.round(angular.isNumber(i.width)?i.width:n.offsetWidth),height:Math.round(angular.isNumber(i.height)?i.height:n.offsetHeight),top:Math.round(i.top-s.top),left:Math.round(i.left-s.left)}},offset:function(n){n=this.getRawNode(n);var r=n.getBoundingClientRect();return{width:Math.round(angular.isNumber(r.width)?r.width:n.offsetWidth),height:Math.round(angular.isNumber(r.height)?r.height:n.offsetHeight),top:Math.round(r.top+(t.pageYOffset||e[0].documentElement.scrollTop)),left:Math.round(r.left+(t.pageXOffset||e[0].documentElement.scrollLeft))}},viewportOffset:function(n,r,i){n=this.getRawNode(n),i=!1!==i;var o=n.getBoundingClientRect(),a={top:0,left:0,bottom:0,right:0},s=r?e[0].documentElement:this.scrollParent(n),l=s.getBoundingClientRect();if(a.top=l.top+s.clientTop,a.left=l.left+s.clientLeft,s===e[0].documentElement&&(a.top+=t.pageYOffset,a.left+=t.pageXOffset),a.bottom=a.top+s.clientHeight,a.right=a.left+s.clientWidth,i){var u=t.getComputedStyle(s);a.top+=this.parseStyle(u.paddingTop),a.bottom-=this.parseStyle(u.paddingBottom),a.left+=this.parseStyle(u.paddingLeft),a.right-=this.parseStyle(u.paddingRight)}return{top:Math.round(o.top-a.top),bottom:Math.round(a.bottom-o.bottom),left:Math.round(o.left-a.left),right:Math.round(a.right-o.right)}},parsePlacement:function(e){var t=o.auto.test(e);return t&&(e=e.replace(o.auto,"")),e=e.split("-"),e[0]=e[0]||"top",o.primary.test(e[0])||(e[0]="top"),e[1]=e[1]||"center",o.secondary.test(e[1])||(e[1]="center"),e[2]=!!t,e},positionElements:function(e,n,r,i){e=this.getRawNode(e),n=this.getRawNode(n);var a=angular.isDefined(n.offsetWidth)?n.offsetWidth:n.prop("offsetWidth"),s=angular.isDefined(n.offsetHeight)?n.offsetHeight:n.prop("offsetHeight");r=this.parsePlacement(r);var l=i?this.offset(e):this.position(e),u={top:0,left:0,placement:""};if(r[2]){var c=this.viewportOffset(e,i),f=t.getComputedStyle(n),d={width:a+Math.round(Math.abs(this.parseStyle(f.marginLeft)+this.parseStyle(f.marginRight))),height:s+Math.round(Math.abs(this.parseStyle(f.marginTop)+this.parseStyle(f.marginBottom)))};if(r[0]="top"===r[0]&&d.height>c.top&&d.height<=c.bottom?"bottom":"bottom"===r[0]&&d.height>c.bottom&&d.height<=c.top?"top":"left"===r[0]&&d.width>c.left&&d.width<=c.right?"right":"right"===r[0]&&d.width>c.right&&d.width<=c.left?"left":r[0],r[1]="top"===r[1]&&d.height-l.height>c.bottom&&d.height-l.height<=c.top?"bottom":"bottom"===r[1]&&d.height-l.height>c.top&&d.height-l.height<=c.bottom?"top":"left"===r[1]&&d.width-l.width>c.right&&d.width-l.width<=c.left?"right":"right"===r[1]&&d.width-l.width>c.left&&d.width-l.width<=c.right?"left":r[1],"center"===r[1])if(o.vertical.test(r[0])){var p=l.width/2-a/2;c.left+p<0&&d.width-l.width<=c.right?r[1]="left":c.right+p<0&&d.width-l.width<=c.left&&(r[1]="right")}else{var h=l.height/2-d.height/2;c.top+h<0&&d.height-l.height<=c.bottom?r[1]="top":c.bottom+h<0&&d.height-l.height<=c.top&&(r[1]="bottom")}}switch(r[0]){case"top":u.top=l.top-s;break;case"bottom":u.top=l.top+l.height;break;case"left":u.left=l.left-a;break;case"right":u.left=l.left+l.width}switch(r[1]){case"top":u.top=l.top;break;case"bottom":u.top=l.top+l.height-s;break;case"left":u.left=l.left;break;case"right":u.left=l.left+l.width-a;break;case"center":o.vertical.test(r[0])?u.left=l.left+l.width/2-a/2:u.top=l.top+l.height/2-s/2}return u.top=Math.round(u.top),u.left=Math.round(u.left),u.placement="center"===r[1]?r[0]:r[0]+"-"+r[1],u},positionArrow:function(e,n){e=this.getRawNode(e);var r=e.querySelector(".tooltip-inner, .popover-inner");if(r){var i=angular.element(r).hasClass("tooltip-inner"),a=i?e.querySelector(".tooltip-arrow"):e.querySelector(".arrow");if(a){var s={top:"",bottom:"",left:"",right:""};if(n=this.parsePlacement(n),"center"===n[1])return void angular.element(a).css(s);var l="border-"+n[0]+"-width",u=t.getComputedStyle(a)[l],c="border-";o.vertical.test(n[0])?c+=n[0]+"-"+n[1]:c+=n[1]+"-"+n[0],c+="-radius";var f=t.getComputedStyle(i?r:e)[c];switch(n[0]){case"top":s.bottom=i?"0":"-"+u;break;case"bottom":s.top=i?"0":"-"+u;break;case"left":s.right=i?"0":"-"+u;break;case"right":s.left=i?"0":"-"+u}s[n[1]]=f,angular.element(a).css(s)}}}}}]),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(e,t,n,r,i,o,a,s,l,u,c,f,d,p,h,m){function g(t){var n=f.parse(t,x,e.date);if(isNaN(n))for(var r=0;r
    "),O?(I=O.timezone,e.ngModelOptions=angular.copy(O),e.ngModelOptions.timezone=null,!0===e.ngModelOptions.updateOnDefault&&(e.ngModelOptions.updateOn=e.ngModelOptions.updateOn?e.ngModelOptions.updateOn+" default":"default"),M.attr("ng-model-options","ngModelOptions")):I=null,M.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":S}),T=angular.element(M.children()[0]),T.attr("template-url",_),e.datepickerOptions||(e.datepickerOptions={}),P&&"month"===n.type&&(e.datepickerOptions.datepickerMode="month",e.datepickerOptions.minMode="month"),T.attr("datepicker-options","datepickerOptions"),P?A.$formatters.push(function(t){return e.date=f.fromTimezone(t,I),t}):(A.$$parserName="date",A.$validators.date=$,A.$parsers.unshift(v),A.$formatters.push(function(t){return A.$isEmpty(t)?(e.date=t,t):(angular.isNumber(t)&&(t=new Date(t)),e.date=f.fromTimezone(t,I),f.filter(e.date,x))})),A.$viewChangeListeners.push(function(){e.date=g(A.$viewValue)}),t.on("keydown",b),N=r(M)(e),M.remove(),E?s.find("body").append(N):t.after(N),e.$on("$destroy",function(){for(!0===e.isOpen&&(l.$$phase||e.$apply(function(){e.isOpen=!1})),N.remove(),t.off("keydown",b),s.off("click",y),D&&D.off("scroll",w),angular.element(a).off("resize",w);L.length;)L.shift()()})},e.getText=function(t){return e[t+"Text"]||d[t+"Text"]},e.isDisabled=function(t){"today"===t&&(t=f.fromTimezone(new Date,I));var n={};return angular.forEach(["minDate","maxDate"],function(t){e.datepickerOptions[t]?angular.isDate(e.datepickerOptions[t])?n[t]=f.fromTimezone(new Date(e.datepickerOptions[t]),I):(m&&i.warn("Literal date support has been deprecated, please switch to date object usage"),n[t]=new Date(c(e.datepickerOptions[t],"medium"))):n[t]=null}),e.datepickerOptions&&n.minDate&&e.compare(t,n.minDate)<0||n.maxDate&&e.compare(t,n.maxDate)>0},e.compare=function(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate())-new Date(t.getFullYear(),t.getMonth(),t.getDate())},e.dateSelection=function(n){angular.isDefined(n)&&(e.date=n);var r=e.date?f.filter(e.date,x):null;t.val(r),A.$setViewValue(r),C&&(e.isOpen=!1,t[0].focus())},e.keydown=function(n){27===n.which&&(n.stopPropagation(),e.isOpen=!1,t[0].focus())},e.select=function(t,n){if(n.stopPropagation(),"today"===t){var r=new Date;angular.isDate(e.date)?(t=new Date(e.date),t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate())):t=new Date(r.setHours(0,0,0,0))}e.dateSelection(t)},e.close=function(n){n.stopPropagation(),e.isOpen=!1,t[0].focus()},e.disabled=angular.isDefined(n.disabled)||!1,n.ngDisabled&&L.push(e.$parent.$watch(o(n.ngDisabled),function(t){e.disabled=t})),e.$watch("isOpen",function(r){r?e.disabled?e.isOpen=!1:p(function(){w(),k&&e.$broadcast("uib:datepicker.focus"),s.on("click",y);var r=n.popupPlacement?n.popupPlacement:d.placement;E||u.parsePlacement(r)[2]?(D=D||angular.element(u.scrollParent(t)))&&D.on("scroll",w):D=null,angular.element(a).on("resize",w)},0,!1):(s.off("click",y),D&&D.off("scroll",w),angular.element(a).off("resize",w))}),e.$on("uib:datepicker.mode",function(){p(w,0,!1)})}]).directive("uibDatepickerPopup",function(){return{require:["ngModel","uibDatepickerPopup"],controller:"UibDatepickerPopupController",scope:{datepickerOptions:"=?",isOpen:"=?",currentText:"@",clearText:"@",closeText:"@"},link:function(e,t,n,r){var i=r[0];r[1].init(i)}}}).directive("uibDatepickerPopupWrap",function(){return{replace:!0,transclude:!0,templateUrl:function(e,t){return t.templateUrl||"uib/template/datepickerPopup/popup.html"}}}),angular.module("ui.bootstrap.debounce",[]).factory("$$debounce",["$timeout",function(e){return function(t,n){var r;return function(){var i=this,o=Array.prototype.slice.call(arguments);r&&e.cancel(r),r=e(function(){t.apply(i,o)},n)}}}]),angular.module("ui.bootstrap.dropdown",["ui.bootstrap.position"]).constant("uibDropdownConfig",{appendToOpenClass:"uib-dropdown-open",openClass:"open"}).service("uibDropdownService",["$document","$rootScope",function(e,t){var n=null;this.open=function(t,o){n||(e.on("click",r),o.on("keydown",i)),n&&n!==t&&(n.isOpen=!1),n=t},this.close=function(t,o){n===t&&(n=null,e.off("click",r),o.off("keydown",i))};var r=function(e){if(n&&!(e&&"disabled"===n.getAutoClose()||e&&3===e.which)){var r=n.getToggleElement();if(!(e&&r&&r[0].contains(e.target))){var i=n.getDropdownElement();e&&"outsideClick"===n.getAutoClose()&&i&&i[0].contains(e.target)||(n.isOpen=!1,t.$$phase||n.$apply())}}},i=function(e){27===e.which?(e.stopPropagation(),n.focusToggleElement(),r()):n.isKeynavEnabled()&&-1!==[38,40].indexOf(e.which)&&n.isOpen&&(e.preventDefault(),e.stopPropagation(),n.focusDropdownEntry(e.which))}}]).controller("UibDropdownController",["$scope","$element","$attrs","$parse","uibDropdownConfig","uibDropdownService","$animate","$uibPosition","$document","$compile","$templateRequest",function(e,t,n,r,i,o,a,s,l,u,c){var f,d,p=this,h=e.$new(),m=i.appendToOpenClass,g=i.openClass,v=angular.noop,$=n.onToggle?r(n.onToggle):angular.noop,y=!1,b=null,w=!1,x=l.find("body");t.addClass("dropdown"),this.init=function(){if(n.isOpen&&(d=r(n.isOpen),v=d.assign,e.$watch(d,function(e){h.isOpen=!!e})),angular.isDefined(n.dropdownAppendTo)){var i=r(n.dropdownAppendTo)(h);i&&(b=angular.element(i))}y=angular.isDefined(n.dropdownAppendToBody),w=angular.isDefined(n.keyboardNav),y&&!b&&(b=x),b&&p.dropdownMenu&&(b.append(p.dropdownMenu),t.on("$destroy",function(){p.dropdownMenu.remove()}))},this.toggle=function(e){return h.isOpen=arguments.length?!!e:!h.isOpen,angular.isFunction(v)&&v(h,h.isOpen),h.isOpen},this.isOpen=function(){return h.isOpen},h.getToggleElement=function(){return p.toggleElement},h.getAutoClose=function(){return n.autoClose||"always"},h.getElement=function(){return t},h.isKeynavEnabled=function(){return w},h.focusDropdownEntry=function(e){var n=p.dropdownMenu?angular.element(p.dropdownMenu).find("a"):t.find("ul").eq(0).find("a");switch(e){case 40:angular.isNumber(p.selectedOption)?p.selectedOption=p.selectedOption===n.length-1?p.selectedOption:p.selectedOption+1:p.selectedOption=0;break;case 38:angular.isNumber(p.selectedOption)?p.selectedOption=0===p.selectedOption?0:p.selectedOption-1:p.selectedOption=n.length-1}n[p.selectedOption].focus()},h.getDropdownElement=function(){return p.dropdownMenu},h.focusToggleElement=function(){p.toggleElement&&p.toggleElement[0].focus()},h.$watch("isOpen",function(n,r){if(b&&p.dropdownMenu){var i,l,d,w=s.positionElements(t,p.dropdownMenu,"bottom-left",!0);if(i={top:w.top+"px",display:n?"block":"none"},l=p.dropdownMenu.hasClass("dropdown-menu-right"),l?(i.left="auto",d=s.scrollbarWidth(!0),i.right=window.innerWidth-d-(w.left+t.prop("offsetWidth"))+"px"):(i.left=w.left+"px",i.right="auto"),!y){var x=s.offset(b);i.top=w.top-x.top+"px",l?i.right=window.innerWidth-(w.left-x.left+t.prop("offsetWidth"))+"px":i.left=w.left-x.left+"px"}p.dropdownMenu.css(i)}var C=b||t;if(C.hasClass(b?m:g)===!n&&a[n?"addClass":"removeClass"](C,b?m:g).then(function(){angular.isDefined(n)&&n!==r&&$(e,{open:!!n})}),n)p.dropdownMenuTemplateUrl&&c(p.dropdownMenuTemplateUrl).then(function(e){f=h.$new(),u(e.trim())(f,function(e){var t=e;p.dropdownMenu.replaceWith(t),p.dropdownMenu=t})}),h.focusToggleElement(),o.open(h,t);else{if(p.dropdownMenuTemplateUrl){f&&f.$destroy();var E=angular.element('');p.dropdownMenu.replaceWith(E),p.dropdownMenu=E}o.close(h,t),p.selectedOption=null}angular.isFunction(v)&&v(e,n)})}]).directive("uibDropdown",function(){return{controller:"UibDropdownController",link:function(e,t,n,r){r.init()}}}).directive("uibDropdownMenu",function(){return{restrict:"A",require:"?^uibDropdown",link:function(e,t,n,r){if(r&&!angular.isDefined(n.dropdownNested)){t.addClass("dropdown-menu");var i=n.templateUrl;i&&(r.dropdownMenuTemplateUrl=i),r.dropdownMenu||(r.dropdownMenu=t)}}}}).directive("uibDropdownToggle",function(){return{require:"?^uibDropdown",link:function(e,t,n,r){if(r){t.addClass("dropdown-toggle"),r.toggleElement=t;var i=function(i){i.preventDefault(),t.hasClass("disabled")||n.disabled||e.$apply(function(){r.toggle()})};t.bind("click",i),t.attr({"aria-haspopup":!0,"aria-expanded":!1}),e.$watch(r.isOpen,function(e){t.attr("aria-expanded",!!e)}),e.$on("$destroy",function(){t.unbind("click",i)})}}}}),angular.module("ui.bootstrap.stackedMap",[]).factory("$$stackedMap",function(){return{createNew:function(){var e=[];return{add:function(t,n){e.push({key:t,value:n})},get:function(t){for(var n=0;n-1&&e0&&(t=w.top().value,t.modalDomEl.toggleClass(t.windowTopClass||"",e))}function p(){if(v&&-1===c()){var e=$;h(v,$,function(){e=null}),v=void 0,$=void 0}}function h(t,n,r,i){function a(){a.done||(a.done=!0,e.leave(t).then(function(){t.remove(),i&&i.resolve()}),n.$destroy(),r&&r())}var s,l=null,u=function(){return s||(s=o.defer(),l=s.promise),function(){s.resolve()}};return n.$broadcast(C.NOW_CLOSING_EVENT,u),o.when(l).then(a)}function m(e){if(e.isDefaultPrevented())return e;var t=w.top();if(t)switch(e.which){case 27:t.value.keyboard&&(e.preventDefault(),i.$apply(function(){C.dismiss(t.key,"escape key press")}));break;case 9:var n=C.loadFocusElementList(t),r=!1;e.shiftKey?(C.isFocusInFirstItem(e,n)||C.isModalFocused(e,t))&&(r=C.focusLastFocusableElement(n)):C.isFocusInLastItem(e,n)&&(r=C.focusFirstFocusableElement(n)),r&&(e.preventDefault(),e.stopPropagation())}}function g(e,t,n){return!e.value.modalScope.$broadcast("modal.closing",t,n).defaultPrevented}var v,$,y,b="modal-open",w=s.createNew(),x=a.createNew(),C={NOW_CLOSING_EVENT:"modal.stack.now-closing"},E=0,k=null;return i.$watch(c,function(e){$&&($.index=e)}),n.on("keydown",m),i.$on("$destroy",function(){n.off("keydown",m)}),C.open=function(t,o){var a=n[0].activeElement,s=o.openedClass||b;d(!1),k=w.top(),w.add(t,{deferred:o.deferred,renderDeferred:o.renderDeferred,closedDeferred:o.closedDeferred,modalScope:o.scope,backdrop:o.backdrop,keyboard:o.keyboard,openedClass:o.openedClass,windowTopClass:o.windowTopClass,animation:o.animation,appendTo:o.appendTo}),x.put(s,t);var u=o.appendTo,f=c();if(!u.length)throw new Error("appendTo element not found. Make sure that the element passed is in DOM.");f>=0&&!v&&($=i.$new(!0),$.modalOptions=o,$.index=f,v=angular.element('
    '),v.attr("backdrop-class",o.backdropClass),o.animation&&v.attr("modal-animation","true"),r(v)($),e.enter(v,u),y=l.scrollbarPadding(u),y.heightOverflow&&y.scrollbarWidth&&u.css({paddingRight:y.right+"px"})),E=k?parseInt(k.value.modalDomEl.attr("index"),10)+1:0;var p=angular.element('
    ');p.attr({"template-url":o.windowTemplateUrl,"window-class":o.windowClass,"window-top-class":o.windowTopClass,size:o.size,index:E,animate:"animate"}).html(o.content),o.animation&&p.attr("modal-animation","true"),u.addClass(s),e.enter(r(p)(o.scope),u),w.top().value.modalDomEl=p,w.top().value.modalOpener=a},C.close=function(e,t){var n=w.get(e);return n&&g(n,t,!0)?(n.value.modalScope.$$uibDestructionScheduled=!0,n.value.deferred.resolve(t),f(e,n.value.modalOpener),!0):!n},C.dismiss=function(e,t){var n=w.get(e);return n&&g(n,t,!1)?(n.value.modalScope.$$uibDestructionScheduled=!0,n.value.deferred.reject(t),f(e,n.value.modalOpener),!0):!n},C.dismissAll=function(e){for(var t=this.getTop();t&&this.dismiss(t.key,e);)t=this.getTop()},C.getTop=function(){return w.top()},C.modalRendered=function(e){var t=w.get(e);t&&t.value.renderDeferred.resolve()},C.focusFirstFocusableElement=function(e){return e.length>0&&(e[0].focus(),!0)},C.focusLastFocusableElement=function(e){return e.length>0&&(e[e.length-1].focus(),!0)},C.isModalFocused=function(e,t){if(e&&t){var n=t.value.modalDomEl;if(n&&n.length)return(e.target||e.srcElement)===n[0]}return!1},C.isFocusInFirstItem=function(e,t){return t.length>0&&(e.target||e.srcElement)===t[0]},C.isFocusInLastItem=function(e,t){return t.length>0&&(e.target||e.srcElement)===t[t.length-1]},C.loadFocusElementList=function(e){if(e){var t=e.value.modalDomEl;if(t&&t.length){var n=t[0].querySelectorAll("a[href], area[href], input:not([disabled]), button:not([disabled]),select:not([disabled]), textarea:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable=true]");return n?Array.prototype.filter.call(n,function(e){return u(e)}):n}}},C}]).provider("$uibModal",function(){var e={options:{animation:!0,backdrop:!0,keyboard:!0},$get:["$rootScope","$q","$document","$templateRequest","$controller","$uibResolve","$uibModalStack",function(t,n,r,i,o,a,s){function l(e){return e.template?n.when(e.template):i(angular.isFunction(e.templateUrl)?e.templateUrl():e.templateUrl)}var u={},c=null;return u.getPromiseChain=function(){return c},u.open=function(i){function u(){return v}var f=n.defer(),d=n.defer(),p=n.defer(),h=n.defer(),m={result:f.promise,opened:d.promise,closed:p.promise,rendered:h.promise,close:function(e){return s.close(m,e)},dismiss:function(e){return s.dismiss(m,e)}};if(i=angular.extend({},e.options,i),i.resolve=i.resolve||{},i.appendTo=i.appendTo||r.find("body").eq(0),!i.template&&!i.templateUrl)throw new Error("One of template or templateUrl options is required.");var g,v=n.all([l(i),a.resolve(i.resolve,{},null,null)]);return g=c=n.all([c]).then(u,u).then(function(e){var n=i.scope||t,r=n.$new();r.$close=m.close,r.$dismiss=m.dismiss,r.$on("$destroy",function(){r.$$uibDestructionScheduled||r.$dismiss("$uibUnscheduledDestruction")});var a,l,u={};i.controller&&(u.$scope=r,u.$scope.$resolve={},u.$uibModalInstance=m,angular.forEach(e[1],function(e,t){u[t]=e,u.$scope.$resolve[t]=e}),l=o(i.controller,u,!0,i.controllerAs),i.controllerAs&&i.bindToController&&(a=l.instance,a.$close=r.$close,a.$dismiss=r.$dismiss,angular.extend(a,{$resolve:u.$scope.$resolve},n)),a=l(),angular.isFunction(a.$onInit)&&a.$onInit()),s.open(m,{scope:r,deferred:f,renderDeferred:h,closedDeferred:p,content:e[0],animation:i.animation,backdrop:i.backdrop,keyboard:i.keyboard,backdropClass:i.backdropClass,windowTopClass:i.windowTopClass,windowClass:i.windowClass,windowTemplateUrl:i.windowTemplateUrl,size:i.size,openedClass:i.openedClass,appendTo:i.appendTo}),d.resolve(!0)},function(e){d.reject(e),f.reject(e)}).finally(function(){c===g&&(c=null)}),m},u}]};return e}), +angular.module("ui.bootstrap.paging",[]).factory("uibPaging",["$parse",function(e){return{create:function(t,n,r){t.setNumPages=r.numPages?e(r.numPages).assign:angular.noop,t.ngModelCtrl={$setViewValue:angular.noop},t._watchers=[],t.init=function(e,i){t.ngModelCtrl=e,t.config=i,e.$render=function(){t.render()},r.itemsPerPage?t._watchers.push(n.$parent.$watch(r.itemsPerPage,function(e){t.itemsPerPage=parseInt(e,10),n.totalPages=t.calculateTotalPages(),t.updatePage()})):t.itemsPerPage=i.itemsPerPage,n.$watch("totalItems",function(e,r){(angular.isDefined(e)||e!==r)&&(n.totalPages=t.calculateTotalPages(),t.updatePage())})},t.calculateTotalPages=function(){var e=t.itemsPerPage<1?1:Math.ceil(n.totalItems/t.itemsPerPage);return Math.max(e||0,1)},t.render=function(){n.page=parseInt(t.ngModelCtrl.$viewValue,10)||1},n.selectPage=function(e,r){r&&r.preventDefault(),(!n.ngDisabled||!r)&&n.page!==e&&e>0&&e<=n.totalPages&&(r&&r.target&&r.target.blur(),t.ngModelCtrl.$setViewValue(e),t.ngModelCtrl.$render())},n.getText=function(e){return n[e+"Text"]||t.config[e+"Text"]},n.noPrevious=function(){return 1===n.page},n.noNext=function(){return n.page===n.totalPages},t.updatePage=function(){t.setNumPages(n.$parent,n.totalPages),n.page>n.totalPages?n.selectPage(n.totalPages):t.ngModelCtrl.$render()},n.$on("$destroy",function(){for(;t._watchers.length;)t._watchers.shift()()})}}}]),angular.module("ui.bootstrap.pager",["ui.bootstrap.paging"]).controller("UibPagerController",["$scope","$attrs","uibPaging","uibPagerConfig",function(e,t,n,r){e.align=angular.isDefined(t.align)?e.$parent.$eval(t.align):r.align,n.create(this,e,t)}]).constant("uibPagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:!0}).directive("uibPager",["uibPagerConfig",function(e){return{scope:{totalItems:"=",previousText:"@",nextText:"@",ngDisabled:"="},require:["uibPager","?ngModel"],controller:"UibPagerController",controllerAs:"pager",templateUrl:function(e,t){return t.templateUrl||"uib/template/pager/pager.html"},replace:!0,link:function(t,n,r,i){var o=i[0],a=i[1];a&&o.init(a,e)}}}]),angular.module("ui.bootstrap.pagination",["ui.bootstrap.paging"]).controller("UibPaginationController",["$scope","$attrs","$parse","uibPaging","uibPaginationConfig",function(e,t,n,r,i){function o(e,t,n){return{number:e,text:t,active:n}}function a(e,t){var n=[],r=1,i=t,a=angular.isDefined(l)&&lt&&(i=t,r=i-l+1)):(r=(Math.ceil(e/l)-1)*l+1,i=Math.min(r+l-1,t)));for(var s=r;s<=i;s++){var p=o(s,d(s),s===e);n.push(p)}if(a&&l>0&&(!u||c||f)){if(r>1){if(!f||r>3){var h=o(r-1,"...",!1);n.unshift(h)}if(f){if(3===r){var m=o(2,"2",!1);n.unshift(m)}var g=o(1,"1",!1);n.unshift(g)}}if(i0&&e.page<=e.totalPages&&(e.pages=a(e.page,e.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(e,t){return{scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@",ngDisabled:"="},require:["uibPagination","?ngModel"],controller:"UibPaginationController",controllerAs:"pagination",templateUrl:function(e,t){return t.templateUrl||"uib/template/pagination/pagination.html"},replace:!0,link:function(e,n,r,i){var o=i[0],a=i[1];a&&o.init(a,t)}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.stackedMap"]).provider("$uibTooltip",function(){function e(e){var t=/[A-Z]/g;return e.replace(t,function(e,t){return(t?"-":"")+e.toLowerCase()})}var t={placement:"top",placementClassPrefix:"",animation:!0,popupDelay:0,popupCloseDelay:0,useContentExp:!1},n={mouseenter:"mouseleave",click:"click",outsideClick:"outsideClick",focus:"blur",none:""},r={};this.options=function(e){angular.extend(r,e)},this.setTriggers=function(e){angular.extend(n,e)},this.$get=["$window","$compile","$timeout","$document","$uibPosition","$interpolate","$rootScope","$parse","$$stackedMap",function(i,o,a,s,l,u,c,f,d){function p(e){if(27===e.which){var t=h.top();t&&(t.value.close(),h.removeTop(),t=null)}}var h=d.createNew();return s.on("keypress",p),c.$on("$destroy",function(){s.off("keypress",p)}),function(i,c,d,p){function m(e){var t=(e||p.trigger||d).split(" ");return{show:t,hide:t.map(function(e){return n[e]||e})}}p=angular.extend({},t,r,p);var g=e(i),v=u.startSymbol(),$=u.endSymbol(),y="
    ';return{compile:function(e,t){var n=o(y);return function(e,t,r,o){function u(){F.isOpen?g():d()}function d(){L&&!e.$eval(r[c+"Enable"])||(b(),C(),F.popupDelay?A||(A=a(v,F.popupDelay,!1)):v())}function g(){$(),F.popupCloseDelay?O||(O=a(y,F.popupCloseDelay,!1)):y()}function v(){if($(),b(),!F.content)return angular.noop;w(),F.$evalAsync(function(){F.isOpen=!0,E(!0),V()})}function $(){A&&(a.cancel(A),A=null),N&&(a.cancel(N),N=null)}function y(){F&&F.$evalAsync(function(){F&&(F.isOpen=!1,E(!1),F.animation?D||(D=a(x,150,!1)):x())})}function b(){O&&(a.cancel(O),O=null),D&&(a.cancel(D),D=null)}function w(){M||(T=F.$new(),M=n(T,function(e){I?s.find("body").append(e):t.after(e)}),k())}function x(){$(),b(),S(),M&&(M.remove(),M=null),T&&(T.$destroy(),T=null)}function C(){F.title=r[c+"Title"],F.content=H?H(e):r[i],F.popupClass=r[c+"Class"],F.placement=angular.isDefined(r[c+"Placement"])?r[c+"Placement"]:p.placement;var t=l.parsePlacement(F.placement);R=t[1]?t[0]+"-"+t[1]:t[0];var n=parseInt(r[c+"PopupDelay"],10),o=parseInt(r[c+"PopupCloseDelay"],10);F.popupDelay=isNaN(n)?p.popupDelay:n,F.popupCloseDelay=isNaN(o)?p.popupCloseDelay:o}function E(t){j&&angular.isFunction(j.assign)&&j.assign(e,t)}function k(){q.length=0,H?(q.push(e.$watch(H,function(e){F.content=e,!e&&F.isOpen&&y()})),q.push(T.$watch(function(){U||(U=!0,T.$$postDigest(function(){U=!1,F&&F.isOpen&&V()}))}))):q.push(r.$observe(i,function(e){F.content=e,!e&&F.isOpen?y():V()})),q.push(r.$observe(c+"Title",function(e){F.title=e,F.isOpen&&V()})),q.push(r.$observe(c+"Placement",function(e){F.placement=e||p.placement,F.isOpen&&V()}))}function S(){q.length&&(angular.forEach(q,function(e){e()}),q.length=0)}function _(e){F&&F.isOpen&&M&&(t[0].contains(e.target)||M[0].contains(e.target)||g())}var M,T,D,A,O,N,R,I=!!angular.isDefined(p.appendToBody)&&p.appendToBody,P=m(void 0),L=angular.isDefined(r[c+"Enable"]),F=e.$new(!0),U=!1,j=!!angular.isDefined(r[c+"IsOpen"])&&f(r[c+"IsOpen"]),H=!!p.useContentExp&&f(r[i]),q=[],V=function(){M&&M.html()&&(N||(N=a(function(){var e=l.positionElements(t,M,F.placement,I);M.css({top:e.top+"px",left:e.left+"px"}),M.hasClass(e.placement.split("-")[0])||(M.removeClass(R.split("-")[0]),M.addClass(e.placement.split("-")[0])),M.hasClass(p.placementClassPrefix+e.placement)||(M.removeClass(p.placementClassPrefix+R),M.addClass(p.placementClassPrefix+e.placement)),M.hasClass("uib-position-measure")?(l.positionArrow(M,e.placement),M.removeClass("uib-position-measure")):R!==e.placement&&l.positionArrow(M,e.placement),R=e.placement,N=null},0,!1)))};F.origScope=e,F.isOpen=!1,h.add(F,{close:y}),F.contentExp=function(){return F.content},r.$observe("disabled",function(e){e&&$(),e&&F.isOpen&&y()}),j&&e.$watch(j,function(e){F&&!e===F.isOpen&&u()});var B=function(){P.show.forEach(function(e){"outsideClick"===e?t.off("click",u):(t.off(e,d),t.off(e,u))}),P.hide.forEach(function(e){"outsideClick"===e?s.off("click",_):t.off(e,g)})};!function(){var e=r[c+"Trigger"];B(),P=m(e),"none"!==P.show&&P.show.forEach(function(e,n){"outsideClick"===e?(t.on("click",u),s.on("click",_)):e===P.hide[n]?t.on(e,u):e&&(t.on(e,d),t.on(P.hide[n],g)),t.on("keypress",function(e){27===e.which&&g()})})}();var z=e.$eval(r[c+"Animation"]);F.animation=angular.isDefined(z)?!!z:p.animation;var Y,W=c+"AppendToBody";Y=W in r&&void 0===r[W]||e.$eval(r[W]),I=angular.isDefined(Y)?Y:I,e.$on("$destroy",function(){B(),x(),h.remove(F),F=null})}}}}}]}).directive("uibTooltipTemplateTransclude",["$animate","$sce","$compile","$templateRequest",function(e,t,n,r){return{link:function(i,o,a){var s,l,u,c=i.$eval(a.tooltipTemplateTranscludeScope),f=0,d=function(){l&&(l.remove(),l=null),s&&(s.$destroy(),s=null),u&&(e.leave(u).then(function(){l=null}),l=u,u=null)};i.$watch(t.parseAsResourceUrl(a.uibTooltipTemplateTransclude),function(t){var a=++f;t?(r(t,!0).then(function(r){if(a===f){var i=c.$new(),l=r,p=n(l)(i,function(t){d(),e.enter(t,o)});s=i,u=p,s.$emit("$includeContentLoaded",t)}},function(){a===f&&(d(),i.$emit("$includeContentError",t))}),i.$emit("$includeContentRequested",t)):d()}),i.$on("$destroy",d)}}}]).directive("uibTooltipClasses",["$uibPosition",function(e){return{restrict:"A",link:function(t,n,r){if(t.placement){var i=e.parsePlacement(t.placement);n.addClass(i[0])}t.popupClass&&n.addClass(t.popupClass),t.animation()&&n.addClass(r.tooltipAnimationClass)}}}]).directive("uibTooltipPopup",function(){return{replace:!0,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-popup.html"}}).directive("uibTooltip",["$uibTooltip",function(e){return e("uibTooltip","tooltip","mouseenter")}]).directive("uibTooltipTemplatePopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/tooltip/tooltip-template-popup.html"}}).directive("uibTooltipTemplate",["$uibTooltip",function(e){return e("uibTooltipTemplate","tooltip","mouseenter",{useContentExp:!0})}]).directive("uibTooltipHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-html-popup.html"}}).directive("uibTooltipHtml",["$uibTooltip",function(e){return e("uibTooltipHtml","tooltip","mouseenter",{useContentExp:!0})}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("uibPopoverTemplatePopup",function(){return{replace:!0,scope:{uibTitle:"@",contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/popover/popover-template.html"}}).directive("uibPopoverTemplate",["$uibTooltip",function(e){return e("uibPopoverTemplate","popover","click",{useContentExp:!0})}]).directive("uibPopoverHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",uibTitle:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover-html.html"}}).directive("uibPopoverHtml",["$uibTooltip",function(e){return e("uibPopoverHtml","popover","click",{useContentExp:!0})}]).directive("uibPopoverPopup",function(){return{replace:!0,scope:{uibTitle:"@",content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover.html"}}).directive("uibPopover",["$uibTooltip",function(e){return e("uibPopover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("uibProgressConfig",{animate:!0,max:100}).controller("UibProgressController",["$scope","$attrs","uibProgressConfig",function(e,t,n){function r(){return angular.isDefined(e.maxParam)?e.maxParam:n.max}var i=this,o=angular.isDefined(t.animate)?e.$parent.$eval(t.animate):n.animate;this.bars=[],e.max=r(),this.addBar=function(e,t,n){o||t.css({transition:"none"}),this.bars.push(e),e.max=r(),e.title=n&&angular.isDefined(n.title)?n.title:"progressbar",e.$watch("value",function(t){e.recalculatePercentage()}),e.recalculatePercentage=function(){var t=i.bars.reduce(function(e,t){return t.percent=+(100*t.value/t.max).toFixed(2),e+t.percent},0);t>100&&(e.percent-=t-100)},e.$on("$destroy",function(){t=null,i.removeBar(e)})},this.removeBar=function(e){this.bars.splice(this.bars.indexOf(e),1),this.bars.forEach(function(e){e.recalculatePercentage()})},e.$watch("maxParam",function(e){i.bars.forEach(function(e){e.max=r(),e.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(e,t,n,r){r.addBar(e,t,n)}}}).directive("uibProgressbar",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",scope:{value:"=",maxParam:"=?max",type:"@"},templateUrl:"uib/template/progressbar/progressbar.html",link:function(e,t,n,r){r.addBar(e,angular.element(t.children()[0]),{title:n.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(e,t,n){var r={$setViewValue:angular.noop},i=this;this.init=function(i){r=i,r.$render=this.render,r.$formatters.push(function(e){return angular.isNumber(e)&&e<<0!==e&&(e=Math.round(e)),e}),this.stateOn=angular.isDefined(t.stateOn)?e.$parent.$eval(t.stateOn):n.stateOn,this.stateOff=angular.isDefined(t.stateOff)?e.$parent.$eval(t.stateOff):n.stateOff,this.enableReset=angular.isDefined(t.enableReset)?e.$parent.$eval(t.enableReset):n.enableReset;var o=angular.isDefined(t.titles)?e.$parent.$eval(t.titles):n.titles;this.titles=angular.isArray(o)&&o.length>0?o:n.titles;var a=angular.isDefined(t.ratingStates)?e.$parent.$eval(t.ratingStates):new Array(angular.isDefined(t.max)?e.$parent.$eval(t.max):n.max);e.range=this.buildTemplateObjects(a)},this.buildTemplateObjects=function(e){for(var t=0,n=e.length;t=this.titles.length?e+1:this.titles[e]},e.rate=function(t){if(!e.readonly&&t>=0&&t<=e.range.length){var n=i.enableReset&&r.$viewValue===t?0:t;r.$setViewValue(n),r.$render()}},e.enter=function(t){e.readonly||(e.value=t),e.onHover({value:t})},e.reset=function(){e.value=r.$viewValue,e.onLeave()},e.onKeydown=function(t){/(37|38|39|40)/.test(t.which)&&(t.preventDefault(),t.stopPropagation(),e.rate(e.value+(38===t.which||39===t.which?1:-1)))},this.render=function(){e.value=r.$viewValue,e.title=i.getTitle(e.value-1)}}]).directive("uibRating",function(){return{require:["uibRating","ngModel"],scope:{readonly:"=?readOnly",onHover:"&",onLeave:"&"},controller:"UibRatingController",templateUrl:"uib/template/rating/rating.html",replace:!0,link:function(e,t,n,r){var i=r[0],o=r[1];i.init(o)}}}),angular.module("ui.bootstrap.tabs",[]).controller("UibTabsetController",["$scope",function(e){function t(e){for(var t=0;tt.index?1:e.index0&&t<13:t>=0&&t<24)&&""!==e.hours)return e.showMeridian&&(12===t&&(t=0),e.meridian===w[1]&&(t+=12)),t}function l(){var t=+e.minutes;if(t>=0&&t<60&&""!==e.minutes)return t}function u(){var t=+e.seconds;return t>=0&&t<60?t:void 0}function c(e,t){return null===e?"":angular.isDefined(e)&&e.toString().length<2&&!t?"0"+e:e.toString()}function f(e){d(),b.$setViewValue(new Date($)),p(e)}function d(){b.$setValidity("time",!0),e.invalidHours=!1,e.invalidMinutes=!1,e.invalidSeconds=!1}function p(t){if(b.$modelValue){var n=$.getHours(),r=$.getMinutes(),i=$.getSeconds();e.showMeridian&&(n=0===n||12===n?12:n%12),e.hours="h"===t?n:c(n,!x),"m"!==t&&(e.minutes=c(r)),e.meridian=$.getHours()<12?w[0]:w[1],"s"!==t&&(e.seconds=c(i)),e.meridian=$.getHours()<12?w[0]:w[1]}else e.hours=null,e.minutes=null,e.seconds=null,e.meridian=w[0]}function h(e){$=g($,e),f()}function m(e,t){return g(e,60*t)}function g(e,t){var n=new Date(e.getTime()+1e3*t),r=new Date(e);return r.setHours(n.getHours(),n.getMinutes(),n.getSeconds()),r}function v(){return(null===e.hours||""===e.hours)&&(null===e.minutes||""===e.minutes)&&(!e.showSeconds||e.showSeconds&&(null===e.seconds||""===e.seconds))}var $=new Date,y=[],b={$setViewValue:angular.noop},w=angular.isDefined(n.meridians)?e.$parent.$eval(n.meridians):a.meridians||o.DATETIME_FORMATS.AMPMS,x=!angular.isDefined(n.padHours)||e.$parent.$eval(n.padHours);e.tabindex=angular.isDefined(n.tabindex)?n.tabindex:0,t.removeAttr("tabindex"),this.init=function(t,r){b=t,b.$render=this.render,b.$formatters.unshift(function(e){return e?new Date(e):null});var i=r.eq(0),o=r.eq(1),s=r.eq(2);(angular.isDefined(n.mousewheel)?e.$parent.$eval(n.mousewheel):a.mousewheel)&&this.setupMousewheelEvents(i,o,s),(angular.isDefined(n.arrowkeys)?e.$parent.$eval(n.arrowkeys):a.arrowkeys)&&this.setupArrowkeyEvents(i,o,s),e.readonlyInput=angular.isDefined(n.readonlyInput)?e.$parent.$eval(n.readonlyInput):a.readonlyInput,this.setupInputEvents(i,o,s)};var C=a.hourStep;n.hourStep&&y.push(e.$parent.$watch(r(n.hourStep),function(e){C=+e}));var E=a.minuteStep;n.minuteStep&&y.push(e.$parent.$watch(r(n.minuteStep),function(e){E=+e}));var k;y.push(e.$parent.$watch(r(n.min),function(e){var t=new Date(e);k=isNaN(t)?void 0:t}));var S;y.push(e.$parent.$watch(r(n.max),function(e){var t=new Date(e);S=isNaN(t)?void 0:t}));var _=!1;n.ngDisabled&&y.push(e.$parent.$watch(r(n.ngDisabled),function(e){_=e})),e.noIncrementHours=function(){var e=m($,60*C);return _||e>S||e<$&&e$&&e>S},e.noIncrementMinutes=function(){var e=m($,E);return _||e>S||e<$&&e$&&e>S},e.noIncrementSeconds=function(){var e=g($,M);return _||e>S||e<$&&e$&&e>S},e.noToggleMeridian=function(){return $.getHours()<12?_||m($,720)>S:_||m($,-720)0};t.bind("mousewheel wheel",function(t){_||e.$apply(i(t)?e.incrementHours():e.decrementHours()),t.preventDefault()}),n.bind("mousewheel wheel",function(t){_||e.$apply(i(t)?e.incrementMinutes():e.decrementMinutes()),t.preventDefault()}),r.bind("mousewheel wheel",function(t){_||e.$apply(i(t)?e.incrementSeconds():e.decrementSeconds()),t.preventDefault()})},this.setupArrowkeyEvents=function(t,n,r){t.bind("keydown",function(t){_||(38===t.which?(t.preventDefault(),e.incrementHours(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementHours(),e.$apply()))}),n.bind("keydown",function(t){_||(38===t.which?(t.preventDefault(),e.incrementMinutes(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementMinutes(),e.$apply()))}),r.bind("keydown",function(t){_||(38===t.which?(t.preventDefault(),e.incrementSeconds(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementSeconds(),e.$apply()))})},this.setupInputEvents=function(t,n,r){if(e.readonlyInput)return e.updateHours=angular.noop,e.updateMinutes=angular.noop,void(e.updateSeconds=angular.noop);var i=function(t,n,r){b.$setViewValue(null),b.$setValidity("time",!1),angular.isDefined(t)&&(e.invalidHours=t),angular.isDefined(n)&&(e.invalidMinutes=n),angular.isDefined(r)&&(e.invalidSeconds=r)};e.updateHours=function(){var e=s(),t=l();b.$setDirty(),angular.isDefined(e)&&angular.isDefined(t)?($.setHours(e),$.setMinutes(t),$S?i(!0):f("h")):i(!0)},t.bind("blur",function(t){b.$setTouched(),v()?d():null===e.hours||""===e.hours?i(!0):!e.invalidHours&&e.hours<10&&e.$apply(function(){e.hours=c(e.hours,!x)})}),e.updateMinutes=function(){var e=l(),t=s();b.$setDirty(),angular.isDefined(e)&&angular.isDefined(t)?($.setHours(t),$.setMinutes(e),$S?i(void 0,!0):f("m")):i(void 0,!0)},n.bind("blur",function(t){b.$setTouched(),v()?d():null===e.minutes?i(void 0,!0):!e.invalidMinutes&&e.minutes<10&&e.$apply(function(){e.minutes=c(e.minutes)})}),e.updateSeconds=function(){var e=u();b.$setDirty(),angular.isDefined(e)?($.setSeconds(e),f("s")):i(void 0,void 0,!0)},r.bind("blur",function(t){v()?d():!e.invalidSeconds&&e.seconds<10&&e.$apply(function(){e.seconds=c(e.seconds)})})},this.render=function(){var t=b.$viewValue;isNaN(t)?(b.$setValidity("time",!1),i.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.')):(t&&($=t),$S?(b.$setValidity("time",!1),e.invalidHours=!0,e.invalidMinutes=!0):d(),p())},e.showSpinners=angular.isDefined(n.showSpinners)?e.$parent.$eval(n.showSpinners):a.showSpinners,e.incrementHours=function(){e.noIncrementHours()||h(60*C*60)},e.decrementHours=function(){e.noDecrementHours()||h(60*-C*60)},e.incrementMinutes=function(){e.noIncrementMinutes()||h(60*E)},e.decrementMinutes=function(){e.noDecrementMinutes()||h(60*-E)},e.incrementSeconds=function(){e.noIncrementSeconds()||h(M)},e.decrementSeconds=function(){e.noDecrementSeconds()||h(-M)},e.toggleMeridian=function(){var t=l(),n=s();e.noToggleMeridian()||(angular.isDefined(t)&&angular.isDefined(n)?h(720*($.getHours()<12?60:-60)):e.meridian=e.meridian===w[0]?w[1]:w[0])},e.blur=function(){b.$setTouched()},e.$on("$destroy",function(){for(;y.length;)y.shift()()})}]).directive("uibTimepicker",["uibTimepickerConfig",function(e){return{require:["uibTimepicker","?^ngModel"],controller:"UibTimepickerController",controllerAs:"timepicker",replace:!0,scope:{},templateUrl:function(t,n){return n.templateUrl||e.templateUrl},link:function(e,t,n,r){var i=r[0],o=r[1];o&&i.init(o,t.find("input"))}}}]),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.debounce","ui.bootstrap.position"]).factory("uibTypeaheadParser",["$parse",function(e){var t=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(n){var r=n.match(t);if(!r)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+n+'".');return{itemName:r[3],source:e(r[4]),viewMapper:e(r[2]||r[1]),modelMapper:e(r[1])}}}}]).controller("UibTypeaheadController",["$scope","$element","$attrs","$compile","$parse","$q","$timeout","$document","$window","$rootScope","$$debounce","$uibPosition","uibTypeaheadParser",function(e,t,n,r,i,o,a,s,l,u,c,f,d){function p(){U.moveInProgress||(U.moveInProgress=!0,U.$digest()),Z()}function h(){U.position=T?f.offset(t):f.position(t),U.position.top+=t.prop("offsetHeight")}var m,g,v=[9,13,27,38,40],$=e.$eval(n.typeaheadMinLength);$||0===$||($=1),e.$watch(n.typeaheadMinLength,function(e){$=e||0===e?e:1});var y=e.$eval(n.typeaheadWaitMs)||0,b=!1!==e.$eval(n.typeaheadEditable);e.$watch(n.typeaheadEditable,function(e){b=!1!==e});var w,x,C=i(n.typeaheadLoading).assign||angular.noop,E=n.typeaheadShouldSelect?i(n.typeaheadShouldSelect):function(e,t){var n=t.$event;return 13===n.which||9===n.which},k=i(n.typeaheadOnSelect),S=!!angular.isDefined(n.typeaheadSelectOnBlur)&&e.$eval(n.typeaheadSelectOnBlur),_=i(n.typeaheadNoResults).assign||angular.noop,M=n.typeaheadInputFormatter?i(n.typeaheadInputFormatter):void 0,T=!!n.typeaheadAppendToBody&&e.$eval(n.typeaheadAppendToBody),D=n.typeaheadAppendTo?e.$eval(n.typeaheadAppendTo):null,A=!1!==e.$eval(n.typeaheadFocusFirst),O=!!n.typeaheadSelectOnExact&&e.$eval(n.typeaheadSelectOnExact),N=i(n.typeaheadIsOpen).assign||angular.noop,R=e.$eval(n.typeaheadShowHint)||!1,I=i(n.ngModel),P=i(n.ngModel+"($$$p)"),L=function(t,n){return angular.isFunction(I(e))&&g&&g.$options&&g.$options.getterSetter?P(t,{$$$p:n}):I.assign(t,n)},F=d.parse(n.uibTypeahead),U=e.$new(),j=e.$on("$destroy",function(){U.$destroy()});U.$on("$destroy",j);var H="typeahead-"+U.$id+"-"+Math.floor(1e4*Math.random());t.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":H});var q,V;R&&(q=angular.element("
    "),q.css("position","relative"),t.after(q),V=t.clone(),V.attr("placeholder",""),V.attr("tabindex","-1"),V.val(""),V.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"}),t.css({position:"relative","vertical-align":"top","background-color":"transparent"}),q.append(V),V.after(t));var B=angular.element("
    ");B.attr({id:H,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(n.typeaheadTemplateUrl)&&B.attr("template-url",n.typeaheadTemplateUrl),angular.isDefined(n.typeaheadPopupTemplateUrl)&&B.attr("popup-template-url",n.typeaheadPopupTemplateUrl);var z=function(){R&&V.val("")},Y=function(){U.matches=[],U.activeIdx=-1,t.attr("aria-expanded",!1),z()},W=function(e){return H+"-option-"+e};U.$watch("activeIdx",function(e){e<0?t.removeAttr("aria-activedescendant"):t.attr("aria-activedescendant",W(e))});var G=function(e,t){return!!(U.matches.length>t&&e)&&e.toUpperCase()===U.matches[t].label.toUpperCase()},K=function(n,r){var i={$viewValue:n};C(e,!0),_(e,!1),o.when(F.source(e,i)).then(function(o){var a=n===m.$viewValue;if(a&&w)if(o&&o.length>0){U.activeIdx=A?0:-1,_(e,!1),U.matches.length=0;for(var s=0;s0&&l.slice(0,n.length).toUpperCase()===n.toUpperCase()?V.val(n+l.slice(n.length)):V.val("")}}else Y(),_(e,!0);a&&C(e,!1)},function(){Y(),C(e,!1),_(e,!0)})};T&&(angular.element(l).on("resize",p),s.find("body").on("scroll",p));var Z=c(function(){U.matches.length&&h(),U.moveInProgress=!1},200);U.moveInProgress=!1,U.query=void 0;var J,X=function(e){J=a(function(){K(e)},y)},Q=function(){J&&a.cancel(J)};Y(),U.assignIsOpen=function(t){N(e,t)},U.select=function(r,i){var o,s,l={};x=!0,l[F.itemName]=s=U.matches[r].model,o=F.modelMapper(e,l),L(e,o),m.$setValidity("editable",!0),m.$setValidity("parse",!0),k(e,{$item:s,$model:o,$label:F.viewMapper(e,l),$event:i}),Y(),!1!==U.$eval(n.typeaheadFocusOnSelect)&&a(function(){t[0].focus()},0,!1)},t.on("keydown",function(t){if(0!==U.matches.length&&-1!==v.indexOf(t.which)){var n=E(e,{$event:t});if(-1===U.activeIdx&&n||9===t.which&&t.shiftKey)return Y(),void U.$digest();t.preventDefault();var r;switch(t.which){case 27:t.stopPropagation(),Y(),e.$digest();break;case 38:U.activeIdx=(U.activeIdx>0?U.activeIdx:U.matches.length)-1,U.$digest(),r=B.find("li")[U.activeIdx],r.parentNode.scrollTop=r.offsetTop;break;case 40:U.activeIdx=(U.activeIdx+1)%U.matches.length,U.$digest(),r=B.find("li")[U.activeIdx],r.parentNode.scrollTop=r.offsetTop;break;default:n&&U.$apply(function(){angular.isNumber(U.debounceUpdate)||angular.isObject(U.debounceUpdate)?c(function(){U.select(U.activeIdx,t) +},angular.isNumber(U.debounceUpdate)?U.debounceUpdate:U.debounceUpdate.default):U.select(U.activeIdx,t)})}}}),t.bind("focus",function(e){w=!0,0!==$||m.$viewValue||a(function(){K(m.$viewValue,e)},0)}),t.bind("blur",function(e){S&&U.matches.length&&-1!==U.activeIdx&&!x&&(x=!0,U.$apply(function(){angular.isObject(U.debounceUpdate)&&angular.isNumber(U.debounceUpdate.blur)?c(function(){U.select(U.activeIdx,e)},U.debounceUpdate.blur):U.select(U.activeIdx,e)})),!b&&m.$error.editable&&(m.$setViewValue(),m.$setValidity("editable",!0),m.$setValidity("parse",!0),t.val("")),w=!1,x=!1});var ee=function(n){t[0]!==n.target&&3!==n.which&&0!==U.matches.length&&(Y(),u.$$phase||e.$digest())};s.on("click",ee),e.$on("$destroy",function(){s.off("click",ee),(T||D)&&te.remove(),T&&(angular.element(l).off("resize",p),s.find("body").off("scroll",p)),B.remove(),R&&q.remove()});var te=r(B)(U);T?s.find("body").append(te):D?angular.element(D).eq(0).append(te):t.after(te),this.init=function(t,n){m=t,g=n,U.debounceUpdate=m.$options&&i(m.$options.debounce)(e),m.$parsers.unshift(function(t){return w=!0,0===$||t&&t.length>=$?y>0?(Q(),X(t)):K(t):(C(e,!1),Q(),Y()),b?t:t?void m.$setValidity("editable",!1):(m.$setValidity("editable",!0),null)}),m.$formatters.push(function(t){var n,r,i={};return b||m.$setValidity("editable",!0),M?(i.$model=t,M(e,i)):(i[F.itemName]=t,n=F.viewMapper(e,i),i[F.itemName]=void 0,r=F.viewMapper(e,i),n!==r?n:t)})}}]).directive("uibTypeahead",function(){return{controller:"UibTypeaheadController",require:["ngModel","^?ngModelOptions","uibTypeahead"],link:function(e,t,n,r){r[2].init(r[0],r[1])}}}).directive("uibTypeaheadPopup",["$$debounce",function(e){return{scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&",assignIsOpen:"&",debounce:"&"},replace:!0,templateUrl:function(e,t){return t.popupTemplateUrl||"uib/template/typeahead/typeahead-popup.html"},link:function(t,n,r){t.templateUrl=r.templateUrl,t.isOpen=function(){var e=t.matches.length>0;return t.assignIsOpen({isOpen:e}),e},t.isActive=function(e){return t.active===e},t.selectActive=function(e){t.active=e},t.selectMatch=function(n,r){var i=t.debounce();angular.isNumber(i)||angular.isObject(i)?e(function(){t.select({activeIdx:n,evt:r})},angular.isNumber(i)?i:i.default):t.select({activeIdx:n,evt:r})}}}}]).directive("uibTypeaheadMatch",["$templateRequest","$compile","$parse",function(e,t,n){return{scope:{index:"=",match:"=",query:"="},link:function(r,i,o){var a=n(o.templateUrl)(r.$parent)||"uib/template/typeahead/typeahead-match.html";e(a).then(function(e){var n=angular.element(e.trim());i.replaceWith(n),t(n)(r)})}}}]).filter("uibTypeaheadHighlight",["$sce","$injector","$log",function(e,t,n){function r(e){return e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function i(e){return/<.*>/g.test(e)}var o;return o=t.has("$sanitize"),function(t,a){return!o&&i(t)&&n.warn("Unsafe use of typeahead please use ngSanitize"),t=a?(""+t).replace(new RegExp(r(a),"gi"),"$&"):t,o||(t=e.trustAsHtml(t)),t}}]),angular.module("uib/template/accordion/accordion-group.html",[]).run(["$templateCache",function(e){e.put("uib/template/accordion/accordion-group.html",'
    \n \n
    \n
    \n
    \n
    \n')}]),angular.module("uib/template/accordion/accordion.html",[]).run(["$templateCache",function(e){e.put("uib/template/accordion/accordion.html",'
    ')}]),angular.module("uib/template/alert/alert.html",[]).run(["$templateCache",function(e){e.put("uib/template/alert/alert.html",'\n')}]),angular.module("uib/template/carousel/carousel.html",[]).run(["$templateCache",function(e){e.put("uib/template/carousel/carousel.html",'\n')}]),angular.module("uib/template/carousel/slide.html",[]).run(["$templateCache",function(e){e.put("uib/template/carousel/slide.html",'
    \n')}]),angular.module("uib/template/datepicker/datepicker.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepicker/datepicker.html",'
    \n \n \n \n
    \n')}]),angular.module("uib/template/datepicker/day.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepicker/day.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    {{::label.abbr}}
    {{ weekNumbers[$index] }}\n \n
    \n')}]),angular.module("uib/template/datepicker/month.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepicker/month.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n')}]),angular.module("uib/template/datepicker/year.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepicker/year.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n')}]),angular.module("uib/template/datepickerPopup/popup.html",[]).run(["$templateCache",function(e){e.put("uib/template/datepickerPopup/popup.html",'
    \n \n
    \n')}]),angular.module("uib/template/modal/backdrop.html",[]).run(["$templateCache",function(e){e.put("uib/template/modal/backdrop.html",'\n')}]),angular.module("uib/template/modal/window.html",[]).run(["$templateCache",function(e){e.put("uib/template/modal/window.html",'\n')}]),angular.module("uib/template/pager/pager.html",[]).run(["$templateCache",function(e){e.put("uib/template/pager/pager.html",'\n')}]),angular.module("uib/template/pagination/pagination.html",[]).run(["$templateCache",function(e){e.put("uib/template/pagination/pagination.html",'\n')}]),angular.module("uib/template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function(e){e.put("uib/template/tooltip/tooltip-html-popup.html",'
    \n
    \n
    \n
    \n')}]),angular.module("uib/template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(e){e.put("uib/template/tooltip/tooltip-popup.html",'
    \n
    \n
    \n
    \n')}]),angular.module("uib/template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function(e){e.put("uib/template/tooltip/tooltip-template-popup.html",'
    \n
    \n
    \n
    \n')}]),angular.module("uib/template/popover/popover-html.html",[]).run(["$templateCache",function(e){e.put("uib/template/popover/popover-html.html",'
    \n
    \n\n
    \n

    \n
    \n
    \n
    \n')}]),angular.module("uib/template/popover/popover-template.html",[]).run(["$templateCache",function(e){e.put("uib/template/popover/popover-template.html",'
    \n
    \n\n
    \n

    \n
    \n
    \n
    \n')}]),angular.module("uib/template/popover/popover.html",[]).run(["$templateCache",function(e){e.put("uib/template/popover/popover.html",'
    \n
    \n\n
    \n

    \n
    \n
    \n
    \n')}]),angular.module("uib/template/progressbar/bar.html",[]).run(["$templateCache",function(e){e.put("uib/template/progressbar/bar.html",'
    \n')}]),angular.module("uib/template/progressbar/progress.html",[]).run(["$templateCache",function(e){e.put("uib/template/progressbar/progress.html",'
    ')}]),angular.module("uib/template/progressbar/progressbar.html",[]).run(["$templateCache",function(e){e.put("uib/template/progressbar/progressbar.html",'
    \n
    \n
    \n')}]),angular.module("uib/template/rating/rating.html",[]).run(["$templateCache",function(e){e.put("uib/template/rating/rating.html",'\n ({{ $index < value ? \'*\' : \' \' }})\n \n\n')}]),angular.module("uib/template/tabs/tab.html",[]).run(["$templateCache",function(e){e.put("uib/template/tabs/tab.html",'\n')}]),angular.module("uib/template/tabs/tabset.html",[]).run(["$templateCache",function(e){e.put("uib/template/tabs/tabset.html",'
    \n \n
    \n
    \n
    \n
    \n
    \n')}]),angular.module("uib/template/timepicker/timepicker.html",[]).run(["$templateCache",function(e){e.put("uib/template/timepicker/timepicker.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
      
    \n \n :\n \n :\n \n
      
    \n')}]),angular.module("uib/template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(e){e.put("uib/template/typeahead/typeahead-match.html",'\n')}]),angular.module("uib/template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(e){e.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}),define("common/angularBootstrap",["common/angular"],function(){}),function(e,t){(function(e){var t=e.module("angularFileUpload",[]);t.value("fileUploaderOptions",{url:"/",alias:"file",headers:{},queue:[],progress:0,autoUpload:!1,removeAfterUpload:!1,method:"POST",filters:[],formData:[],queueLimit:Number.MAX_VALUE,withCredentials:!1}).factory("FileUploader",["fileUploaderOptions","$rootScope","$http","$window","$compile",function(t,n,r,i,o){function a(n){var r=e.copy(t);e.extend(this,r,n,{isUploading:!1,_nextIndex:0,_failFilterIndex:-1,_directives:{select:[],drop:[],over:[]}}),this.filters.unshift({name:"queueLimit",fn:this._queueLimitFilter}),this.filters.unshift({name:"folder",fn:this._folderFilter})}function s(t){var n=e.isElement(t),r=n?t.value:t;this["_createFrom"+(e.isString(r)?"FakePath":"Object")](r)}function l(t,n,r){var i=e.isElement(n),o=i?e.element(n):null,s=i?null:n;e.extend(this,{url:t.url,alias:t.alias,headers:e.copy(t.headers),formData:e.copy(t.formData),removeAfterUpload:t.removeAfterUpload,withCredentials:t.withCredentials,method:t.method},r,{uploader:t,file:new a.FileLikeObject(n),isReady:!1,isUploading:!1,isUploaded:!1,isSuccess:!1,isCancel:!1,isError:!1,progress:0,index:null,_file:s,_input:o}),o&&this._replaceNode(o)}function u(t){e.extend(this,t),this.uploader._directives[this.prop].push(this),this._saveLinks(),this.bind()}function c(e){c.super_.apply(this,arguments),this.uploader.isHTML5||this.element.removeAttr("multiple"),this.element.prop("value",null)}function f(e){f.super_.apply(this,arguments)}function d(e){d.super_.apply(this,arguments)} +return a.prototype.isHTML5=!(!i.File||!i.FormData),a.prototype.addToQueue=function(t,n,r){var i=this.isArrayLikeObject(t)?t:[t],o=this._getFilters(r),s=this.queue.length,l=[];e.forEach(i,function(e){var t=new a.FileLikeObject(e);if(this._isValidFile(t,o,n)){var r=new a.FileItem(this,e,n);l.push(r),this.queue.push(r),this._onAfterAddingFile(r)}else{var i=this.filters[this._failFilterIndex];this._onWhenAddingFileFailed(t,i,n)}},this),this.queue.length!==s&&(this._onAfterAddingAll(l),this.progress=this._getTotalProgress()),this._render(),this.autoUpload&&this.uploadAll()},a.prototype.removeFromQueue=function(e){var t=this.getIndexOfItem(e),n=this.queue[t];n.isUploading&&n.cancel(),this.queue.splice(t,1),n._destroy(),this.progress=this._getTotalProgress()},a.prototype.clearQueue=function(){for(;this.queue.length;)this.queue[0].remove();this.progress=0},a.prototype.uploadItem=function(e){var t=this.getIndexOfItem(e),n=this.queue[t],r=this.isHTML5?"_xhrTransport":"_iframeTransport";n._prepareToUploading(),this.isUploading||(this.isUploading=!0,this[r](n))},a.prototype.cancelItem=function(e){var t=this.getIndexOfItem(e),n=this.queue[t],r=this.isHTML5?"_xhr":"_form";n&&n.isUploading&&n[r].abort()},a.prototype.uploadAll=function(){var t=this.getNotUploadedItems().filter(function(e){return!e.isUploading});t.length&&(e.forEach(t,function(e){e._prepareToUploading()}),t[0].upload())},a.prototype.cancelAll=function(){var t=this.getNotUploadedItems();e.forEach(t,function(e){e.cancel()})},a.prototype.isFile=function(e){var t=i.File;return t&&e instanceof t},a.prototype.isFileLikeObject=function(e){return e instanceof a.FileLikeObject},a.prototype.isArrayLikeObject=function(t){return e.isObject(t)&&"length"in t},a.prototype.getIndexOfItem=function(t){return e.isNumber(t)?t:this.queue.indexOf(t)},a.prototype.getNotUploadedItems=function(){return this.queue.filter(function(e){return!e.isUploaded})},a.prototype.getReadyItems=function(){return this.queue.filter(function(e){return e.isReady&&!e.isUploading}).sort(function(e,t){return e.index-t.index})},a.prototype.destroy=function(){e.forEach(this._directives,function(t){e.forEach(this._directives[t],function(e){e.destroy()},this)},this)},a.prototype.onAfterAddingAll=function(e){},a.prototype.onAfterAddingFile=function(e){},a.prototype.onWhenAddingFileFailed=function(e,t,n){},a.prototype.onBeforeUploadItem=function(e){},a.prototype.onProgressItem=function(e,t){},a.prototype.onProgressAll=function(e){},a.prototype.onSuccessItem=function(e,t,n,r){},a.prototype.onErrorItem=function(e,t,n,r){},a.prototype.onCancelItem=function(e,t,n,r){},a.prototype.onCompleteItem=function(e,t,n,r){},a.prototype.onCompleteAll=function(){},a.prototype._getTotalProgress=function(e){if(this.removeAfterUpload)return e||0;var t=this.getNotUploadedItems().length,n=t?this.queue.length-t:this.queue.length,r=100/this.queue.length,i=(e||0)*r/100;return Math.round(n*r+i)},a.prototype._getFilters=function(t){if(e.isUndefined(t))return this.filters;if(e.isArray(t))return t;var n=t.match(/[^\s,]+/g);return this.filters.filter(function(e){return-1!==n.indexOf(e.name)},this)},a.prototype._render=function(){n.$$phase||n.$apply()},a.prototype._folderFilter=function(e){return!(!e.size&&!e.type)},a.prototype._queueLimitFilter=function(){return this.queue.length=200&&e<300||304===e},a.prototype._transformResponse=function(t,n){var i=this._headersGetter(n);return e.forEach(r.defaults.transformResponse,function(e){t=e(t,i)}),t},a.prototype._parseHeaders=function(t){var n,r,i,o={};return t?(e.forEach(t.split("\n"),function(e){i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim(),n&&(o[n]=o[n]?o[n]+", "+r:r)}),o):o},a.prototype._headersGetter=function(e){return function(t){return t?e[t.toLowerCase()]||null:e}},a.prototype._xhrTransport=function(t){var n=t._xhr=new XMLHttpRequest,r=new FormData,i=this;i._onBeforeUploadItem(t),e.forEach(t.formData,function(t){e.forEach(t,function(e,t){r.append(t,e)})}),r.append(t.alias,t._file,t.file.name),n.upload.onprogress=function(e){var n=Math.round(e.lengthComputable?100*e.loaded/e.total:0);i._onProgressItem(t,n)},n.onload=function(){var e=i._parseHeaders(n.getAllResponseHeaders()),r=i._transformResponse(n.response,e),o=i._isSuccessCode(n.status)?"Success":"Error";i["_on"+o+"Item"](t,r,n.status,e),i._onCompleteItem(t,r,n.status,e)},n.onerror=function(){var e=i._parseHeaders(n.getAllResponseHeaders()),r=i._transformResponse(n.response,e);i._onErrorItem(t,r,n.status,e),i._onCompleteItem(t,r,n.status,e)},n.onabort=function(){var e=i._parseHeaders(n.getAllResponseHeaders()),r=i._transformResponse(n.response,e);i._onCancelItem(t,r,n.status,e),i._onCompleteItem(t,r,n.status,e)},n.open(t.method,t.url,!0),n.withCredentials=t.withCredentials,e.forEach(t.headers,function(e,t){n.setRequestHeader(t,e)}),n.send(r),this._render()},a.prototype._iframeTransport=function(t){var n=e.element('
    '),r=e.element('"),n=e.prop("attributes");angular.forEach(n,function(e){t.attr(e.name,e.value)}),t.attr("src",t.attr("ta-insert-video")),e.replaceWith(t)}}]).value("taTranslations",{html:{tooltip:"Toggle html / Rich Text"},heading:{tooltip:"Heading "},p:{tooltip:"Paragraph"},pre:{tooltip:"Preformatted text"},ul:{tooltip:"Unordered List"},ol:{tooltip:"Ordered List"},quote:{tooltip:"Quote/unquote selection or paragraph"},undo:{tooltip:"Undo"},redo:{tooltip:"Redo"},bold:{tooltip:"Bold"},italic:{tooltip:"Italic"},underline:{tooltip:"Underline"},strikeThrough:{tooltip:"Strikethrough"},justifyLeft:{tooltip:"Align text left"},justifyRight:{tooltip:"Align text right"},justifyFull:{tooltip:"Justify text"},justifyCenter:{tooltip:"Center"},indent:{tooltip:"Increase indent"},outdent:{tooltip:"Decrease indent"},clear:{tooltip:"Clear formatting"},insertImage:{dialogPrompt:"Please enter an image URL to insert",tooltip:"Insert image",hotkey:"the - possibly language dependent hotkey ... for some future implementation"},insertVideo:{tooltip:"Insert video",dialogPrompt:"Please enter a youtube URL to embed"},insertLink:{tooltip:"Insert / edit link",dialogPrompt:"Please enter a URL to insert"},editLink:{reLinkButton:{tooltip:"Relink"},unLinkButton:{tooltip:"Unlink"},targetToggle:{buttontext:"Open in New Window"}},wordcount:{tooltip:"Display words Count"},charcount:{tooltip:"Display characters Count"}}).factory("taToolFunctions",["$window","taTranslations",function(e,t){return{imgOnSelectAction:function(e,t,n){var r=function(){n.updateTaBindtaTextElement(),n.hidePopover()};e.preventDefault(),n.displayElements.popover.css("width","375px");var i=n.displayElements.popoverContainer;i.empty();var o=angular.element('
    '),a=angular.element('');a.on("click",function(e){e.preventDefault(),t.css({width:"100%",height:""}),r()});var s=angular.element('');s.on("click",function(e){e.preventDefault(),t.css({width:"50%",height:""}),r()});var l=angular.element('');l.on("click",function(e){e.preventDefault(),t.css({width:"25%",height:""}),r()});var u=angular.element('');u.on("click",function(e){e.preventDefault(),t.css({width:"",height:""}),r()}),o.append(a),o.append(s),o.append(l),o.append(u),i.append(o),o=angular.element('
    ');var c=angular.element('');c.on("click",function(e){e.preventDefault(),t.css("float","left"),t.css("cssFloat","left"),t.css("styleFloat","left"),r()});var f=angular.element('');f.on("click",function(e){e.preventDefault(),t.css("float","right"),t.css("cssFloat","right"),t.css("styleFloat","right"),r()});var d=angular.element('');d.on("click",function(e){e.preventDefault(),t.css("float",""),t.css("cssFloat",""),t.css("styleFloat",""),r()}),o.append(c),o.append(d),o.append(f),i.append(o),o=angular.element('
    ');var p=angular.element('');p.on("click",function(e){e.preventDefault(),t.remove(),r()}),o.append(p),i.append(o),n.showPopover(t),n.showResizeOverlay(t)},aOnSelectAction:function(n,r,i){n.preventDefault(),i.displayElements.popover.css("width","436px");var o=i.displayElements.popoverContainer;o.empty(),o.css("line-height","28px");var a=angular.element(''+r.attr("href")+"");a.css({display:"inline-block","max-width":"200px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","vertical-align":"middle"}),o.append(a);var s=angular.element('
    '),l=angular.element('');l.on("click",function(n){n.preventDefault();var o=e.prompt(t.insertLink.dialogPrompt,r.attr("href"));o&&""!==o&&"http://"!==o&&(r.attr("href",o),i.updateTaBindtaTextElement()),i.hidePopover()}),s.append(l);var u=angular.element('');u.on("click",function(e){e.preventDefault(),r.replaceWith(r.contents()),i.updateTaBindtaTextElement(),i.hidePopover()}),s.append(u);var c=angular.element('");"_blank"===r.attr("target")&&c.addClass("active"),c.on("click",function(e){e.preventDefault(),r.attr("target","_blank"===r.attr("target")?"":"_blank"),c.toggleClass("active"),i.updateTaBindtaTextElement()}),s.append(c),o.append(s),i.showPopover(r)},extractYoutubeVideoId:function(e){var t=/(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i,n=e.match(t);return n&&n[1]||null}}}]).run(["taRegisterTool","$window","taTranslations","taSelection","taToolFunctions","$sanitize","taOptions","$log",function(e,t,n,r,i,o,a,s){var l={};if(o("",l),!0===a.forceTextAngularSanitize&&"taSanitize"!==l.version)throw angular.$$minErr("textAngular")("textAngularSetup","The textAngular-sanitize provider has been replaced by another -- have you included angular-sanitize by mistake?");e("html",{iconclass:"fa fa-code",tooltiptext:n.html.tooltip,action:function(){this.$editor().switchView()},activeState:function(){return this.$editor().showHtml}});var u=function(e){return function(){return this.$editor().queryFormatBlockState(e)}},c=function(){return this.$editor().wrapSelection("formatBlock","<"+this.name.toUpperCase()+">")};angular.forEach(["h1","h2","h3","h4","h5","h6"],function(t){e(t.toLowerCase(),{buttontext:t.toUpperCase(),tooltiptext:n.heading.tooltip+t.charAt(1),action:c,activeState:u(t.toLowerCase())})}),e("p",{buttontext:"P",tooltiptext:n.p.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","

    ")},activeState:function(){return this.$editor().queryFormatBlockState("p")}}),e("pre",{buttontext:"pre",tooltiptext:n.pre.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","

    ")},activeState:function(){return this.$editor().queryFormatBlockState("pre")}}),e("ul",{iconclass:"fa fa-list-ul",tooltiptext:n.ul.tooltip,action:function(){return this.$editor().wrapSelection("insertUnorderedList",null)},activeState:function(){return this.$editor().queryCommandState("insertUnorderedList")}}),e("ol",{iconclass:"fa fa-list-ol",tooltiptext:n.ol.tooltip,action:function(){return this.$editor().wrapSelection("insertOrderedList",null)},activeState:function(){return this.$editor().queryCommandState("insertOrderedList")}}),e("quote",{iconclass:"fa fa-quote-right",tooltiptext:n.quote.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","
    ")},activeState:function(){return this.$editor().queryFormatBlockState("blockquote")}}),e("undo",{iconclass:"fa fa-undo",tooltiptext:n.undo.tooltip,action:function(){return this.$editor().wrapSelection("undo",null)}}),e("redo",{iconclass:"fa fa-repeat",tooltiptext:n.redo.tooltip,action:function(){return this.$editor().wrapSelection("redo",null)}}),e("bold",{iconclass:"fa fa-bold",tooltiptext:n.bold.tooltip,action:function(){return this.$editor().wrapSelection("bold",null)},activeState:function(){return this.$editor().queryCommandState("bold")},commandKeyCode:98}),e("justifyLeft",{iconclass:"fa fa-align-left",tooltiptext:n.justifyLeft.tooltip,action:function(){return this.$editor().wrapSelection("justifyLeft",null)},activeState:function(e){if(e&&"#document"===e.nodeName)return!1;var t=!1;if(e)try{t="left"===e.css("text-align")||"left"===e.attr("align")||"right"!==e.css("text-align")&&"center"!==e.css("text-align")&&"justify"!==e.css("text-align")&&!this.$editor().queryCommandState("justifyRight")&&!this.$editor().queryCommandState("justifyCenter")&&!this.$editor().queryCommandState("justifyFull")}catch(e){t=!1}return t=t||this.$editor().queryCommandState("justifyLeft")}}),e("justifyRight",{iconclass:"fa fa-align-right",tooltiptext:n.justifyRight.tooltip,action:function(){return this.$editor().wrapSelection("justifyRight",null)},activeState:function(e){if(e&&"#document"===e.nodeName)return!1;var t=!1;if(e)try{t="right"===e.css("text-align")}catch(e){t=!1}return t=t||this.$editor().queryCommandState("justifyRight")}}),e("justifyFull",{iconclass:"fa fa-align-justify",tooltiptext:n.justifyFull.tooltip,action:function(){return this.$editor().wrapSelection("justifyFull",null)},activeState:function(e){ +var t=!1;if(e)try{t="justify"===e.css("text-align")}catch(e){t=!1}return t=t||this.$editor().queryCommandState("justifyFull")}}),e("justifyCenter",{iconclass:"fa fa-align-center",tooltiptext:n.justifyCenter.tooltip,action:function(){return this.$editor().wrapSelection("justifyCenter",null)},activeState:function(e){if(e&&"#document"===e.nodeName)return!1;var t=!1;if(e)try{t="center"===e.css("text-align")}catch(e){t=!1}return t=t||this.$editor().queryCommandState("justifyCenter")}}),e("indent",{iconclass:"fa fa-indent",tooltiptext:n.indent.tooltip,action:function(){return this.$editor().wrapSelection("indent",null)},activeState:function(){return this.$editor().queryFormatBlockState("blockquote")},commandKeyCode:"TabKey"}),e("outdent",{iconclass:"fa fa-outdent",tooltiptext:n.outdent.tooltip,action:function(){return this.$editor().wrapSelection("outdent",null)},activeState:function(){return!1},commandKeyCode:"ShiftTabKey"}),e("italics",{iconclass:"fa fa-italic",tooltiptext:n.italic.tooltip,action:function(){return this.$editor().wrapSelection("italic",null)},activeState:function(){return this.$editor().queryCommandState("italic")},commandKeyCode:105}),e("underline",{iconclass:"fa fa-underline",tooltiptext:n.underline.tooltip,action:function(){return this.$editor().wrapSelection("underline",null)},activeState:function(){return this.$editor().queryCommandState("underline")},commandKeyCode:117}),e("strikeThrough",{iconclass:"fa fa-strikethrough",tooltiptext:n.strikeThrough.tooltip,action:function(){return this.$editor().wrapSelection("strikeThrough",null)},activeState:function(){return document.queryCommandState("strikeThrough")}}),e("clear",{iconclass:"fa fa-ban",tooltiptext:n.clear.tooltip,action:function(e,t){var n;this.$editor().wrapSelection("removeFormat",null);var i=angular.element(r.getSelectionElement());n=r.getAllSelectedElements();var o=function(e,t){e=angular.element(e);var n=t;return t||(n=e),angular.forEach(e.children(),function(e){if("ul"===e.tagName.toLowerCase()||"ol"===e.tagName.toLowerCase())n=o(e,n);else{var t=angular.element("

    ");t.html(angular.element(e).html()),n.after(t),n=t}}),e.remove(),n};angular.forEach(n,function(e){"ul"!==e.nodeName.toLowerCase()&&"ol"!==e.nodeName.toLowerCase()||o(e)}),angular.forEach(i.find("ul"),o),angular.forEach(i.find("ol"),o);var a=this.$editor(),s=function(e){e=angular.element(e),e[0]!==a.displayElements.text[0]&&e.removeAttr("class"),angular.forEach(e.children(),s)};angular.forEach(i,s),i[0]&&"li"!==i[0].tagName.toLowerCase()&&"ol"!==i[0].tagName.toLowerCase()&&"ul"!==i[0].tagName.toLowerCase()&&"true"!==i[0].getAttribute("contenteditable")&&this.$editor().wrapSelection("formatBlock","default"),t()}});var f=function(e){return-1!==e.toLowerCase().indexOf("javascript")};e("insertImage",{iconclass:"fa fa-picture-o",tooltiptext:n.insertImage.tooltip,action:function(){var e;if((e=t.prompt(n.insertImage.dialogPrompt,"http://"))&&""!==e&&"http://"!==e&&!f(e)){r.getSelectionElement().tagName&&"a"===r.getSelectionElement().tagName.toLowerCase()&&r.setSelectionAfterElement(r.getSelectionElement());var i='';return this.$editor().wrapSelection("insertHTML",i,!0)}},onElementSelect:{element:"img",action:i.imgOnSelectAction}}),e("insertVideo",{iconclass:"fa fa-youtube-play",tooltiptext:n.insertVideo.tooltip,action:function(){var e;if(e=t.prompt(n.insertVideo.dialogPrompt,"https://"),!f(e)&&e&&""!==e&&"https://"!==e&&(videoId=i.extractYoutubeVideoId(e),videoId)){var o="https://www.youtube.com/embed/"+videoId,a='';return r.getSelectionElement().tagName&&"a"===r.getSelectionElement().tagName.toLowerCase()&&r.setSelectionAfterElement(r.getSelectionElement()),this.$editor().wrapSelection("insertHTML",a,!0)}},onElementSelect:{element:"img",onlyWithAttrs:["ta-insert-video"],action:i.imgOnSelectAction}}),e("insertLink",{tooltiptext:n.insertLink.tooltip,iconclass:"fa fa-link",action:function(){var e;if((e=r.getSelectionElement().tagName&&"a"===r.getSelectionElement().tagName.toLowerCase()?t.prompt(n.insertLink.dialogPrompt,r.getSelectionElement().href):t.prompt(n.insertLink.dialogPrompt,"http://"))&&""!==e&&"http://"!==e&&!f(e))return this.$editor().wrapSelection("createLink",e,!0)},activeState:function(e){return!!e&&"A"===e[0].tagName},onElementSelect:{element:"a",action:i.aOnSelectAction}}),e("wordcount",{display:'
    Words:
    ',disabled:!0,wordcount:0,activeState:function(){var e=this.$editor().displayElements.text,t=e[0].innerHTML||"",n=0;return""!==t.replace(/\s*<[^>]*?>\s*/g,"")&&""!==t.trim()&&(n=t.replace(/<\/?(b|i|em|strong|span|u|strikethrough|a|img|small|sub|sup|label)( [^>*?])?>/gi,"").replace(/(<[^>]*?>\s*<[^>]*?>)/gi," ").replace(/(<[^>]*?>)/gi,"").replace(/\s+/gi," ").match(/\S+/g).length),this.wordcount=n,this.$editor().wordcount=n,!1}}),e("charcount",{display:'
    Characters:
    ',disabled:!0,charcount:0,activeState:function(){var e=this.$editor().displayElements.text,t=e[0].innerText||e[0].textContent,n=t.replace(/(\r\n|\n|\r)/gm,"").replace(/^\s+/g," ").replace(/\s+$/g," ").length;return this.charcount=n,this.$editor().charcount=n,!1}})}]),define("common/text-angular-setup",function(){});var textAngularVersion="v1.5.16",_browserDetect={ie:function(){for(var e=3,t=document.createElement("div"),n=t.getElementsByTagName("i");t.innerHTML="\x3c!--[if gt IE "+ ++e+"]>4?e:void 0}(),webkit:/AppleWebKit\/([\d.]+)/i.test(navigator.userAgent),isFirefox:navigator.userAgent.toLowerCase().indexOf("firefox")>-1},performance=performance||{};performance.now=function(){return performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()}}();var BLOCKELEMENTS=/^(address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i,LISTELEMENTS=/^(ul|li|ol)$/i,VALIDELEMENTS=/^(#text|span|address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i;String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var sheet,addCSSRule,removeCSSRule,_addCSSRule,_removeCSSRule,_getRuleIndex;if(_browserDetect.ie>8||void 0===_browserDetect.ie){for(var _sheets=document.styleSheets,i=0;i<_sheets.length;i++)if((0===_sheets[i].media.length||_sheets[i].media.mediaText.match(/(all|screen)/gi))&&_sheets[i].href&&_sheets[i].href.match(/textangular\.(min\.|)css/gi)){sheet=_sheets[i];break}sheet||(sheet=function(){var e=document.createElement("style");return _browserDetect.webkit&&e.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(e),e.sheet}()),addCSSRule=function(e,t){return _addCSSRule(sheet,e,t)},_addCSSRule=function(e,t,n){var r,i;return e.cssRules?r=Math.max(e.cssRules.length-1,0):e.rules&&(r=Math.max(e.rules.length-1,0)),e.insertRule?e.insertRule(t+"{"+n+"}",r):e.addRule(t,n,r),sheet.rules?i=sheet.rules[r]:sheet.cssRules&&(i=sheet.cssRules[r]),i},_getRuleIndex=function(e,t){var n,r;for(n=0;n
    ");return r[0].innerHTML=n,angular.forEach(e,function(e){var n=[];e.selector&&""!==e.selector?n=r.find(e.selector):e.customAttribute&&""!==e.customAttribute&&(n=t.getByAttribute(r,e.customAttribute)),angular.forEach(n,function(t){t=angular.element(t),e.selector&&""!==e.selector&&e.customAttribute&&""!==e.customAttribute?void 0!==t.attr(e.customAttribute)&&e.renderLogic(t):e.renderLogic(t)})}),r[0].innerHTML}}]).factory("taFixChrome",function(){return function(e,t){if(!e||!angular.isString(e)||e.length<=0)return e;for(var n,r,i,o=/style\s?=\s?(["'])(?:(?=(\\?))\2.)*?\1/gi,a=/([^<]+)<\/span>/gi,s="",l=0;n=a.exec(e);)i=n[1],i=i.replace(/ /gi," "),s+=e.substring(l,n.index)+i,l=n.index+n[0].length;if(l&&(s+=e.substring(l),e=s,s="",l=0),!t){for(;n=o.exec(e);)s+=e.substring(l,n.index-1),r=n[0],n=/font-family: inherit;|line-height: 1.[0-9]{3,12};|color: inherit; line-height: 1.1;|color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);|background-color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);/gi.exec(r),n?(r=r.replace(/( |)font-family: inherit;|( |)line-height: 1.[0-9]{3,12};|( |)color: inherit;|( |)color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);|( |)background-color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);/gi,""),r.length>8&&(s+=" "+r)):s+=" "+r,l=o.lastIndex;s+=e.substring(l)}if(l>0){return s.replace(/(.*?)<\/span>(|)/gi,"$1")}return e}}).factory("taSanitize",["$sanitize",function(e){function t(e,t){for(var n,r=0,i=0,o=/<[^>]*>/gi;n=o.exec(e);)if(i=n.index,"/"===n[0].substr(1,1)){if(0===r)break;r--}else r++;return t+e.substring(0,i)+angular.element(t)[0].outerHTML.substring(t.length)+e.substring(i)}function n(e){if(!e||!angular.isString(e)||e.length<=0)return e;for(var r,o,a,s,l,c,f=/<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/gi,d="",p="",h=0;o=f.exec(e);){s=o[3]||o[4];var m=new RegExp(u,"i");if(angular.isString(s)&&m.test(s)){l="";for(var g=new RegExp(u,"ig");a=g.exec(s);)for(r=0;r");c=n(e.substring(h,o.index)),d.length>0?p+=t(c,d):p+=c,s=s.replace(new RegExp(u,"ig"),""),p+="<"+o[1].trim(),s.length>0&&(p+=' style="'+s+'"'),p+=o[5]+">",h=o.index+o[0].length,d=l}}return d.length>0?p+=t(e.substring(h),d):p+=e.substring(h),p}function r(e){if(!e||!angular.isString(e)||e.length<=0)return e;for(var t,n=/<([^>\/]+?)align=("([^"]+)"|'([^']+)')([^>]*)>/gi,r="",i=0;t=n.exec(e);){r+=e.substring(i,t.index),i=t.index+t[0].length;var o="<"+t[1]+t[5];/style=("([^"]+)"|'([^']+)')/gi.test(o)?o=o.replace(/style=("([^"]+)"|'([^']+)')/i,'style="$2$3 text-align:'+(t[3]||t[4])+';"'):o+=' style="text-align:'+(t[3]||t[4])+';"',o+=">",r+=o}return r+e.substring(i)}for(var i=[{property:"font-weight",values:["bold"],tag:"b"},{property:"font-style",values:["italic"],tag:"i"}],o=[],a=0;a0&&(s+="|"),s+=i[a].values[l];s+=");)",o.push(s)}var u="("+o.join("|")+")",c=new RegExp(/[^<>]+?<\/span>/gi),f=new RegExp(/[^<>]+?<\/span>/gi),d=new RegExp(/[^<>]+?<\/span>/gi);return function(t,i,o){if(!o)try{t=n(t)}catch(e){}if(t=r(t))try{t=t.replace(c,""),t=t.replace(f,""),t=t.replace(c,""),t=t.replace(d,"")}catch(e){}var a;try{a=e(t),o&&(a=t)}catch(e){a=i||""}var s,l=a.match(/(]*>.*?<\/pre[^>]*>)/gi),u=a.replace(/(&#(9|10);)*/gi,""),p=/]*>.*?<\/pre[^>]*>/gi,h=0,m=0;for(a="";null!==(s=p.exec(u))&&h=0;i--)r=angular.element("<"+n+">"+o[i].innerHTML+""),t.after(r);t.remove(),e.setSelectionToElementEnd(r[0])},i=function(n,r,i,o,a){var s,l,u,c,f,d=n.find("li");for(l=0;l0&&(u=d[l-1]),l+1"+r[0].innerHTML+"":(p+="<"+t(i)+">",p+="
  • "+r[0].innerHTML+"
  • ",p+=""),s=angular.element(p),u)if(c){var h=(n.parent(),""),m=n[0].nodeName.toLowerCase();for(h+="<"+m+">",l=0;l"+d[l].innerHTML+"";h+="";var g="";for(g+="<"+m+">",l=f+1;l"+d[l].innerHTML+"";g+="",n.after(angular.element(g)),n.after(s),n.after(angular.element(h)),n.remove(),e.setSelectionToElementEnd(s[0])}else r.remove(),n.after(s),e.setSelectionToElementEnd(s[0]);else r.remove(),n.after(angular.element(n[0].outerHTML)),n.after(s),n.remove(),e.setSelectionToElementEnd(s[0])},o=function(n,r,i,o,a){var s,l,u,c,f,d=n.find("li"),p=[];for(l=0;l0&&(c=d[p[0]-1]),p[r.length-1]+1"+r[u].innerHTML+"",r[u].remove();else{for(h+="<"+t(i)+">",u=0;u"}if(s=angular.element(h),c)if(f){var m="",g=n[0].nodeName.toLowerCase();for(m+="<"+g+">",l=0;l"+d[l].innerHTML+"";m+="";var v="";for(v+="<"+g+">",l=p[r.length-1]+1;l"+d[l].innerHTML+"";v+="",n.after(angular.element(v)),n.after(s),n.after(angular.element(m)),n.remove(),e.setSelectionToElementEnd(s[0])}else n.after(s),e.setSelectionToElementEnd(s[0]);else n.after(angular.element(n[0].outerHTML)),n.after(s),n.remove(),e.setSelectionToElementEnd(s[0])},a=function(t){/()$/i.test(t.innerHTML.trim())?e.setSelectionBeforeElement(angular.element(t).find("br")[0]):e.setSelectionToElementEnd(t)},s=function(e,t){var n=angular.element("<"+t+">"+e[0].innerHTML+"");e.after(n),e.remove(),a(n.find("li")[0])},l=function(e,n,r){for(var i="",o=0;o"+e[o].innerHTML+"";var s=angular.element("<"+r+">"+i+"");n.after(s),n.remove(),a(s.find("li")[0])},u=function(e,t){for(var n=0;n"===t)return e;var i=angular.element(t);return i[0].innerHTML=e.innerHTML,e.parentNode.insertBefore(i[0],e),e.parentNode.removeChild(e),i};return function(a,c){return a=t(a),function(f,d,p,h){var m,g,v,$,y,b,w,x,C=angular.element("<"+a+">");try{e.getSelection&&(x=e.getSelection()),w=e.getSelectionElement();var E,k;void 0!==w.tagName&&("div"===w.tagName.toLowerCase()&&/taTextElement.+/.test(w.id)&&x&&x.start&&1===x.start.offset&&1===x.end.offset?(E=w.innerHTML,/
    /i.test(E)&&(E=E.replace(/
    /i,"​")),//i.test(E)&&(E=E.replace(//i,"​")),/()+/i.test(E)&&(E=__.replace(/()+/i,"")),/<\/span>(<\/span>)+/i.test(E)&&(E=__.replace(/<\/span>(<\/span>)+/i,"")),/<\/span>/i.test(E)&&(E=E.replace(/<\/span>/i,"")),k="
    "+E+"
    ",w.innerHTML=k,e.setSelectionToElementEnd(w.childNodes[0]),w=e.getSelectionElement()):"span"===w.tagName.toLowerCase()&&x&&x.start&&1===x.start.offset&&1===x.end.offset?(E=w.innerHTML,/
    /i.test(E)&&(E=E.replace(/
    /i,"​")),//i.test(E)&&(E=E.replace(//i,"​")),/()+/i.test(E)&&(E=__.replace(/()+/i,"")),/<\/span>(<\/span>)+/i.test(E)&&(E=__.replace(/<\/span>(<\/span>)+/i,"")),/<\/span>/i.test(E)&&(E=E.replace(/<\/span>/i,"")),k="
    "+E+"
    ",w.innerHTML=k,e.setSelectionToElementEnd(w.childNodes[0]),w=e.getSelectionElement()):"p"===w.tagName.toLowerCase()&&x&&x.start&&1===x.start.offset&&1===x.end.offset?(E=w.innerHTML,/
    /i.test(E)&&(E=E.replace(/
    /i,"​"),w.innerHTML=E)):"li"===w.tagName.toLowerCase()&&x&&x.start&&x.start.offset===x.end.offset&&(E=w.innerHTML,/
    /i.test(E)&&(E=E.replace(/
    /i,""),w.innerHTML=E)))}catch(e){}if(w){var S=angular.element(w),_=w&&w.tagName&&w.tagName.toLowerCase()||"";if("insertorderedlist"===f.toLowerCase()||"insertunorderedlist"===f.toLowerCase()){var M=t("insertorderedlist"===f.toLowerCase()?"ol":"ul"),T=e.getOnlySelectedElements();if(T.length>1&&("ol"===_||"ul"===_))return o(S,T,M,M===_,a);if(_===M)return S[0].childNodes.length!==T.length&&1===T.length?(S=angular.element(T[0]),i(S.parent(),S,M,!0,a)):r(S,a);if("li"===_&&S.parent()[0].tagName.toLowerCase()===M&&1===S.parent().children().length)return r(S.parent(),a);if("li"===_&&S.parent()[0].tagName.toLowerCase()!==M&&1===S.parent().children().length)return s(S.parent(),M);if(_.match(BLOCKELEMENTS)&&!S.hasClass("ta-bind")){if(T.length&&S[0].childNodes.length!==T.length&&1===T.length)return S=angular.element(T[0]),i(S.parent(),S,M,M===_,a);if("ol"===_||"ul"===_)return s(S,M);var D=!1;return angular.forEach(S.children(),function(e){e.tagName.match(BLOCKELEMENTS)&&(D=!0)}),D?l(S.children(),S,M):l([angular.element("
    "+w.innerHTML+"
    ")[0]],S,M)}if(_.match(BLOCKELEMENTS)){if($=e.getOnlySelectedElements(),0===$.length)g=angular.element("<"+M+">
  • "+w.innerHTML+"
  • "),S.html(""),S.append(g);else{if(1===$.length&&("ol"===$[0].tagName.toLowerCase()||"ul"===$[0].tagName.toLowerCase()))return $[0].tagName.toLowerCase()===M?r(angular.element($[0]),a):s(angular.element($[0]),M);v="";var A=[];for(m=0;m<$.length;m++)if(3!==$[m].nodeType){var O=angular.element($[m]);if("li"===$[m].tagName.toLowerCase())continue;"ol"===$[m].tagName.toLowerCase()||"ul"===$[m].tagName.toLowerCase()?v+=O[0].innerHTML:"span"!==$[m].tagName.toLowerCase()||"ol"!==$[m].childNodes[0].tagName.toLowerCase()&&"ul"!==$[m].childNodes[0].tagName.toLowerCase()?v+="<"+t("li")+">"+O[0].innerHTML+"":v+=O[0].childNodes[0].innerHTML,A.unshift(O)}g=angular.element("<"+M+">"+v+""),A.pop().replaceWith(g),angular.forEach(A,function(e){e.remove()})}return void e.setSelectionToElementEnd(g[0])}}else{if("formatblock"===f.toLowerCase()){for(b=p.toLowerCase().replace(/[<>]/gi,""),"default"===b.trim()&&(b=a,p="<"+a+">"),g="li"===_?S.parent():S;!g[0].tagName||!g[0].tagName.match(BLOCKELEMENTS)&&!g.parent().attr("contenteditable");)g=g.parent(),_=(g[0].tagName||"").toLowerCase();if(_===b){$=g.children();var N=!1;for(m=0;m<$.length;m++)N=N||$[m].tagName.match(BLOCKELEMENTS);N?(g.after($),y=g.next(),g.remove(),g=y):(C.append(g[0].childNodes),g.after(C),g.remove(),g=C)}else if(g.parent()[0].tagName.toLowerCase()!==b||g.parent().hasClass("ta-bind"))if(_.match(LISTELEMENTS))g.wrap(p);else{for($=e.getOnlySelectedElements(),0===$.length&&($=[g[0]]),m=0;m<$.length;m++)if(3===$[m].nodeType||!$[m].tagName.match(BLOCKELEMENTS))for(;3===$[m].nodeType||!$[m].tagName||!$[m].tagName.match(BLOCKELEMENTS);)$[m]=$[m].parentNode;if($=$.filter(function(e,t,n){return n.indexOf(e)===t}),$.length>1&&($=$.filter(function(e,t,n){return!("div"===e.nodeName.toLowerCase()&&/^taTextElement/.test(e.id))})),angular.element($[0]).hasClass("ta-bind"))g=angular.element(p),g[0].innerHTML=$[0].innerHTML,$[0].innerHTML=g[0].outerHTML;else if("blockquote"===b){for(v="",m=0;m<$.length;m++)v+=$[m].outerHTML;for(g=angular.element(p),g[0].innerHTML=v,$[0].parentNode.insertBefore(g[0],$[0]),m=$.length-1;m>=0;m--)$[m].parentNode&&$[m].parentNode.removeChild($[m])}else if("pre"===b&&e.getStateShiftKey()){for(v="",m=0;m<$.length;m++)v+=$[m].outerHTML;for(g=angular.element(p),g[0].innerHTML=v,$[0].parentNode.insertBefore(g[0],$[0]),m=$.length-1;m>=0;m--)$[m].parentNode&&$[m].parentNode.removeChild($[m])}else for(m=0;m<$.length;m++){var R=u($[m],p);$[m]===g[0]&&(g=angular.element(R))}}else{var I=g.parent(),P=I.contents();for(m=0;m"),C[0].innerHTML=P[m].outerHTML,P[m]=C[0]),I.parent()[0].insertBefore(P[m],I[0]);I.remove()}return e.setSelectionToElementEnd(g[0]),void g[0].focus()}if("createlink"===f.toLowerCase()){if("a"===_)return void(e.getSelectionElement().href=p);var L='';if(e.getSelection().collapsed)e.insertHtml(L+p+"",c);else if(rangy.getSelection().getRangeAt(0).canSurroundContents()){var F=angular.element(L+"")[0];rangy.getSelection().getRangeAt(0).surroundContents(F)}return}if("inserthtml"===f.toLowerCase())return void e.insertHtml(p,c)}try{n[0].execCommand(f,d,p)}catch(e){}}}}}]).service("taSelection",["$document","taDOM","$log",function(e,t,n){var r,i=e[0],o=function(e,t){return e.tagName&&e.tagName.match(/^br$/i)&&0===t&&!e.previousSibling?{element:e.parentNode,offset:0}:{element:e,offset:t}},a={getSelection:function(){var e;try{e=rangy.getSelection().getRangeAt(0)}catch(e){return}var t=e.commonAncestorContainer,n={start:o(e.startContainer,e.startOffset),end:o(e.endContainer,e.endOffset),collapsed:e.collapsed};return 3===t.nodeType&&("div"===t.parentNode.nodeName.toLowerCase()&&/^taTextElement/.test(t.parentNode.id)||(t=t.parentNode)),"div"===t.nodeName.toLowerCase()&&/^taTextElement/.test(t.id)?(n.start.element=t.childNodes[n.start.offset],n.end.element=t.childNodes[n.end.offset],n.container=t):t.parentNode===n.start.element||t.parentNode===n.end.element?n.container=t.parentNode:n.container=t,n},updateLeftArrowKey:function(e){var t=rangy.getSelection().getRangeAt(0);if(t&&t.collapsed){var n=a.getFlattenedDom(t);if(!n.findIndex)return;var r,i=t.startContainer,o=n.findIndex(function(e,t){return e.node===i||-1!==e.parents.indexOf(i)});if(n.forEach(function(e,t){e.parents.forEach(function(e,t){})}),o+10&&(s=n[o-1].node),0===t.startOffset&&s&&/^\ufeff([^\ufeff]*)$/.exec(s.textContent)&&a.setSelectionToElementEnd(s)}},updateRightArrowKey:function(e){},getFlattenedDom:function(e){function t(e){if(e.node.childNodes.length){Array.prototype.slice.call(e.node.childNodes).forEach(function(n){var r=e.parents.slice();r.slice(-1)[0]!==e.node&&r.push(e.node),t({parents:r,node:n})})}else r.push({parents:e.parents,node:e.node})}var n=e.commonAncestorContainer.parentNode;if(!n)return e.commonAncestorContainer.childNodes;var r=Array.prototype.slice.call(n.childNodes),i=r.indexOf(e.startContainer);return i+10||n.parentNode&&(n=n.parentNode),r=[],t({parents:[n],node:n}),r},getOnlySelectedElements:function(){var e=rangy.getSelection().getRangeAt(0),t=e.commonAncestorContainer;return t=3===t.nodeType?t.parentNode:t,e.getNodes([1],function(e){return e.parentNode===t})},getAllSelectedElements:function(){var e=rangy.getSelection().getRangeAt(0),t=e.commonAncestorContainer;t=3===t.nodeType?t.parentNode:t;var n=e.getNodes([1],function(e){return e.parentNode===t}),r=t.innerHTML;if((r=r.replace(/]+>\ufeff?<\/span>/gi,""))===e.toHtml()&&("div"!==t.nodeName.toLowerCase()||!/^taTextElement/.test(t.id))){for(var i=[],o=n.length;o--;i.unshift(n[o]));n=i,n.push(t)}return n},getSelectionElement:function(){return a.getSelection()?a.getSelection().container:void 0},setSelection:function(e,t,n,r){var i=rangy.createRange();i.setStart(e,n),i.setEnd(t,r),rangy.getSelection().setSingleRange(i)},setSelectionBeforeElement:function(e){var t=rangy.createRange();t.selectNode(e),t.collapse(!0),rangy.getSelection().setSingleRange(t)},setSelectionAfterElement:function(e){var t=rangy.createRange();t.selectNode(e),t.collapse(!1),rangy.getSelection().setSingleRange(t)},setSelectionToElementStart:function(e){var t=rangy.createRange();t.selectNodeContents(e),t.collapse(!0),rangy.getSelection().setSingleRange(t)},setSelectionToElementEnd:function(e){var t=rangy.createRange();t.selectNodeContents(e),t.collapse(!1),e.childNodes&&e.childNodes[e.childNodes.length-1]&&"br"===e.childNodes[e.childNodes.length-1].nodeName&&(t.startOffset=t.endOffset=t.startOffset-1),rangy.getSelection().setSingleRange(t)},setStateShiftKey:function(e){r=e},getStateShiftKey:function(){return r},insertHtml:function(e,n){var r,o,s,l,u,c,f,d=angular.element("
    "+e+"
    "),p=rangy.getSelection().getRangeAt(0),h=i.createDocumentFragment(),m=d[0].childNodes,g=!0;if(m.length>0){for(l=[],s=0;s)$/i.test(p.startContainer.innerHTML)&&p.selectNode(p.startContainer)}else g=!0,c=h=i.createTextNode(e);if(g)p.deleteContents();else if(p.collapsed&&p.startContainer!==n)if(p.startContainer.innerHTML&&p.startContainer.innerHTML.match(/^<[^>]*>$/i))r=p.startContainer,1===p.startOffset?(p.setStartAfter(r),p.setEndAfter(r)):(p.setStartBefore(r),p.setEndBefore(r));else{if(3===p.startContainer.nodeType&&p.startContainer.parentNode!==n)for(r=p.startContainer.parentNode,o=r.cloneNode(),t.splitNodes(r.childNodes,r,o,p.startContainer,p.startOffset);!VALIDELEMENTS.test(r.nodeName);){angular.element(r).after(o),r=r.parentNode;var y=o;o=r.cloneNode(),t.splitNodes(r.childNodes,r,o,y)}else r=p.startContainer,o=r.cloneNode(),t.splitNodes(r.childNodes,r,o,void 0,void 0,p.startOffset);if(angular.element(r).after(o),p.setStartAfter(r),p.setEndAfter(r),/^(|)$/i.test(r.innerHTML.trim())&&(p.setStartBefore(r),p.setEndBefore(r),angular.element(r).remove()),/^(|)$/i.test(o.innerHTML.trim())&&angular.element(o).remove(),"li"===r.nodeName.toLowerCase()){for(f=i.createDocumentFragment(),u=0;u"),t.transferChildNodes(h.childNodes[u],d[0]),t.transferNodeAttributes(h.childNodes[u],d[0]),f.appendChild(d[0]);h=f,c&&(c=h.childNodes[h.childNodes.length-1],c=c.childNodes[c.childNodes.length-1])}}else p.deleteContents();p.insertNode(h),c&&a.setSelectionToElementEnd(c)}};return a}]).service("taDOM",function(){var e={getByAttribute:function(t,n){var r=[],i=t.children();return i.length&&angular.forEach(i,function(t){r=r.concat(e.getByAttribute(angular.element(t),n))}),void 0!==t.attr(n)&&r.push(t),r},transferChildNodes:function(e,t){for(t.innerHTML="";e.childNodes.length>0;)t.appendChild(e.childNodes[0]);return t},splitNodes:function(t,n,r,i,o,a){if(!i&&isNaN(a))throw new Error("taDOM.splitNodes requires a splitNode or splitIndex");for(var s=document.createDocumentFragment(),l=document.createDocumentFragment(),u=0;t.length>0&&(isNaN(a)||a!==u)&&t[0]!==i;)s.appendChild(t[0]),u++;for(!isNaN(o)&&o>=0&&t[0]&&(s.appendChild(document.createTextNode(t[0].nodeValue.substring(0,o))),t[0].nodeValue=t[0].nodeValue.substring(o));t.length>0;)l.appendChild(t[0]);e.transferChildNodes(s,n),e.transferChildNodes(l,r)},transferNodeAttributes:function(e,t){for(var n=0;n");return t.html(e),t.text().length<=i}}}}).directive("taMinText",function(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){var i=parseInt(e.$eval(n.taMinText));if(isNaN(i))throw"Min text must be an integer";n.$observe("taMinText",function(e){if(i=parseInt(e),isNaN(i))throw"Min text must be an integer";r.$dirty&&r.$validate()}),r.$validators.taMinText=function(e){var t=angular.element("
    ");return t.html(e),!t.text().length||t.text().length>=i}}}}),angular.module("textAngular.taBind",["textAngular.factories","textAngular.DOM"]).service("_taBlankTest",[function(){return function(e){return!e||""===stripHtmlToText(e)&&!/]+>/.test(e)}}]).directive("taButton",[function(){return{link:function(e,t,n){t.attr("unselectable","on"),t.on("mousedown",function(e,t){return t&&angular.extend(e,t),e.preventDefault(),!1})}}}]).directive("taBind",["taSanitize","$timeout","$document","taFixChrome","taBrowserTag","taSelection","taSelectableElements","taApplyCustomRenderers","taOptions","_taBlankTest","$parse","taDOM","textAngularManager",function(e,t,n,r,i,o,a,s,l,u,c,f,d){return{priority:2,require:["ngModel","?ngModelOptions"],link:function(i,f,p,h){function m(e){var t;return R.forEach(function(n){if(n.keyCode===e.keyCode){var r=(e.metaKey?A:0)+(e.ctrlKey?D:0)+(e.shiftKey?N:0)+(e.altKey?O:0);if(n.forbiddenModifiers&r)return;n.mustHaveModifiers.every(function(e){return r&e})&&(t=n.specialKey)}}),t}var g,v,$,y=h[0],b=h[1]||{},w=void 0!==f.attr("contenteditable")&&f.attr("contenteditable"),x=w||"textarea"===f[0].tagName.toLowerCase()||"input"===f[0].tagName.toLowerCase(),C=!1,E=!1,k=!1,S=p.taUnsafeSanitizer||l.disableSanitizer,_=p.taKeepStyles||l.keepStyles,M=/^(9|19|20|27|33|34|35|36|37|38|39|40|45|112|113|114|115|116|117|118|119|120|121|122|123|144|145)$/i,T=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,D=1,A=2,O=4,N=8,R=[{specialKey:"UndoKey",forbiddenModifiers:O+N,mustHaveModifiers:[A+D],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:O,mustHaveModifiers:[A+D,N],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:O+N,mustHaveModifiers:[A+D],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:A+N+O+D,mustHaveModifiers:[],keyCode:9},{specialKey:"ShiftTabKey",forbiddenModifiers:A+O+D,mustHaveModifiers:[N],keyCode:9}];void 0===p.taDefaultWrap&&(p.taDefaultWrap="p"),""===p.taDefaultWrap?($="",void 0===_browserDetect.ie||(_browserDetect.ie>=11||_browserDetect.ie)):($=void 0===_browserDetect.ie||_browserDetect.ie>=11?"br"===p.taDefaultWrap.toLowerCase()?"

    ":"<"+p.taDefaultWrap+">
    ":_browserDetect.ie<=8?"<"+p.taDefaultWrap.toUpperCase()+">":"<"+p.taDefaultWrap+">",void 0===_browserDetect.ie||_browserDetect.ie>=11?"br"===p.taDefaultWrap.toLowerCase()||(p.taDefaultWrap,p.taDefaultWrap):_browserDetect.ie<=8?(p.taDefaultWrap.toUpperCase(),p.taDefaultWrap.toUpperCase()):(p.taDefaultWrap,p.taDefaultWrap)),b.$options||(b.$options={});var I=function(e){if(u(e))return e;var t=angular.element("
    "+e+"
    ");if(0===t.children().length)e="<"+p.taDefaultWrap+">"+e+"";else{var n,r=t[0].childNodes,i=!1;for(n=0;n"+s+"":e+=s}else if(a.match(BLOCKELEMENTS))e+=o.outerHTML;else{var l=o.outerHTML||o.nodeValue;""!==l.trim()?e+="<"+p.taDefaultWrap+">"+l+"":e+=l}}else e="<"+p.taDefaultWrap+">"+e+""}return e};p.taPaste&&(v=c(p.taPaste)),f.addClass("ta-bind");var P;i["$undoManager"+(p.id||"")]=y.$undoManager={_stack:[],_index:0,_max:1e3,push:function(e){return void 0===e||null===e||void 0!==this.current()&&null!==this.current()&&e===this.current()?e:(this._indexthis._max&&this._stack.shift(),this._index=this._stack.length-1,e)},undo:function(){ +return this.setToIndex(this._index-1)},redo:function(){return this.setToIndex(this._index+1)},setToIndex:function(e){if(!(e<0||e>this._stack.length-1))return this._index=e,this.current()},current:function(){return this._stack[this._index]}};var L,F=function(){if(w)return f[0].innerHTML;if(x)return f.val();throw"textAngular Error: attempting to update non-editable taBind"},U=function(e){return i.$emit("ta-element-select",this),e.preventDefault(),!1},j=i["reApplyOnSelectorHandlers"+(p.id||"")]=function(){C||angular.forEach(a,function(e){f.find(e).off("click",U).on("click",U)})},H=function(e,t,n){k=n||!1,void 0!==t&&null!==t||(t=w),void 0!==e&&null!==e||(e=F()),u(e)?(""!==y.$viewValue&&y.$setViewValue(""),t&&""!==y.$undoManager.current()&&y.$undoManager.push("")):(j(),y.$viewValue!==e&&(y.$setViewValue(e),t&&y.$undoManager.push(e))),y.$render()},q=function(e){f[0].innerHTML=e},V=i["$undoTaBind"+(p.id||"")]=function(){if(!C&&w){var e=y.$undoManager.undo();void 0!==e&&null!==e&&(q(e),H(e,!1),L&&t.cancel(L),L=t(function(){f[0].focus(),o.setSelectionToElementEnd(f[0])},1))}},B=i["$redoTaBind"+(p.id||"")]=function(){if(!C&&w){var e=y.$undoManager.redo();void 0!==e&&null!==e&&(q(e),H(e,!1),L&&t.cancel(L),L=t(function(){f[0].focus(),o.setSelectionToElementEnd(f[0])},1))}};i["updateTaBind"+(p.id||"")]=function(){C||H(void 0,void 0,!0)};var z=function(t){return y.$oldViewValue=e(r(t,_),y.$oldViewValue,S)};if(f.attr("required")&&(y.$validators.required=function(e,t){return!u(e||t)}),y.$parsers.push(z),y.$parsers.unshift(I),y.$formatters.push(z),y.$formatters.unshift(I),y.$formatters.unshift(function(e){return y.$undoManager.push(e||"")}),x)if(i.events={},w){var Y=!1,W=function(n){var r=void 0!==n&&n.match(/content=["']*OneNote.File/i);if(n&&n.trim().length){if(n.match(/class=["']*Mso(Normal|List)/i)||n.match(/content=["']*Word.Document/i)||n.match(/content=["']*OneNote.File/i)){var a=n.match(/([\s\S]*?)/i);a=a?a[1]:n,a=a.replace(/[\s\S]*?<\/o:p>/gi,"").replace(/class=(["']|)MsoNormal(["']|)/gi,"");var s=angular.element("
    "+a+"
    "),l=angular.element("
    "),u={element:null,lastIndent:[],lastLi:null,isUl:!1};u.lastIndent.peek=function(){var e=this.length;if(e>0)return this[e-1]};for(var c=function(e){u.isUl=e,u.element=angular.element(e?"
      ":"
        "),u.lastIndent=[],u.lastIndent.peek=function(){var e=this.length;if(e>0)return this[e-1]},u.lastLevelMatch=null},d=0;d<=s[0].childNodes.length;d++)if(s[0].childNodes[d]&&"#text"!==s[0].childNodes[d].nodeName){var p=s[0].childNodes[d].tagName.toLowerCase();if("p"===p||"ul"===p||"h1"===p||"h2"===p||"h3"===p||"h4"===p||"h5"===p||"h6"===p||"table"===p){var h=angular.element(s[0].childNodes[d]),m=(h.attr("class")||"").match(/MsoList(Bullet|Number|Paragraph)(CxSp(First|Middle|Last)|)/i);if(m){if(h[0].childNodes.length<2||h[0].childNodes[1].childNodes.length<1)continue;var g="bullet"===m[1].toLowerCase()||"number"!==m[1].toLowerCase()&&!(/^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]]":"
          "),u.lastLi.append(u.element);else if(null!=u.lastIndent.peek()&&u.lastIndent.peek()>b){for(;null!=u.lastIndent.peek()&&u.lastIndent.peek()>b;)if("li"!==u.element.parent()[0].tagName.toLowerCase()){if(!/[uo]l/i.test(u.element.parent()[0].tagName.toLowerCase()))break;u.element=u.element.parent(),u.lastIndent.pop()}else u.element=u.element.parent();u.isUl="ul"===u.element[0].tagName.toLowerCase(),g!==u.isUl&&(c(g),l.append(u.element))}u.lastLevelMatch=w,b!==u.lastIndent.peek()&&u.lastIndent.push(b),u.lastLi=angular.element("
        1. "),u.element.append(u.lastLi),u.lastLi.html(h.html().replace(/[\s\S]*?/gi,"")),h.remove()}else c(!1),l.append(h)}}var x=function(e){e=angular.element(e);for(var t=e[0].childNodes.length-1;t>=0;t--)e.after(e[0].childNodes[t]);e.remove()};angular.forEach(l.find("span"),function(e){e.removeAttribute("lang"),e.attributes.length<=0&&x(e)}),angular.forEach(l.find("font"),x),n=l.html(),r&&(n=l.html()||s.html()),n=n.replace(/\n/g," ")}else{if(n=n.replace(/<(|\/)meta[^>]*?>/gi,""),n.match(/<[^>]*?(ta-bind)[^>]*?>/)){if(n.match(/<[^>]*?(text-angular)[^>]*?>/)){var C=angular.element("
          "+n+"
          ");C.find("textarea").remove();for(var E=0;E',"")}}else n.match(/^.<\/span>/gi)||(n=n.replace(/<(|\/)span[^>]*?>/gi,"")));n=n.replace(/
          ]*?>/gi,"").replace(/( | )<\/span>/gi," ")}//i.test(n)&&!1===/(|).*/i.test(n)&&(n=n.replace(/.*<\/li(\s.*)?>/i,"
            $&
          ")),n=n.replace(/^[ |\u00A0]+/gm,function(e){for(var t="",n=0;n").replace(/\t/g,"    "),v&&(n=v(i,{$html:n})||n),n=n.replace(/]*?)("|')>([^<]+?)<\/span>/g,"$5"),n=e(n,"",S),o.insertHtml(n,f[0]),t(function(){y.$setViewValue(F()),Y=!1,f.removeClass("processing-paste")},0)}else Y=!1,f.removeClass("processing-paste")};f.on("paste",i.events.paste=function(e,r){if(r&&angular.extend(e,r),C||Y)return e.stopPropagation(),e.preventDefault(),!1;Y=!0,f.addClass("processing-paste");var i,o=(e.originalEvent||e).clipboardData;if(!o&&window.clipboardData&&window.clipboardData.getData)return i=window.clipboardData.getData("Text"),W(i),e.stopPropagation(),e.preventDefault(),!1;if(o&&o.getData&&o.types.length>0){for(var a="",s=0;s
    ');n.find("body").append(u),u[0].focus(),t(function(){rangy.restoreSelection(l),W(u[0].innerHTML),f[0].focus(),u.remove()},0)}),f.on("cut",i.events.cut=function(e){C?e.preventDefault():t(function(){y.$setViewValue(F())},0)}),f.on("keydown",i.events.keydown=function(e,t){t&&angular.extend(e,t),16===e.keyCode?o.setStateShiftKey(!0):o.setStateShiftKey(!1),e.specialKey=m(e);var n;if(l.keyMappings.forEach(function(t){e.specialKey===t.commandKeyCode&&(e.specialKey=void 0),t.testForKey(e)&&(n=t.commandKeyCode),"UndoKey"!==t.commandKeyCode&&"RedoKey"!==t.commandKeyCode||t.enablePropagation||e.preventDefault()}),void 0!==n&&(e.specialKey=n),void 0===e.specialKey||"UndoKey"===e.specialKey&&"RedoKey"===e.specialKey||(e.preventDefault(),d.sendKeyCommand(i,e)),!(C||("UndoKey"===e.specialKey&&(V(),e.preventDefault()),"RedoKey"===e.specialKey&&(B(),e.preventDefault()),13!==e.keyCode||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey))){var r,a=o.getSelectionElement();if(!a.nodeName.match(VALIDELEMENTS))return;var s=angular.element($),u=["blockquote","ul","ol"];if(function(e,t){for(var n=0;n$/i.test(a.innerHTML.trim())&&!a.nextSibling){r=angular.element(a);var c=r.parent();c.after(s),r.remove(),0===c.children().length&&c.remove(),o.setSelectionToElementStart(s[0]),e.preventDefault()}/^<[^>]+><\/[^>]+>$/i.test(a.innerHTML.trim())&&(r=angular.element(a),r.after(s),r.remove(),o.setSelectionToElementStart(s[0]),e.preventDefault())}}});var G;f.on("keyup",i.events.keyup=function(e,n){if(n&&angular.extend(e,n),o.setStateShiftKey(!1),9===e.keyCode){return void(o.getSelection().start.element===f[0]&&f.children().length&&o.setSelectionToElementStart(f.children()[0]))}if(37!==e.keyCode||e.shiftKey||o.updateLeftArrowKey(f),39!==e.keyCode||e.shiftKey||o.updateRightArrowKey(f),P&&t.cancel(P),!C&&!M.test(e.keyCode))if(13===e.keyCode&&(e.ctrlKey||e.metaKey||e.altKey));else{if(""!==$&&"

    "!==$&&13===e.keyCode&&!e.ctrlKey&&!e.metaKey&&!e.altKey){for(var r=o.getSelectionElement();!r.nodeName.match(VALIDELEMENTS)&&r!==f[0];)r=r.parentNode;if(e.shiftKey){var i=r.tagName.toLowerCase();if((i===p.taDefaultWrap||"li"===i||"pre"===i||"div"===i)&&!/.+

    /.test(r.innerHTML.trim())){var a=r.previousSibling;a&&(a.innerHTML=a.innerHTML+"

    ",angular.element(r).remove(),o.setSelectionToElementEnd(a))}}else if(r.tagName.toLowerCase()!==p.taDefaultWrap&&"li"!==r.nodeName.toLowerCase()&&(""===r.innerHTML.trim()||"
    "===r.innerHTML.trim())){var s=angular.element($);angular.element(r).replaceWith(s),o.setSelectionToElementStart(s[0])}}var l=F();""===$||""!==l.trim()&&"
    "!==l.trim()?"<"!==l.substring(0,1)&&p.taDefaultWrap:(q($),o.setSelectionToElementStart(f.children()[0]));var u=g!==e.keyCode&&T.test(e.keyCode);G&&t.cancel(G),G=t(function(){H(l,u,!0)},b.$options.debounce||400),u||(P=t(function(){y.$undoManager.push(l)},250)),g=e.keyCode}});var K;if(f.on("input",function(){F()!==y.$viewValue&&(K&&t.cancel(K),K=t(function(){var e=rangy.saveSelection(),t=F();t!==y.$viewValue&&H(t,!0),0!==y.$viewValue.length&&rangy.restoreSelection(e)},1e3))}),f.on("blur",i.events.blur=function(){E=!1,C?(k=!0,y.$render()):H(void 0,void 0,!0)}),p.placeholder&&(_browserDetect.ie>8||void 0===_browserDetect.ie)){var Z;if(!p.id)throw"textAngular Error: An unique ID is required for placeholders to work";Z=addCSSRule("#"+p.id+".placeholder-text:before",'content: "'+p.placeholder+'"'),i.$on("$destroy",function(){removeCSSRule(Z)})}f.on("focus",i.events.focus=function(){E=!0,f.removeClass("placeholder-text"),j()}),f.on("mouseup",i.events.mouseup=function(){var e=o.getSelection();e&&e.start.element===f[0]&&f.children().length&&o.setSelectionToElementStart(f.children()[0])}),f.on("mousedown",i.events.mousedown=function(e,t){t&&angular.extend(e,t),e.stopPropagation()})}else{f.on("change blur",i.events.change=i.events.blur=function(){C||y.$setViewValue(F())}),f.on("keydown",i.events.keydown=function(e,t){if(t&&angular.extend(e,t),9===e.keyCode){var n=this.selectionStart,r=this.selectionEnd,i=f.val();if(e.shiftKey){var o=i.lastIndexOf("\n",n),a=i.lastIndexOf("\t",n);-1!==a&&a>=o&&(f.val(i.substring(0,a)+i.substring(a+1)),this.selectionStart=this.selectionEnd=n-1)}else f.val(i.substring(0,n)+"\t"+i.substring(r)),this.selectionStart=this.selectionEnd=n+1;e.preventDefault()}});var J=function(e,t){for(var n="",r=0;r"+e+"
    ")[0].childNodes;return t.length>0&&(e="",X(t,function(t,n){var r=n.nodeName.toLowerCase();return"#comment"===r?void(e+="\x3c!--"+n.nodeValue+"--\x3e"):"#text"===r?void(e+=n.textContent):void(n.outerHTML&&(e.length>0&&(e+="\n"),e+="ul"===r||"ol"===r?""+Q(n,0):""+n.outerHTML))})),e})}var ee,te=function(e,n){if(n&&angular.extend(e,n),!dropFired&&!C){dropFired=!0;var r;r=e.originalEvent?e.originalEvent.dataTransfer:e.dataTransfer,i.$emit("ta-drop-event",this,e,r),t(function(){dropFired=!1,H(void 0,void 0,!0)},100)}},ne=!1;y.$render=function(){if(!ne){ne=!0;var e=y.$viewValue||"";k||(w&&E&&(f.removeClass("placeholder-text"),ee&&t.cancel(ee),ee=t(function(){E||(f[0].focus(),o.setSelectionToElementEnd(f.children()[f.children().length-1])),ee=void 0},1)),w?(q(p.placeholder?""===e?$:e:""===e?$:e),C?f.off("drop",te):(j(),f.on("drop",te))):"textarea"!==f[0].tagName.toLowerCase()&&"input"!==f[0].tagName.toLowerCase()?q(s(e)):f.val(e)),w&&p.placeholder&&(""===e?E?f.removeClass("placeholder-text"):f.addClass("placeholder-text"):f.removeClass("placeholder-text")),ne=k=!1}},p.taReadonly&&(C=i.$eval(p.taReadonly),C?(f.addClass("ta-readonly"),"textarea"!==f[0].tagName.toLowerCase()&&"input"!==f[0].tagName.toLowerCase()||f.attr("disabled","disabled"),void 0!==f.attr("contenteditable")&&f.attr("contenteditable")&&f.removeAttr("contenteditable")):(f.removeClass("ta-readonly"),"textarea"===f[0].tagName.toLowerCase()||"input"===f[0].tagName.toLowerCase()?f.removeAttr("disabled"):w&&f.attr("contenteditable","true")),i.$watch(p.taReadonly,function(e,t){t!==e&&(e?(f.addClass("ta-readonly"),"textarea"!==f[0].tagName.toLowerCase()&&"input"!==f[0].tagName.toLowerCase()||f.attr("disabled","disabled"),void 0!==f.attr("contenteditable")&&f.attr("contenteditable")&&f.removeAttr("contenteditable"),angular.forEach(a,function(e){f.find(e).on("click",U)}),f.off("drop",te)):(f.removeClass("ta-readonly"),"textarea"===f[0].tagName.toLowerCase()||"input"===f[0].tagName.toLowerCase()?f.removeAttr("disabled"):w&&f.attr("contenteditable","true"),angular.forEach(a,function(e){f.find(e).off("click",U)}),f.on("drop",te)),C=e)})),w&&!C&&(angular.forEach(a,function(e){f.find(e).on("click",U)}),f.on("drop",te))}}}]);var dropFired=!1,textAngular=angular.module("textAngular",["ngSanitize","textAngularSetup","textAngular.factories","textAngular.DOM","textAngular.validators","textAngular.taBind"]);textAngular.config([function(){angular.forEach(taTools,function(e,t){delete taTools[t]})}]),textAngular.directive("textAngular",["$compile","$timeout","taOptions","taSelection","taExecCommand","textAngularManager","$document","$animate","$log","$q","$parse",function(e,t,n,r,i,o,a,s,l,u,c){return{require:"?ngModel",scope:{},restrict:"EA",priority:2,link:function(f,d,p,h){var m,g,v,$,y,b,w,x,C,E,k,S,_=p.serial?p.serial:Math.floor(1e16*Math.random());f._name=p.name?p.name:"textAngularEditor"+_;var M=function(e,n,r){t(function(){e.one(n,r)},100)};if(C=i(p.taDefaultWrap),angular.extend(f,angular.copy(n),{wrapSelection:function(e,t,n){"undo"===e.toLowerCase()?f["$undoTaBindtaTextElement"+_]():"redo"===e.toLowerCase()?f["$redoTaBindtaTextElement"+_]():(C(e,!1,t,f.defaultTagAttributes),n&&f["reApplyOnSelectorHandlerstaTextElement"+_](),f.displayElements.text[0].focus())},showHtml:f.$eval(p.taShowHtml)||!1}),p.taFocussedClass&&(f.classes.focussed=p.taFocussedClass),p.taTextEditorClass&&(f.classes.textEditor=p.taTextEditorClass),p.taHtmlEditorClass&&(f.classes.htmlEditor=p.taHtmlEditorClass),p.taDefaultTagAttributes)try{angular.extend(f.defaultTagAttributes,angular.fromJson(p.taDefaultTagAttributes))}catch(e){l.error(e)}p.taTextEditorSetup&&(f.setup.textEditorSetup=f.$parent.$eval(p.taTextEditorSetup)),p.taHtmlEditorSetup&&(f.setup.htmlEditorSetup=f.$parent.$eval(p.taHtmlEditorSetup)),p.taFileDrop?f.fileDropHandler=f.$parent.$eval(p.taFileDrop):f.fileDropHandler=f.defaultFileDropHandler,w=d[0].innerHTML,d[0].innerHTML="",f.displayElements={forminput:angular.element(""),html:angular.element(""),text:angular.element("
    "),scrollWindow:angular.element("
    "),popover:angular.element('
    '),popoverArrow:angular.element('
    '),popoverContainer:angular.element('
    '),resize:{overlay:angular.element('
    '),background:angular.element('
    '),anchors:[angular.element('
    '),angular.element('
    '),angular.element('
    '),angular.element('
    ')],info:angular.element('
    ')}},f.displayElements.popover.append(f.displayElements.popoverArrow),f.displayElements.popover.append(f.displayElements.popoverContainer),f.displayElements.scrollWindow.append(f.displayElements.popover),f.displayElements.popover.on("mousedown",function(e,t){return t&&angular.extend(e,t),e.preventDefault(),!1}),f.handlePopoverEvents=function(){"block"===f.displayElements.popover.css("display")&&(S&&t.cancel(S),S=t(function(){f.reflowPopover(f.resizeElement),f.reflowResizeOverlay(f.resizeElement)},100))},angular.element(window).on("resize",f.handlePopoverEvents),angular.element(window).on("scroll",f.handlePopoverEvents);var T=function(e){var t,n={vertical:!1,horizontal:!1};try{if(null===(t=window.getComputedStyle(e)))return n}catch(e){return n}var r=t["overflow-y"],i=t["overflow-x"];return{vertical:("scroll"===r||"auto"===r)&&e.scrollHeight>e.clientHeight,horizontal:("scroll"===i||"auto"===i)&&e.scrollWidth>e.clientWidth}};f.getScrollTop=function(e,t){var n=e.scrollTop;return void 0===n&&(n=0),t&&T(e).vertical&&(e.removeEventListener("scroll",f._scrollListener,!1),e.addEventListener("scroll",f._scrollListener,!1)),0!==n?{node:e.nodeName,top:n}:e.parentNode?f.getScrollTop(e.parentNode,t):{node:"",top:0}},f.showPopover=function(e){f.getScrollTop(f.displayElements.scrollWindow[0],!0),f.displayElements.popover.css("display","block"),t(function(){f.displayElements.resize.overlay.css("display","block")}),f.resizeElement=e,f.reflowPopover(e),s.addClass(f.displayElements.popover,"in"),M(a.find("body"),"click keyup",function(){f.hidePopover()})},f._scrollListener=function(e,t){f.handlePopoverEvents()},f.reflowPopover=function(e){var t=f.getScrollTop(f.displayElements.scrollWindow[0],!1);e[0].offsetTop-t.top<51?(f.displayElements.popover.css("top",e[0].offsetTop+e[0].offsetHeight+f.displayElements.scrollWindow[0].scrollTop+"px"),f.displayElements.popover.removeClass("top").addClass("bottom")):(f.displayElements.popover.css("top",e[0].offsetTop-54+f.displayElements.scrollWindow[0].scrollTop+"px"),f.displayElements.popover.removeClass("bottom").addClass("top"));var n=f.displayElements.text[0].offsetWidth-f.displayElements.popover[0].offsetWidth,r=e[0].offsetLeft+e[0].offsetWidth/2-f.displayElements.popover[0].offsetWidth/2,i=Math.max(0,Math.min(n,r)),o=Math.min(r,Math.max(0,r-n))-11;i+=window.scrollX,o-=window.scrollX,f.displayElements.popover.css("left",i+"px"),f.displayElements.popoverArrow.css("margin-left",o+"px")},f.hidePopover=function(){f.displayElements.popover.css("display","none"),f.displayElements.popoverContainer.attr("style",""),f.displayElements.popoverContainer.attr("class","popover-content"),f.displayElements.popover.removeClass("in"),f.displayElements.resize.overlay.css("display","none")},f.displayElements.resize.overlay.append(f.displayElements.resize.background),angular.forEach(f.displayElements.resize.anchors,function(e){f.displayElements.resize.overlay.append(e)}),f.displayElements.resize.overlay.append(f.displayElements.resize.info),f.displayElements.scrollWindow.append(f.displayElements.resize.overlay),f.displayElements.resize.background.on("click",function(e){f.displayElements.text[0].focus()}),f.reflowResizeOverlay=function(e){e=angular.element(e)[0],f.displayElements.resize.overlay.css({display:"block",left:e.offsetLeft-5+"px",top:e.offsetTop-5+"px",width:e.offsetWidth+10+"px",height:e.offsetHeight+10+"px"}),f.displayElements.resize.info.text(e.offsetWidth+" x "+e.offsetHeight)},f.showResizeOverlay=function(e){var t=a.find("body");E=function(n){var r={width:parseInt(e.attr("width")),height:parseInt(e.attr("height")),x:n.clientX,y:n.clientY};(void 0===r.width||isNaN(r.width))&&(r.width=e[0].offsetWidth),(void 0===r.height||isNaN(r.height))&&(r.height=e[0].offsetHeight),f.hidePopover();var i=r.height/r.width,o=function(t){function n(e){return Math.round(Math.max(0,e))}var o={x:Math.max(0,r.width+(t.clientX-r.x)),y:Math.max(0,r.height+(t.clientY-r.y))},a=void 0!==p.taResizeForceAspectRatio,s=p.taResizeMaintainAspectRatio;if(a||s&&!t.shiftKey){var l=o.y/o.x;o.x=i>l?o.x:o.y/i,o.y=i>l?o.x*i:o.y}var u=angular.element(e);u.css("height",n(o.y)+"px"),u.css("width",n(o.x)+"px"),f.reflowResizeOverlay(e)};t.on("mousemove",o),M(t,"mouseup",function(e){e.preventDefault(),e.stopPropagation(),t.off("mousemove",o),f.$apply(function(){f.hidePopover(),f.updateTaBindtaTextElement()},100)}),n.stopPropagation(),n.preventDefault()},f.displayElements.resize.anchors[3].off("mousedown"),f.displayElements.resize.anchors[3].on("mousedown",E),f.reflowResizeOverlay(e),M(t,"click",function(){f.hideResizeOverlay()})},f.hideResizeOverlay=function(){f.displayElements.resize.anchors[3].off("mousedown",E),f.displayElements.resize.overlay.css("display","none")},f.setup.htmlEditorSetup(f.displayElements.html),f.setup.textEditorSetup(f.displayElements.text),f.displayElements.html.attr({id:"taHtmlElement"+_,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":d.attr("ng-model-options")}),f.displayElements.text.attr({id:"taTextElement"+_,contentEditable:"true","ta-bind":"ta-bind","ng-model":"html","ng-model-options":d.attr("ng-model-options")}),f.displayElements.scrollWindow.attr({"ng-hide":"showHtml"}),p.taDefaultWrap&&f.displayElements.text.attr("ta-default-wrap",p.taDefaultWrap),p.taUnsafeSanitizer&&(f.displayElements.text.attr("ta-unsafe-sanitizer",p.taUnsafeSanitizer),f.displayElements.html.attr("ta-unsafe-sanitizer",p.taUnsafeSanitizer)),p.taKeepStyles&&(f.displayElements.text.attr("ta-keep-styles",p.taKeepStyles),f.displayElements.html.attr("ta-keep-styles",p.taKeepStyles)),f.displayElements.scrollWindow.append(f.displayElements.text),d.append(f.displayElements.scrollWindow),d.append(f.displayElements.html),f.displayElements.forminput.attr("name",f._name),d.append(f.displayElements.forminput),p.tabindex&&(d.removeAttr("tabindex"),f.displayElements.text.attr("tabindex",p.tabindex),f.displayElements.html.attr("tabindex",p.tabindex)),p.placeholder&&(f.displayElements.text.attr("placeholder",p.placeholder),f.displayElements.html.attr("placeholder",p.placeholder)),p.taDisabled&&(f.displayElements.text.attr("ta-readonly","disabled"),f.displayElements.html.attr("ta-readonly","disabled"),f.disabled=f.$parent.$eval(p.taDisabled),f.$parent.$watch(p.taDisabled,function(e){f.disabled=e,f.disabled?d.addClass(f.classes.disabled):d.removeClass(f.classes.disabled)})),p.taPaste&&(f._pasteHandler=function(e){return c(p.taPaste)(f.$parent,{$html:e})},f.displayElements.text.attr("ta-paste","_pasteHandler($html)")),e(f.displayElements.scrollWindow)(f),e(f.displayElements.html)(f),f.updateTaBindtaTextElement=f["updateTaBindtaTextElement"+_],f.updateTaBindtaHtmlElement=f["updateTaBindtaHtmlElement"+_],d.addClass("ta-root"),f.displayElements.scrollWindow.addClass("ta-text ta-editor "+f.classes.textEditor),f.displayElements.html.addClass("ta-html ta-editor "+f.classes.htmlEditor);var D=function(e,t){t!==a[0].queryCommandState(e)&&a[0].execCommand(e,!1,null)};f._actionRunning=!1;var A=!1;if(f.startAction=function(){var e=!1,t=!1,n=!1,r=!1;return f._actionRunning=!0,e=a[0].queryCommandState("bold"),t=a[0].queryCommandState("italic"),n=a[0].queryCommandState("underline"),r=a[0].queryCommandState("strikeThrough"),A=rangy.saveSelection(),D("bold",e),D("italic",t),D("underline",n),D("strikeThrough",r),function(){A&&rangy.restoreSelection(A)}},f.endAction=function(){f._actionRunning=!1,A&&(f.showHtml?f.displayElements.html[0].focus():f.displayElements.text[0].focus(),rangy.removeMarkers(A)),A=!1,f.updateSelectedStyles(),f.showHtml||f["updateTaBindtaTextElement"+_]()},y=function(e){f.focussed=!0,d.addClass(f.classes.focussed),x.focus(),d.triggerHandler("focus"),f.updateSelectedStyles&&!f._bUpdateSelectedStyles&&t(function(){f.updateSelectedStyles()},0)},f.displayElements.html.on("focus",y),f.displayElements.text.on("focus",y),b=function(e){return f._actionRunning||a[0].activeElement===f.displayElements.html[0]||a[0].activeElement===f.displayElements.text[0]||(d.removeClass(f.classes.focussed),x.unfocus(),t(function(){f._bUpdateSelectedStyles=!1,d.triggerHandler("blur"),f.focussed=!1},0)),e.preventDefault(),!1},f.displayElements.html.on("blur",b),f.displayElements.text.on("blur",b),f.displayElements.text.on("paste",function(e){d.triggerHandler("paste",e)}),f.queryFormatBlockState=function(e){return!f.showHtml&&e.toLowerCase()===a[0].queryCommandValue("formatBlock").toLowerCase()},f.queryCommandState=function(e){return f.showHtml?"":a[0].queryCommandState(e)},f.switchView=function(){f.showHtml=!f.showHtml,s.enabled(!1,f.displayElements.html),s.enabled(!1,f.displayElements.text),f.showHtml?t(function(){return s.enabled(!0,f.displayElements.html),s.enabled(!0,f.displayElements.text),f.displayElements.html[0].focus()},100):t(function(){return s.enabled(!0,f.displayElements.html),s.enabled(!0,f.displayElements.text),f.displayElements.text[0].focus()},100)},p.ngModel){var O=!0;h.$render=function(){if(O){O=!1;var e=f.$parent.$eval(p.ngModel);void 0!==e&&null!==e||!w||""===w||h.$setViewValue(w)}f.displayElements.forminput.val(h.$viewValue),f.html=h.$viewValue||""},d.attr("required")&&(h.$validators.required=function(e,t){var n=e||t;return!(!n||""===n.trim())})}else f.displayElements.forminput.val(w),f.html=w;if(f.$watch("html",function(e,t){e!==t&&(p.ngModel&&h.$viewValue!==e&&h.$setViewValue(e),f.displayElements.forminput.val(e))}),p.taTargetToolbars)x=o.registerEditor(f._name,f,p.taTargetToolbars.split(","));else{var N=angular.element('
    ');p.taToolbar&&N.attr("ta-toolbar",p.taToolbar),p.taToolbarClass&&N.attr("ta-toolbar-class",p.taToolbarClass),p.taToolbarGroupClass&&N.attr("ta-toolbar-group-class",p.taToolbarGroupClass),p.taToolbarButtonClass&&N.attr("ta-toolbar-button-class",p.taToolbarButtonClass),p.taToolbarActiveButtonClass&&N.attr("ta-toolbar-active-button-class",p.taToolbarActiveButtonClass),p.taFocussedClass&&N.attr("ta-focussed-class",p.taFocussedClass),d.prepend(N),e(N)(f.$parent),x=o.registerEditor(f._name,f,["textAngularToolbar"+_])}f.$on("$destroy",function(){o.unregisterEditor(f._name),angular.element(window).off("blur"),angular.element(window).off("resize",f.handlePopoverEvents),angular.element(window).off("scroll",f.handlePopoverEvents)}),f.$on("ta-element-select",function(e,t){x.triggerElementSelect(e,t)&&f["reApplyOnSelectorHandlerstaTextElement"+_]()}),f.$on("ta-drop-event",function(e,n,i,o){o&&o.files&&o.files.length>0?(f.displayElements.text[0].focus(),r.setSelectionToElementEnd(i.target),angular.forEach(o.files,function(e){try{u.when(f.fileDropHandler(e,f.wrapSelection)||f.fileDropHandler!==f.defaultFileDropHandler&&u.when(f.defaultFileDropHandler(e,f.wrapSelection))).then(function(){f["updateTaBindtaTextElement"+_]()})}catch(e){l.error(e)}}),i.preventDefault(),i.stopPropagation()):t(function(){f["updateTaBindtaTextElement"+_]()},0)}),f._bUpdateSelectedStyles=!1,angular.element(window).on("blur",function(){f._bUpdateSelectedStyles=!1,f.focussed=!1}),f.updateSelectedStyles=function(){var e;k&&t.cancel(k),void 0!==(e=r.getSelectionElement())&&e.parentNode!==f.displayElements.text[0]?x.updateSelectedStyles(angular.element(e)):x.updateSelectedStyles(),f._bUpdateSelectedStyles&&(k=t(f.updateSelectedStyles,200))},m=function(){if(!f.focussed)return void(f._bUpdateSelectedStyles=!1);f._bUpdateSelectedStyles||(f._bUpdateSelectedStyles=!0,f.$apply(function(){f.updateSelectedStyles()}))},f.displayElements.html.on("keydown",m),f.displayElements.text.on("keydown",m),g=function(){f._bUpdateSelectedStyles=!1},f.displayElements.html.on("keyup",g),f.displayElements.text.on("keyup",g),v=function(e,t){if(r.getSelection){var n=r.getSelection();r.getSelectionElement()&&"a"===r.getSelectionElement().nodeName.toLowerCase()&&(3===n.start.element.nodeType&&n.start.element.textContent.length===n.end.offset&&r.setSelectionAfterElement(r.getSelectionElement()),3===n.start.element.nodeType&&0===n.start.offset&&r.setSelectionBeforeElement(r.getSelectionElement()))}t&&angular.extend(e,t),f.$apply(function(){if(x.sendKeyCommand(e))return f._bUpdateSelectedStyles||f.updateSelectedStyles(),e.preventDefault(),!1})},f.displayElements.html.on("keypress",v),f.displayElements.text.on("keypress",v),$=function(){f._bUpdateSelectedStyles=!1,t(function(){f.updateSelectedStyles()},0)},f.displayElements.html.on("mouseup",$),f.displayElements.text.on("mouseup",$)}}}]),textAngular.service("textAngularManager",["taToolExecuteAction","taTools","taRegisterTool","$interval","$rootScope","$log",function(e,t,n,r,i,o){var a,s={},l={},u=0,c=function(e){angular.forEach(l,function(t){t.editorFunctions.updateSelectedStyles(e)})},f=function(){u=Date.now(),a=r(function(){c(),a=void 0},50,1)};i.$on("destroy",function(){a&&(r.cancel(a),a=void 0)});var d=function(){Math.abs(Date.now()-u)>50&&f()};return{registerEditor:function(n,r,i){if(!n||""===n)throw"textAngular Error: An editor requires a name";if(!r)throw"textAngular Error: An editor requires a scope";if(l[n])throw'textAngular Error: An Editor with name "'+n+'" already exists';return l[n]={scope:r,toolbars:i,toolbarScopes:[],_registerToolbarScope:function(e){this.toolbars.indexOf(e.name)>=0&&this.toolbarScopes.push(e)},editorFunctions:{disable:function(){angular.forEach(l[n].toolbarScopes,function(e){e.disabled=!0})},enable:function(){angular.forEach(l[n].toolbarScopes,function(e){e.disabled=!1})},focus:function(){angular.forEach(l[n].toolbarScopes,function(e){e._parent=r,e.disabled=!1,e.focussed=!0}),r.focussed=!0},unfocus:function(){angular.forEach(l[n].toolbarScopes,function(e){e.disabled=!0,e.focussed=!1}),r.focussed=!1},updateSelectedStyles:function(e){angular.forEach(l[n].toolbarScopes,function(t){angular.forEach(t.tools,function(n){n.activeState&&(t._parent=r,n.active=n.activeState(e))})})},sendKeyCommand:function(i){var o=!1;return(i.ctrlKey||i.metaKey||i.specialKey)&&angular.forEach(t,function(t,a){if(t.commandKeyCode&&(t.commandKeyCode===i.which||t.commandKeyCode===i.specialKey))for(var s=0;s0)for(var f=0;f"),t&&t.class?r.addClass(t.class):r.addClass(a.classes.toolbarButton),r.attr("name",n.name),r.attr("ta-button","ta-button"),r.attr("ng-disabled","isDisabled()"),r.attr("tabindex","-1"),r.attr("ng-click","executeAction()"),r.attr("ng-class","displayActiveToolClass(active)"),t&&t.tooltiptext&&r.attr("title",t.tooltiptext),t&&!t.display&&!n._display&&(r[0].innerHTML="",t.buttontext&&(r[0].innerHTML=t.buttontext),t.iconclass)){var i=angular.element(""),o=r[0].innerHTML;i.addClass(t.iconclass),r[0].innerHTML="",r.append(i),o&&""!==o&&r.append(" "+o)}return n._lastToolDefinition=angular.copy(t),e(r)(n)};a.tools={},a._parent={disabled:!0,showHtml:!1,queryFormatBlockState:function(){return!1},queryCommandState:function(){return!1}};var c={$window:o,$editor:function(){return a._parent},isDisabled:function(){return("html"!==this.name||!a._parent.startAction)&&("function"!=typeof this.$eval("disabled")&&this.$eval("disabled")||this.$eval("disabled()")||"html"!==this.name&&this.$editor().showHtml||this.$parent.disabled||this.$editor().disabled)},displayActiveToolClass:function(e){return e?a.classes.toolbarButtonActive:""},executeAction:i};angular.forEach(a.toolbar,function(e){var t=angular.element("
    ");t.addClass(a.classes.toolbarGroup),angular.forEach(e,function(e){a.tools[e]=angular.extend(a.$new(!0),r[e],c,{name:e}),a.tools[e].$element=u(r[e],a.tools[e]),t.append(a.tools[e].$element)}),s.append(t)}),a.updateToolDisplay=function(e,t,n){var r=a.tools[e];if(r){if(r._lastToolDefinition&&!n&&(t=angular.extend({},r._lastToolDefinition,t)),null===t.buttontext&&null===t.iconclass&&null===t.display)throw'textAngular Error: Tool Definition for updating "'+e+'" does not have a valid display/iconclass/buttontext value';null===t.buttontext&&delete t.buttontext,null===t.iconclass&&delete t.iconclass,null===t.display&&delete t.display;var i=u(t,r);r.$element.replaceWith(i),r.$element=i}},a.addTool=function(e,t,n,i){a.tools[e]=angular.extend(a.$new(!0),r[e],c,{name:e}),a.tools[e].$element=u(r[e],a.tools[e]);var o;void 0===n&&(n=a.toolbar.length-1),o=angular.element(s.children()[n]),void 0===i?(o.append(a.tools[e].$element),a.toolbar[n][a.toolbar[n].length-1]=e):(o.children().eq(i).after(a.tools[e].$element),a.toolbar[n][i]=e)},t.registerToolbar(a),a.$on("$destroy",function(){t.unregisterToolbar(a.name)})}}}]),textAngular.directive("textAngularVersion",["textAngularManager",function(e){var t=e.getVersion();return{restrict:"EA",link:function(e,n,r){n.html(t)}}}]),define("common/text-angular",["common/rangy-core","common/rangy-selectionsaverestore","common/text-angular-sanitize","common/text-angular-setup"],function(){}),function(){"use strict";var e={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91,MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(t){switch(t.which){case e.COMMAND:case e.SHIFT:case e.CTRL:case e.ALT:return!0}return!!(t.metaKey||t.ctrlKey||t.altKey)},isFunctionKey:function(e){return(e=e.which?e.which:e)>=112&&e<=123},isVerticalMovement:function(t){return~[e.UP,e.DOWN].indexOf(t)},isHorizontalMovement:function(t){return~[e.LEFT,e.RIGHT,e.BACKSPACE,e.DELETE].indexOf(t)},toSeparator:function(t){var n={ENTER:"\n",TAB:"\t",SPACE:" "}[t];return n||(e[t]?void 0:t)}};void 0===angular.element.prototype.querySelectorAll&&(angular.element.prototype.querySelectorAll=function(e){return angular.element(this[0].querySelectorAll(e))}),void 0===angular.element.prototype.closest&&(angular.element.prototype.closest=function(e){for(var t=this[0],n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(n.bind(t)(e))return t;t=t.parentElement}return!1});var t=0,n=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,skipFocusser:!1,dropdownPosition:"auto",removeSelected:!0,resetSearchInput:!0,generateId:function(){return t++},appendToBody:!1,spinnerEnabled:!1,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var e=angular.$$minErr("ui.select");return function(){var t=e.apply(this,arguments),n=t.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(n)}}).directive("uisTranscludeAppend",function(){return{link:function(e,t,n,r,i){i(e,function(e){t.append(e)})}}}).filter("highlight",function(){function e(e){return(""+e).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(t,n){return n&&t?(""+t).replace(new RegExp(e(n),"gi"),'$&'):t}}).factory("uisOffset",["$document","$window",function(e,t){return function(n){var r=n[0].getBoundingClientRect();return{width:r.width||n.prop("offsetWidth"),height:r.height||n.prop("offsetHeight"),top:r.top+(t.pageYOffset||e[0].documentElement.scrollTop),left:r.left+(t.pageXOffset||e[0].documentElement.scrollLeft)}}}]);n.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(e,t,n,r,i){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){return t.addClass("ui-select-choices"),(t.parent().attr("theme")||e.theme)+"/choices.tpl.html"},compile:function(r,o){if(!o.repeat)throw n("repeat","Expected 'repeat' expression.");var a=o.groupBy,s=o.groupFilter;if(a){var l=r.querySelectorAll(".ui-select-choices-group");if(1!==l.length)throw n("rows","Expected 1 .ui-select-choices-group but got '{0}'.",l.length);l.attr("ng-repeat",t.getGroupNgRepeatExpression())}var u=t.parse(o.repeat),c=r.querySelectorAll(".ui-select-choices-row");if(1!==c.length)throw n("rows","Expected 1 .ui-select-choices-row but got '{0}'.",c.length);c.attr("ng-repeat",u.repeatExpression(a)).attr("ng-if","$select.open");var f=r.querySelectorAll(".ui-select-choices-row-inner");if(1!==f.length)throw n("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",f.length);return f.attr("uis-transclude-append",""),(i.document.addEventListener?c:f).attr("ng-click","$select.select("+u.itemName+",$select.skipFocusser,$event)"),function(t,n,i,o){o.parseRepeatAttr(i.repeat,a,s),o.disableChoiceExpression=i.uiDisableChoice,o.onHighlightCallback=i.onHighlight,o.dropdownPosition=i.position?i.position.toLowerCase():e.dropdownPosition,t.$on("$destroy",function(){c.remove()}),t.$watch("$select.search",function(e){e&&!o.open&&o.multiple&&o.activate(!1,!0),o.activeIndex=o.tagging.isActivated?-1:0,!i.minimumInputLength||o.search.length>=i.minimumInputLength?o.refresh(i.refresh):o.items=[]}),i.$observe("refreshDelay",function(){var n=t.$eval(i.refreshDelay);o.refreshDelay=void 0!==n?n:e.refreshDelay}),t.$watch("$select.open",function(e){e?r.attr("role","listbox"):r.removeAttr("role")})}}}}]),n.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function(t,n,r,i,o,a,s,l,u,c,f){function d(e,t,n){if(e.findIndex)return e.findIndex(t,n);for(var r,i=Object(e),o=i.length>>>0,a=0;a-1&&E.splice(n,1)}function g(e){return E.indexOf(e)>-1}function v(e){function t(e,t){var n=r.indexOf(e);t&&-1===n&&r.push(e),!t&&n>-1&&r.splice(n,0)}function n(e){return r.indexOf(e)>-1}if(e){var r=[];b.isLocked=function(e,r){var i=!1,o=b.selected[r];return o&&(e?(i=!!e.$eval(b.lockChoiceExpression),t(o,i)):i=n(o)),i}}}function $(t){var n=!0;switch(t){case e.DOWN:!b.open&&b.multiple?b.activate(!1,!0):b.activeIndex0||0===b.search.length&&b.tagging.isActivated&&b.activeIndex>-1)&&b.activeIndex--;break;case e.TAB:b.multiple&&!b.open||b.select(b.items[b.activeIndex],!0);break;case e.ENTER:b.open&&(b.tagging.isActivated||b.activeIndex>=0)?b.select(b.items[b.activeIndex],b.skipFocusser):b.activate(!1,!0);break;case e.ESC:b.close();break;default:n=!1}return n}function y(){var e=n.querySelectorAll(".ui-select-choices-content"),t=e.querySelectorAll(".ui-select-choices-row");if(t.length<1)throw s("choices","Expected multiple .ui-select-choices-row but got '{0}'.",t.length);if(!(b.activeIndex<0)){var r=t[b.activeIndex],i=r.offsetTop+r.clientHeight-e[0].scrollTop,o=e[0].offsetHeight;i>o?e[0].scrollTop+=i-o:i=b.items.length?0:b.activeIndex,-1===b.activeIndex&&!1!==b.taggingLabel&&(b.activeIndex=0);var o=n.querySelectorAll(".ui-select-choices-content"),a=n.querySelectorAll(".ui-select-search");if(b.$animate&&b.$animate.on&&b.$animate.enabled(o[0])){var s=function(t,n){"start"===n&&0===b.items.length?(b.$animate.off("removeClass",a[0],s),r(function(){b.focusSearchInput(e)})):"close"===n&&(b.$animate.off("enter",o[0],s),r(function(){b.focusSearchInput(e)}))};b.items.length>0?b.$animate.on("enter",o[0],s):b.$animate.on("removeClass",a[0],s)}else r(function(){b.focusSearchInput(e),!b.tagging.isActivated&&b.items.length>1&&y()})}},b.focusSearchInput=function(e){b.search=e||b.search,b.searchInput[0].focus()},b.findGroupByName=function(e){return b.groups&&b.groups.filter(function(t){return t.name===e})[0]},b.parseRepeatAttr=function(e,n,r){function i(e){var i=t.$eval(n);if(b.groups=[],angular.forEach(e,function(e){var t=angular.isFunction(i)?i(e):e[i],n=b.findGroupByName(t);n?n.items.push(e):b.groups.push({name:t,items:[e]})}),r){var o=t.$eval(r);angular.isFunction(o)?b.groups=o(b.groups):angular.isArray(o)&&(b.groups=h(b.groups,o))}b.items=[],b.groups.forEach(function(e){b.items=b.items.concat(e.items)})}function o(e){b.items=e}b.setItemsFn=n?i:o,b.parserResult=a.parse(e),b.isGrouped=!!n,b.itemProperty=b.parserResult.itemName;var l=b.parserResult.source,c=function(){var e=l(t);t.$uisSource=Object.keys(e).map(function(t){var n={};return n[b.parserResult.keyName]=t,n.value=e[t],n})};b.parserResult.keyName&&(c(),b.parserResult.source=u("$uisSource"+b.parserResult.filters),t.$watch(l,function(e,t){e!==t&&c()},!0)),b.refreshItems=function(e){e=e||b.parserResult.source(t);var n=b.selected;if(b.isEmpty()||angular.isArray(n)&&!n.length||!b.multiple||!b.removeSelected)b.setItemsFn(e);else if(void 0!==e&&null!==e){var r=e.filter(function(e){return angular.isArray(n)?n.every(function(t){return!angular.equals(e,t)}):!angular.equals(e,n)});b.setItemsFn(r)}"auto"!==b.dropdownPosition&&"up"!==b.dropdownPosition||t.calculateDropdownPos(),t.$broadcast("uis:refresh")},t.$watchCollection(b.parserResult.source,function(e){if(void 0===e||null===e)b.items=[];else{if(!angular.isArray(e))throw s("items","Expected an array but got '{0}'.",e);b.refreshItems(e),angular.isDefined(b.ngModel.$modelValue)&&(b.ngModel.$modelValue=null)}})};var x;b.refresh=function(e){void 0!==e&&(x&&r.cancel(x),x=r(function(){var n=t.$eval(e);n&&angular.isFunction(n.then)&&!b.refreshing&&(b.refreshing=!0,n.then(function(){b.refreshing=!1}))},b.refreshDelay))},b.isActive=function(e){if(!b.open)return!1;var t=b.items.indexOf(e[b.itemProperty]),n=t==b.activeIndex;return!(!n||t<0)&&(n&&!angular.isUndefined(b.onHighlightCallback)&&e.$eval(b.onHighlightCallback),n)};var C=function(e){return b.selected&&angular.isArray(b.selected)&&b.selected.filter(function(t){return angular.equals(t,e)}).length>0},E=[];b.isDisabled=function(e){if(b.open){var t=e[b.itemProperty],n=b.items.indexOf(t),r=!1;if(n>=0&&(angular.isDefined(b.disableChoiceExpression)||b.multiple)){if(t.isTag)return!1;b.multiple&&(r=C(t)),!r&&angular.isDefined(b.disableChoiceExpression)&&(r=!!e.$eval(b.disableChoiceExpression)),m(t,r)}return r}},b.select=function(e,n,i){if(void 0===e||!g(e)){if(!b.items&&!b.search&&!b.tagging.isActivated)return;if(!e||!g(e)){if(b.clickTriggeredSelect=!1,i&&("click"===i.type||"touchend"===i.type)&&e&&(b.clickTriggeredSelect=!0),b.tagging.isActivated&&!1===b.clickTriggeredSelect){if(!1===b.taggingLabel)if(b.activeIndex<0){if(void 0===e&&(e=void 0!==b.tagging.fct?b.tagging.fct(b.search):b.search),!e||angular.equals(b.items[0],e))return}else e=b.items[b.activeIndex];else if(0===b.activeIndex){if(void 0===e)return;if(void 0!==b.tagging.fct&&"string"==typeof e){if(!(e=b.tagging.fct(e)))return}else"string"==typeof e&&(e=e.replace(b.taggingLabel,"").trim())}if(C(e))return void b.close(n)}p(),t.$broadcast("uis:select",e);var o={};o[b.parserResult.itemName]=e,r(function(){b.onSelectCallback(t,{$item:e,$model:b.parserResult.modelMapper(t,o)})}),b.closeOnSelect&&b.close(n)}}},b.close=function(e){b.open&&(b.ngModel&&b.ngModel.$setTouched&&b.ngModel.$setTouched(),b.open=!1,p(),t.$broadcast("uis:close",e))},b.setFocus=function(){b.focus||b.focusInput[0].focus()},b.clear=function(e){b.select(void 0),e.stopPropagation(),r(function(){b.focusser[0].focus()},0,!1)},b.toggle=function(e){b.open?(b.close(),e.preventDefault(),e.stopPropagation()):b.activate()},b.isLocked=function(){return!1},t.$watch(function(){return angular.isDefined(b.lockChoiceExpression)&&""!==b.lockChoiceExpression},v);var k=null,S=!1;b.sizeSearchInput=function(){var e=b.searchInput[0],n=b.searchInput.parent().parent()[0],i=function(){return n.clientWidth*!!e.offsetParent},o=function(t){if(0===t)return!1;var n=t-e.offsetLeft-10;return n<50&&(n=t),b.searchInput.css("width",n+"px"),!0};b.searchInput.css("width","10px"),r(function(){null!==k||o(i())||(k=t.$watch(function(){S||(S=!0,t.$$postDigest(function(){S=!1,o(i())&&(k(),k=null)}))},angular.noop))})},b.searchInput.on("keydown",function(n){var i=n.which;~[e.ENTER,e.ESC].indexOf(i)&&(n.preventDefault(),n.stopPropagation()),t.$apply(function(){var t=!1;if((b.items.length>0||b.tagging.isActivated)&&($(i)||b.searchEnabled||(n.preventDefault(),n.stopPropagation()),b.taggingTokens.isActivated)){for(var o=0;o0&&(t=!0);t&&r(function(){b.searchInput.triggerHandler("tagged");var t=b.search.replace(e.MAP[n.keyCode],"").trim();b.tagging.fct&&(t=b.tagging.fct(t)),t&&b.select(t,!0)})}}),e.isVerticalMovement(i)&&b.items.length>0&&y(),i!==e.ENTER&&i!==e.ESC||(n.preventDefault(),n.stopPropagation())}),b.searchInput.on("paste",function(t){var n;if(n=window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):(t.originalEvent||t).clipboardData.getData("text/plain"),(n=b.search+n)&&n.length>0)if(b.taggingTokens.isActivated){for(var r=[],i=0;i-1){r=n.split(o);break}}0===r.length&&(r=[n]);var a=b.search;angular.forEach(r,function(e){var t=b.tagging.fct?b.tagging.fct(e):e;t&&b.select(t,!0)}),b.search=a||w,t.preventDefault(),t.stopPropagation()}else b.paste&&(b.paste(n),b.search=w,t.preventDefault(),t.stopPropagation())}),b.searchInput.on("tagged",function(){r(function(){p()})});var _=o(function(){b.sizeSearchInput()},50);angular.element(f).bind("resize",_),t.$on("$destroy",function(){b.searchInput.off("keyup keydown tagged blur paste"),angular.element(f).off("resize",_)}),t.$watch("$select.activeIndex",function(e){e&&n.find("input").attr("aria-activedescendant","ui-select-choices-row-"+b.generatedId+"-"+e)}),t.$watch("$select.open",function(e){e||n.find("input").removeAttr("aria-activedescendant")})}]),n.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","uisOffset","$compile","$parse","$timeout",function(e,t,n,r,i,o,a){return{restrict:"EA",templateUrl:function(e,n){return(n.theme||t.theme)+(angular.isDefined(n.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",compile:function(i,s){var l=/{(.*)}\s*{(.*)}/.exec(s.ngClass);if(l){var u="{"+l[1]+", "+l[2]+"}";s.ngClass=u,i.attr("ng-class",u)}return angular.isDefined(s.multiple)?i.append("").removeAttr("multiple"):i.append(""),s.inputId&&(i.querySelectorAll("input.ui-select-search")[0].id=s.inputId),function(i,s,l,u,c){function f(e){if(h.open){if(!(window.jQuery?window.jQuery.contains(s[0],e.target):s[0].contains(e.target))&&!h.clickTriggeredSelect){var t;if(h.skipFocusser)t=!0;else{var n=["input","button","textarea","select"],r=angular.element(e.target).controller("uiSelect");t=r&&r!==h,t||(t=~n.indexOf(e.target.tagName.toLowerCase()))}h.close(t),i.$digest()}h.clickTriggeredSelect=!1}}function d(){var t=r(s);v=angular.element('
    '),v[0].style.width=t.width+"px",v[0].style.height=t.height+"px",s.after(v),$=s[0].style.width,e.find("body").append(s),s[0].style.position="absolute",s[0].style.left=t.left+"px",s[0].style.top=t.top+"px",s[0].style.width=t.width+"px"}function p(){null!==v&&(v.replaceWith(s),v=null,s[0].style.position="",s[0].style.left="",s[0].style.top="",s[0].style.width=$,h.setFocus())}var h=u[0],m=u[1];h.generatedId=t.generateId(),h.baseTitle=l.title||"Select box",h.focusserTitle=h.baseTitle+" focus",h.focusserId="focusser-"+h.generatedId,h.closeOnSelect=function(){return angular.isDefined(l.closeOnSelect)?o(l.closeOnSelect)():t.closeOnSelect}(),i.$watch("skipFocusser",function(){var e=i.$eval(l.skipFocusser);h.skipFocusser=void 0!==e?e:t.skipFocusser}),h.onSelectCallback=o(l.onSelect),h.onRemoveCallback=o(l.onRemove),h.ngModel=m,h.choiceGrouped=function(e){return h.isGrouped&&e&&e.name},l.tabindex&&l.$observe("tabindex",function(e){h.focusInput.attr("tabindex",e),s.removeAttr("tabindex")}),i.$watch(function(){return i.$eval(l.searchEnabled)},function(e){h.searchEnabled=void 0!==e?e:t.searchEnabled}),i.$watch("sortable",function(){var e=i.$eval(l.sortable);h.sortable=void 0!==e?e:t.sortable}),l.$observe("limit",function(){h.limit=angular.isDefined(l.limit)?parseInt(l.limit,10):void 0}),i.$watch("removeSelected",function(){var e=i.$eval(l.removeSelected);h.removeSelected=void 0!==e?e:t.removeSelected}),l.$observe("disabled",function(){h.disabled=void 0!==l.disabled&&l.disabled}),l.$observe("resetSearchInput",function(){var e=i.$eval(l.resetSearchInput);h.resetSearchInput=void 0===e||e}),l.$observe("paste",function(){h.paste=i.$eval(l.paste)}),l.$observe("tagging",function(){if(void 0!==l.tagging){var e=i.$eval(l.tagging);h.tagging={isActivated:!0,fct:!0!==e?e:void 0}}else h.tagging={isActivated:!1,fct:void 0}}),l.$observe("taggingLabel",function(){void 0!==l.tagging&&("false"===l.taggingLabel?h.taggingLabel=!1:h.taggingLabel=void 0!==l.taggingLabel?l.taggingLabel:"(new)")}),l.$observe("taggingTokens",function(){if(void 0!==l.tagging){var e=void 0!==l.taggingTokens?l.taggingTokens.split("|"):[",","ENTER"];h.taggingTokens={isActivated:!0,tokens:e}}}),l.$observe("spinnerEnabled",function(){var e=i.$eval(l.spinnerEnabled);h.spinnerEnabled=void 0!==e?e:t.spinnerEnabled}),l.$observe("spinnerClass",function(){var e=l.spinnerClass;h.spinnerClass=void 0!==e?l.spinnerClass:t.spinnerClass}),angular.isDefined(l.autofocus)&&a(function(){h.setFocus()}),angular.isDefined(l.focusOn)&&i.$on(l.focusOn,function(){a(function(){h.setFocus()})}),e.on("click",f),i.$on("$destroy",function(){e.off("click",f)}),c(i,function(e){var t=angular.element("
    ").append(e),r=t.querySelectorAll(".ui-select-match");if(r.removeAttr("ui-select-match"),r.removeAttr("data-ui-select-match"),1!==r.length)throw n("transcluded","Expected 1 .ui-select-match but got '{0}'.",r.length);s.querySelectorAll(".ui-select-match").replaceWith(r);var i=t.querySelectorAll(".ui-select-choices");if(i.removeAttr("ui-select-choices"),i.removeAttr("data-ui-select-choices"),1!==i.length)throw n("transcluded","Expected 1 .ui-select-choices but got '{0}'.",i.length);s.querySelectorAll(".ui-select-choices").replaceWith(i);var o=t.querySelectorAll(".ui-select-no-choice");o.removeAttr("ui-select-no-choice"),o.removeAttr("data-ui-select-no-choice"),1==o.length&&s.querySelectorAll(".ui-select-no-choice").replaceWith(o)});var g=i.$eval(l.appendToBody);(void 0!==g?g:t.appendToBody)&&(i.$watch("$select.open",function(e){e?d():p()}),i.$on("$destroy",function(){p()}));var v=null,$="",y=null;i.$watch("$select.open",function(){"auto"!==h.dropdownPosition&&"up"!==h.dropdownPosition||i.calculateDropdownPos()});var b=function(e,t){e=e||r(s),t=t||r(y),y[0].style.position="absolute",y[0].style.top=-1*t.height+"px",s.addClass("direction-up")},w=function(e,t){s.removeClass("direction-up"),e=e||r(s),t=t||r(y),y[0].style.position="",y[0].style.top=""},x=function(){a(function(){if("up"===h.dropdownPosition)b();else{s.removeClass("direction-up");var t=r(s),n=r(y),i=e[0].documentElement.scrollTop||e[0].body.scrollTop;t.top+t.height+n.height>i+e[0].documentElement.clientHeight?b(t,n):w(t,n)}y[0].style.opacity=1})},C=!1;i.calculateDropdownPos=function(){if(h.open){if(y=angular.element(s).querySelectorAll(".ui-select-dropdown"),0===y.length)return;if(""!==h.search||C||(y[0].style.opacity=0,C=!0),!r(y).height&&h.$animate&&h.$animate.on&&h.$animate.enabled(y)){var e=!0;h.$animate.on("enter",y,function(t,n){"close"===n&&e&&(x(),e=!1)})}else x()}else{if(null===y||0===y.length)return;y[0].style.opacity=0,y[0].style.position="",y[0].style.top="",s.removeClass("direction-up")}}}}}}]),n.directive("uiSelectMatch",["uiSelectConfig",function(e){function t(e,t){return e[0].hasAttribute(t)?e.attr(t):e[0].hasAttribute("data-"+t)?e.attr("data-"+t):e[0].hasAttribute("x-"+t)?e.attr("x-"+t):void 0}return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(n){n.addClass("ui-select-match");var r=n.parent();return(t(r,"theme")||e.theme)+(angular.isDefined(t(r,"multiple"))?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(t,n,r,i){function o(e){i.allowClear=!!angular.isDefined(e)&&(""===e||"true"===e.toLowerCase())}i.lockChoiceExpression=r.uiLockChoice,r.$observe("placeholder",function(t){i.placeholder=void 0!==t?t:e.placeholder}),r.$observe("allowClear",o),o(r.allowClear),i.multiple&&i.sizeSearchInput()}}}]),n.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(t,n){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function(e,t){var n,r=this,i=e.$select;angular.isUndefined(i.selected)&&(i.selected=[]),e.$evalAsync(function(){n=e.ngModel}),r.activeMatchIndex=-1,r.updateModel=function(){n.$setViewValue(Date.now()),r.refreshComponent()},r.refreshComponent=function(){i.refreshItems&&i.refreshItems(),i.sizeSearchInput&&i.sizeSearchInput()},r.removeChoice=function(n){if(i.isLocked(null,n))return!1;var o=i.selected[n],a={};return a[i.parserResult.itemName]=o,i.selected.splice(n,1),r.activeMatchIndex=-1,i.sizeSearchInput(),t(function(){i.onRemoveCallback(e,{$item:o,$model:i.parserResult.modelMapper(e,a)})}),r.updateModel(),!0},r.getPlaceholder=function(){if(!i.selected||!i.selected.length)return i.placeholder}}],controllerAs:"$selectMultiple",link:function(r,i,o,a){function s(e){return angular.isNumber(e.selectionStart)?e.selectionStart:e.value.length}function l(t){var n=s(f.searchInput[0]),r=f.selected.length,i=r-1,o=p.activeMatchIndex,a=p.activeMatchIndex+1,l=p.activeMatchIndex-1,u=o;return!(n>0||f.search.length&&t==e.RIGHT)&&(f.close(),u=function(){switch(t){case e.LEFT:return~p.activeMatchIndex?l:i;case e.RIGHT:return~p.activeMatchIndex&&o!==i?a:(f.activate(),!1);case e.BACKSPACE:return~p.activeMatchIndex?p.removeChoice(o)?l:o:i;case e.DELETE:return!!~p.activeMatchIndex&&(p.removeChoice(p.activeMatchIndex),o)}}(),f.selected.length&&!1!==u?p.activeMatchIndex=Math.min(i,Math.max(0,u)):p.activeMatchIndex=-1,!0)}function u(e){return void 0!==e&&void 0!==f.search&&e.filter(function(e){return void 0!==f.search.toUpperCase()&&void 0!==e&&e.toUpperCase()===f.search.toUpperCase()}).length>0}function c(e,t){var n=-1;if(angular.isArray(e))for(var r=angular.copy(e),i=0;i=0;i--)t={},t[f.parserResult.itemName]=f.selected[i],e=f.parserResult.modelMapper(r,t),n.unshift(e);return n}),d.$formatters.unshift(function(e){var t,n=f.parserResult&&f.parserResult.source(r,{$select:{search:""}}),i={};if(!n)return e;var o=[],a=function(e,n){if(e&&e.length){for(var a=e.length-1;a>=0;a--){if(i[f.parserResult.itemName]=e[a],t=f.parserResult.modelMapper(r,i),f.parserResult.trackByExp){var s=/(\w*)\./.exec(f.parserResult.trackByExp),l=/\.([^\s]+)/.exec(f.parserResult.trackByExp);if(s&&s.length>0&&s[1]==f.parserResult.itemName&&l&&l.length>0&&t[l[1]]==n[l[1]])return o.unshift(e[a]),!0}if(angular.equals(t,n))return o.unshift(e[a]),!0}return!1}};if(!e)return o;for(var s=e.length-1;s>=0;s--)a(f.selected,e[s])||a(n,e[s])||o.unshift(e[s]);return o}),r.$watchCollection(function(){return d.$modelValue},function(e,t){t!=e&&(angular.isDefined(d.$modelValue)&&(d.$modelValue=null),p.refreshComponent())}),d.$render=function(){if(!angular.isArray(d.$viewValue)){if(!angular.isUndefined(d.$viewValue)&&null!==d.$viewValue)throw t("multiarr","Expected model value to be array but got '{0}'",d.$viewValue);d.$viewValue=[]}f.selected=d.$viewValue,p.refreshComponent(),r.$evalAsync()},r.$on("uis:select",function(e,t){f.selected.length>=f.limit||(f.selected.push(t),p.updateModel())}),r.$on("uis:activate",function(){p.activeMatchIndex=-1}),r.$watch("$select.disabled",function(e,t){t&&!e&&f.sizeSearchInput()}),f.searchInput.on("keydown",function(t){var n=t.which;r.$apply(function(){var r=!1;e.isHorizontalMovement(n)&&(r=l(n)),r&&n!=e.TAB&&(t.preventDefault(),t.stopPropagation())})}),f.searchInput.on("keyup",function(t){if(e.isVerticalMovement(t.which)||r.$evalAsync(function(){f.activeIndex=!1===f.taggingLabel?-1:0}),f.tagging.isActivated&&f.search.length>0){ +if(t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||e.isVerticalMovement(t.which))return;if(f.activeIndex=!1===f.taggingLabel?-1:0,!1===f.taggingLabel)return;var n,i,o,a,s=angular.copy(f.items),l=angular.copy(f.items),d=!1,p=-1;if(void 0!==f.tagging.fct){if(o=f.$filter("filter")(s,{isTag:!0}),o.length>0&&(a=o[0]),s.length>0&&a&&(d=!0,s=s.slice(1,s.length),l=l.slice(1,l.length)),n=f.tagging.fct(f.search),l.some(function(e){return angular.equals(e,n)})||f.selected.some(function(e){return angular.equals(e,n)}))return void r.$evalAsync(function(){f.activeIndex=0,f.items=s});n&&(n.isTag=!0)}else{if(o=f.$filter("filter")(s,function(e){return e.match(f.taggingLabel)}),o.length>0&&(a=o[0]),i=s[0],void 0!==i&&s.length>0&&a&&(d=!0,s=s.slice(1,s.length),l=l.slice(1,l.length)),n=f.search+" "+f.taggingLabel,c(f.selected,f.search)>-1)return;if(u(l.concat(f.selected)))return void(d&&(s=l,r.$evalAsync(function(){f.activeIndex=0,f.items=s})));if(u(l))return void(d&&(f.items=l.slice(1,l.length)))}d&&(p=c(f.selected,n)),p>-1?s=s.slice(p+1,s.length-1):(s=[],n&&s.push(n),s=s.concat(l)),r.$evalAsync(function(){if(f.activeIndex=0,f.items=s,f.isGrouped){var e=n?s.slice(1):s;f.setItemsFn(e),n&&(f.items.unshift(n),f.groups.unshift({name:"",items:[n],tagging:!0}))}})}}),f.searchInput.on("blur",function(){n(function(){p.activeMatchIndex=-1})})}}}]),n.directive("uiSelectNoChoice",["uiSelectConfig",function(e){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){return t.addClass("ui-select-no-choice"),(t.parent().attr("theme")||e.theme)+"/no-choice.tpl.html"}}}]),n.directive("uiSelectSingle",["$timeout","$compile",function(t,n){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(r,i,o,a){var s=a[0],l=a[1];l.$parsers.unshift(function(e){var t={};return t[s.parserResult.itemName]=e,s.parserResult.modelMapper(r,t)}),l.$formatters.unshift(function(e){var t,n=s.parserResult&&s.parserResult.source(r,{$select:{search:""}}),i={};if(n){var o=function(n){return i[s.parserResult.itemName]=n,(t=s.parserResult.modelMapper(r,i))===e};if(s.selected&&o(s.selected))return s.selected;for(var a=n.length-1;a>=0;a--)if(o(n[a]))return n[a]}return e}),r.$watch("$select.selected",function(e){l.$viewValue!==e&&l.$setViewValue(e)}),l.$render=function(){s.selected=l.$viewValue},r.$on("uis:select",function(e,t){s.selected=t}),r.$on("uis:close",function(e,n){t(function(){s.focusser.prop("disabled",!1),n||s.focusser[0].focus()},0,!1)}),r.$on("uis:activate",function(){u.prop("disabled",!0)});var u=angular.element("");n(u)(r),s.focusser=u,s.focusInput=u,i.parent().append(u),u.bind("focus",function(){r.$evalAsync(function(){s.focus=!0})}),u.bind("blur",function(){r.$evalAsync(function(){s.focus=!1})}),u.bind("keydown",function(t){if(t.which===e.BACKSPACE)return t.preventDefault(),t.stopPropagation(),s.select(void 0),void r.$apply();t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||(t.which!=e.DOWN&&t.which!=e.UP&&t.which!=e.ENTER&&t.which!=e.SPACE||(t.preventDefault(),t.stopPropagation(),s.activate()),r.$digest())}),u.bind("keyup input",function(t){t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||t.which==e.ENTER||t.which===e.BACKSPACE||(s.activate(u.val()),u.val(""),r.$digest())})}}}]),n.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(e,t,n){return{require:["^^uiSelect","^ngModel"],link:function(t,r,i,o){if(null===t[i.uiSelectSort])throw n("sort","Expected a list to sort");var a=o[0],s=o[1],l=angular.extend({axis:"horizontal"},t.$eval(i.uiSelectSortOptions)),u=l.axis;t.$watch(function(){return a.sortable},function(e){e?r.attr("draggable",!0):r.removeAttr("draggable")}),r.on("dragstart",function(e){r.addClass("dragging"),(e.dataTransfer||e.originalEvent.dataTransfer).setData("text",t.$index.toString())}),r.on("dragend",function(){d("dragging")});var c,f=function(e,t){this.splice(t,0,this.splice(e,1)[0])},d=function(e){angular.forEach(a.$element.querySelectorAll("."+e),function(t){angular.element(t).removeClass(e)})},p=function(e){e.preventDefault(),("vertical"===u?e.offsetY||e.layerY||(e.originalEvent?e.originalEvent.offsetY:0):e.offsetX||e.layerX||(e.originalEvent?e.originalEvent.offsetX:0))
  • '),e.put("bootstrap/match-multiple.tpl.html",' × '),e.put("bootstrap/match.tpl.html",'
    {{$select.placeholder}}
    '),e.put("bootstrap/no-choice.tpl.html",''),e.put("bootstrap/select-multiple.tpl.html",''),e.put("bootstrap/select.tpl.html",''),e.put("select2/choices.tpl.html",'
    '),e.put("select2/match-multiple.tpl.html",'
  • '),e.put("select2/match.tpl.html",'{{$select.placeholder}} '),e.put("select2/no-choice.tpl.html",''),e.put("select2/select-multiple.tpl.html",'
    '),e.put("select2/select.tpl.html",'
    '),e.put("selectize/choices.tpl.html",'
    '),e.put("selectize/match-multiple.tpl.html",'
    ×
    '),e.put("selectize/match.tpl.html",'
    {{$select.placeholder}}
    '),e.put("selectize/no-choice.tpl.html",'
    '),e.put("selectize/select-multiple.tpl.html",'
    '),e.put("selectize/select.tpl.html",'
    ')}]),define("common/ui-select",["common/angular"],function(){}),function(){function e(e){return e&&(e.ownerDocument||e.document||e).documentElement}function t(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}function n(e,t){return t>e?-1:e>t?1:e>=t?0:NaN}function r(e){return null===e?NaN:+e}function i(e){return!isNaN(e)}function o(e){return{left:function(t,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var o=r+i>>>1;e(t[o],n)<0?r=o+1:i=o}return r},right:function(t,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var o=r+i>>>1;e(t[o],n)>0?i=o:r=o+1}return r}}}function a(e){return e.length}function s(e){for(var t=1;e*t%1;)t*=10;return t}function l(e,t){for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}function u(){this._=Object.create(null)}function c(e){return(e+="")===pa||e[0]===ha?ha+e:e}function f(e){return(e+="")[0]===ha?e.slice(1):e}function d(e){return c(e)in this._}function p(e){return(e=c(e))in this._&&delete this._[e]}function h(){var e=[];for(var t in this._)e.push(f(t));return e}function m(){var e=0;for(var t in this._)++e;return e}function g(){for(var e in this._)return!1;return!0}function v(){this._=Object.create(null)}function $(e){return e}function y(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function b(e,t){if(t in e)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var n=0,r=ma.length;r>n;++n){var i=ma[n]+t;if(i in e)return i}}function w(){}function x(){}function C(e){function t(){for(var t,r=n,i=-1,o=r.length;++in;n++)for(var i,o=e[n],a=0,s=o.length;s>a;a++)(i=o[a])&&t(i,a,n);return e}function B(e){return va(e,Ca),e}function z(e){var t,n;return function(r,i,o){var a,s=e[o].update,l=s.length;for(o!=n&&(n=o,t=0),i>=t&&(t=i+1);!(a=s[t])&&++t0&&(e=e.slice(0,s));var u=Ea.get(e);return u&&(e=u,l=G),s?t?i:r:t?w:o}function W(e,t){return function(n){var r=na.event;na.event=n,t[0]=this.__data__;try{e.apply(this,t)}finally{na.event=r}}}function G(e,t){var n=W(e,t);return function(e){var t=this,r=e.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||n.call(t,e)}}function K(n){var r=".dragsuppress-"+ ++Sa,i="click"+r,o=na.select(t(n)).on("touchmove"+r,E).on("dragstart"+r,E).on("selectstart"+r,E);if(null==ka&&(ka=!("onselectstart"in n)&&b(n.style,"userSelect")),ka){var a=e(n).style,s=a[ka];a[ka]="none"}return function(e){if(o.on(r,null),ka&&(a[ka]=s),e){var t=function(){o.on(i,null)};o.on(i,function(){E(),t()},!0),setTimeout(t,0)}}}function Z(e,n){n.changedTouches&&(n=n.changedTouches[0]);var r=e.ownerSVGElement||e;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>_a){var o=t(e);if(o.scrollX||o.scrollY){r=na.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=r[0][0].getScreenCTM();_a=!(a.f||a.e),r.remove()}}return _a?(i.x=n.pageX,i.y=n.pageY):(i.x=n.clientX,i.y=n.clientY),i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}var s=e.getBoundingClientRect();return[n.clientX-s.left-e.clientLeft,n.clientY-s.top-e.clientTop]}function J(){return na.event.changedTouches[0].identifier}function X(e){return e>0?1:0>e?-1:0}function Q(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function ee(e){return e>1?0:-1>e?Da:Math.acos(e)}function te(e){return e>1?Na:-1>e?-Na:Math.asin(e)}function ne(e){return((e=Math.exp(e))-1/e)/2}function re(e){return((e=Math.exp(e))+1/e)/2}function ie(e){return((e=Math.exp(2*e))-1)/(e+1)}function oe(e){return(e=Math.sin(e/2))*e}function ae(){}function se(e,t,n){return this instanceof se?(this.h=+e,this.s=+t,void(this.l=+n)):arguments.length<2?e instanceof se?new se(e.h,e.s,e.l):we(""+e,xe,se):new se(e,t,n)}function le(e,t,n){function r(e){return e>360?e-=360:0>e&&(e+=360),60>e?o+(a-o)*e/60:180>e?a:240>e?o+(a-o)*(240-e)/60:o}function i(e){return Math.round(255*r(e))}var o,a;return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)?0:0>t?0:t>1?1:t,n=0>n?0:n>1?1:n,a=.5>=n?n*(1+t):n+t-n*t,o=2*n-a,new ve(i(e+120),i(e),i(e-120))}function ue(e,t,n){return this instanceof ue?(this.h=+e,this.c=+t,void(this.l=+n)):arguments.length<2?e instanceof ue?new ue(e.h,e.c,e.l):e instanceof fe?pe(e.l,e.a,e.b):pe((e=Ce((e=na.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new ue(e,t,n)}function ce(e,t,n){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new fe(n,Math.cos(e*=Ra)*t,Math.sin(e)*t)}function fe(e,t,n){return this instanceof fe?(this.l=+e,this.a=+t,void(this.b=+n)):arguments.length<2?e instanceof fe?new fe(e.l,e.a,e.b):e instanceof ue?ce(e.h,e.c,e.l):Ce((e=ve(e)).r,e.g,e.b):new fe(e,t,n)}function de(e,t,n){var r=(e+16)/116,i=r+t/500,o=r-n/200;return i=he(i)*Ba,r=he(r)*za,o=he(o)*Ya,new ve(ge(3.2404542*i-1.5371385*r-.4985314*o),ge(-.969266*i+1.8760108*r+.041556*o),ge(.0556434*i-.2040259*r+1.0572252*o))}function pe(e,t,n){return e>0?new ue(Math.atan2(n,t)*Ia,Math.sqrt(t*t+n*n),e):new ue(NaN,NaN,e)}function he(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function me(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function ge(e){return Math.round(255*(.00304>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function ve(e,t,n){return this instanceof ve?(this.r=~~e,this.g=~~t,void(this.b=~~n)):arguments.length<2?e instanceof ve?new ve(e.r,e.g,e.b):we(""+e,ve,le):new ve(e,t,n)}function $e(e){return new ve(e>>16,e>>8&255,255&e)}function ye(e){return $e(e)+""}function be(e){return 16>e?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function we(e,t,n){e=e.toLowerCase();var r,i,o,a=0,s=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(e))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(ke(i[0]),ke(i[1]),ke(i[2]))}return(o=Ka.get(e))?t(o.r,o.g,o.b):(null==e||"#"!==e.charAt(0)||isNaN(o=parseInt(e.slice(1),16))||(4===e.length?(a=(3840&o)>>4,a|=a>>4,s=240&o,s|=s>>4,l=15&o,l|=l<<4):7===e.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),t(a,s,l))}function xe(e,t,n){var r,i,o=Math.min(e/=255,t/=255,n/=255),a=Math.max(e,t,n),s=a-o,l=(a+o)/2;return s?(i=.5>l?s/(a+o):s/(2-a-o),r=e==a?(t-n)/s+(n>t?6:0):t==a?(n-e)/s+2:(e-t)/s+4,r*=60):(r=NaN,i=l>0&&1>l?0:r),new se(r,i,l)}function Ce(e,t,n){e=Ee(e),t=Ee(t),n=Ee(n);var r=me((.4124564*e+.3575761*t+.1804375*n)/Ba),i=me((.2126729*e+.7151522*t+.072175*n)/za);return fe(116*i-16,500*(r-i),200*(i-me((.0193339*e+.119192*t+.9503041*n)/Ya)))}function Ee(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ke(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}function Se(e){return"function"==typeof e?e:function(){return e}}function _e(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Me(t,n,e,r)}}function Me(e,t,n,r){function i(){var e,t=l.status;if(!t&&De(l)||t>=200&&300>t||304===t){try{e=n.call(o,l)}catch(e){return void a.error.call(o,e)}a.load.call(o,e)}else a.error.call(o,l)}var o={},a=na.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(e)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(e){var t=na.event;na.event=e;try{a.progress.call(o,l)}finally{na.event=t}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(t=null==e?null:e+"",o):t},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return n=e,o},["get","post"].forEach(function(e){o[e]=function(){return o.send.apply(o,[e].concat(ia(arguments)))}}),o.send=function(n,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(n,e,!0),null==t||"accept"in s||(s.accept=t+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=u&&(l.responseType=u),null!=i&&o.on("error",i).on("load",function(e){i(null,e)}),a.beforesend.call(o,l),l.send(null==r?null:r),o},o.abort=function(){return l.abort(),o},na.rebind(o,a,"on"),null==r?o:o.get(Te(r))}function Te(e){return 1===e.length?function(t,n){e(null==t?n:null)}:e}function De(e){var t=e.responseType;return t&&"text"!==t?e.response:e.responseText}function Ae(){var e=Oe(),t=Ne()-e;t>24?(isFinite(t)&&(clearTimeout(Qa),Qa=setTimeout(Ae,t)),Xa=0):(Xa=1,ts(Ae))}function Oe(){var e=Date.now();for(es=Za;es;)e>=es.t&&(es.f=es.c(e-es.t)),es=es.n;return e}function Ne(){for(var e,t=Za,n=1/0;t;)t.f?t=e?e.n=t.n:Za=t.n:(t.t8?function(e){return e/n}:function(e){return e*n},symbol:e}}function Pe(e){var t=e.decimal,n=e.thousands,r=e.grouping,i=e.currency,o=r&&n?function(e,t){for(var i=e.length,o=[],a=0,s=r[0],l=0;i>0&&s>0&&(l+s+1>t&&(s=Math.max(1,t-l)),o.push(e.substring(i-=s,i+s)),!((l+=s+1)>t));)s=r[a=(a+1)%r.length];return o.reverse().join(n)}:$;return function(e){var n=rs.exec(e),r=n[1]||" ",a=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],d=n[8],p=n[9],h=1,m="",g="",v=!1,$=!0;switch(d&&(d=+d.substring(1)),(u||"0"===r&&"="===a)&&(u=r="0",a="="),p){case"n":f=!0,p="g";break;case"%":h=100,g="%",p="f";break;case"p":h=100,g="%",p="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+p.toLowerCase());case"c":$=!1;case"d":v=!0,d=0;break;case"s":h=-1,p="r"}"$"===l&&(m=i[0],g=i[1]),"r"!=p||d||(p="g"),null!=d&&("g"==p?d=Math.max(1,Math.min(21,d)):("e"==p||"f"==p)&&(d=Math.max(0,Math.min(20,d)))),p=is.get(p)||Le;var y=u&&f;return function(e){var n=g;if(v&&e%1)return"";var i=0>e||0===e&&0>1/e?(e=-e,"-"):"-"===s?"":s;if(0>h){var l=na.formatPrefix(e,d);e=l.scale(e),n=l.symbol+g}else e*=h +;e=p(e,d);var b,w,x=e.lastIndexOf(".");if(0>x){var C=$?e.lastIndexOf("e"):-1;0>C?(b=e,w=""):(b=e.substring(0,C),w=e.substring(C))}else b=e.substring(0,x),w=t+e.substring(x+1);!u&&f&&(b=o(b,1/0));var E=m.length+b.length+w.length+(y?0:i.length),k=c>E?new Array(E=c-E+1).join(r):"";return y&&(b=o(k+b,k.length?c-w.length:1/0)),i+=m,e=b+w,("<"===a?i+e+k:">"===a?k+i+e:"^"===a?k.substring(0,E>>=1)+i+e+k.substring(E):i+(y?e:k+e))+n}}}function Le(e){return e+""}function Fe(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ue(e,t,n){function r(t){var n=e(t),r=o(n,1);return r-t>t-n?n:r}function i(n){return t(n=e(new as(n-1)),1),n}function o(e,n){return t(e=new as(+e),n),e}function a(e,r,o){var a=i(e),s=[];if(o>1)for(;r>a;)n(a)%o||s.push(new Date(+a)),t(a,1);else for(;r>a;)s.push(new Date(+a)),t(a,1);return s}function s(e,t,n){try{as=Fe;var r=new Fe;return r._=e,a(r,t,n)}finally{as=Date}}e.floor=e,e.round=r,e.ceil=i,e.offset=o,e.range=a;var l=e.utc=je(e);return l.floor=l,l.round=je(r),l.ceil=je(i),l.offset=je(o),l.range=s,e}function je(e){return function(t,n){try{as=Fe;var r=new Fe;return r._=t,e(r,n)._}finally{as=Date}}}function He(e){function t(e){function t(t){for(var n,i,o,a=[],s=-1,l=0;++ss;){if(r>=u)return-1;if(37===(i=t.charCodeAt(s++))){if(a=t.charAt(s++),!(o=T[a in ls?t.charAt(s++):a])||(r=o(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(e,t,n){x.lastIndex=0;var r=x.exec(t.slice(n));return r?(e.w=C.get(r[0].toLowerCase()),n+r[0].length):-1}function i(e,t,n){b.lastIndex=0;var r=b.exec(t.slice(n));return r?(e.w=w.get(r[0].toLowerCase()),n+r[0].length):-1}function o(e,t,n){S.lastIndex=0;var r=S.exec(t.slice(n));return r?(e.m=_.get(r[0].toLowerCase()),n+r[0].length):-1}function a(e,t,n){E.lastIndex=0;var r=E.exec(t.slice(n));return r?(e.m=k.get(r[0].toLowerCase()),n+r[0].length):-1}function s(e,t,r){return n(e,M.c.toString(),t,r)}function l(e,t,r){return n(e,M.x.toString(),t,r)}function u(e,t,r){return n(e,M.X.toString(),t,r)}function c(e,t,n){var r=y.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)}var f=e.dateTime,d=e.date,p=e.time,h=e.periods,m=e.days,g=e.shortDays,v=e.months,$=e.shortMonths;t.utc=function(e){function n(e){try{as=Fe;var t=new as;return t._=e,r(t)}finally{as=Date}}var r=t(e);return n.parse=function(e){try{as=Fe;var t=r.parse(e);return t&&t._}finally{as=Date}},n.toString=r.toString,n},t.multi=t.utc.multi=st;var y=na.map(),b=Ve(m),w=Be(m),x=Ve(g),C=Be(g),E=Ve(v),k=Be(v),S=Ve($),_=Be($);h.forEach(function(e,t){y.set(e.toLowerCase(),t)});var M={a:function(e){return g[e.getDay()]},A:function(e){return m[e.getDay()]},b:function(e){return $[e.getMonth()]},B:function(e){return v[e.getMonth()]},c:t(f),d:function(e,t){return qe(e.getDate(),t,2)},e:function(e,t){return qe(e.getDate(),t,2)},H:function(e,t){return qe(e.getHours(),t,2)},I:function(e,t){return qe(e.getHours()%12||12,t,2)},j:function(e,t){return qe(1+os.dayOfYear(e),t,3)},L:function(e,t){return qe(e.getMilliseconds(),t,3)},m:function(e,t){return qe(e.getMonth()+1,t,2)},M:function(e,t){return qe(e.getMinutes(),t,2)},p:function(e){return h[+(e.getHours()>=12)]},S:function(e,t){return qe(e.getSeconds(),t,2)},U:function(e,t){return qe(os.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return qe(os.mondayOfYear(e),t,2)},x:t(d),X:t(p),y:function(e,t){return qe(e.getFullYear()%100,t,2)},Y:function(e,t){return qe(e.getFullYear()%1e4,t,4)},Z:ot,"%":function(){return"%"}},T={a:r,A:i,b:o,B:a,c:s,d:Qe,e:Qe,H:tt,I:tt,j:et,L:it,m:Xe,M:nt,p:c,S:rt,U:Ye,w:ze,W:We,x:l,X:u,y:Ke,Y:Ge,Z:Ze,"%":at};return t}function qe(e,t,n){var r=0>e?"-":"",i=(r?-e:e)+"",o=i.length;return r+(n>o?new Array(n-o+1).join(t)+i:i)}function Ve(e){return new RegExp("^(?:"+e.map(na.requote).join("|")+")","i")}function Be(e){for(var t=new u,n=-1,r=e.length;++n68?1900:2e3)}function Xe(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Qe(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function et(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+3));return r?(e.j=+r[0],n+r[0].length):-1}function tt(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function nt(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function rt(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function it(e,t,n){us.lastIndex=0;var r=us.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ot(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=da(t)/60|0,i=da(t)%60;return n+qe(r,"0",2)+qe(i,"0",2)}function at(e,t,n){cs.lastIndex=0;var r=cs.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function st(e){for(var t=e.length,n=-1;++n=0?1:-1,s=a*n,l=Math.cos(t),u=Math.sin(t),c=o*u,f=i*l+c*Math.cos(s),d=c*a*Math.sin(s);gs.add(Math.atan2(d,f)),r=e,i=l,o=u}var t,n,r,i,o;vs.point=function(a,s){vs.point=e,r=(t=a)*Ra,i=Math.cos(s=(n=s)*Ra/2+Da/4),o=Math.sin(s)},vs.lineEnd=function(){e(t,n)}}function ht(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function mt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function gt(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function vt(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function $t(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function yt(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function bt(e){return[Math.atan2(e[1],e[0]),te(e[2])]}function wt(e,t){return da(e[0]-t[0])s;++s)i.point((n=e[s])[0],n[1]);return void i.lineEnd()}var l=new At(n,e,null,!0),u=new At(n,null,l,!1);l.o=u,o.push(l),a.push(u),l=new At(r,e,null,!1),u=new At(r,null,l,!0),l.o=u,o.push(l),a.push(u)}}),a.sort(t),Dt(o),Dt(a),o.length){for(var s=0,l=n,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,f,d=o[0];;){for(var p=d,h=!0;p.v;)if((p=p.n)===d)return;c=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(h)for(var s=0,u=c.length;u>s;++s)i.point((f=c[s])[0],f[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(h){c=p.p.z;for(var s=c.length-1;s>=0;--s)i.point((f=c[s])[0],f[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,c=p.z,h=!h}while(!p.v);i.lineEnd()}}}function Dt(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r0){for(w||(o.polygonStart(),w=!0),o.lineStart();++a1&&2&t&&n.push(n.pop().concat(n.shift())),p.push(n.filter(Nt))}var p,h,m,g=t(o),v=i.invert(r[0],r[1]),$={point:a,lineStart:l,lineEnd:u,polygonStart:function(){$.point=c,$.lineStart=f,$.lineEnd=d,p=[],h=[]},polygonEnd:function(){$.point=a,$.lineStart=l,$.lineEnd=u,p=na.merge(p);var e=Ut(v,h);p.length?(w||(o.polygonStart(),w=!0),Tt(p,It,e,n,o)):e&&(w||(o.polygonStart(),w=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),w&&(o.polygonEnd(),w=!1),p=h=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},y=Rt(),b=t(y),w=!1;return $}}function Nt(e){return e.length>1}function Rt(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,n){e.push([t,n])},lineEnd:w,buffer:function(){var n=t;return t=[],e=null,n},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function It(e,t){return((e=e.x)[0]<0?e[1]-Na-Ma:Na-e[1])-((t=t.x)[0]<0?t[1]-Na-Ma:Na-t[1])}function Pt(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?Da:-Da,l=da(o-n);da(l-Da)0?Na:-Na),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(o,r),t=0):i!==s&&l>=Da&&(da(n-i)Ma?Math.atan((Math.sin(t)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*o*a)):(t+r)/2}function Ft(e,t,n,r){var i;if(null==e)i=n*Na,r.point(-Da,i),r.point(0,i),r.point(Da,i),r.point(Da,0),r.point(Da,-i),r.point(0,-i),r.point(-Da,-i),r.point(-Da,0),r.point(-Da,i);else if(da(e[0]-t[0])>Ma){var o=e[0]s;++s){var u=t[s],c=u.length;if(c)for(var f=u[0],d=f[0],p=f[1]/2+Da/4,h=Math.sin(p),m=Math.cos(p),g=1;;){g===c&&(g=0),e=u[g];var v=e[0],$=e[1]/2+Da/4,y=Math.sin($),b=Math.cos($),w=v-d,x=w>=0?1:-1,C=x*w,E=C>Da,k=h*y;if(gs.add(Math.atan2(k*x*Math.sin(C),m*b+k*Math.cos(C))),o+=E?w+x*Aa:w,E^d>=n^v>=n){var S=gt(ht(f),ht(e));yt(S);var _=gt(i,S);yt(_);var M=(E^w>=0?-1:1)*te(_[2]);(r>M||r===M&&(S[0]||S[1]))&&(a+=E^w>=0?1:-1)}if(!g++)break;d=v,h=y,m=b,f=e}}return(-Ma>o||Ma>o&&0>gs)^1&a}function jt(e){function t(e,t){return Math.cos(e)*Math.cos(t)>o}function n(e){var n,o,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,d){var p,h=[f,d],m=t(f,d),g=a?m?0:i(f,d):m?i(f+(0>f?Da:-Da),d):0;if(!n&&(u=l=m)&&e.lineStart(),m!==l&&(p=r(n,h),(wt(n,p)||wt(h,p))&&(h[0]+=Ma,h[1]+=Ma,m=t(h[0],h[1]))),m!==l)c=0,m?(e.lineStart(),p=r(h,n),e.point(p[0],p[1])):(p=r(n,h),e.point(p[0],p[1]),e.lineEnd()),n=p;else if(s&&n&&a^m){var v;g&o||!(v=r(h,n,!0))||(c=0,a?(e.lineStart(),e.point(v[0][0],v[0][1]),e.point(v[1][0],v[1][1]),e.lineEnd()):(e.point(v[1][0],v[1][1]),e.lineEnd(),e.lineStart(),e.point(v[0][0],v[0][1])))}!m||n&&wt(n,h)||e.point(h[0],h[1]),n=h,l=m,o=g},lineEnd:function(){l&&e.lineEnd(),n=null},clean:function(){return c|(u&&l)<<1}}}function r(e,t,n){var r=ht(e),i=ht(t),a=[1,0,0],s=gt(r,i),l=mt(s,s),u=s[0],c=l-u*u;if(!c)return!n&&e;var f=o*l/c,d=-o*u/c,p=gt(a,s),h=$t(a,f);vt(h,$t(s,d));var m=p,g=mt(h,m),v=mt(m,m),$=g*g-v*(mt(h,h)-1);if(!(0>$)){var y=Math.sqrt($),b=$t(m,(-g-y)/v);if(vt(b,h),b=bt(b),!n)return b;var w,x=e[0],C=t[0],E=e[1],k=t[1];x>C&&(w=x,x=C,C=w);var S=C-x,_=da(S-Da)S;if(!_&&E>k&&(w=E,E=k,k=w),M?_?E+k>0^b[1]<(da(b[0]-x)Da^(x<=b[0]&&b[0]<=C)){var T=$t(m,(-g+y)/v);return vt(T,h),[b,bt(T)]}}}function i(t,n){var r=a?e:Da-e,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>n?i|=4:n>r&&(i|=8),i}var o=Math.cos(e),a=o>0,s=da(o)>Ma;return Ot(t,n,hn(e,6*Ra),a?[0,-e]:[-Da,e-Da])}function Ht(e,t,n,r){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,f=s.y,d=0,p=1,h=c-l,m=f-u;if(o=e-l,h||!(o>0)){if(o/=h,0>h){if(d>o)return;p>o&&(p=o)}else if(h>0){if(o>p)return;o>d&&(d=o)}if(o=n-l,h||!(0>o)){if(o/=h,0>h){if(o>p)return;o>d&&(d=o)}else if(h>0){if(d>o)return;p>o&&(p=o)}if(o=t-u,m||!(o>0)){if(o/=m,0>m){if(d>o)return;p>o&&(p=o)}else if(m>0){if(o>p)return;o>d&&(d=o)}if(o=r-u,m||!(0>o)){if(o/=m,0>m){if(o>p)return;o>d&&(d=o)}else if(m>0){if(d>o)return;p>o&&(p=o)}return d>0&&(i.a={x:l+d*h,y:u+d*m}),1>p&&(i.b={x:l+p*h,y:u+p*m}),i}}}}}}function qt(e,t,n,r){function i(r,i){return da(r[0]-e)0?0:3:da(r[0]-n)0?2:1:da(r[1]-t)0?1:0:i>0?3:2}function o(e,t){return a(e.x,t.x)}function a(e,t){var n=i(e,1),r=i(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(s){function l(e){for(var t=0,n=g.length,r=e[1],i=0;n>i;++i)for(var o,a=1,s=g[i],l=s.length,u=s[0];l>a;++a)o=s[a],u[1]<=r?o[1]>r&&Q(u,o,e)>0&&++t:o[1]<=r&&Q(u,o,e)<0&&--t,u=o;return 0!==t}function u(o,s,l,u){var c=0,f=0;if(null==o||(c=i(o,l))!==(f=i(s,l))||a(o,s)<0^l>0)do{u.point(0===c||3===c?e:n,c>1?r:t)}while((c=(c+l+4)%4)!==f);else u.point(s[0],s[1])}function c(i,o){return i>=e&&n>=i&&o>=t&&r>=o}function f(e,t){c(e,t)&&s.point(e,t)}function d(){T.point=h,g&&g.push(v=[]),E=!0,C=!1,w=x=NaN}function p(){m&&(h($,y),b&&C&&_.rejoin(),m.push(_.buffer())),T.point=f,C&&s.lineEnd()}function h(e,t){e=Math.max(-As,Math.min(As,e)),t=Math.max(-As,Math.min(As,t));var n=c(e,t);if(g&&v.push([e,t]),E)$=e,y=t,b=n,E=!1,n&&(s.lineStart(),s.point(e,t));else if(n&&C)s.point(e,t);else{var r={a:{x:w,y:x},b:{x:e,y:t}};M(r)?(C||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),k=!1):n&&(s.lineStart(),s.point(e,t),k=!1)}w=e,x=t,C=n}var m,g,v,$,y,b,w,x,C,E,k,S=s,_=Rt(),M=Ht(e,t,n,r),T={point:f,lineStart:d,lineEnd:p,polygonStart:function(){s=_,m=[],g=[],k=!0},polygonEnd:function(){s=S,m=na.merge(m);var t=l([e,r]),n=k&&t,i=m.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Tt(m,o,t,u,s),s.polygonEnd()),m=g=v=null}};return T}}function Vt(e){var t=0,n=Da/3,r=an(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*Da/180,n=e[1]*Da/180):[t/Da*180,n/Da*180]},i}function Bt(e,t){function n(e,t){var n=Math.sqrt(o-2*i*Math.sin(t))/i;return[n*Math.sin(e*=i),a-n*Math.cos(e)]}var r=Math.sin(e),i=(r+Math.sin(t))/2,o=1+r*(2*i-r),a=Math.sqrt(o)/i;return n.invert=function(e,t){var n=a-t;return[Math.atan2(e,n)/i,te((o-(e*e+n*n)*i*i)/(2*i))]},n}function zt(){function e(e,t){Ns+=i*e-r*t,r=e,i=t}var t,n,r,i;Fs.point=function(o,a){Fs.point=e,t=r=o,n=i=a},Fs.lineEnd=function(){e(t,n)}}function Yt(e,t){Rs>e&&(Rs=e),e>Ps&&(Ps=e),Is>t&&(Is=t),t>Ls&&(Ls=t)}function Wt(){function e(e,t){a.push("M",e,",",t,o)}function t(e,t){a.push("M",e,",",t),s.point=n}function n(e,t){a.push("L",e,",",t)}function r(){s.point=e}function i(){a.push("Z")}var o=Gt(4.5),a=[],s={point:e,lineStart:function(){s.point=t},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r,s.point=e},pointRadius:function(e){return o=Gt(e),s},result:function(){if(a.length){var e=a.join("");return a=[],e}}};return s}function Gt(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function Kt(e,t){bs+=e,ws+=t,++xs}function Zt(){function e(e,r){var i=e-t,o=r-n,a=Math.sqrt(i*i+o*o);Cs+=a*(t+e)/2,Es+=a*(n+r)/2,ks+=a,Kt(t=e,n=r)}var t,n;js.point=function(r,i){js.point=e,Kt(t=r,n=i)}}function Jt(){js.point=Kt}function Xt(){function e(e,t){var n=e-r,o=t-i,a=Math.sqrt(n*n+o*o);Cs+=a*(r+e)/2,Es+=a*(i+t)/2,ks+=a,a=i*e-r*t,Ss+=a*(r+e),_s+=a*(i+t),Ms+=3*a,Kt(r=e,i=t)}var t,n,r,i;js.point=function(o,a){js.point=e,Kt(t=r=o,n=i=a)},js.lineEnd=function(){e(t,n)}}function Qt(e){function t(t,n){e.moveTo(t+a,n),e.arc(t,n,a,0,Aa)}function n(t,n){e.moveTo(t,n),s.point=r}function r(t,n){e.lineTo(t,n)}function i(){s.point=t}function o(){e.closePath()}var a=4.5,s={point:t,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i,s.point=t},pointRadius:function(e){return a=e,s},result:w};return s}function en(e){function t(e){return(s?r:n)(e)}function n(t){return rn(t,function(n,r){n=e(n,r),t.point(n[0],n[1])})}function r(t){function n(n,r){n=e(n,r),t.point(n[0],n[1])}function r(){y=NaN,E.point=o,t.lineStart()}function o(n,r){var o=ht([n,r]),a=e(n,r);i(y,b,$,w,x,C,y=a[0],b=a[1],$=n,w=o[0],x=o[1],C=o[2],s,t),t.point(y,b)}function a(){E.point=n,t.lineEnd()}function l(){r(),E.point=u,E.lineEnd=c}function u(e,t){o(f=e,d=t),p=y,h=b,m=w,g=x,v=C,E.point=o}function c(){i(y,b,$,w,x,C,p,h,f,m,g,v,s,t),E.lineEnd=a,a()}var f,d,p,h,m,g,v,$,y,b,w,x,C,E={point:n,lineStart:r,lineEnd:a,polygonStart:function(){t.polygonStart(),E.lineStart=l},polygonEnd:function(){t.polygonEnd(),E.lineStart=r}};return E}function i(t,n,r,s,l,u,c,f,d,p,h,m,g,v){var $=c-t,y=f-n,b=$*$+y*y;if(b>4*o&&g--){var w=s+p,x=l+h,C=u+m,E=Math.sqrt(w*w+x*x+C*C),k=Math.asin(C/=E),S=da(da(C)-1)o||da(($*D+y*A)/b-.5)>.3||a>s*p+l*h+u*m)&&(i(t,n,r,s,l,u,M,T,S,w/=E,x/=E,C,g,v),v.point(M,T),i(M,T,S,w,x,C,c,f,d,p,h,m,g,v))}}var o=.5,a=Math.cos(30*Ra),s=16;return t.precision=function(e){return arguments.length?(s=(o=e*e)>0&&16,t):Math.sqrt(o)},t}function tn(e){var t=en(function(t,n){return e([t*Ia,n*Ia])});return function(e){return sn(t(e))}}function nn(e){this.stream=e}function rn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function on(e){return an(function(){return e})()}function an(e){function t(e){return e=s(e[0]*Ra,e[1]*Ra),[e[0]*d+l,u-e[1]*d]}function n(e){return(e=s.invert((e[0]-l)/d,(u-e[1])/d))&&[e[0]*Ia,e[1]*Ia]}function r(){s=_t(a=cn(v,y,b),o);var e=o(m,g);return l=p-e[0]*d,u=h+e[1]*d,i()}function i(){return c&&(c.valid=!1,c=null),t}var o,a,s,l,u,c,f=en(function(e,t){return e=o(e,t),[e[0]*d+l,u-e[1]*d]}),d=150,p=480,h=250,m=0,g=0,v=0,y=0,b=0,w=Ds,x=$,C=null,E=null;return t.stream=function(e){return c&&(c.valid=!1),c=sn(w(a,f(x(e)))),c.valid=!0,c},t.clipAngle=function(e){return arguments.length?(w=null==e?(C=e,Ds):jt((C=+e)*Ra),i()):C},t.clipExtent=function(e){return arguments.length?(E=e,x=e?qt(e[0][0],e[0][1],e[1][0],e[1][1]):$,i()):E},t.scale=function(e){return arguments.length?(d=+e,r()):d},t.translate=function(e){return arguments.length?(p=+e[0],h=+e[1],r()):[p,h]},t.center=function(e){return arguments.length?(m=e[0]%360*Ra,g=e[1]%360*Ra,r()):[m*Ia,g*Ia]},t.rotate=function(e){return arguments.length?(v=e[0]%360*Ra,y=e[1]%360*Ra,b=e.length>2?e[2]%360*Ra:0,r()):[v*Ia,y*Ia,b*Ia]},na.rebind(t,f,"precision"),function(){return o=e.apply(this,arguments),t.invert=o.invert&&n,r()}}function sn(e){return rn(e,function(t,n){e.point(t*Ra,n*Ra)})}function ln(e,t){return[e,t]}function un(e,t){return[e>Da?e-Aa:-Da>e?e+Aa:e,t]}function cn(e,t,n){return e?t||n?_t(dn(e),pn(t,n)):dn(e):t||n?pn(t,n):un}function fn(e){return function(t,n){return t+=e,[t>Da?t-Aa:-Da>t?t+Aa:t,n]}}function dn(e){var t=fn(e);return t.invert=fn(-e),t}function pn(e,t){function n(e,t){var n=Math.cos(t),s=Math.cos(e)*n,l=Math.sin(e)*n,u=Math.sin(t),c=u*r+s*i;return[Math.atan2(l*o-c*a,s*r-u*i),te(c*o+l*a)]}var r=Math.cos(e),i=Math.sin(e),o=Math.cos(t),a=Math.sin(t);return n.invert=function(e,t){var n=Math.cos(t),s=Math.cos(e)*n,l=Math.sin(e)*n,u=Math.sin(t),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*r+c*i),te(c*r-s*i)]},n}function hn(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,o,a,s){var l=a*t;null!=i?(i=mn(n,i),o=mn(n,o),(a>0?o>i:i>o)&&(i+=a*Aa)):(i=e+a*Aa,o=e-.5*l);for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=bt([n,-r*Math.cos(c),-r*Math.sin(c)]))[0],u[1])}}function mn(e,t){var n=ht(t);n[0]-=e,yt(n);var r=ee(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-Ma)%(2*Math.PI)}function gn(e,t,n){var r=na.range(e,t-Ma,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function vn(e,t,n){var r=na.range(e,t-Ma,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function $n(e){return e.source}function yn(e){return e.target}function bn(e,t,n,r){var i=Math.cos(t),o=Math.sin(t),a=Math.cos(r),s=Math.sin(r),l=i*Math.cos(e),u=i*Math.sin(e),c=a*Math.cos(n),f=a*Math.sin(n),d=2*Math.asin(Math.sqrt(oe(r-t)+i*a*oe(n-e))),p=1/Math.sin(d),h=d?function(e){var t=Math.sin(e*=d)*p,n=Math.sin(d-e)*p,r=n*l+t*c,i=n*u+t*f,a=n*o+t*s;return[Math.atan2(i,r)*Ia,Math.atan2(a,Math.sqrt(r*r+i*i))*Ia]}:function(){return[e*Ia,t*Ia]};return h.distance=d,h}function wn(){function e(e,i){var o=Math.sin(i*=Ra),a=Math.cos(i),s=da((e*=Ra)-t),l=Math.cos(s);Hs+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=r*o-n*a*l)*s),n*o+r*a*l),t=e,n=o,r=a}var t,n,r;qs.point=function(i,o){t=i*Ra,n=Math.sin(o*=Ra),r=Math.cos(o),qs.point=e},qs.lineEnd=function(){qs.point=qs.lineEnd=w}}function xn(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),o=e(r*i);return[o*i*Math.sin(t),o*Math.sin(n)]}return n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(e*o,r*a),Math.asin(r&&n*o/r)]},n}function Cn(e,t){function n(e,t){a>0?-Na+Ma>t&&(t=-Na+Ma):t>Na-Ma&&(t=Na-Ma);var n=a/Math.pow(i(t),o);return[n*Math.sin(o*e),a-n*Math.cos(o*e)]}var r=Math.cos(e),i=function(e){return Math.tan(Da/4+e/2)},o=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(i(t)/i(e)),a=r*Math.pow(i(e),o)/o;return o?(n.invert=function(e,t){var n=a-t,r=X(o)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/o,2*Math.atan(Math.pow(a/r,1/o))-Na]},n):kn}function En(e,t){function n(e,t){var n=o-t;return[n*Math.sin(i*e),o-n*Math.cos(i*e)]}var r=Math.cos(e),i=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),o=r/i+e;return da(i)i;i++){for(;r>1&&Q(e[n[r-2]],e[n[r-1]],e[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function An(e,t){return e[0]-t[0]||e[1]-t[1]}function On(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function Nn(e,t,n,r){var i=e[0],o=n[0],a=t[0]-i,s=r[0]-o,l=e[1],u=n[1],c=t[1]-l,f=r[1]-u,d=(s*(l-u)-f*(i-o))/(f*a-s*c);return[i+d*a,l+d*c]}function Rn(e){var t=e[0],n=e[e.length-1];return!(t[0]-n[0]||t[1]-n[1])}function In(){nr(this),this.edge=this.site=this.circle=null}function Pn(e){var t=el.pop()||new In;return t.site=e,t}function Ln(e){Wn(e),Js.remove(e),el.push(e),nr(e)}function Fn(e){var t=e.circle,n=t.x,r=t.cy,i={x:n,y:r},o=e.P,a=e.N,s=[e];Ln(e);for(var l=o;l.circle&&da(n-l.circle.x)c;++c)u=s[c],l=s[c-1],Qn(u.edge,l.site,u.site,i);l=s[0],u=s[f-1],u.edge=Jn(l.site,u.site,null,i),Yn(l),Yn(u)}function Un(e){for(var t,n,r,i,o=e.x,a=e.y,s=Js._;s;)if((r=jn(s,a)-o)>Ma)s=s.L;else{if(!((i=o-Hn(s,a))>Ma)){r>-Ma?(t=s.P,n=s):i>-Ma?(t=s,n=s.N):t=n=s;break}if(!s.R){t=s;break}s=s.R}var l=Pn(e);if(Js.insert(t,l),t||n){if(t===n)return Wn(t),n=Pn(t.site),Js.insert(l,n),l.edge=n.edge=Jn(t.site,l.site),Yn(t),void Yn(n);if(!n)return void(l.edge=Jn(t.site,l.site));Wn(t),Wn(n);var u=t.site,c=u.x,f=u.y,d=e.x-c,p=e.y-f,h=n.site,m=h.x-c,g=h.y-f,v=2*(d*g-p*m),$=d*d+p*p,y=m*m+g*g,b={x:(g*$-p*y)/v+c,y:(d*y-m*$)/v+f};Qn(n.edge,u,h,b),l.edge=Jn(u,e,null,b),n.edge=Jn(e,h,null,b),Yn(t),Yn(n)}}function jn(e,t){var n=e.site,r=n.x,i=n.y,o=i-t;if(!o)return r;var a=e.P;if(!a)return-1/0;n=a.site;var s=n.x,l=n.y,u=l-t;if(!u)return s;var c=s-r,f=1/o-1/u,d=c/u;return f?(-d+Math.sqrt(d*d-2*f*(c*c/(-2*u)-l+u/2+i-o/2)))/f+r:(r+s)/2}function Hn(e,t){var n=e.N;if(n)return jn(n,t);var r=e.site;return r.y===t?r.x:1/0}function qn(e){this.site=e,this.edges=[]}function Vn(e){for(var t,n,r,i,o,a,s,l,u,c,f=e[0][0],d=e[1][0],p=e[0][1],h=e[1][1],m=Zs,g=m.length;g--;)if((o=m[g])&&o.prepare())for(s=o.edges,l=s.length,a=0;l>a;)c=s[a].end(),r=c.x,i=c.y,u=s[++a%l].start(),t=u.x,n=u.y,(da(r-t)>Ma||da(i-n)>Ma)&&(s.splice(a,0,new er(Xn(o.site,c,da(r-f)Ma?{x:f,y:da(t-f)Ma?{x:da(n-h)Ma?{x:d,y:da(t-d)Ma?{x:da(n-p)=-Ta)){var p=l*l+u*u,h=c*c+f*f,m=(f*p-u*h)/d,g=(l*h-c*p)/d,f=g+s,v=tl.pop()||new zn;v.arc=e,v.site=i,v.x=m+a,v.y=f+Math.sqrt(m*m+g*g),v.cy=f,e.circle=v;for(var $=null,y=Qs._;y;)if(v.yg||g>=s)return;if(d>h){if(o){if(o.y>=u)return}else o={x:g,y:l};n={x:g,y:u}}else{if(o){if(o.yr||r>1)if(d>h){if(o){if(o.y>=u)return}else o={x:(l-i)/r,y:l};n={x:(u-i)/r,y:u}}else{if(o){if(o.yp){if(o){if(o.x>=s)return}else o={x:a,y:r*a+i};n={x:s,y:r*s+i}}else{if(o){if(o.xo||f>a||r>d||i>p)){if(h=u.point){var h,m=t-u.x,g=n-u.y,v=m*m+g*g;if(l>v){var $=Math.sqrt(l=v);r=t-$,i=n-$,o=t+$,a=n+$,s=h}}for(var y=u.nodes,b=.5*(c+d),w=.5*(f+p),x=t>=b,C=n>=w,E=C<<1|x,k=E+4;k>E;++E)if(u=y[3&E])switch(3&E){case 0:e(u,c,f,b,w);break;case 1:e(u,b,f,d,w);break;case 2:e(u,c,w,b,p);break;case 3:e(u,b,w,d,p)}}}(e,r,i,o,a),s}function hr(e,t){e=na.rgb(e),t=na.rgb(t);var n=e.r,r=e.g,i=e.b,o=t.r-n,a=t.g-r,s=t.b-i;return function(e){return"#"+be(Math.round(n+o*e))+be(Math.round(r+a*e))+be(Math.round(i+s*e))}}function mr(e,t){var n,r={},i={};for(n in e)n in t?r[n]=$r(e[n],t[n]):i[n]=e[n];for(n in t)n in e||(i[n]=t[n]);return function(e){for(n in r)i[n]=r[n](e);return i}}function gr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function vr(e,t){var n,r,i,o=rl.lastIndex=il.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=rl.exec(e))&&(r=il.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:gr(n,r)})),o=il.lastIndex;return or;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}function $r(e,t){for(var n,r=na.interpolators.length;--r>=0&&!(n=na.interpolators[r](e,t)););return n}function yr(e,t){var n,r=[],i=[],o=e.length,a=t.length,s=Math.min(e.length,t.length);for(n=0;s>n;++n)r.push($r(e[n],t[n]));for(;o>n;++n)i[n]=e[n];for(;a>n;++n)i[n]=t[n];return function(e){for(n=0;s>n;++n)i[n]=r[n](e);return i}}function br(e){return function(t){return 0>=t?0:t>=1?1:e(t)}}function wr(e){return function(t){return 1-e(1-t)}}function xr(e){return function(t){return.5*(.5>t?e(2*t):2-e(2-2*t))}} +function Cr(e){return e*e}function Er(e){return e*e*e}function kr(e){if(0>=e)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(.5>e?n:3*(e-t)+n-.75)}function Sr(e){return function(t){return Math.pow(t,e)}}function _r(e){return 1-Math.cos(e*Na)}function Mr(e){return Math.pow(2,10*(e-1))}function Tr(e){return 1-Math.sqrt(1-e*e)}function Dr(e,t){var n;return arguments.length<2&&(t=.45),arguments.length?n=t/Aa*Math.asin(1/e):(e=1,n=t/4),function(r){return 1+e*Math.pow(2,-10*r)*Math.sin((r-n)*Aa/t)}}function Ar(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function Or(e){return 1/2.75>e?7.5625*e*e:2/2.75>e?7.5625*(e-=1.5/2.75)*e+.75:2.5/2.75>e?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function Nr(e,t){e=na.hcl(e),t=na.hcl(t);var n=e.h,r=e.c,i=e.l,o=t.h-n,a=t.c-r,s=t.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?t.c:r),isNaN(o)?(o=0,n=isNaN(n)?t.h:n):o>180?o-=360:-180>o&&(o+=360),function(e){return ce(n+o*e,r+a*e,i+s*e)+""}}function Rr(e,t){e=na.hsl(e),t=na.hsl(t);var n=e.h,r=e.s,i=e.l,o=t.h-n,a=t.s-r,s=t.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?t.s:r),isNaN(o)?(o=0,n=isNaN(n)?t.h:n):o>180?o-=360:-180>o&&(o+=360),function(e){return le(n+o*e,r+a*e,i+s*e)+""}}function Ir(e,t){e=na.lab(e),t=na.lab(t);var n=e.l,r=e.a,i=e.b,o=t.l-n,a=t.a-r,s=t.b-i;return function(e){return de(n+o*e,r+a*e,i+s*e)+""}}function Pr(e,t){return t-=e,function(n){return Math.round(e+t*n)}}function Lr(e){var t=[e.a,e.b],n=[e.c,e.d],r=Ur(t),i=Fr(t,n),o=Ur(jr(n,t,-i))||0;t[0]*n[1]180?c+=360:c-u>180&&(u+=360),i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:gr(u,c)})):c&&r.push(r.pop()+"rotate("+c+")"),f!=d?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:gr(f,d)}):d&&r.push(r.pop()+"skewX("+d+")"),p[0]!=h[0]||p[1]!=h[1]?(n=r.push(r.pop()+"scale(",null,",",null,")"),i.push({i:n-4,x:gr(p[0],h[0])},{i:n-2,x:gr(p[1],h[1])})):(1!=h[0]||1!=h[1])&&r.push(r.pop()+"scale("+h+")"),n=i.length,function(e){for(var t,o=-1;++o=0;)n.push(i[r])}function ei(e,t){for(var n=[e],r=[];null!=(e=n.pop());)if(r.push(e),(o=e.children)&&(i=o.length))for(var i,o,a=-1;++an;++n)(t=e[n][1])>i&&(r=n,i=t);return r}function fi(e){return e.reduce(di,0)}function di(e,t){return e+t[1]}function pi(e,t){return hi(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function hi(e,t){for(var n=-1,r=+e[0],i=(e[1]-r)/t,o=[];++n<=t;)o[n]=i*n+r;return o}function mi(e){return[na.min(e),na.max(e)]}function gi(e,t){return e.value-t.value}function vi(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function $i(e,t){e._pack_next=t,t._pack_prev=e}function yi(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return.999*i*i>n*n+r*r}function bi(e){function t(e){c=Math.min(e.x-e.r,c),f=Math.max(e.x+e.r,f),d=Math.min(e.y-e.r,d),p=Math.max(e.y+e.r,p)}if((n=e.children)&&(u=n.length)){var n,r,i,o,a,s,l,u,c=1/0,f=-1/0,d=1/0,p=-1/0;if(n.forEach(wi),r=n[0],r.x=-r.r,r.y=0,t(r),u>1&&(i=n[1],i.x=i.r,i.y=0,t(i),u>2))for(o=n[2],Ei(r,i,o),t(o),vi(r,o),r._pack_prev=o,vi(o,i),i=r._pack_next,a=3;u>a;a++){Ei(r,i,o=n[a]);var h=0,m=1,g=1;for(s=i._pack_next;s!==i;s=s._pack_next,m++)if(yi(s,o)){h=1;break}if(1==h)for(l=r._pack_prev;l!==s._pack_prev&&!yi(l,o);l=l._pack_prev,g++);h?(g>m||m==g&&i.ra;a++)o=n[a],o.x-=v,o.y-=$,y=Math.max(y,o.r+Math.sqrt(o.x*o.x+o.y*o.y));e.r=y,n.forEach(xi)}}function wi(e){e._pack_next=e._pack_prev=e}function xi(e){delete e._pack_next,delete e._pack_prev}function Ci(e,t,n,r){var i=e.children;if(e.x=t+=r*e.x,e.y=n+=r*e.y,e.r*=r,i)for(var o=-1,a=i.length;++o=0;)t=i[o],t.z+=n,t.m+=n,n+=t.s+(r+=t.c)}function Di(e,t,n){return e.a.parent===t.parent?e.a:n}function Ai(e){return 1+na.max(e,function(e){return e.y})}function Oi(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Ni(e){var t=e.children;return t&&t.length?Ni(t[0]):e}function Ri(e){var t,n=e.children;return n&&(t=n.length)?Ri(n[t-1]):e}function Ii(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Pi(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],o=e.dy-t[0]-t[2];return 0>i&&(n+=i/2,i=0),0>o&&(r+=o/2,o=0),{x:n,y:r,dx:i,dy:o}}function Li(e){var t=e[0],n=e[e.length-1];return n>t?[t,n]:[n,t]}function Fi(e){return e.rangeExtent?e.rangeExtent():Li(e.range())}function Ui(e,t,n,r){var i=n(e[0],e[1]),o=r(t[0],t[1]);return function(e){return o(i(e))}}function ji(e,t){var n,r=0,i=e.length-1,o=e[r],a=e[i];return o>a&&(n=r,r=i,i=n,n=o,o=a,a=n),e[r]=t.floor(o),e[i]=t.ceil(a),e}function Hi(e){return e?{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}:ml}function qi(e,t,n,r){var i=[],o=[],a=0,s=Math.min(e.length,t.length)-1;for(e[s]2?qi:Ui,l=r?Vr:qr;return a=i(e,t,l,n),s=i(t,e,l,$r),o}function o(e){return a(e)}var a,s;return o.invert=function(e){return s(e)},o.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},o.range=function(e){return arguments.length?(t=e,i()):t},o.rangeRound=function(e){return o.range(e).interpolate(Pr)},o.clamp=function(e){return arguments.length?(r=e,i()):r},o.interpolate=function(e){return arguments.length?(n=e,i()):n},o.ticks=function(t){return Wi(e,t)},o.tickFormat=function(t,n){return Gi(e,t,n)},o.nice=function(t){return zi(e,t),i()},o.copy=function(){return Vi(e,t,n,r)},i()}function Bi(e,t){return na.rebind(e,t,"range","rangeRound","interpolate","clamp")}function zi(e,t){return ji(e,Hi(Yi(e,t)[2]))}function Yi(e,t){null==t&&(t=10);var n=Li(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),o=t/r*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function Wi(e,t){return na.range.apply(na,Yi(e,t))}function Gi(e,t,n){var r=Yi(e,t);if(n){var i=rs.exec(n);if(i.shift(),"s"===i[8]){var o=na.formatPrefix(Math.max(da(r[0]),da(r[1])));return i[7]||(i[7]="."+Ki(o.scale(r[2]))),i[8]="f",n=na.format(i.join("")),function(e){return n(o.scale(e))+o.symbol}}i[7]||(i[7]="."+Zi(i[8],r)),n=i.join("")}else n=",."+Ki(r[2])+"f";return na.format(n)}function Ki(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}function Zi(e,t){var n=Ki(t[2]);return e in gl?Math.abs(n-Ki(Math.max(da(t[0]),da(t[1]))))+ +("e"!==e):n-2*("%"===e)}function Ji(e,t,n,r){function i(e){return(n?Math.log(0>e?0:e):-Math.log(e>0?0:-e))/Math.log(t)}function o(e){return n?Math.pow(t,e):-Math.pow(t,-e)}function a(t){return e(i(t))}return a.invert=function(t){return o(e.invert(t))},a.domain=function(t){return arguments.length?(n=t[0]>=0,e.domain((r=t.map(Number)).map(i)),a):r},a.base=function(n){return arguments.length?(t=+n,e.domain(r.map(i)),a):t},a.nice=function(){var t=ji(r.map(i),n?Math:$l);return e.domain(t),r=t.map(o),a},a.ticks=function(){var e=Li(r),a=[],s=e[0],l=e[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=t%1?2:t;if(isFinite(c-u)){if(n){for(;c>u;u++)for(var d=1;f>d;d++)a.push(o(u)*d);a.push(o(u))}else for(a.push(o(u));u++0;d--)a.push(o(u)*d);for(u=0;a[u]l;c--);a=a.slice(u,c)}return a},a.tickFormat=function(e,t){if(!arguments.length)return vl;arguments.length<2?t=vl:"function"!=typeof t&&(t=na.format(t));var r,s=Math.max(.1,e/a.ticks().length),l=n?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(e){return e/o(l(i(e)+r))<=s?t(e):""}},a.copy=function(){return Ji(e.copy(),t,n,r)},Bi(a,e)}function Xi(e,t,n){function r(t){return e(i(t))}var i=Qi(t),o=Qi(1/t);return r.invert=function(t){return o(e.invert(t))},r.domain=function(t){return arguments.length?(e.domain((n=t.map(Number)).map(i)),r):n},r.ticks=function(e){return Wi(n,e)},r.tickFormat=function(e,t){return Gi(n,e,t)},r.nice=function(e){return r.domain(zi(n,e))},r.exponent=function(a){return arguments.length?(i=Qi(t=a),o=Qi(1/t),e.domain(n.map(i)),r):t},r.copy=function(){return Xi(e.copy(),t,n)},Bi(r,e)}function Qi(e){return function(t){return 0>t?-Math.pow(-t,e):Math.pow(t,e)}}function eo(e,t){function n(n){return o[((i.get(n)||("range"===t.t?i.set(n,e.push(n)):NaN))-1)%o.length]}function r(t,n){return na.range(e.length).map(function(e){return t+n*e})}var i,o,a;return n.domain=function(r){if(!arguments.length)return e;e=[],i=new u;for(var o,a=-1,s=r.length;++an?[NaN,NaN]:[n>0?s[n-1]:e[0],nt?NaN:t/o+e,[t,t+1/o]},r.copy=function(){return no(e,t,n)},i()}function ro(e,t){function n(n){return n>=n?t[na.bisect(e,n)]:void 0}return n.domain=function(t){return arguments.length?(e=t,n):e},n.range=function(e){return arguments.length?(t=e,n):t},n.invertExtent=function(n){return n=t.indexOf(n),[e[n-1],e[n]]},n.copy=function(){return ro(e,t)},n}function io(e){function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=n.map(t),t):e},t.ticks=function(t){return Wi(e,t)},t.tickFormat=function(t,n){return Gi(e,t,n)},t.copy=function(){return io(e)},t}function oo(){return 0}function ao(e){return e.innerRadius}function so(e){return e.outerRadius}function lo(e){return e.startAngle}function uo(e){return e.endAngle}function co(e){return e&&e.padAngle}function fo(e,t,n,r){return(e-n)*t-(t-r)*e>0?0:1}function po(e,t,n,r,i){var o=e[0]-t[0],a=e[1]-t[1],s=(i?r:-r)/Math.sqrt(o*o+a*a),l=s*a,u=-s*o,c=e[0]+l,f=e[1]+u,d=t[0]+l,p=t[1]+u,h=(c+d)/2,m=(f+p)/2,g=d-c,v=p-f,$=g*g+v*v,y=n-r,b=c*p-d*f,w=(0>v?-1:1)*Math.sqrt(y*y*$-b*b),x=(b*v-g*w)/$,C=(-b*g-v*w)/$,E=(b*v+g*w)/$,k=(-b*g+v*w)/$,S=x-h,_=C-m,M=E-h,T=k-m;return S*S+_*_>M*M+T*T&&(x=E,C=k),[[x-l,C-u],[x*n/y,C*n/y]]}function ho(e){function t(t){function a(){u.push("M",o(e(c),s))}for(var l,u=[],c=[],f=-1,d=t.length,p=Se(n),h=Se(r);++f1&&i.push("H",r[0]),i.join("")}function $o(e){for(var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];++t1){s=t[1],o=e[l],l++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u9&&(i=3*t/Math.sqrt(i),a[s]=i*n,a[s+1]=i*r));for(s=-1;++s<=l;)i=(e[Math.min(l,s+1)][0]-e[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}function Ro(e){return e.length<3?mo(e):e[0]+Co(e,No(e))}function Io(e){for(var t,n,r,i=-1,o=e.length;++ir)return c();var i=o[o.active];i&&(--o.count,delete o[o.active],i.event&&i.event.interrupt.call(e,e.__data__,i.index)),o.active=r,a.event&&a.event.start.call(e,e.__data__,t),a.tween.forEach(function(n,r){(r=r.call(e,e.__data__,t))&&m.push(r)}),d=a.ease,f=a.duration,na.timer(function(){return h.c=u(n||1)?Mt:u,1},0,s)}function u(n){if(o.active!==r)return 1;for(var i=n/f,s=d(i),l=m.length;l>0;)m[--l].call(e,s);return i>=1?(a.event&&a.event.end.call(e,e.__data__,t),c()):void 0}function c(){return--o.count?delete o[r]:delete e[n],1}var f,d,p=a.delay,h=es,m=[];return h.t=p+s,i>=p?l(i-p):void(h.c=l)},0,s)}}function Ko(e,t,n){e.attr("transform",function(e){var r=t(e);return"translate("+(isFinite(r)?r:n(e))+",0)"})}function Zo(e,t,n){e.attr("transform",function(e){var r=t(e);return"translate(0,"+(isFinite(r)?r:n(e))+")"})}function Jo(e){return e.toISOString()}function Xo(e,t,n){function r(t){return e(t)}function i(e,n){var r=e[1]-e[0],i=r/n,o=na.bisect(Vl,i);return o==Vl.length?[t.year,Yi(e.map(function(e){return e/31536e6}),n)[2]]:o?t[i/Vl[o-1]1?{floor:function(t){for(;n(t=e.floor(t));)t=Qo(t-1);return t},ceil:function(t){for(;n(t=e.ceil(t));)t=Qo(+t+1);return t}}:e))},r.ticks=function(e,t){var n=Li(r.domain()),o=null==e?i(n,10):"number"==typeof e?i(n,e):!e.range&&[{range:e},t];return o&&(e=o[0],t=o[1]),e.range(n[0],Qo(+n[1]+1),1>t?1:t)},r.tickFormat=function(){return n},r.copy=function(){return Xo(e.copy(),t,n)},Bi(r,e)}function Qo(e){return new Date(e)}function ea(e){return JSON.parse(e.responseText)}function ta(e){var t=oa.createRange();return t.selectNode(oa.body),t.createContextualFragment(e.responseText)}var na={version:"3.5.6"},ra=[].slice,ia=function(e){return ra.call(e)},oa=this.document;if(oa)try{ia(oa.documentElement.childNodes)[0].nodeType}catch(e){ia=function(e){for(var t=e.length,n=new Array(t);t--;)n[t]=e[t];return n}}if(Date.now||(Date.now=function(){return+new Date}),oa)try{oa.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var aa=this.Element.prototype,sa=aa.setAttribute,la=aa.setAttributeNS,ua=this.CSSStyleDeclaration.prototype,ca=ua.setProperty;aa.setAttribute=function(e,t){sa.call(this,e,t+"")},aa.setAttributeNS=function(e,t,n){la.call(this,e,t,n+"")},ua.setProperty=function(e,t,n){ca.call(this,e,t+"",n)}}na.ascending=n,na.descending=function(e,t){return e>t?-1:t>e?1:t>=e?0:NaN},na.min=function(e,t){var n,r,i=-1,o=e.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},na.max=function(e,t){var n,r,i=-1,o=e.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},na.extent=function(e,t){var n,r,i,o=-1,a=e.length;if(1===arguments.length){for(;++o=r){n=i=r;break}for(;++or&&(n=r),r>i&&(i=r))}else{for(;++o=r){n=i=r;break}for(;++or&&(n=r),r>i&&(i=r))}return[n,i]},na.sum=function(e,t){var n,r=0,o=e.length,a=-1;if(1===arguments.length)for(;++a1?l/(c-1):void 0},na.deviation=function(){var e=na.variance.apply(this,arguments);return e?Math.sqrt(e):e};var fa=o(n);na.bisectLeft=fa.left,na.bisect=na.bisectRight=fa.right,na.bisector=function(e){return o(1===e.length?function(t,r){return n(e(t),r)}:e)},na.shuffle=function(e,t,n){(o=arguments.length)<3&&(n=e.length,2>o&&(t=0));for(var r,i,o=n-t;o;)i=Math.random()*o--|0,r=e[o+t],e[o+t]=e[i+t],e[i+t]=r;return e},na.permute=function(e,t){for(var n=t.length,r=new Array(n);n--;)r[n]=e[t[n]];return r},na.pairs=function(e){for(var t=0,n=e.length-1,r=e[0],i=new Array(0>n?0:n);n>t;)i[t]=[r,r=e[++t]];return i},na.zip=function(){if(!(r=arguments.length))return[];for(var e=-1,t=na.min(arguments,a),n=new Array(t);++e=0;)for(r=e[i],t=r.length;--t>=0;)n[--a]=r[t];return n};var da=Math.abs;na.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("infinite range");var r,i=[],o=s(da(n)),a=-1;if(e*=o,t*=o,0>(n*=o))for(;(r=e+n*++a)>t;)i.push(r/o);else for(;(r=e+n*++a)=o.length)return r?r.call(i,a):n?a.sort(n):a;for(var l,c,f,d,p=-1,h=a.length,m=o[s++],g=new u;++p=o.length)return e;var r=[],i=a[n++];return e.forEach(function(e,i){r.push({key:e,values:t(i,n)})}),i?r.sort(function(e,t){return i(e.key,t.key)}):r}var n,r,i={},o=[],a=[];return i.map=function(t,n){return e(n,t,0)},i.entries=function(n){return t(e(na.map,n,0),0)},i.key=function(e){return o.push(e),i},i.sortKeys=function(e){return a[o.length-1]=e,i},i.sortValues=function(e){return n=e,i},i.rollup=function(e){return r=e,i},i},na.set=function(e){var t=new v;if(e)for(var n=0,r=e.length;r>n;++n)t.add(e[n]);return t},l(v,{has:d,add:function(e){return this._[c(e+="")]=!0,e},remove:p,values:h,size:m,empty:g,forEach:function(e){for(var t in this._)e.call(this,f(t))}}),na.behavior={},na.rebind=function(e,t){for(var n,r=1,i=arguments.length;++r=0&&(r=e.slice(n+1),e=e.slice(0,n)),e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(r,null);return this}},na.event=null,na.requote=function(e){return e.replace(ga,"\\$&")};var ga=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,va={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]},$a=function(e,t){return t.querySelector(e)},ya=function(e,t){return t.querySelectorAll(e)},ba=function(e,t){var n=e.matches||e[b(e,"matchesSelector")];return(ba=function(e,t){return n.call(e,t)})(e,t)};"function"==typeof Sizzle&&($a=function(e,t){return Sizzle(e,t)[0]||null},ya=Sizzle,ba=Sizzle.matchesSelector),na.selection=function(){return na.select(oa.documentElement)};var wa=na.selection.prototype=[];wa.select=function(e){var t,n,r,i,o=[];e=M(e);for(var a=-1,s=this.length;++a=0&&(n=e.slice(0,t),e=e.slice(t+1)),xa.hasOwnProperty(n)?{space:xa[n],local:e}:e}},wa.attr=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node();return e=na.ns.qualify(e),e.local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(D(t,e[t]));return this}return this.each(D(e,t))},wa.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node(),r=(e=N(e)).length,i=-1;if(t=n.classList){for(;++ii){if("string"!=typeof e){2>i&&(n="");for(r in e)this.each(P(r,e[r],n));return this}if(2>i){var o=this.node();return t(o).getComputedStyle(o,null).getPropertyValue(e)}r=""}return this.each(P(e,n,r))},wa.property=function(e,t){if(arguments.length<2){if("string"==typeof e)return this.node()[e];for(t in e)this.each(L(t,e[t]));return this}return this.each(L(e,t))},wa.text=function(e){return arguments.length?this.each("function"==typeof e?function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}:null==e?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent},wa.html=function(e){return arguments.length?this.each("function"==typeof e?function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}:null==e?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML},wa.append=function(e){return e=F(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},wa.insert=function(e,t){return e=F(e),t=M(t),this.select(function(){return this.insertBefore(e.apply(this,arguments),t.apply(this,arguments)||null)})},wa.remove=function(){return this.each(U)},wa.data=function(e,t){function n(e,n){ +var r,i,o,a=e.length,f=n.length,d=Math.min(a,f),p=new Array(f),h=new Array(f),m=new Array(a);if(t){var g,v=new u,$=new Array(a);for(r=-1;++rr;++r)h[r]=j(n[r]);for(;a>r;++r)m[r]=e[r]}h.update=p,h.parentNode=p.parentNode=m.parentNode=e.parentNode,s.push(h),l.push(p),c.push(m)}var r,i,o=-1,a=this.length;if(!arguments.length){for(e=new Array(a=(r=this[0]).length);++oo;o++){i.push(t=[]),t.parentNode=(n=this[o]).parentNode;for(var s=0,l=n.length;l>s;s++)(r=n[s])&&e.call(r,r.__data__,s,o)&&t.push(r)}return _(i)},wa.order=function(){for(var e=-1,t=this.length;++e=0;)(n=r[i])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},wa.sort=function(e){e=q.apply(this,arguments);for(var t=-1,n=this.length;++te;e++)for(var n=this[e],r=0,i=n.length;i>r;r++){var o=n[r];if(o)return o}return null},wa.size=function(){var e=0;return V(this,function(){++e}),e};var Ca=[];na.selection.enter=B,na.selection.enter.prototype=Ca,Ca.append=wa.append,Ca.empty=wa.empty,Ca.node=wa.node,Ca.call=wa.call,Ca.size=wa.size,Ca.select=function(e){for(var t,n,r,i,o,a=[],s=-1,l=this.length;++sr){if("string"!=typeof e){2>r&&(t=!1);for(n in e)this.each(Y(n,e[n],t));return this}if(2>r)return(r=this.node()["__on"+e])&&r._;n=!1}return this.each(Y(e,t,n))};var Ea=na.map({mouseenter:"mouseover",mouseleave:"mouseout"});oa&&Ea.forEach(function(e){"on"+e in oa&&Ea.remove(e)});var ka,Sa=0;na.mouse=function(e){return Z(e,k())};var _a=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;na.touch=function(e,t,n){if(arguments.length<3&&(n=t,t=k().changedTouches),t)for(var r,i=0,o=t.length;o>i;++i)if((r=t[i]).identifier===n)return Z(e,r)},na.behavior.drag=function(){function e(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function n(e,t,n,o,a){return function(){function s(){var e,n,r=t(d,m);r&&(e=r[0]-y[0],n=r[1]-y[1],h|=e|n,y=r,p({type:"drag",x:r[0]+u[0],y:r[1]+u[1],dx:e,dy:n}))}function l(){t(d,m)&&(v.on(o+g,null).on(a+g,null),$(h&&na.event.target===f),p({type:"dragend"}))}var u,c=this,f=na.event.target,d=c.parentNode,p=r.of(c,arguments),h=0,m=e(),g=".drag"+(null==m?"":"-"+m),v=na.select(n(f)).on(o+g,s).on(a+g,l),$=K(f),y=t(d,m);i?(u=i.apply(c,arguments),u=[u.x-y[0],u.y-y[1]]):u=[0,0],p({type:"dragstart"})}}var r=S(e,"drag","dragstart","dragend"),i=null,o=n(w,na.mouse,t,"mousemove","mouseup"),a=n(J,na.touch,$,"touchmove","touchend");return e.origin=function(t){return arguments.length?(i=t,e):i},na.rebind(e,r,"on")},na.touches=function(e,t){return arguments.length<2&&(t=k().touches),t?ia(t).map(function(t){var n=Z(e,t);return n.identifier=t.identifier,n}):[]};var Ma=1e-6,Ta=Ma*Ma,Da=Math.PI,Aa=2*Da,Oa=Aa-Ma,Na=Da/2,Ra=Da/180,Ia=180/Da,Pa=Math.SQRT2,La=2;na.interpolateZoom=function(e,t){function n(e){var t=e*$;if(v){var n=re(m),a=o/(La*d)*(n*ie(Pa*t+m)-ne(m));return[r+a*u,i+a*c,o*n/re(Pa*t+m)]}return[r+e*u,i+e*c,o*Math.exp(Pa*t)]}var r=e[0],i=e[1],o=e[2],a=t[0],s=t[1],l=t[2],u=a-r,c=s-i,f=u*u+c*c,d=Math.sqrt(f),p=(l*l-o*o+4*f)/(2*o*La*d),h=(l*l-o*o-4*f)/(2*l*La*d),m=Math.log(Math.sqrt(p*p+1)-p),g=Math.log(Math.sqrt(h*h+1)-h),v=g-m,$=(v||Math.log(l/o))/Pa;return n.duration=1e3*$,n},na.behavior.zoom=function(){function e(e){e.on(A,f).on(Ua+".zoom",p).on("dblclick.zoom",h).on(R,d)}function n(e){return[(e[0]-k.x)/k.k,(e[1]-k.y)/k.k]}function r(e){return[e[0]*k.k+k.x,e[1]*k.k+k.y]}function i(e){k.k=Math.max(M[0],Math.min(M[1],e))}function o(e,t){t=r(t),k.x+=e[0]-t[0],k.y+=e[1]-t[1]}function a(t,n,r,a){t.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,a)),o(g=n,r),t=na.select(t),T>0&&(t=t.transition().duration(T)),t.call(e.event)}function s(){w&&w.domain(b.range().map(function(e){return(e-k.x)/k.k}).map(b.invert)),C&&C.domain(x.range().map(function(e){return(e-k.y)/k.k}).map(x.invert))}function l(e){D++||e({type:"zoomstart"})}function u(e){s(),e({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(e){--D||(e({type:"zoomend"}),g=null)}function f(){function e(){f=1,o(na.mouse(i),p),u(s)}function r(){d.on(O,null).on(N,null),h(f&&na.event.target===a),c(s)}var i=this,a=na.event.target,s=I.of(i,arguments),f=0,d=na.select(t(i)).on(O,e).on(N,r),p=n(na.mouse(i)),h=K(i);Nl.call(i),l(s)}function d(){function e(){var e=na.touches(h);return p=k.k,e.forEach(function(e){e.identifier in g&&(g[e.identifier]=n(e))}),e}function t(){var t=na.event.target;na.select(t).on(b,r).on(w,s),x.push(t);for(var n=na.event.changedTouches,i=0,o=n.length;o>i;++i)g[n[i].identifier]=null;var l=e(),u=Date.now();if(1===l.length){if(500>u-y){var c=l[0];a(h,c,g[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),E()}y=u}else if(l.length>1){var c=l[0],f=l[1],d=c[0]-f[0],p=c[1]-f[1];v=d*d+p*p}}function r(){var e,t,n,r,a=na.touches(h);Nl.call(h);for(var s=0,l=a.length;l>s;++s,r=null)if(n=a[s],r=g[n.identifier]){if(t)break;e=n,t=r}if(r){var c=(c=n[0]-e[0])*c+(c=n[1]-e[1])*c,f=v&&Math.sqrt(c/v);e=[(e[0]+n[0])/2,(e[1]+n[1])/2],t=[(t[0]+r[0])/2,(t[1]+r[1])/2],i(f*p)}y=null,o(e,t),u(m)}function s(){if(na.event.touches.length){for(var t=na.event.changedTouches,n=0,r=t.length;r>n;++n)delete g[t[n].identifier];for(var i in g)return void e()}na.selectAll(x).on($,null),C.on(A,f).on(R,d),S(),c(m)}var p,h=this,m=I.of(h,arguments),g={},v=0,$=".zoom-"+na.event.changedTouches[0].identifier,b="touchmove"+$,w="touchend"+$,x=[],C=na.select(h),S=K(h);t(),l(m),C.on(A,null).on(R,t)}function p(){var e=I.of(this,arguments);$?clearTimeout($):(Nl.call(this),m=n(g=v||na.mouse(this)),l(e)),$=setTimeout(function(){$=null,c(e)},50),E(),i(Math.pow(2,.002*Fa())*k.k),o(g,m),u(e)}function h(){var e=na.mouse(this),t=Math.log(k.k)/Math.LN2;a(this,e,n(e),na.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}var m,g,v,$,y,b,w,x,C,k={x:0,y:0,k:1},_=[960,500],M=ja,T=250,D=0,A="mousedown.zoom",O="mousemove.zoom",N="mouseup.zoom",R="touchstart.zoom",I=S(e,"zoomstart","zoom","zoomend");return Ua||(Ua="onwheel"in oa?(Fa=function(){return-na.event.deltaY*(na.event.deltaMode?120:1)},"wheel"):"onmousewheel"in oa?(Fa=function(){return na.event.wheelDelta},"mousewheel"):(Fa=function(){return-na.event.detail},"MozMousePixelScroll")),e.event=function(e){e.each(function(){var e=I.of(this,arguments),t=k;Al?na.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(e)}).tween("zoom:zoom",function(){var n=_[0],r=_[1],i=g?g[0]:n/2,o=g?g[1]:r/2,a=na.interpolateZoom([(i-k.x)/k.k,(o-k.y)/k.k,n/k.k],[(i-t.x)/t.k,(o-t.y)/t.k,n/t.k]);return function(t){var r=a(t),s=n/r[2];this.__chart__=k={x:i-r[0]*s,y:o-r[1]*s,k:s},u(e)}}).each("interrupt.zoom",function(){c(e)}).each("end.zoom",function(){c(e)}):(this.__chart__=k,l(e),u(e),c(e))})},e.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},s(),e):[k.x,k.y]},e.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:+t},s(),e):k.k},e.scaleExtent=function(t){return arguments.length?(M=null==t?ja:[+t[0],+t[1]],e):M},e.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],e):v},e.size=function(t){return arguments.length?(_=t&&[+t[0],+t[1]],e):_},e.duration=function(t){return arguments.length?(T=+t,e):T},e.x=function(t){return arguments.length?(w=t,b=t.copy(),k={x:0,y:0,k:1},e):w},e.y=function(t){return arguments.length?(C=t,x=t.copy(),k={x:0,y:0,k:1},e):C},na.rebind(e,I,"on")};var Fa,Ua,ja=[0,1/0];na.color=ae,ae.prototype.toString=function(){return this.rgb()+""},na.hsl=se;var Ha=se.prototype=new ae;Ha.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new se(this.h,this.s,this.l/e)},Ha.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new se(this.h,this.s,e*this.l)},Ha.rgb=function(){return le(this.h,this.s,this.l)},na.hcl=ue;var qa=ue.prototype=new ae;qa.brighter=function(e){return new ue(this.h,this.c,Math.min(100,this.l+Va*(arguments.length?e:1)))},qa.darker=function(e){return new ue(this.h,this.c,Math.max(0,this.l-Va*(arguments.length?e:1)))},qa.rgb=function(){return ce(this.h,this.c,this.l).rgb()},na.lab=fe;var Va=18,Ba=.95047,za=1,Ya=1.08883,Wa=fe.prototype=new ae;Wa.brighter=function(e){return new fe(Math.min(100,this.l+Va*(arguments.length?e:1)),this.a,this.b)},Wa.darker=function(e){return new fe(Math.max(0,this.l-Va*(arguments.length?e:1)),this.a,this.b)},Wa.rgb=function(){return de(this.l,this.a,this.b)},na.rgb=ve;var Ga=ve.prototype=new ae;Ga.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return t||n||r?(t&&i>t&&(t=i),n&&i>n&&(n=i),r&&i>r&&(r=i),new ve(Math.min(255,t/e),Math.min(255,n/e),Math.min(255,r/e))):new ve(i,i,i)},Ga.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new ve(e*this.r,e*this.g,e*this.b)},Ga.hsl=function(){return xe(this.r,this.g,this.b)},Ga.toString=function(){return"#"+be(this.r)+be(this.g)+be(this.b)};var Ka=na.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Ka.forEach(function(e,t){Ka.set(e,$e(t))}),na.functor=Se,na.xhr=_e($),na.dsv=function(e,t){function n(e,n,o){arguments.length<3&&(o=n,n=null);var a=Me(e,t,null==n?r:i(n),o);return a.row=function(e){return arguments.length?a.response(null==(n=e)?r:i(e)):n},a}function r(e){return n.parse(e.responseText)}function i(e){return function(t){return n.parse(t.responseText,e)}}function o(t){return t.map(a).join(e)}function a(e){return s.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp('["'+e+"\n]"),l=e.charCodeAt(0);return n.parse=function(e,t){var r;return n.parseRows(e,function(e,n){if(r)return r(e,n-1);var i=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");r=t?function(e,n){return t(i(e),n)}:i})},n.parseRows=function(e,t){function n(){if(c>=u)return a;if(i)return i=!1,o;var t=c;if(34===e.charCodeAt(t)){for(var n=t;n++c;){var r=e.charCodeAt(c++),s=1;if(10===r)i=!0;else if(13===r)i=!0,10===e.charCodeAt(c)&&(++c,++s);else if(r!==l)continue;return e.slice(t,c-s)}return e.slice(t)}for(var r,i,o={},a={},s=[],u=e.length,c=0,f=0;(r=n())!==a;){for(var d=[];r!==o&&r!==a;)d.push(r),r=n();t&&null==(d=t(d,f++))||s.push(d)}return s},n.format=function(t){if(Array.isArray(t[0]))return n.formatRows(t);var r=new v,i=[];return t.forEach(function(e){for(var t in e)r.has(t)||i.push(r.add(t))}),[i.map(a).join(e)].concat(t.map(function(t){return i.map(function(e){return a(t[e])}).join(e)})).join("\n")},n.formatRows=function(e){return e.map(o).join("\n")},n},na.csv=na.dsv(",","text/csv"),na.tsv=na.dsv("\t","text/tab-separated-values");var Za,Ja,Xa,Qa,es,ts=this[b(this,"requestAnimationFrame")]||function(e){setTimeout(e,17)};na.timer=function(e,t,n){var r=arguments.length;2>r&&(t=0),3>r&&(n=Date.now());var i=n+t,o={c:e,t:i,f:!1,n:null};Ja?Ja.n=o:Za=o,Ja=o,Xa||(Qa=clearTimeout(Qa),Xa=1,ts(Ae))},na.timer.flush=function(){Oe(),Ne()},na.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};var ns=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(Ie);na.formatPrefix=function(e,t){var n=0;return e&&(0>e&&(e*=-1),t&&(e=na.round(e,Re(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),ns[8+n/3]};var rs=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,is=na.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return(e=na.round(e,Re(e,t))).toFixed(Math.max(0,Math.min(20,Re(e*(1+1e-15),t))))}}),os=na.time={},as=Date;Fe.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ss.setUTCDate.apply(this._,arguments)},setDay:function(){ss.setUTCDay.apply(this._,arguments)},setFullYear:function(){ss.setUTCFullYear.apply(this._,arguments)},setHours:function(){ss.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ss.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ss.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ss.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ss.setUTCSeconds.apply(this._,arguments)},setTime:function(){ss.setTime.apply(this._,arguments)}};var ss=Date.prototype;os.year=Ue(function(e){return e=os.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),os.years=os.year.range,os.years.utc=os.year.utc.range,os.day=Ue(function(e){var t=new as(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),os.days=os.day.range,os.days.utc=os.day.utc.range,os.dayOfYear=function(e){var t=os.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,t){t=7-t;var n=os[e]=Ue(function(e){return(e=os.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+7*Math.floor(t))},function(e){var n=os.year(e).getDay();return Math.floor((os.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});os[e+"s"]=n.range,os[e+"s"].utc=n.utc.range,os[e+"OfYear"]=function(e){var n=os.year(e).getDay();return Math.floor((os.dayOfYear(e)+(n+t)%7)/7)}}),os.week=os.sunday,os.weeks=os.sunday.range,os.weeks.utc=os.sunday.utc.range,os.weekOfYear=os.sundayOfYear;var ls={"-":"",_:" ",0:"0"},us=/^\s*\d+/,cs=/^%/;na.locale=function(e){return{numberFormat:Pe(e),timeFormat:He(e)}};var fs=na.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});na.format=fs.numberFormat,na.geo={},lt.prototype={s:0,t:0,add:function(e){ut(e,this.t,ds),ut(ds.s,this.s,this),this.s?this.t+=ds.t:this.s=ds.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ds=new lt;na.geo.stream=function(e,t){e&&ps.hasOwnProperty(e.type)?ps[e.type](e,t):ct(e,t)};var ps={Feature:function(e,t){ct(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++re?4*Da+e:e,vs.lineStart=vs.lineEnd=vs.point=w}};na.geo.bounds=function(){function e(e,t){y.push(b=[c=e,d=e]),f>t&&(f=t),t>p&&(p=t)}function t(t,n){var r=ht([t*Ra,n*Ra]);if(v){var i=gt(v,r),o=[i[1],-i[0],0],a=gt(o,i);yt(a),a=bt(a);var l=t-h,u=l>0?1:-1,m=a[0]*Ia*u,g=da(l)>180;if(g^(m>u*h&&u*t>m)){var $=a[1]*Ia;$>p&&(p=$)}else if(m=(m+360)%360-180,g^(m>u*h&&u*t>m)){var $=-a[1]*Ia;f>$&&(f=$)}else f>n&&(f=n),n>p&&(p=n);g?h>t?s(c,t)>s(c,d)&&(d=t):s(t,d)>s(c,d)&&(c=t):d>=c?(c>t&&(c=t),t>d&&(d=t)):t>h?s(c,t)>s(c,d)&&(d=t):s(t,d)>s(c,d)&&(c=t)}else e(t,n);v=r,h=t}function n(){w.point=t}function r(){b[0]=c,b[1]=d,w.point=e,v=null}function i(e,n){if(v){var r=e-h;$+=da(r)>180?r+(r>0?360:-360):r}else m=e,g=n;vs.point(e,n),t(e,n)}function o(){vs.lineStart()}function a(){i(m,g),vs.lineEnd(),da($)>Ma&&(c=-(d=180)),b[0]=c,b[1]=d,v=null}function s(e,t){return(t-=e)<0?t+360:t}function l(e,t){return e[0]-t[0]}function u(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:egs?(c=-(d=180),f=-(p=90)):$>Ma?p=90:-Ma>$&&(f=-90),b[0]=c,b[1]=d}};return function(e){p=d=-(c=f=1/0),y=[],na.geo.stream(e,w);var t=y.length;if(t){y.sort(l);for(var n,r=1,i=y[0],o=[i];t>r;++r)n=y[r],u(n[0],i)||u(n[1],i)?(s(i[0],n[1])>s(i[0],i[1])&&(i[1]=n[1]),s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])):o.push(i=n);for(var a,n,h=-1/0,t=o.length-1,r=0,i=o[t];t>=r;i=n,++r)n=o[r],(a=s(i[1],n[0]))>h&&(h=a,c=n[0],d=i[1])}return y=b=null,1/0===c||1/0===f?[[NaN,NaN],[NaN,NaN]]:[[c,f],[d,p]]}}(),na.geo.centroid=function(e){$s=ys=bs=ws=xs=Cs=Es=ks=Ss=_s=Ms=0,na.geo.stream(e,Ts);var t=Ss,n=_s,r=Ms,i=t*t+n*n+r*r;return Ta>i&&(t=Cs,n=Es,r=ks,Ma>ys&&(t=bs,n=ws,r=xs),i=t*t+n*n+r*r,Ta>i)?[NaN,NaN]:[Math.atan2(n,t)*Ia,te(r/Math.sqrt(i))*Ia]};var $s,ys,bs,ws,xs,Cs,Es,ks,Ss,_s,Ms,Ts={sphere:w,point:xt,lineStart:Et,lineEnd:kt,polygonStart:function(){Ts.lineStart=St},polygonEnd:function(){Ts.lineStart=Et}},Ds=Ot(Mt,Pt,Ft,[-Da,-Da/2]),As=1e9;na.geo.clipExtent=function(){var e,t,n,r,i,o,a={stream:function(e){return i&&(i.valid=!1),i=o(e),i.valid=!0,i},extent:function(s){return arguments.length?(o=qt(e=+s[0][0],t=+s[0][1],n=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),a):[[e,t],[n,r]]}};return a.extent([[0,0],[960,500]])},(na.geo.conicEqualArea=function(){return Vt(Bt)}).raw=Bt,na.geo.albers=function(){return na.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},na.geo.albersUsa=function(){function e(e){var o=e[0],a=e[1];return t=null,n(o,a),t||(r(o,a),t)||i(o,a),t}var t,n,r,i,o=na.geo.albers(),a=na.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=na.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(e,n){t=[e,n]}};return e.invert=function(e){var t=o.scale(),n=o.translate(),r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?a:i>=.166&&.234>i&&r>=-.214&&-.115>r?s:o).invert(e)},e.stream=function(e){var t=o.stream(e),n=a.stream(e),r=s.stream(e);return{point:function(e,i){t.point(e,i),n.point(e,i),r.point(e,i)},sphere:function(){t.sphere(),n.sphere(),r.sphere()},lineStart:function(){t.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},e.precision=function(t){return arguments.length?(o.precision(t),a.precision(t),s.precision(t),e):o.precision()},e.scale=function(t){return arguments.length?(o.scale(t),a.scale(.35*t),s.scale(t),e.translate(o.translate())):o.scale()},e.translate=function(t){if(!arguments.length)return o.translate();var u=o.scale(),c=+t[0],f=+t[1];return n=o.translate(t).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,r=a.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Ma,f+.12*u+Ma],[c-.214*u-Ma,f+.234*u-Ma]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Ma,f+.166*u+Ma],[c-.115*u-Ma,f+.234*u-Ma]]).stream(l).point,e},e.scale(1070)};var Os,Ns,Rs,Is,Ps,Ls,Fs={point:w,lineStart:w,lineEnd:w,polygonStart:function(){Ns=0,Fs.lineStart=zt},polygonEnd:function(){Fs.lineStart=Fs.lineEnd=Fs.point=w,Os+=da(Ns/2)}},Us={point:Yt,lineStart:w,lineEnd:w,polygonStart:w,polygonEnd:w},js={point:Kt,lineStart:Zt,lineEnd:Jt,polygonStart:function(){js.lineStart=Xt},polygonEnd:function(){js.point=Kt,js.lineStart=Zt,js.lineEnd=Jt}};na.geo.path=function(){function e(e){return e&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=i(o)),na.geo.stream(e,a)),o.result()}function t(){return a=null,e}var n,r,i,o,a,s=4.5;return e.area=function(e){return Os=0,na.geo.stream(e,i(Fs)),Os},e.centroid=function(e){return bs=ws=xs=Cs=Es=ks=Ss=_s=Ms=0,na.geo.stream(e,i(js)),Ms?[Ss/Ms,_s/Ms]:ks?[Cs/ks,Es/ks]:xs?[bs/xs,ws/xs]:[NaN,NaN]},e.bounds=function(e){return Ps=Ls=-(Rs=Is=1/0),na.geo.stream(e,i(Us)),[[Rs,Is],[Ps,Ls]]},e.projection=function(e){return arguments.length?(i=(n=e)?e.stream||tn(e):$,t()):n},e.context=function(e){return arguments.length?(o=null==(r=e)?new Wt:new Qt(e),"function"!=typeof s&&o.pointRadius(s),t()):r},e.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(o.pointRadius(+t),+t),e):s},e.projection(na.geo.albersUsa()).context(null)},na.geo.transform=function(e){return{stream:function(t){var n=new nn(t);for(var r in e)n[r]=e[r];return n}}},nn.prototype={point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},na.geo.projection=on,na.geo.projectionMutator=an,(na.geo.equirectangular=function(){return on(ln)}).raw=ln.invert=ln,na.geo.rotation=function(e){function t(t){return t=e(t[0]*Ra,t[1]*Ra),t[0]*=Ia,t[1]*=Ia,t}return e=cn(e[0]%360*Ra,e[1]*Ra,e.length>2?e[2]*Ra:0),t.invert=function(t){return t=e.invert(t[0]*Ra,t[1]*Ra),t[0]*=Ia,t[1]*=Ia,t},t},un.invert=ln,na.geo.circle=function(){function e(){var e="function"==typeof r?r.apply(this,arguments):r,t=cn(-e[0]*Ra,-e[1]*Ra,0).invert,i=[];return n(null,null,1,{point:function(e,n){i.push(e=t(e,n)),e[0]*=Ia,e[1]*=Ia}}),{type:"Polygon",coordinates:[i]}}var t,n,r=[0,0],i=6;return e.origin=function(t){return arguments.length?(r=t,e):r},e.angle=function(r){return arguments.length?(n=hn((t=+r)*Ra,i*Ra),e):t},e.precision=function(r){return arguments.length?(n=hn(t*Ra,(i=+r)*Ra),e):i},e.angle(90)},na.geo.distance=function(e,t){var n,r=(t[0]-e[0])*Ra,i=e[1]*Ra,o=t[1]*Ra,a=Math.sin(r),s=Math.cos(r),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*a)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)},na.geo.graticule=function(){function e(){return{type:"MultiLineString",coordinates:t()}}function t(){return na.range(Math.ceil(o/g)*g,i,g).map(d).concat(na.range(Math.ceil(u/v)*v,l,v).map(p)).concat(na.range(Math.ceil(r/h)*h,n,h).filter(function(e){return da(e%g)>Ma}).map(c)).concat(na.range(Math.ceil(s/m)*m,a,m).filter(function(e){return da(e%v)>Ma}).map(f))}var n,r,i,o,a,s,l,u,c,f,d,p,h=10,m=h,g=90,v=360,$=2.5;return e.lines=function(){return t().map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(p(l).slice(1),d(i).reverse().slice(1),p(u).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.majorExtent(t).minorExtent(t):e.minorExtent()},e.majorExtent=function(t){return arguments.length?(o=+t[0][0],i=+t[1][0],u=+t[0][1],l=+t[1][1],o>i&&(t=o,o=i,i=t),u>l&&(t=u,u=l,l=t),e.precision($)):[[o,u],[i,l]]},e.minorExtent=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),e.precision($)):[[r,s],[n,a]]},e.step=function(t){return arguments.length?e.majorStep(t).minorStep(t):e.minorStep()},e.majorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],e):[g,v]},e.minorStep=function(t){return arguments.length?(h=+t[0],m=+t[1],e):[h,m]},e.precision=function(t){return arguments.length?($=+t,c=gn(s,a,90),f=vn(r,n,$),d=gn(u,l,90),p=vn(o,i,$),e):$},e.majorExtent([[-180,-90+Ma],[180,90-Ma]]).minorExtent([[-180,-80-Ma],[180,80+Ma]])},na.geo.greatArc=function(){function e(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),n||i.apply(this,arguments)]}}var t,n,r=$n,i=yn;return e.distance=function(){return na.geo.distance(t||r.apply(this,arguments),n||i.apply(this,arguments))},e.source=function(n){return arguments.length?(r=n,t="function"==typeof n?null:n,e):r},e.target=function(t){return arguments.length?(i=t,n="function"==typeof t?null:t,e):i},e.precision=function(){return arguments.length?e:0},e},na.geo.interpolate=function(e,t){return bn(e[0]*Ra,e[1]*Ra,t[0]*Ra,t[1]*Ra)},na.geo.length=function(e){return Hs=0,na.geo.stream(e,qs),Hs};var Hs,qs={sphere:w,point:w,lineStart:wn,lineEnd:w,polygonStart:w,polygonEnd:w},Vs=xn(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(na.geo.azimuthalEqualArea=function(){return on(Vs)}).raw=Vs;var Bs=xn(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},$);(na.geo.azimuthalEquidistant=function(){return on(Bs)}).raw=Bs,(na.geo.conicConformal=function(){return Vt(Cn)}).raw=Cn,(na.geo.conicEquidistant=function(){return Vt(En)}).raw=En;var zs=xn(function(e){return 1/e},Math.atan);(na.geo.gnomonic=function(){return on(zs)}).raw=zs,kn.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-Na]},(na.geo.mercator=function(){return Sn(kn)}).raw=kn;var Ys=xn(function(){return 1},Math.asin);(na.geo.orthographic=function(){return on(Ys)}).raw=Ys;var Ws=xn(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(na.geo.stereographic=function(){return on(Ws)}).raw=Ws,_n.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Na]},(na.geo.transverseMercator=function(){var e=Sn(_n),t=e.center,n=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return e?n([e[0],e[1],e.length>2?e[2]+90:90]):(e=n(),[e[0],e[1],e[2]-90])},n([0,0,90])}).raw=_n,na.geom={},na.geom.hull=function(e){function t(e){if(e.length<3)return[];var t,i=Se(n),o=Se(r),a=e.length,s=[],l=[];for(t=0;a>t;t++)s.push([+i.call(this,e[t],t),+o.call(this,e[t],t),t]);for(s.sort(An),t=0;a>t;t++)l.push([s[t][0],-s[t][1]]);var u=Dn(s),c=Dn(l),f=c[0]===u[0],d=c[c.length-1]===u[u.length-1],p=[];for(t=u.length-1;t>=0;--t)p.push(e[s[u[t]][2]]);for(t=+f;t=r&&u.x<=o&&u.y>=i&&u.y<=a?[[r,a],[o,a],[o,i],[r,i]]:[]).point=e[s]}),t}function n(e){return e.map(function(e,t){return{x:Math.round(o(e,t)/Ma)*Ma,y:Math.round(a(e,t)/Ma)*Ma,i:t}})}var r=Mn,i=Tn,o=r,a=i,s=nl;return e?t(e):(t.links=function(e){return ar(n(e)).edges.filter(function(e){return e.l&&e.r}).map(function(t){return{source:e[t.l.i],target:e[t.r.i]}})},t.triangles=function(e){var t=[];return ar(n(e)).cells.forEach(function(n,r){for(var i,o=n.site,a=n.edges.sort(Bn),s=-1,l=a.length,u=a[l-1].edge,c=u.l===o?u.r:u.l;++s=u,d=r>=c,p=d<<1|f;e.leaf=!1,e=e.nodes[p]||(e.nodes[p]=fr()),f?i=u:s=u,d?a=c:l=c,o(e,t,n,r,i,a,s,l)}var c,f,d,p,h,m,g,v,$,y=Se(s),b=Se(l);if(null!=t)m=t,g=n,v=r,$=i;else if(v=$=-(m=g=1/0),f=[],d=[],h=e.length,a)for(p=0;h>p;++p)c=e[p],c.xv&&(v=c.x),c.y>$&&($=c.y),f.push(c.x),d.push(c.y);else for(p=0;h>p;++p){var w=+y(c=e[p],p),x=+b(c,p);m>w&&(m=w),g>x&&(g=x),w>v&&(v=w),x>$&&($=x),f.push(w),d.push(x)}var C=v-m,E=$-g;C>E?$=g+C:v=m+E;var k=fr();if(k.add=function(e){o(k,e,+y(e,++p),+b(e,p),m,g,v,$)},k.visit=function(e){dr(e,k,m,g,v,$)},k.find=function(e){return pr(k,e[0],e[1],m,g,v,$)},p=-1,null==t){for(;++p=0?e.slice(0,t):e,r=t>=0?e.slice(t+1):"in";return n=al.get(n)||ol,r=sl.get(r)||$,br(r(n.apply(null,ra.call(arguments,1))))},na.interpolateHcl=Nr,na.interpolateHsl=Rr,na.interpolateLab=Ir,na.interpolateRound=Pr,na.transform=function(e){var t=oa.createElementNS(na.ns.prefix.svg,"g");return(na.transform=function(e){if(null!=e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate()}return new Lr(n?n.matrix:ll)})(e)},Lr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ll={a:1,b:0,c:0,d:1,e:0,f:0};na.interpolateTransform=Hr,na.layout={},na.layout.bundle=function(){return function(e){for(var t=[],n=-1,r=e.length;++ns*s/g){if(h>l){var u=t.charge/l;e.px-=o*u,e.py-=a*u}return!0}if(t.point&&l&&h>l){var u=t.pointCharge/l;e.px-=o*u,e.py-=a*u}}return!t.charge}}function t(e){e.px=na.event.x,e.py=na.event.y,s.resume()}var n,r,i,o,a,s={},l=na.dispatch("start","tick","end"),u=[1,1],c=.9,f=ul,d=cl,p=-30,h=fl,m=.1,g=.64,v=[],y=[];return s.tick=function(){if((r*=.99)<.005)return l.end({type:"end",alpha:r=0}),!0;var t,n,s,f,d,h,g,$,b,w=v.length,x=y.length;for(n=0;x>n;++n)s=y[n],f=s.source,d=s.target,$=d.x-f.x,b=d.y-f.y,(h=$*$+b*b)&&(h=r*o[n]*((h=Math.sqrt(h))-i[n])/h,$*=h,b*=h,d.x-=$*(g=f.weight/(d.weight+f.weight)),d.y-=b*g,f.x+=$*(g=1-g),f.y+=b*g);if((g=r*m)&&($=u[0]/2,b=u[1]/2,n=-1,g))for(;++n0?e:0:e>0&&(l.start({type:"start",alpha:r=e}),na.timer(s.tick)),s):r},s.start=function(){function e(e,r){if(!n){for(n=new Array(l),s=0;l>s;++s)n[s]=[];for(s=0;c>s;++s){var i=y[s];n[i.source.index].push(i.target),n[i.target.index].push(i.source)}}for(var o,a=n[t],s=-1,u=a.length;++st;++t)(r=v[t]).index=t,r.weight=0;for(t=0;c>t;++t)r=y[t],"number"==typeof r.source&&(r.source=v[r.source]),"number"==typeof r.target&&(r.target=v[r.target]),++r.source.weight,++r.target.weight;for(t=0;l>t;++t)r=v[t],isNaN(r.x)&&(r.x=e("x",h)),isNaN(r.y)&&(r.y=e("y",m)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(i=[],"function"==typeof f)for(t=0;c>t;++t)i[t]=+f.call(this,y[t],t);else for(t=0;c>t;++t)i[t]=f;if(o=[],"function"==typeof d)for(t=0;c>t;++t)o[t]=+d.call(this,y[t],t);else for(t=0;c>t;++t)o[t]=d;if(a=[],"function"==typeof p)for(t=0;l>t;++t)a[t]=+p.call(this,v[t],t);else for(t=0;l>t;++t)a[t]=p;return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){return n||(n=na.behavior.drag().origin($).on("dragstart.force",Wr).on("drag.force",t).on("dragend.force",Gr)),arguments.length?void this.on("mouseover.force",Kr).on("mouseout.force",Zr).call(n):n},na.rebind(s,l,"on")};var ul=20,cl=1,fl=1/0;na.layout.hierarchy=function(){function e(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(u=n.call(e,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)a.push(c=u[l]),c.parent=o,c.depth=o.depth+1;r&&(o.value=0),o.children=u}else r&&(o.value=+r.call(e,o,o.depth)||0),delete o.children;return ei(i,function(e){var n,i;t&&(n=e.children)&&n.sort(t),r&&(i=e.parent)&&(i.value+=e.value)}),s}var t=ri,n=ti,r=ni;return e.sort=function(n){return arguments.length?(t=n,e):t},e.children=function(t){return arguments.length?(n=t,e):n},e.value=function(t){return arguments.length?(r=t,e):r},e.revalue=function(t){return r&&(Qr(t,function(e){e.children&&(e.value=0)}),ei(t,function(t){var n;t.children||(t.value=+r.call(e,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)})),t},e},na.layout.partition=function(){function e(t,n,r,i){var o=t.children;if(t.x=n,t.y=t.depth*i,t.dx=r,t.dy=i,o&&(a=o.length)){var a,s,l,u=-1;for(r=t.value?r/t.value:0;++uf?-1:1),h=(f-l*p)/na.sum(u),m=na.range(l),g=[];return null!=n&&m.sort(n===dl?function(e,t){return u[t]-u[e]}:function(e,t){return n(a[e],a[t])}),m.forEach(function(e){g[e]={data:a[e],value:s=u[e],startAngle:c,endAngle:c+=s*h+p,padAngle:d}}),g}var t=Number,n=dl,r=0,i=Aa,o=0;return e.value=function(n){return arguments.length?(t=n,e):t},e.sort=function(t){return arguments.length?(n=t,e):n},e.startAngle=function(t){return arguments.length?(r=t,e):r},e.endAngle=function(t){return arguments.length?(i=t,e):i},e.padAngle=function(t){return arguments.length?(o=t,e):o},e};var dl={};na.layout.stack=function(){function e(s,l){if(!(d=s.length))return s;var u=s.map(function(n,r){return t.call(e,n,r)}),c=u.map(function(t){return t.map(function(t,n){return[o.call(e,t,n),a.call(e,t,n)]})}),f=n.call(e,c,l);u=na.permute(u,f),c=na.permute(c,f);var d,p,h,m,g=r.call(e,c,l),v=u[0].length;for(h=0;v>h;++h)for(i.call(e,u[0][h],m=g[h],c[0][h][1]),p=1;d>p;++p)i.call(e,u[p][h],m+=c[p-1][h][1],c[p][h][1]);return s}var t=$,n=li,r=ui,i=si,o=oi,a=ai;return e.values=function(n){return arguments.length?(t=n,e):t},e.order=function(t){return arguments.length?(n="function"==typeof t?t:pl.get(t)||li,e):n},e.offset=function(t){return arguments.length?(r="function"==typeof t?t:hl.get(t)||ui,e):r},e.x=function(t){return arguments.length?(o=t,e):o},e.y=function(t){return arguments.length?(a=t,e):a},e.out=function(t){return arguments.length?(i=t,e):i},e};var pl=na.map({"inside-out":function(e){var t,n,r=e.length,i=e.map(ci),o=e.map(fi),a=na.range(r).sort(function(e,t){return i[e]-i[t]}),s=0,l=0,u=[],c=[];for(t=0;r>t;++t)n=a[t],l>s?(s+=o[n],u.push(n)):(l+=o[n],c.push(n));return c.reverse().concat(u)},reverse:function(e){return na.range(e.length).reverse()},default:li}),hl=na.map({silhouette:function(e){var t,n,r,i=e.length,o=e[0].length,a=[],s=0,l=[];for(n=0;o>n;++n){for(t=0,r=0;i>t;t++)r+=e[t][n][1];r>s&&(s=r),a.push(r)}for(n=0;o>n;++n)l[n]=(s-a[n])/2;return l},wiggle:function(e){var t,n,r,i,o,a,s,l,u,c=e.length,f=e[0],d=f.length,p=[];for(p[0]=l=u=0,n=1;d>n;++n){for(t=0,i=0;c>t;++t)i+=e[t][n][1];for(t=0,o=0,s=f[n][0]-f[n-1][0];c>t;++t){for(r=0,a=(e[t][n][1]-e[t][n-1][1])/(2*s);t>r;++r)a+=(e[r][n][1]-e[r][n-1][1])/s;o+=a*e[t][n][1]}p[n]=l-=i?o/i*s:0,u>l&&(u=l)}for(n=0;d>n;++n)p[n]-=u;return p},expand:function(e){var t,n,r,i=e.length,o=e[0].length,a=1/i,s=[];for(n=0;o>n;++n){for(t=0,r=0;i>t;t++)r+=e[t][n][1];if(r)for(t=0;i>t;t++)e[t][n][1]/=r;else for(t=0;i>t;t++)e[t][n][1]=a}for(n=0;o>n;++n)s[n]=0;return s},zero:ui});na.layout.histogram=function(){function e(e,o){for(var a,s,l=[],u=e.map(n,this),c=r.call(this,u,o),f=i.call(this,c,u,o),o=-1,d=u.length,p=f.length-1,h=t?1:1/d;++o0)for(o=-1;++o=c[0]&&s<=c[1]&&(a=l[na.bisect(f,s,1,p)-1],a.y+=h,a.push(e[o]));return l}var t=!0,n=Number,r=mi,i=pi;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=Se(t),e):r},e.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return hi(e,t)}:Se(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},na.layout.pack=function(){function e(e,o){var a=n.call(this,e,o),s=a[0],l=i[0],u=i[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,ei(s,function(e){e.r=+c(e.value)}),ei(s,bi),r){var f=r*(t?1:Math.max(2*s.r/l,2*s.r/u))/2;ei(s,function(e){e.r+=f}),ei(s,bi),ei(s,function(e){e.r-=f})}return Ci(s,l/2,u/2,t?1:1/Math.max(2*s.r/l,2*s.r/u)),a}var t,n=na.layout.hierarchy().sort(gi),r=0,i=[1,1];return e.size=function(t){return arguments.length?(i=t,e):i},e.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,e):t},e.padding=function(t){return arguments.length?(r=+t,e):r},Xr(e,n)},na.layout.tree=function(){function e(e,i){var c=a.call(this,e,i),f=c[0],d=t(f);if(ei(d,n),d.parent.m=-d.z,Qr(d,r),u)Qr(f,o);else{var p=f,h=f,m=f;Qr(f,function(e){e.xh.x&&(h=e),e.depth>m.depth&&(m=e)});var g=s(p,h)/2-p.x,v=l[0]/(h.x+s(h,p)/2+g),$=l[1]/(m.depth||1);Qr(f,function(e){e.x=(e.x+g)*v,e.y=e.depth*$})}return c}function t(e){for(var t,n={A:null,children:[e]},r=[n];null!=(t=r.pop());)for(var i,o=t.children,a=0,s=o.length;s>a;++a)r.push((o[a]=i={_:o[a],parent:t,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return n.children[0]}function n(e){var t=e.children,n=e.parent.children,r=e.i?n[e.i-1]:null;if(t.length){Ti(e);var o=(t[0].z+t[t.length-1].z)/2;r?(e.z=r.z+s(e._,r._),e.m=e.z-o):e.z=o}else r&&(e.z=r.z+s(e._,r._));e.parent.A=i(e,r,e.parent.A||n[0])}function r(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function i(e,t,n){if(t){for(var r,i=e,o=e,a=t,l=i.parent.children[0],u=i.m,c=o.m,f=a.m,d=l.m;a=_i(a),i=Si(i),a&&i;)l=Si(l),o=_i(o),o.a=e,r=a.z+f-i.z-u+s(a._,i._),r>0&&(Mi(Di(a,e,n),e,r),u+=r,c+=r),f+=a.m,u+=i.m,d+=l.m,c+=o.m;a&&!_i(o)&&(o.t=a,o.m+=f-c),i&&!Si(l)&&(l.t=i,l.m+=u-d,n=e)}return n}function o(e){e.x*=l[0],e.y=e.depth*l[1]}var a=na.layout.hierarchy().sort(null).value(null),s=ki,l=[1,1],u=null;return e.separation=function(t){return arguments.length?(s=t,e):s},e.size=function(t){return arguments.length?(u=null==(l=t)?o:null,e):u?null:l},e.nodeSize=function(t){return arguments.length?(u=null==(l=t)?null:o,e):u?l:null},Xr(e,a)},na.layout.cluster=function(){function e(e,o){var a,s=t.call(this,e,o),l=s[0],u=0;ei(l,function(e){var t=e.children;t&&t.length?(e.x=Oi(t),e.y=Ai(t)):(e.x=a?u+=n(e,a):0,e.y=0,a=e)});var c=Ni(l),f=Ri(l),d=c.x-n(c,f)/2,p=f.x+n(f,c)/2;return ei(l,i?function(e){e.x=(e.x-l.x)*r[0],e.y=(l.y-e.y)*r[1]}:function(e){e.x=(e.x-d)/(p-d)*r[0],e.y=(1-(l.y?e.y/l.y:1))*r[1]}),s}var t=na.layout.hierarchy().sort(null).value(null),n=ki,r=[1,1],i=!1;return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(i=null==(r=t),e):i?null:r},e.nodeSize=function(t){return arguments.length?(i=null!=(r=t),e):i?r:null},Xr(e,t)},na.layout.treemap=function(){function e(e,t){for(var n,r,i=-1,o=e.length;++it?0:t),n.area=isNaN(r)||0>=r?0:r}function t(n){var o=n.children;if(o&&o.length){var a,s,l,u=f(n),c=[],d=o.slice(),h=1/0,m="slice"===p?u.dx:"dice"===p?u.dy:"slice-dice"===p?1&n.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(e(d,u.dx*u.dy/n.value),c.area=0;(l=d.length)>0;)c.push(a=d[l-1]),c.area+=a.area,"squarify"!==p||(s=r(c,m))<=h?(d.pop(),h=s):(c.area-=c.pop().area,i(c,m,u,!1),m=Math.min(u.dx,u.dy),c.length=c.area=0,h=1/0);c.length&&(i(c,m,u,!0),c.length=c.area=0),o.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var o,a=f(t),s=r.slice(),l=[];for(e(s,a.dx*a.dy/t.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(i(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);r.forEach(n)}}function r(e,t){for(var n,r=e.area,i=0,o=1/0,a=-1,s=e.length;++an&&(o=n),n>i&&(i=n));return r*=r,t*=t,r?Math.max(t*i*h/r,r/(t*o*h)):1/0}function i(e,t,n,r){var i,o=-1,a=e.length,s=n.x,u=n.y,c=t?l(e.area/t):0;if(t==n.dx){for((r||c>n.dy)&&(c=n.dy);++on.dx)&&(c=n.dx);++on&&(t=1),1>n&&(e=0),function(){var n,r,i;do{n=2*Math.random()-1,r=2*Math.random()-1,i=n*n+r*r}while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=na.random.normal.apply(na,arguments);return function(){return Math.exp(e())}},bates:function(e){var t=na.random.irwinHall(e);return function(){return t()/e}},irwinHall:function(e){return function(){for(var t=0,n=0;e>n;n++)t+=Math.random();return t}}},na.scale={};var ml={floor:$,ceil:$};na.scale.linear=function(){return Vi([0,1],[0,1],$r,!1)};var gl={s:1,g:1,p:1,r:1,e:1};na.scale.log=function(){return Ji(na.scale.linear().domain([0,1]),10,!0,[1,10])};var vl=na.format(".0e"),$l={floor:function(e){return-Math.ceil(-e)},ceil:function(e){return-Math.floor(-e)}};na.scale.pow=function(){return Xi(na.scale.linear(),1,[0,1])},na.scale.sqrt=function(){return na.scale.pow().exponent(.5)},na.scale.ordinal=function(){return eo([],{t:"range",a:[[]]})},na.scale.category10=function(){return na.scale.ordinal().range(yl)},na.scale.category20=function(){return na.scale.ordinal().range(bl)},na.scale.category20b=function(){return na.scale.ordinal().range(wl)},na.scale.category20c=function(){return na.scale.ordinal().range(xl)};var yl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ye),bl=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ye),wl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ye),xl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ye);na.scale.quantile=function(){return to([],[])},na.scale.quantize=function(){return no(0,1,[0,1])},na.scale.threshold=function(){return ro([.5],[0,1])},na.scale.identity=function(){return io([0,1])},na.svg={},na.svg.arc=function(){function e(){var e=Math.max(0,+n.apply(this,arguments)),u=Math.max(0,+r.apply(this,arguments)),c=a.apply(this,arguments)-Na,f=s.apply(this,arguments)-Na,d=Math.abs(f-c),p=c>f?0:1;if(e>u&&(h=u,u=e,e=h),d>=Oa)return t(u,p)+(e?t(e,1-p):"")+"Z";var h,m,g,v,$,y,b,w,x,C,E,k,S=0,_=0,M=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=o===Cl?Math.sqrt(e*e+u*u):+o.apply(this,arguments),p||(_*=-1),u&&(_=te(g/u*Math.sin(v))),e&&(S=te(g/e*Math.sin(v)))),u){$=u*Math.cos(c+_),y=u*Math.sin(c+_),b=u*Math.cos(f-_),w=u*Math.sin(f-_);var T=Math.abs(f-c-2*_)<=Da?0:1;if(_&&fo($,y,b,w)===p^T){var D=(c+f)/2;$=u*Math.cos(D),y=u*Math.sin(D),b=w=null}}else $=y=0;if(e){x=e*Math.cos(f-S),C=e*Math.sin(f-S),E=e*Math.cos(c+S),k=e*Math.sin(c+S);var A=Math.abs(c-f+2*S)<=Da?0:1;if(S&&fo(x,C,E,k)===1-p^A){var O=(c+f)/2;x=e*Math.cos(O),C=e*Math.sin(O),E=k=null}}else x=C=0;if((h=Math.min(Math.abs(u-e)/2,+i.apply(this,arguments)))>.001){m=u>e^p?0:1;var N=null==E?[x,C]:null==b?[$,y]:Nn([$,y],[E,k],[b,w],[x,C]),R=$-N[0],I=y-N[1],P=b-N[0],L=w-N[1],F=1/Math.sin(Math.acos((R*P+I*L)/(Math.sqrt(R*R+I*I)*Math.sqrt(P*P+L*L)))/2),U=Math.sqrt(N[0]*N[0]+N[1]*N[1]);if(null!=b){var j=Math.min(h,(u-U)/(F+1)),H=po(null==E?[x,C]:[E,k],[$,y],u,j,p),q=po([b,w],[x,C],u,j,p);h===j?M.push("M",H[0],"A",j,",",j," 0 0,",m," ",H[1],"A",u,",",u," 0 ",1-p^fo(H[1][0],H[1][1],q[1][0],q[1][1]),",",p," ",q[1],"A",j,",",j," 0 0,",m," ",q[0]):M.push("M",H[0],"A",j,",",j," 0 1,",m," ",q[0])}else M.push("M",$,",",y);if(null!=E){var V=Math.min(h,(e-U)/(F-1)),B=po([$,y],[E,k],e,-V,p),z=po([x,C],null==b?[$,y]:[b,w],e,-V,p);h===V?M.push("L",z[0],"A",V,",",V," 0 0,",m," ",z[1],"A",e,",",e," 0 ",p^fo(z[1][0],z[1][1],B[1][0],B[1][1]),",",1-p," ",B[1],"A",V,",",V," 0 0,",m," ",B[0]):M.push("L",z[0],"A",V,",",V," 0 0,",m," ",B[0])}else M.push("L",x,",",C)}else M.push("M",$,",",y),null!=b&&M.push("A",u,",",u," 0 ",T,",",p," ",b,",",w),M.push("L",x,",",C),null!=E&&M.push("A",e,",",e," 0 ",A,",",1-p," ",E,",",k);return M.push("Z"),M.join("")}function t(e,t){return"M0,"+e+"A"+e+","+e+" 0 1,"+t+" 0,"+-e+"A"+e+","+e+" 0 1,"+t+" 0,"+e}var n=ao,r=so,i=oo,o=Cl,a=lo,s=uo,l=co;return e.innerRadius=function(t){return arguments.length?(n=Se(t),e):n},e.outerRadius=function(t){return arguments.length?(r=Se(t),e):r},e.cornerRadius=function(t){return arguments.length?(i=Se(t),e):i},e.padRadius=function(t){return arguments.length?(o=t==Cl?Cl:Se(t),e):o},e.startAngle=function(t){return arguments.length?(a=Se(t),e):a},e.endAngle=function(t){return arguments.length?(s=Se(t),e):s},e.padAngle=function(t){return arguments.length?(l=Se(t),e):l},e.centroid=function(){var e=(+n.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-Na;return[Math.cos(t)*e,Math.sin(t)*e]},e};var Cl="auto";na.svg.line=function(){return ho($)};var El=na.map({linear:mo,"linear-closed":go,step:vo,"step-before":$o,"step-after":yo,basis:ko,"basis-open":So,"basis-closed":_o,bundle:Mo,cardinal:xo,"cardinal-open":bo,"cardinal-closed":wo,monotone:Ro});El.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var kl=[0,2/3,1/3,0],Sl=[0,1/3,2/3,0],_l=[0,1/6,2/3,1/6];na.svg.line.radial=function(){var e=ho(Io);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},$o.reverse=yo,yo.reverse=$o,na.svg.area=function(){return Po($)},na.svg.area.radial=function(){var e=Po(Io);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},na.svg.chord=function(){function e(e,s){var l=t(this,o,e,s),u=t(this,a,e,s);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(n(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+r(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function t(e,t,n,r){var i=t.call(e,n,r),o=s.call(e,i,r),a=l.call(e,i,r)-Na,c=u.call(e,i,r)-Na;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function n(e,t){return e.a0==t.a0&&e.a1==t.a1}function r(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Da)+",1 "+t}function i(e,t,n,r){return"Q 0,0 "+r}var o=$n,a=yn,s=Lo,l=lo,u=uo;return e.radius=function(t){return arguments.length?(s=Se(t),e):s},e.source=function(t){return arguments.length?(o=Se(t),e):o},e.target=function(t){return arguments.length?(a=Se(t),e):a},e.startAngle=function(t){return arguments.length?(l=Se(t),e):l},e.endAngle=function(t){return arguments.length?(u=Se(t),e):u},e},na.svg.diagonal=function(){function e(e,i){var o=t.call(this,e,i),a=n.call(this,e,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var t=$n,n=yn,r=Fo;return e.source=function(n){return arguments.length?(t=Se(n),e):t},e.target=function(t){return arguments.length?(n=Se(t),e):n},e.projection=function(t){return arguments.length?(r=t,e):r},e},na.svg.diagonal.radial=function(){var e=na.svg.diagonal(),t=Fo,n=e.projection;return e.projection=function(e){return arguments.length?n(Uo(t=e)):t},e},na.svg.symbol=function(){function e(e,r){return(Ml.get(t.call(this,e,r))||qo)(n.call(this,e,r))}var t=Ho,n=jo;return e.type=function(n){return arguments.length?(t=Se(n),e):t},e.size=function(t){return arguments.length?(n=Se(t),e):n},e};var Ml=na.map({circle:qo,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Dl)),n=t*Dl;return"M0,"+-t+"L"+n+",0 0,"+t+" "+-n+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Tl),n=t*Tl/2;return"M0,"+n+"L"+t+","+-n+" "+-t+","+-n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Tl),n=t*Tl/2;return"M0,"+-n+"L"+t+","+n+" "+-t+","+n+"Z"}});na.svg.symbolTypes=Ml.keys();var Tl=Math.sqrt(3),Dl=Math.tan(30*Ra);wa.transition=function(e){for(var t,n,r=Al||++Il,i=Wo(e),o=[],a=Ol||{time:Date.now(),ease:kr,delay:0,duration:250},s=-1,l=this.length;++so;o++){i.push(t=[]);for(var n=this[o],s=0,l=n.length;l>s;s++)(r=n[s])&&e.call(r,r.__data__,s,o)&&t.push(r)}return Bo(i,this.namespace,this.id)},Rl.tween=function(e,t){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(e):V(this,null==t?function(t){t[r][n].tween.remove(e)}:function(i){i[r][n].tween.set(e,t)})},Rl.attr=function(e,t){function n(){this.removeAttribute(s)}function r(){this.removeAttributeNS(s.space,s.local)}function i(e){return null==e?n:(e+="",function(){var t,n=this.getAttribute(s);return n!==e&&(t=a(n,e),function(e){this.setAttribute(s,t(e))})})}function o(e){return null==e?r:(e+="",function(){var t,n=this.getAttributeNS(s.space,s.local);return n!==e&&(t=a(n,e),function(e){this.setAttributeNS(s.space,s.local,t(e))})})}if(arguments.length<2){for(t in e)this.attr(t,e[t]);return this}var a="transform"==e?Hr:$r,s=na.ns.qualify(e);return zo(this,"attr."+e,t,s.local?o:i)},Rl.attrTween=function(e,t){function n(e,n){var r=t.call(this,e,n,this.getAttribute(i));return r&&function(e){this.setAttribute(i,r(e))}}function r(e,n){var r=t.call(this,e,n,this.getAttributeNS(i.space,i.local));return r&&function(e){this.setAttributeNS(i.space,i.local,r(e))}}var i=na.ns.qualify(e);return this.tween("attr."+e,i.local?r:n)},Rl.style=function(e,n,r){function i(){this.style.removeProperty(e)}function o(n){return null==n?i:(n+="",function(){var i,o=t(this).getComputedStyle(this,null).getPropertyValue(e);return o!==n&&(i=$r(o,n),function(t){this.style.setProperty(e,i(t),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof e){2>a&&(n="");for(r in e)this.style(r,e[r],n);return this}r=""}return zo(this,"style."+e,n,o)},Rl.styleTween=function(e,n,r){function i(i,o){var a=n.call(this,i,o,t(this).getComputedStyle(this,null).getPropertyValue(e));return a&&function(t){this.style.setProperty(e,a(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+e,i)},Rl.text=function(e){return zo(this,"text",e,Yo)},Rl.remove=function(){var e=this.namespace;return this.each("end.transition",function(){var t;this[e].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Rl.ease=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].ease:("function"!=typeof e&&(e=na.ease.apply(na,arguments)),V(this,function(r){r[n][t].ease=e}))},Rl.delay=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].delay:V(this,"function"==typeof e?function(r,i,o){r[n][t].delay=+e.call(r,r.__data__,i,o)}:(e=+e,function(r){r[n][t].delay=e}))},Rl.duration=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].duration:V(this,"function"==typeof e?function(r,i,o){r[n][t].duration=Math.max(1,e.call(r,r.__data__,i,o))}:(e=Math.max(1,e),function(r){r[n][t].duration=e}))},Rl.each=function(e,t){var n=this.id,r=this.namespace;if(arguments.length<2){var i=Ol,o=Al;try{Al=n,V(this,function(t,i,o){Ol=t[r][n],e.call(t,t.__data__,i,o)})}finally{Ol=i,Al=o}}else V(this,function(i){var o=i[r][n] +;(o.event||(o.event=na.dispatch("start","end","interrupt"))).on(e,t)});return this},Rl.transition=function(){for(var e,t,n,r,i=this.id,o=++Il,a=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(e=[]);for(var t=this[l],c=0,f=t.length;f>c;c++)(n=t[c])&&(r=n[a][i],Go(n,c,a,o,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),e.push(n)}return Bo(s,a,o)},na.svg.axis=function(){function e(e){e.each(function(){var e,u=na.select(this),c=this.__chart__||n,f=this.__chart__=n.copy(),d=null==l?f.ticks?f.ticks.apply(f,s):f.domain():l,p=null==t?f.tickFormat?f.tickFormat.apply(f,s):$:t,h=u.selectAll(".tick").data(d,f),m=h.enter().insert("g",".domain").attr("class","tick").style("opacity",Ma),g=na.transition(h.exit()).style("opacity",Ma).remove(),v=na.transition(h.order()).style("opacity",1),y=Math.max(i,0)+a,b=Fi(f),w=u.selectAll(".domain").data([0]),x=(w.enter().append("path").attr("class","domain"),na.transition(w));m.append("line"),m.append("text");var C,E,k,S,_=m.select("line"),M=v.select("line"),T=h.select("text").text(p),D=m.select("text"),A=v.select("text"),O="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(e=Ko,C="x",k="y",E="x2",S="y2",T.attr("dy",0>O?"0em":".71em").style("text-anchor","middle"),x.attr("d","M"+b[0]+","+O*o+"V0H"+b[1]+"V"+O*o)):(e=Zo,C="y",k="x",E="y2",S="x2",T.attr("dy",".32em").style("text-anchor",0>O?"end":"start"),x.attr("d","M"+O*o+","+b[0]+"H0V"+b[1]+"H"+O*o)),_.attr(S,O*i),D.attr(k,O*y),M.attr(E,0).attr(S,O*i),A.attr(C,0).attr(k,O*y),f.rangeBand){var N=f,R=N.rangeBand()/2;c=f=function(e){return N(e)+R}}else c.rangeBand?c=f:g.call(e,f,c);m.call(e,c,f),v.call(e,f,f)})}var t,n=na.scale.linear(),r=Pl,i=6,o=6,a=3,s=[10],l=null;return e.scale=function(t){return arguments.length?(n=t,e):n},e.orient=function(t){return arguments.length?(r=t in Ll?t+"":Pl,e):r},e.ticks=function(){return arguments.length?(s=arguments,e):s},e.tickValues=function(t){return arguments.length?(l=t,e):l},e.tickFormat=function(n){return arguments.length?(t=n,e):t},e.tickSize=function(t){var n=arguments.length;return n?(i=+t,o=+arguments[n-1],e):i},e.innerTickSize=function(t){return arguments.length?(i=+t,e):i},e.outerTickSize=function(t){return arguments.length?(o=+t,e):o},e.tickPadding=function(t){return arguments.length?(a=+t,e):a},e.tickSubdivide=function(){return arguments.length&&e},e};var Pl="bottom",Ll={top:1,right:1,bottom:1,left:1};na.svg.brush=function(){function e(t){t.each(function(){var t=na.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),a=t.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=t.selectAll(".resize").data(m,$);s.exit().remove(),s.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Fl[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",e.empty()?"none":null);var l,f=na.transition(t),d=na.transition(a);u&&(l=Fi(u),d.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),c&&(l=Fi(c),d.attr("y",l[0]).attr("height",l[1]-l[0]),i(f)),n(f)})}function n(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+f[+/e$/.test(e)]+","+d[+/^s/.test(e)]+")"})}function r(e){e.select(".extent").attr("x",f[0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function i(e){e.select(".extent").attr("y",d[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==na.event.keyCode&&(T||(y=null,A[0]-=f[1],A[1]-=d[1],T=2),E())}function m(){32==na.event.keyCode&&2==T&&(A[0]+=f[1],A[1]+=d[1],T=0,E())}function g(){var e=na.mouse(w),t=!1;b&&(e[0]+=b[0],e[1]+=b[1]),T||(na.event.altKey?(y||(y=[(f[0]+f[1])/2,(d[0]+d[1])/2]),A[0]=f[+(e[0]c?(i=r,r=c):i=c),m[0]!=r||m[1]!=i?(n?s=null:a=null,m[0]=r,m[1]=i,!0):void 0}function $(){g(),k.style("pointer-events","all").selectAll(".resize").style("display",e.empty()?"none":null),na.select("body").style("cursor",null),O.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),D(),C({type:"brushend"})}var y,b,w=this,x=na.select(na.event.target),C=l.of(w,arguments),k=na.select(w),S=x.datum(),_=!/^(n|s)$/.test(S)&&u,M=!/^(e|w)$/.test(S)&&c,T=x.classed("extent"),D=K(w),A=na.mouse(w),O=na.select(t(w)).on("keydown.brush",o).on("keyup.brush",m);if(na.event.changedTouches?O.on("touchmove.brush",g).on("touchend.brush",$):O.on("mousemove.brush",g).on("mouseup.brush",$),k.interrupt().selectAll("*").interrupt(),T)A[0]=f[0]-A[0],A[1]=d[0]-A[1];else if(S){var N=+/w$/.test(S),R=+/^n/.test(S);b=[f[1-N]-A[0],d[1-R]-A[1]],A[0]=f[N],A[1]=d[R]}else na.event.altKey&&(y=A.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),na.select("body").style("cursor",x.style("cursor")),C({type:"brushstart"}),g()}var a,s,l=S(e,"brushstart","brush","brushend"),u=null,c=null,f=[0,0],d=[0,0],p=!0,h=!0,m=Ul[0];return e.event=function(e){e.each(function(){var e=l.of(this,arguments),t={x:f,y:d,i:a,j:s},n=this.__chart__||t;this.__chart__=t,Al?na.select(this).transition().each("start.brush",function(){a=n.i,s=n.j,f=n.x,d=n.y,e({type:"brushstart"})}).tween("brush:brush",function(){var n=yr(f,t.x),r=yr(d,t.y);return a=s=null,function(i){f=t.x=n(i),d=t.y=r(i),e({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=t.i,s=t.j,e({type:"brush",mode:"resize"}),e({type:"brushend"})}):(e({type:"brushstart"}),e({type:"brush",mode:"resize"}),e({type:"brushend"}))})},e.x=function(t){return arguments.length?(u=t,m=Ul[!u<<1|!c],e):u},e.y=function(t){return arguments.length?(c=t,m=Ul[!u<<1|!c],e):c},e.clamp=function(t){return arguments.length?(u&&c?(p=!!t[0],h=!!t[1]):u?p=!!t:c&&(h=!!t),e):u&&c?[p,h]:u?p:c?h:null},e.extent=function(t){var n,r,i,o,l;return arguments.length?(u&&(n=t[0],r=t[1],c&&(n=n[0],r=r[0]),a=[n,r],u.invert&&(n=u(n),r=u(r)),n>r&&(l=n,n=r,r=l),(n!=f[0]||r!=f[1])&&(f=[n,r])),c&&(i=t[0],o=t[1],u&&(i=i[1],o=o[1]),s=[i,o],c.invert&&(i=c(i),o=c(o)),i>o&&(l=i,i=o,o=l),(i!=d[0]||o!=d[1])&&(d=[i,o])),e):(u&&(a?(n=a[0],r=a[1]):(n=f[0],r=f[1],u.invert&&(n=u.invert(n),r=u.invert(r)),n>r&&(l=n,n=r,r=l))),c&&(s?(i=s[0],o=s[1]):(i=d[0],o=d[1],c.invert&&(i=c.invert(i),o=c.invert(o)),i>o&&(l=i,i=o,o=l))),u&&c?[[n,i],[r,o]]:u?[n,r]:c&&[i,o])},e.clear=function(){return e.empty()||(f=[0,0],d=[0,0],a=s=null),e},e.empty=function(){return!!u&&f[0]==f[1]||!!c&&d[0]==d[1]},na.rebind(e,l,"on")};var Fl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ul=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],jl=os.format=fs.timeFormat,Hl=jl.utc,ql=Hl("%Y-%m-%dT%H:%M:%S.%LZ");jl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Jo:ql,Jo.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Jo.toString=ql.toString,os.second=Ue(function(e){return new as(1e3*Math.floor(e/1e3))},function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))},function(e){return e.getSeconds()}),os.seconds=os.second.range,os.seconds.utc=os.second.utc.range,os.minute=Ue(function(e){return new as(6e4*Math.floor(e/6e4))},function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))},function(e){return e.getMinutes()}),os.minutes=os.minute.range,os.minutes.utc=os.minute.utc.range,os.hour=Ue(function(e){var t=e.getTimezoneOffset()/60;return new as(36e5*(Math.floor(e/36e5-t)+t))},function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))},function(e){return e.getHours()}),os.hours=os.hour.range,os.hours.utc=os.hour.utc.range,os.month=Ue(function(e){return e=os.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),os.months=os.month.range,os.months.utc=os.month.utc.range;var Vl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Bl=[[os.second,1],[os.second,5],[os.second,15],[os.second,30],[os.minute,1],[os.minute,5],[os.minute,15],[os.minute,30],[os.hour,1],[os.hour,3],[os.hour,6],[os.hour,12],[os.day,1],[os.day,2],[os.week,1],[os.month,1],[os.month,3],[os.year,1]],zl=jl.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Mt]]),Yl={range:function(e,t,n){return na.range(Math.ceil(e/n)*n,+t,n).map(Qo)},floor:$,ceil:$};Bl.year=os.year,os.scale=function(){return Xo(na.scale.linear(),Bl,zl)};var Wl=Bl.map(function(e){return[e[0].utc,e[1]]}),Gl=Hl.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Mt]]);Wl.year=os.year.utc,os.scale.utc=function(){return Xo(na.scale.linear(),Wl,Gl)},na.text=_e(function(e){return e.responseText}),na.json=function(e,t){return Me(e,"application/json",ea,t)},na.html=function(e,t){return Me(e,"text/html",ta,t)},na.xml=_e(function(e){return e.responseXML}),"function"==typeof define&&define.amd?define("common/d3",na):"object"==typeof module&&module.exports&&(module.exports=na),this.d3=na}(),function(){function e(e,t){if(e!==t){var n=null===e,r=e===b,i=e===e,o=null===t,a=t===b,s=t===t;if(e>t&&!o||!i||n&&!a&&s||r&&s)return 1;if(e=e&&9<=e&&13>=e||32==e||160==e||5760==e||6158==e||8192<=e&&(8202>=e||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}function m(e,t){for(var n=-1,r=e.length,i=-1,o=[];++n=I&&gi&&ci?new je(t):null,u=t.length;l&&(a=He,s=!1,t=l);e:for(;++oa(t,l,0)&&i.push(l);return i}function st(e,t){var n=!0;return Ri(e,function(e,r,i){return n=!!t(e,r,i)}),n}function lt(e,t,n,r){var i=r,o=i;return Ri(e,function(e,a,s){a=+t(e,a,s),(n(a,i)||a===r&&a===o)&&(i=a,o=e)}),o}function ut(e,t){var n=[];return Ri(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function ct(e,t,n,r){var i;return n(e,function(e,n,o){return t(e,n,o)?(i=r?n:e,!1):void 0}),i}function ft(e,t,n,r){r||(r=[]);for(var i=-1,o=e.length;++it&&(t=-t>i?0:i+t),n=n===b||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0,n=jr(i);++r=u)break e;o=r[o],i*="asc"===o||!0===o?1:-1;break e}i=t.b-n.b}return i})}function Ot(e,t){var n=0;return Ri(e,function(e,r,i){n+=+t(e,r,i)||0}),n}function Nt(e,t){var r=-1,i=xn(),o=e.length,a=i===n,s=a&&o>=I,l=s&&gi&&ci?new je(void 0):null,u=[];l?(i=He,a=!1):(s=!1,l=t?[]:u);e:for(;++ri(l,f,0)&&((t||s)&&l.push(f),u.push(c))}return u}function Rt(e,t){for(var n=-1,r=t.length,i=jr(r);++n>>1,a=e[o];(n?a<=t:ai?b:o,i=1);++r=I)return t.plant(r).value();for(var i=0,e=n?o[i].apply(this,e):r;++iarguments.length;return"function"==typeof r&&o===b&&Mo(n)?e(n,r,i,a):_t(n,bn(r,o,4),i,a,t)}}function fn(e,t,n,r,i,o,a,s,l,u){function c(){for(var y=arguments.length,w=y,E=jr(y);w--;)E[w]=arguments[w];if(r&&(E=Ht(E,r,i)),o&&(E=qt(E,o,a)),h||v){var w=c.placeholder,k=m(E,w),y=y-k.length;if(yt?0:t)):[]}function Bn(e,t,n){var r=e?e.length:0;return r?((n?An(e,t,n):null==t)&&(t=1),t=r-(+t||0),Mt(e,0,0>t?0:t)):[]}function zn(e){return e?e[0]:b}function Yn(e,t,r){var i=e?e.length:0;if(!i)return-1;if("number"==typeof r)r=0>r?wi(i+r,0):r;else if(r)return r=Lt(e,t),rn?wi(i+n,0):n||0,"string"==typeof e||!Mo(e)&&wr(e)?n<=i&&-1t?0:+t||0,r);++n=e&&(t=b),n}}function lr(e,t,n){function r(t,n){n&&ai(n),l=d=p=b,t&&(h=ho(),u=e.apply(f,s),d||l||(s=f=b))}function i(){var e=t-(ho()-c);0>=e||e>t?r(p,l):d=fi(i,e)}function o(){r(g,d)}function a(){if(s=arguments,c=ho(),f=this,p=g&&(d||!v),!1===m)var n=v&&!d;else{l||v||(h=c);var r=m-(c-h),a=0>=r||r>m;a?(l&&(l=ai(l)),h=c,u=e.apply(f,s)):l||(l=fi(o,r))}return a&&d?d=ai(d):d||t===m||(d=fi(i,t)),n&&(a=!0,u=e.apply(f,s)),!a||d||l||(s=f=b),u}var s,l,u,c,f,d,p,h=0,m=!1,g=!0;if("function"!=typeof e)throw new Kr(F);if(t=0>t?0:+t||0,!0===n)var v=!0,g=!1;else gr(n)&&(v=!!n.leading,m="maxWait"in n&&wi(+n.maxWait||0,t),g="trailing"in n?!!n.trailing:g);return a.cancel=function(){d&&ai(d),l&&ai(l),h=0,l=d=p=b},a}function ur(e,t){function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;return o.has(i)?o.get(i):(r=e.apply(this,r),n.cache=o.set(i,r),r)}if("function"!=typeof e||t&&"function"!=typeof t)throw new Kr(F);return n.cache=new ur.Cache,n}function cr(e,t){if("function"!=typeof e)throw new Kr(F);return t=wi(t===b?e.length-1:+t||0,0),function(){for(var n=arguments,r=-1,i=wi(n.length-t,0),o=jr(i);++rt}function dr(e){return p(e)&&Tn(e)&&ei.call(e,"callee")&&!ui.call(e,"callee")}function pr(e,t,n,r){return r=(n="function"==typeof n?Ut(n,r,3):b)?n(e,t):b,r===b?vt(e,t,n):!!r}function hr(e){return p(e)&&"string"==typeof e.message&&ni.call(e)==B}function mr(e){return gr(e)&&ni.call(e)==z}function gr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function vr(e){return null!=e&&(mr(e)?ii.test(Qr.call(e)):p(e)&&Se.test(e))}function $r(e){return"number"==typeof e||p(e)&&ni.call(e)==Y}function yr(e){var t;if(!p(e)||ni.call(e)!=W||dr(e)||!(ei.call(e,"constructor")||"function"!=typeof(t=e.constructor)||t instanceof t))return!1;var n;return dt(e,function(e,t){n=t}),n===b||ei.call(e,n)}function br(e){return gr(e)&&ni.call(e)==G}function wr(e){return"string"==typeof e||p(e)&&ni.call(e)==K}function xr(e){return p(e)&&Rn(e.length)&&!!Ne[ni.call(e)]}function Cr(e,t){return e(t=+t)||!e||!yi(t))return n;do{t%2&&(n+=e),t=vi(t/2),e+=e}while(t);return n}function Or(e,t,n){var r=e;return(e=i(e))?(n?An(r,t,n):null==t)?e.slice(g(e),v(e)+1):(t+="",e.slice(o(e,t),a(e,t)+1)):e}function Nr(e,t,n){return n&&An(e,t,n)&&(t=b),e=i(e),e.match(t||Ae)||[]}function Rr(e,t,n){return n&&An(e,t,n)&&(t=b),p(e)?Pr(e):rt(e,t)}function Ir(e){return e}function Pr(e){return bt(it(e,!0))}function Lr(e,t,n){if(null==n){var r=gr(t),i=r?Uo(t):b;((i=i&&i.length?mt(t,i):b)?i.length:r)||(i=!1,n=t,t=e,e=this)}i||(i=mt(t,Uo(t)));var o=!0,r=-1,a=mr(e),s=i.length;!1===n?o=!1:gr(n)&&"chain"in n&&(o=n.chain);for(;++r=N)return n}else e=0;return Fi(n,r)}}(),qi=cr(function(e,t){return p(e)&&Tn(e)?at(e,ft(t,!1,!0)):[]}),Vi=en(),Bi=en(!0),zi=cr(function(e){for(var t=e.length,r=t,i=jr(c),o=xn(),a=o===n,s=[];r--;){var l=e[r]=Tn(l=e[r])?l:[];i[r]=a&&120<=l.length&&gi&&ci?new je(r&&l):null}var a=e[0],u=-1,c=a?a.length:0,f=i[0];e:for(;++u(f?He(f,l):o(s,l,0))){for(r=t;--r;){var d=i[r];if(0>(d?He(d,l):o(e[r],l,0)))continue e}f&&f.push(l),s.push(l)}return s}),Yi=cr(function(t,n){n=ft(n);var r=tt(t,n);return kt(t,n.sort(e)),r}),Wi=mn(),Gi=mn(!0),Ki=cr(function(e){return Nt(ft(e,!1,!0))}),Zi=cr(function(e,t){return Tn(e)?at(e,t):[]}),Ji=cr(Zn),Xi=cr(function(e){var t=e.length,n=2--e?t.apply(this,arguments):void 0}},Ie.ary=function(e,t,n){return n&&An(e,t,n)&&(t=b),t=e&&null==t?e.length:wi(+t||0,0),gn(e,T,b,b,b,b,t)},Ie.assign=Do,Ie.at=eo,Ie.before=sr,Ie.bind=mo,Ie.bindAll=go,Ie.bindKey=vo,Ie.callback=Rr,Ie.chain=Qn,Ie.chunk=function(e,t,n){t=(n?An(e,t,n):null==t)?1:wi(vi(t)||1,1),n=0;for(var r=e?e.length:0,i=-1,o=jr(mi(r/t));nn&&(n=-n>i?0:i+n),r=r===b||r>i?i:+r||0,0>r&&(r+=i),i=n>r?0:r>>>0,n>>>=0;nt?0:t)):[]},Ie.takeRight=function(e,t,n){var r=e?e.length:0;return r?((n?An(e,t,n):null==t)&&(t=1),t=r-(+t||0),Mt(e,0>t?0:t)):[]},Ie.takeRightWhile=function(e,t,n){return e&&e.length?It(e,bn(t,n,3),!1,!0):[]},Ie.takeWhile=function(e,t,n){return e&&e.length?It(e,bn(t,n,3)):[]},Ie.tap=function(e,t,n){return t.call(n,e),e},Ie.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Kr(F);return!1===n?r=!1:gr(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),lr(e,t,{leading:r,maxWait:+t,trailing:i})},Ie.thru=er,Ie.times=function(e,t,n){if(1>(e=vi(e))||!yi(e))return[];var r=-1,i=jr(xi(e,4294967295));for(t=Ut(t,n,1);++rr?i[r]=t(r):t(r);return i},Ie.toArray=Er,Ie.toPlainObject=kr,Ie.transform=function(e,t,n,r){var i=Mo(e)||xr(e);return t=bn(t,r,4),null==n&&(i||gr(e)?(r=e.constructor,n=i?Mo(e)?new r:[]:Ni(mr(r)?r.prototype:b)):n={}),(i?Ve:pt)(e,function(e,r,i){return t(n,e,r,i)}),n},Ie.union=Ki,Ie.uniq=Kn,Ie.unzip=Zn,Ie.unzipWith=Jn,Ie.values=Tr,Ie.valuesIn=function(e){return Rt(e,_r(e))},Ie.where=function(e,t){return nr(e,bt(t))},Ie.without=Zi,Ie.wrap=function(e,t){return t=null==t?Ir:t,gn(t,_,b,[e],[])},Ie.xor=function(){for(var e=-1,t=arguments.length;++en?0:+n||0,r),0<=(n-=t.length)&&e.indexOf(t,n)==n},Ie.escape=function(e){return(e=i(e))&&de.test(e)?e.replace(ce,u):e},Ie.escapeRegExp=function(e){return(e=i(e))&&be.test(e)?e.replace(ye,c):e||"(?:)"},Ie.every=tr,Ie.find=no,Ie.findIndex=Vi,Ie.findKey=No,Ie.findLast=ro,Ie.findLastIndex=Bi,Ie.findLastKey=Ro,Ie.findWhere=function(e,t){return no(e,bt(t))},Ie.first=zn,Ie.floor=ea,Ie.get=function(e,t,n){return e=null==e?b:gt(e,Hn(t),t+""),e===b?n:e},Ie.gt=fr,Ie.gte=function(e,t){return e>=t},Ie.has=function(e,t){if(null==e)return!1;var n=ei.call(e,t);if(!n&&!On(t)){if(t=Hn(t),null==(e=1==t.length?e:gt(e,Mt(t,0,-1))))return!1;t=Wn(t),n=ei.call(e,t)}return n||Rn(e.length)&&Dn(t,e.length)&&(Mo(e)||dr(e))},Ie.identity=Ir,Ie.includes=rr,Ie.indexOf=Yn,Ie.inRange=function(e,t,n){return t=+t||0,n===b?(n=t,t=0):n=+n||0,e>=xi(t,n)&&en?wi(r+n,0):xi(n||0,r-1))+1;else if(n)return i=Lt(e,t,!0)-1,e=e[i],(t===t?t===e:e!==e)?i:-1;if(t!==t)return d(e,i,!0);for(;i--;)if(e[i]===t)return i;return-1},Ie.lt=Cr,Ie.lte=function(e,t){return e<=t},Ie.max=ta,Ie.min=na,Ie.noConflict=function(){return Ye._=ri,this},Ie.noop=Fr,Ie.now=ho,Ie.pad=function(e,t,n){e=i(e),t=+t;var r=e.length;return rn?0:+n||0,e.length),e.lastIndexOf(t,n)==n},Ie.sum=function(e,t,n){if(n&&An(e,t,n)&&(t=b),t=bn(t,n,3),1==t.length){e=Mo(e)?e:Un(e),n=e.length;for(var r=0;n--;)r+=+t(e[n])||0;e=r}else e=Ot(e,t);return e},Ie.template=function(e,t,n){var r=Ie.templateSettings;n&&An(e,t,n)&&(t=n=b),e=i(e),t=Qe(et({},n||t),r,Xe),n=Qe(et({},t.imports),r.imports,Xe);var o,a,s=Uo(n),l=Rt(n,s),u=0;n=t.interpolate||Te;var c="__p+='";n=Wr((t.escape||Te).source+"|"+n.source+"|"+(n===me?Ce:Te).source+"|"+(t.evaluate||Te).source+"|$","g");var d="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(e.replace(n,function(t,n,r,i,s,l){return r||(r=i),c+=e.slice(u,l).replace(De,f),n&&(o=!0,c+="'+__e("+n+")+'"),s&&(a=!0,c+="';"+s+";\n__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),u=l+t.length,t}),c+="';",(t=t.variable)||(c="with(obj){"+c+"}"),c=(a?c.replace(ae,""):c).replace(se,"$1").replace(le,"$1;"),c="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(a?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}",t=Zo(function(){return Vr(s,d+"return "+c).apply(b,l)}),t.source=c,hr(t))throw t;return t},Ie.trim=Or,Ie.trimLeft=function(e,t,n){var r=e;return(e=i(e))?e.slice((n?An(r,t,n):null==t)?g(e):o(e,t+"")):e},Ie.trimRight=function(e,t,n){var r=e;return(e=i(e))?(n?An(r,t,n):null==t)?e.slice(0,v(e)+1):e.slice(0,a(e,t+"")+1):e},Ie.trunc=function(e,t,n){n&&An(e,t,n)&&(t=b);var r=A;if(n=O,null!=t)if(gr(t)){var o="separator"in t?t.separator:o,r="length"in t?+t.length||0:r;n="omission"in t?i(t.omission):n}else r=+t||0;if(e=i(e),r>=e.length)return e;if(1>(r-=n.length))return n;if(t=e.slice(0,r),null==o)return t+n;if(br(o)){if(e.slice(r).search(o)){var a,s=e.slice(0,r);for(o.global||(o=Wr(o.source,(Ee.exec(o)||"")+"g")),o.lastIndex=0;e=o.exec(s);)a=e.index;t=t.slice(0,null==a?r:a)}}else e.indexOf(o,r)!=r&&-1<(o=t.lastIndexOf(o))&&(t=t.slice(0,o));return t+n},Ie.unescape=function(e){return(e=i(e))&&fe.test(e)?e.replace(ue,$):e},Ie.uniqueId=function(e){var t=++ti;return i(e)+t},Ie.words=Nr,Ie.all=tr,Ie.any=ar,Ie.contains=rr,Ie.eq=pr,Ie.detect=no,Ie.foldl=co,Ie.foldr=fo,Ie.head=zn,Ie.include=rr,Ie.inject=co,Lr(Ie,function(){var e={};return pt(Ie,function(t,n){Ie.prototype[n]||(e[n]=t)}),e}(),!1),Ie.sample=or,Ie.prototype.sample=function(e){return this.__chain__||null!=e?this.thru(function(t){return or(t,e)}):or(this.value())},Ie.VERSION=w,Ve("bind bindKey curry curryRight partial partialRight".split(" "),function(e){Ie[e].placeholder=Ie}),Ve(["drop","take"],function(e,t){Fe.prototype[e]=function(n){var r=this.__filtered__;if(r&&!t)return new Fe(this);n=null==n?1:wi(vi(n)||0,0);var i=this.clone();return r?i.__takeCount__=xi(i.__takeCount__,n):i.__views__.push({size:n,type:e+(0>i.__dir__?"Right":"")}),i},Fe.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Ve(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n!=L;Fe.prototype[e]=function(e,t){var i=this.clone();return i.__iteratees__.push({iteratee:bn(e,t,1),type:n}),i.__filtered__=i.__filtered__||r,i}}),Ve(["first","last"],function(e,t){var n="take"+(t?"Right":"");Fe.prototype[e]=function(){return this[n](1).value()[0]}}),Ve(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");Fe.prototype[e]=function(){return this.__filtered__?new Fe(this):this[n](1)}}),Ve(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?bt:Ur;Fe.prototype[e]=function(e){return this[n](r(e))}}),Fe.prototype.compact=function(){return this.filter(Ir)},Fe.prototype.reject=function(e,t){return e=bn(e,t,1),this.filter(function(t){return!e(t)})},Fe.prototype.slice=function(e,t){e=null==e?0:+e||0;var n=this;return n.__filtered__&&(0t)?new Fe(n):(0>e?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==b&&(t=+t||0,n=0>t?n.dropRight(-t):n.take(t-e)),n)},Fe.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Fe.prototype.toArray=function(){return this.take(_i)},pt(Fe.prototype,function(e,t){var n=/^(?:filter|map|reject)|While$/.test(t),r=/^(?:first|last)$/.test(t),i=Ie[r?"take"+("last"==t?"Right":""):t];i&&(Ie.prototype[t]=function(){function t(e){return r&&a?i(e,1)[0]:i.apply(b,Ke([e],o))}var o=r?[1]:arguments,a=this.__chain__,s=this.__wrapped__,l=!!this.__actions__.length,u=s instanceof Fe,c=o[0],f=u||Mo(s);return f&&n&&"function"==typeof c&&1!=c.length&&(u=f=!1),c={func:er,args:[t],thisArg:b},l=u&&!l,r&&!a?l?(s=s.clone(),s.__actions__.push(c),e.call(s)):i.call(b,this.value())[0]:!r&&f?(s=l?s:new Fe(this),s=e.apply(s,o),s.__actions__.push(c),new Le(s,a)):this.thru(t)})}),Ve("join pop push replace shift sort splice split unshift".split(" "),function(e){var t=(/^(?:replace|split)$/.test(e)?Xr:Zr)[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:join|pop|replace|shift)$/.test(e);Ie.prototype[e]=function(){var e=arguments;return r&&!this.__chain__?t.apply(this.value(),e):this[n](function(n){return t.apply(n,e)})}}),pt(Fe.prototype,function(e,t){var n=Ie[t];if(n){var r=n.name+"";(Oi[r]||(Oi[r]=[])).push({name:t,func:n})}}),Oi[fn(b,C).name]=[{name:"wrapper",func:b}],Fe.prototype.clone=function(){var e=new Fe(this.__wrapped__);return e.__actions__=qe(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=qe(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=qe(this.__views__),e},Fe.prototype.reverse=function(){if(this.__filtered__){var e=new Fe(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},Fe.prototype.value=function(){var e,t=this.__wrapped__.value(),n=this.__dir__,r=Mo(t),i=0>n,o=r?t.length:0;e=o;for(var a=this.__views__,s=0,l=-1,u=a.length;++l"'`]/g,fe=RegExp(ue.source),de=RegExp(ce.source),pe=/<%-([\s\S]+?)%>/g,he=/<%([\s\S]+?)%>/g,me=/<%=([\s\S]+?)%>/g,ge=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,ve=/^\w*$/,$e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,ye=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,be=RegExp(ye.source),we=/[\u0300-\u036f\ufe20-\ufe23]/g,xe=/\\(\\)?/g,Ce=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ee=/\w*$/,ke=/^0[xX]/,Se=/^\[object .+?Constructor\]$/,_e=/^\d+$/,Me=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Te=/($^)/,De=/['\n\r\u2028\u2029\\]/g,Ae=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),Oe="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout isFinite parseFloat parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap".split(" "),Ne={};Ne[J]=Ne[X]=Ne[Q]=Ne[ee]=Ne[te]=Ne[ne]=Ne[re]=Ne[ie]=Ne[oe]=!0,Ne[j]=Ne[H]=Ne[Z]=Ne[q]=Ne[V]=Ne[B]=Ne[z]=Ne["[object Map]"]=Ne[Y]=Ne[W]=Ne[G]=Ne["[object Set]"]=Ne[K]=Ne["[object WeakMap]"]=!1;var Re={};Re[j]=Re[H]=Re[Z]=Re[q]=Re[V]=Re[J]=Re[X]=Re[Q]=Re[ee]=Re[te]=Re[Y]=Re[W]=Re[G]=Re[K]=Re[ne]=Re[re]=Re[ie]=Re[oe]=!0,Re[B]=Re[z]=Re["[object Map]"]=Re["[object Set]"]=Re["[object WeakMap]"]=!1;var Ie={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Pe={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Le={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Fe={function:!0,object:!0},Ue={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},je={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},He=Fe[typeof exports]&&exports&&!exports.nodeType&&exports,qe=Fe[typeof module]&&module&&!module.nodeType&&module,Ve=Fe[typeof self]&&self&&self.Object&&self,Be=Fe[typeof window]&&window&&window.Object&&window,ze=qe&&qe.exports===He&&He,Ye=He&&qe&&"object"==typeof global&&global&&global.Object&&global||Be!==(this&&this.window)&&Be||Ve||this,We=y();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Ye._=We,define("common/lodash",[],function(){return We})):He&&qe?ze?(qe.exports=We)._=We:He._=We:Ye._=We}.call(this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("common/moment",t):e.moment=t()}(this,function(){"use strict";function e(){return Yn.apply(null,arguments)}function t(e){return"[object Array]"===Object.prototype.toString.call(e)}function n(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function r(e,t){var n,r=[];for(n=0;n0)for(n in Gn)r=Gn[n],i=t[r],f(i)||(e[r]=i);return e}function p(t){d(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),!1===Kn&&(Kn=!0,e.updateOffset(this),Kn=!1)}function h(e){return e instanceof p||null!=e&&null!=e._isAMomentObject}function m(e){return 0>e?Math.ceil(e):Math.floor(e)}function g(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=m(t)),n}function v(e,t,n){var r,i=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),a=0;for(r=0;i>r;r++)(n&&e[r]!==t[r]||!n&&g(e[r])!==g(t[r]))&&a++;return a+o}function $(){}function y(e){return e?e.toLowerCase().replace("_","-"):e}function b(e){for(var t,n,r,i,o=0;o0;){if(r=w(i.slice(0,t).join("-")))return r;if(n&&n.length>=t&&v(i,n,!0)>=t-1)break;t--}o++}return null}function w(e){var t=null;if(!Zn[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=Wn._abbr,require("./locale/"+e),x(t)}catch(e){}return Zn[e]}function x(e,t){var n;return e&&(n=f(t)?E(e):C(e,t))&&(Wn=n),Wn._abbr}function C(e,t){return null!==t?(t.abbr=e,Zn[e]=Zn[e]||new $,Zn[e].set(t),x(e),Zn[e]):(delete Zn[e],null)}function E(e){var n;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Wn;if(!t(e)){if(n=w(e))return n;e=[e]}return b(e)}function k(e,t){var n=e.toLowerCase();Jn[n]=Jn[n+"s"]=Jn[t]=e}function S(e){return"string"==typeof e?Jn[e]||Jn[e.toLowerCase()]:void 0}function _(e){var t,n,r={};for(n in e)i(e,n)&&(t=S(n))&&(r[t]=e[n]);return r}function M(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function T(t,n){return function(r){return null!=r?(A(this,t,r),e.updateOffset(this,n),this):D(this,t)}}function D(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function A(e,t,n){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](n)}function O(e,t){var n;if("object"==typeof e)for(n in e)this.set(n,e[n]);else if(e=S(e),M(this[e]))return this[e](t);return this}function N(e,t,n){var r=""+Math.abs(e),i=t-r.length;return(e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}function R(e,t,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),e&&(tr[e]=i),t&&(tr[t[0]]=function(){return N(i.apply(this,arguments),t[1],t[2])}),n&&(tr[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function I(e){ +return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function P(e){var t,n,r=e.match(Xn);for(t=0,n=r.length;n>t;t++)tr[r[t]]?r[t]=tr[r[t]]:r[t]=I(r[t]);return function(i){var o="";for(t=0;n>t;t++)o+=r[t]instanceof Function?r[t].call(i,e):r[t];return o}}function L(e,t){return e.isValid()?(t=F(t,e.localeData()),er[t]=er[t]||P(t),er[t](e)):e.localeData().invalidDate()}function F(e,t){function n(e){return t.longDateFormat(e)||e}var r=5;for(Qn.lastIndex=0;r>=0&&Qn.test(e);)e=e.replace(Qn,n),Qn.lastIndex=0,r-=1;return e}function U(e,t,n){yr[e]=M(t)?t:function(e,r){return e&&n?n:t}}function j(e,t){return i(yr,e)?yr[e](t._strict,t._locale):new RegExp(H(e))}function H(e){return q(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,r,i){return t||n||r||i}))}function q(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function V(e,t){var n,r=t;for("string"==typeof e&&(e=[e]),"number"==typeof t&&(r=function(e,n){n[t]=g(e)}),n=0;nr;r++){if(i=a([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}}function Z(e,t){var n;return e.isValid()?"string"==typeof t&&"number"!=typeof(t=e.localeData().monthsParse(t))?e:(n=Math.min(e.date(),Y(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e):e}function J(t){return null!=t?(Z(this,t),e.updateOffset(this,!0),this):D(this,"Month")}function X(){return Y(this.year(),this.month())}function Q(e){return this._monthsParseExact?(i(this,"_monthsRegex")||te.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex}function ee(e){return this._monthsParseExact?(i(this,"_monthsRegex")||te.call(this),e?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex}function te(){function e(e,t){return t.length-e.length}var t,n,r=[],i=[],o=[];for(t=0;12>t;t++)n=a([2e3,t]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(r.sort(e),i.sort(e),o.sort(e),t=0;12>t;t++)r[t]=q(r[t]),i[t]=q(i[t]),o[t]=q(o[t]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")$","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")$","i")}function ne(e){var t,n=e._a;return n&&-2===l(e).overflow&&(t=n[xr]<0||n[xr]>11?xr:n[Cr]<1||n[Cr]>Y(n[wr],n[xr])?Cr:n[Er]<0||n[Er]>24||24===n[Er]&&(0!==n[kr]||0!==n[Sr]||0!==n[_r])?Er:n[kr]<0||n[kr]>59?kr:n[Sr]<0||n[Sr]>59?Sr:n[_r]<0||n[_r]>999?_r:-1,l(e)._overflowDayOfYear&&(wr>t||t>Cr)&&(t=Cr),l(e)._overflowWeeks&&-1===t&&(t=Mr),l(e)._overflowWeekday&&-1===t&&(t=Tr),l(e).overflow=t),e}function re(t){!1===e.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function ie(e,t){var n=!0;return o(function(){return n&&(re(e+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),n=!1),t.apply(this,arguments)},t)}function oe(e,t){Ir[e]||(re(t),Ir[e]=!0)}function ae(e){var t,n,r,i,o,a,s=e._i,u=Pr.exec(s)||Lr.exec(s);if(u){for(l(e).iso=!0,t=0,n=Ur.length;n>t;t++)if(Ur[t][1].exec(u[1])){i=Ur[t][0],r=!1!==Ur[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=jr.length;n>t;t++)if(jr[t][1].exec(u[3])){o=(u[2]||" ")+jr[t][0];break}if(null==o)return void(e._isValid=!1)}if(!r&&null!=o)return void(e._isValid=!1);if(u[4]){if(!Fr.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(o||"")+(a||""),we(e)}else e._isValid=!1}function se(t){var n=Hr.exec(t._i);return null!==n?void(t._d=new Date(+n[1])):(ae(t),void(!1===t._isValid&&(delete t._isValid,e.createFromInputFallback(t))))}function le(e,t,n,r,i,o,a){var s=new Date(e,t,n,r,i,o,a);return 100>e&&e>=0&&isFinite(s.getFullYear())&&s.setFullYear(e),s}function ue(e){var t=new Date(Date.UTC.apply(null,arguments));return 100>e&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function ce(e){return fe(e)?366:365}function fe(e){return e%4==0&&e%100!=0||e%400==0}function de(){return fe(this.year())}function pe(e,t,n){var r=7+t-n;return-(7+ue(e,0,r).getUTCDay()-t)%7+r-1}function he(e,t,n,r,i){var o,a,s=(7+n-r)%7,l=pe(e,r,i),u=1+7*(t-1)+s+l;return 0>=u?(o=e-1,a=ce(o)+u):u>ce(e)?(o=e+1,a=u-ce(e)):(o=e,a=u),{year:o,dayOfYear:a}}function me(e,t,n){var r,i,o=pe(e.year(),t,n),a=Math.floor((e.dayOfYear()-o-1)/7)+1;return 1>a?(i=e.year()-1,r=a+ge(i,t,n)):a>ge(e.year(),t,n)?(r=a-ge(e.year(),t,n),i=e.year()+1):(i=e.year(),r=a),{week:r,year:i}}function ge(e,t,n){var r=pe(e,t,n),i=pe(e+1,t,n);return(ce(e)-r+i)/7}function ve(e,t,n){return null!=e?e:null!=t?t:n}function $e(t){var n=new Date(e.now());return t._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function ye(e){var t,n,r,i,o=[];if(!e._d){for(r=$e(e),e._w&&null==e._a[Cr]&&null==e._a[xr]&&be(e),e._dayOfYear&&(i=ve(e._a[wr],r[wr]),e._dayOfYear>ce(i)&&(l(e)._overflowDayOfYear=!0),n=ue(i,0,e._dayOfYear),e._a[xr]=n.getUTCMonth(),e._a[Cr]=n.getUTCDate()),t=0;3>t&&null==e._a[t];++t)e._a[t]=o[t]=r[t];for(;7>t;t++)e._a[t]=o[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Er]&&0===e._a[kr]&&0===e._a[Sr]&&0===e._a[_r]&&(e._nextDay=!0,e._a[Er]=0),e._d=(e._useUTC?ue:le).apply(null,o),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Er]=24)}}function be(e){var t,n,r,i,o,a,s,u;t=e._w,null!=t.GG||null!=t.W||null!=t.E?(o=1,a=4,n=ve(t.GG,e._a[wr],me(Te(),1,4).year),r=ve(t.W,1),(1>(i=ve(t.E,1))||i>7)&&(u=!0)):(o=e._locale._week.dow,a=e._locale._week.doy,n=ve(t.gg,e._a[wr],me(Te(),o,a).year),r=ve(t.w,1),null!=t.d?(0>(i=t.d)||i>6)&&(u=!0):null!=t.e?(i=t.e+o,(t.e<0||t.e>6)&&(u=!0)):i=o),1>r||r>ge(n,o,a)?l(e)._overflowWeeks=!0:null!=u?l(e)._overflowWeekday=!0:(s=he(n,r,i,o,a),e._a[wr]=s.year,e._dayOfYear=s.dayOfYear)}function we(t){if(t._f===e.ISO_8601)return void ae(t);t._a=[],l(t).empty=!0;var n,r,i,o,a,s=""+t._i,u=s.length,c=0;for(i=F(t._f,t._locale).match(Xn)||[],n=0;n0&&l(t).unusedInput.push(a),s=s.slice(s.indexOf(r)+r.length),c+=r.length),tr[o]?(r?l(t).empty=!1:l(t).unusedTokens.push(o),z(o,r,t)):t._strict&&!r&&l(t).unusedTokens.push(o);l(t).charsLeftOver=u-c,s.length>0&&l(t).unusedInput.push(s),!0===l(t).bigHour&&t._a[Er]<=12&&t._a[Er]>0&&(l(t).bigHour=void 0),t._a[Er]=xe(t._locale,t._a[Er],t._meridiem),ye(t),ne(t)}function xe(e,t,n){var r;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?(r=e.isPM(n),r&&12>t&&(t+=12),r||12!==t||(t=0),t):t}function Ce(e){var t,n,r,i,a;if(0===e._f.length)return l(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;ia)&&(r=a,n=t));o(e,n||t)}function Ee(e){if(!e._d){var t=_(e._i);e._a=r([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ye(e)}}function ke(e){var t=new p(ne(Se(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function Se(e){var r=e._i,i=e._f;return e._locale=e._locale||E(e._l),null===r||void 0===i&&""===r?c({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),h(r)?new p(ne(r)):(t(i)?Ce(e):i?we(e):n(r)?e._d=r:_e(e),u(e)||(e._d=null),e))}function _e(i){var o=i._i;void 0===o?i._d=new Date(e.now()):n(o)?i._d=new Date(+o):"string"==typeof o?se(i):t(o)?(i._a=r(o.slice(0),function(e){return parseInt(e,10)}),ye(i)):"object"==typeof o?Ee(i):"number"==typeof o?i._d=new Date(o):e.createFromInputFallback(i)}function Me(e,t,n,r,i){var o={};return"boolean"==typeof n&&(r=n,n=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=i,o._l=n,o._i=e,o._f=t,o._strict=r,ke(o)}function Te(e,t,n,r){return Me(e,t,n,r,!1)}function De(e,n){var r,i;if(1===n.length&&t(n[0])&&(n=n[0]),!n.length)return Te();for(r=n[0],i=1;ie&&(e=-e,n="-"),n+N(~~(e/60),2)+t+N(~~e%60,2)})}function Pe(e,t){var n=(t||"").match(e)||[],r=n[n.length-1]||[],i=(r+"").match(Yr)||["-",0,0],o=60*i[1]+g(i[2]);return"+"===i[0]?o:-o}function Le(t,r){var i,o;return r._isUTC?(i=r.clone(),o=(h(t)||n(t)?+t:+Te(t))-+i,i._d.setTime(+i._d+o),e.updateOffset(i,!1),i):Te(t).local()}function Fe(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Ue(t,n){var r,i=this._offset||0;return this.isValid()?null!=t?("string"==typeof t?t=Pe(gr,t):Math.abs(t)<16&&(t*=60),!this._isUTC&&n&&(r=Fe(this)),this._offset=t,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==t&&(!n||this._changeInProgress?tt(this,Ze(t-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?i:Fe(this):null!=t?this:NaN}function je(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function He(e){return this.utcOffset(0,e)}function qe(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Fe(this),"m")),this}function Ve(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Pe(mr,this._i)),this}function Be(e){return!!this.isValid()&&(e=e?Te(e).utcOffset():0,(this.utcOffset()-e)%60==0)}function ze(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ye(){if(!f(this._isDSTShifted))return this._isDSTShifted;var e={};if(d(e,this),e=Se(e),e._a){var t=e._isUTC?a(e._a):Te(e._a);this._isDSTShifted=this.isValid()&&v(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function We(){return!!this.isValid()&&!this._isUTC}function Ge(){return!!this.isValid()&&this._isUTC}function Ke(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ze(e,t){var n,r,o,a=e,s=null;return Re(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(a={},t?a[t]=e:a.milliseconds=e):(s=Wr.exec(e))?(n="-"===s[1]?-1:1,a={y:0,d:g(s[Cr])*n,h:g(s[Er])*n,m:g(s[kr])*n,s:g(s[Sr])*n,ms:g(s[_r])*n}):(s=Gr.exec(e))?(n="-"===s[1]?-1:1,a={y:Je(s[2],n),M:Je(s[3],n),d:Je(s[4],n),h:Je(s[5],n),m:Je(s[6],n),s:Je(s[7],n),w:Je(s[8],n)}):null==a?a={}:"object"==typeof a&&("from"in a||"to"in a)&&(o=Qe(Te(a.from),Te(a.to)),a={},a.ms=o.milliseconds,a.M=o.months),r=new Ne(a),Re(e)&&i(e,"_locale")&&(r._locale=e._locale),r}function Je(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Xe(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Qe(e,t){var n;return e.isValid()&&t.isValid()?(t=Le(t,e),e.isBefore(t)?n=Xe(e,t):(n=Xe(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function et(e,t){return function(n,r){var i,o;return null===r||isNaN(+r)||(oe(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),o=n,n=r,r=o),n="string"==typeof n?+n:n,i=Ze(n,r),tt(this,i,e),this}}function tt(t,n,r,i){var o=n._milliseconds,a=n._days,s=n._months;t.isValid()&&(i=null==i||i,o&&t._d.setTime(+t._d+o*r),a&&A(t,"Date",D(t,"Date")+a*r),s&&Z(t,D(t,"Month")+s*r),i&&e.updateOffset(t,a||s))}function nt(e,t){var n=e||Te(),r=Le(n,this).startOf("day"),i=this.diff(r,"days",!0),o=-6>i?"sameElse":-1>i?"lastWeek":0>i?"lastDay":1>i?"sameDay":2>i?"nextDay":7>i?"nextWeek":"sameElse",a=t&&(M(t[o])?t[o]():t[o]);return this.format(a||this.localeData().calendar(o,this,Te(n)))}function rt(){return new p(this)}function it(e,t){var n=h(e)?e:Te(e);return!(!this.isValid()||!n.isValid())&&(t=S(f(t)?"millisecond":t),"millisecond"===t?+this>+n:+n<+this.clone().startOf(t))}function ot(e,t){var n=h(e)?e:Te(e);return!(!this.isValid()||!n.isValid())&&(t=S(f(t)?"millisecond":t),"millisecond"===t?+n>+this:+this.clone().endOf(t)<+n)}function at(e,t,n){return this.isAfter(e,n)&&this.isBefore(t,n)}function st(e,t){var n,r=h(e)?e:Te(e);return!(!this.isValid()||!r.isValid())&&(t=S(t||"millisecond"),"millisecond"===t?+this==+r:(n=+r,+this.clone().startOf(t)<=n&&n<=+this.clone().endOf(t)))}function lt(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function ut(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function ct(e,t,n){var r,i,o,a;return this.isValid()?(r=Le(e,this),r.isValid()?(i=6e4*(r.utcOffset()-this.utcOffset()),t=S(t),"year"===t||"month"===t||"quarter"===t?(a=ft(this,r),"quarter"===t?a/=3:"year"===t&&(a/=12)):(o=this-r,a="second"===t?o/1e3:"minute"===t?o/6e4:"hour"===t?o/36e5:"day"===t?(o-i)/864e5:"week"===t?(o-i)/6048e5:o),n?a:m(a)):NaN):NaN}function ft(e,t){var n,r,i=12*(t.year()-e.year())+(t.month()-e.month()),o=e.clone().add(i,"months");return 0>t-o?(n=e.clone().add(i-1,"months"),r=(t-o)/(o-n)):(n=e.clone().add(i+1,"months"),r=(t-o)/(n-o)),-(i+r)}function dt(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function pt(){var e=this.clone().utc();return 0o&&(t=o),Ut.call(this,e,t,n,r,i))}function Ut(e,t,n,r,i){var o=he(e,t,n,r,i),a=ue(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function jt(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function Ht(e){return me(e,this._week.dow,this._week.doy).week}function qt(){return this._week.dow}function Vt(){return this._week.doy}function Bt(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function zt(e){var t=me(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function Yt(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function Wt(e,n){return t(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(n)?"format":"standalone"][e.day()]}function Gt(e){return this._weekdaysShort[e.day()]}function Kt(e){return this._weekdaysMin[e.day()]}function Zt(e,t,n){var r,i,o;for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;7>r;r++){if(i=Te([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}}function Jt(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=Yt(e,this.localeData()),this.add(e-t,"d")):t}function Xt(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function Qt(e){return this.isValid()?null==e?this.day()||7:this.day(this.day()%7?e:e-7):null!=e?this:NaN}function en(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function tn(){return this.hours()%12||12}function nn(e,t){R(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function rn(e,t){return t._meridiemParse}function on(e){return"p"===(e+"").toLowerCase().charAt(0)}function an(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}function sn(e,t){t[_r]=g(1e3*("0."+e))}function ln(){return this._isUTC?"UTC":""}function un(){return this._isUTC?"Coordinated Universal Time":""}function cn(e){return Te(1e3*e)}function fn(){return Te.apply(null,arguments).parseZone()}function dn(e,t,n){var r=this._calendar[e];return M(r)?r.call(t,n):r}function pn(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])}function hn(){return this._invalidDate}function mn(e){return this._ordinal.replace("%d",e)}function gn(e){return e}function vn(e,t,n,r){var i=this._relativeTime[n];return M(i)?i(e,t,n,r):i.replace(/%d/i,e)}function $n(e,t){var n=this._relativeTime[e>0?"future":"past"];return M(n)?n(t):n.replace(/%s/i,t)}function yn(e){var t,n;for(n in e)t=e[n],M(t)?this[n]=t:this["_"+n]=t;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function bn(e,t,n,r){var i=E(),o=a().set(r,t);return i[n](o,e)}function wn(e,t,n,r,i){if("number"==typeof e&&(t=e,e=void 0),e=e||"",null!=t)return bn(e,t,n,i);var o,a=[];for(o=0;r>o;o++)a[o]=bn(e,o,n,i);return a}function xn(e,t){return wn(e,t,"months",12,"month")}function Cn(e,t){return wn(e,t,"monthsShort",12,"month")}function En(e,t){return wn(e,t,"weekdays",7,"day")}function kn(e,t){return wn(e,t,"weekdaysShort",7,"day")}function Sn(e,t){return wn(e,t,"weekdaysMin",7,"day")}function _n(){var e=this._data;return this._milliseconds=gi(this._milliseconds),this._days=gi(this._days),this._months=gi(this._months),e.milliseconds=gi(e.milliseconds),e.seconds=gi(e.seconds),e.minutes=gi(e.minutes),e.hours=gi(e.hours),e.months=gi(e.months),e.years=gi(e.years),this}function Mn(e,t,n,r){var i=Ze(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Tn(e,t){return Mn(this,e,t,1)}function Dn(e,t){return Mn(this,e,t,-1)}function An(e){return 0>e?Math.floor(e):Math.ceil(e)}function On(){var e,t,n,r,i,o=this._milliseconds,a=this._days,s=this._months,l=this._data;return o>=0&&a>=0&&s>=0||0>=o&&0>=a&&0>=s||(o+=864e5*An(Rn(s)+a),a=0,s=0),l.milliseconds=o%1e3,e=m(o/1e3),l.seconds=e%60,t=m(e/60),l.minutes=t%60,n=m(t/60),l.hours=n%24,a+=m(n/24),i=m(Nn(a)),s+=i,a-=An(Rn(i)),r=m(s/12),s%=12,l.days=a,l.months=s,l.years=r,this}function Nn(e){return 4800*e/146097}function Rn(e){return 146097*e/4800}function In(e){var t,n,r=this._milliseconds;if("month"===(e=S(e))||"year"===e)return t=this._days+r/864e5,n=this._months+Nn(t),"month"===e?n:n/12;switch(t=this._days+Math.round(Rn(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}}function Pn(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*g(this._months/12)}function Ln(e){return function(){return this.as(e)}}function Fn(e){return e=S(e),this[e+"s"]()}function Un(e){return function(){return this._data[e]}}function jn(){return m(this.days()/7)}function Hn(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function qn(e,t,n){var r=Ze(e).abs(),i=Oi(r.as("s")),o=Oi(r.as("m")),a=Oi(r.as("h")),s=Oi(r.as("d")),l=Oi(r.as("M")),u=Oi(r.as("y")),c=i=o&&["m"]||o=a&&["h"]||a=s&&["d"]||s=l&&["M"]||l=u&&["y"]||["yy",u];return c[2]=t,c[3]=+e>0,c[4]=n,Hn.apply(null,c)}function Vn(e,t){return void 0!==Ni[e]&&(void 0===t?Ni[e]:(Ni[e]=t,!0))}function Bn(e){var t=this.localeData(),n=qn(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)}function zn(){var e,t,n,r=Ri(this._milliseconds)/1e3,i=Ri(this._days),o=Ri(this._months);e=m(r/60),t=m(e/60),r%=60,e%=60,n=m(o/12),o%=12;var a=n,s=o,l=i,u=t,c=e,f=r,d=this.asSeconds();return d?(0>d?"-":"")+"P"+(a?a+"Y":"")+(s?s+"M":"")+(l?l+"D":"")+(u||c||f?"T":"")+(u?u+"H":"")+(c?c+"M":"")+(f?f+"S":""):"P0D"}var Yn,Wn,Gn=e.momentProperties=[],Kn=!1,Zn={},Jn={},Xn=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Qn=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,er={},tr={},nr=/\d/,rr=/\d\d/,ir=/\d{3}/,or=/\d{4}/,ar=/[+-]?\d{6}/,sr=/\d\d?/,lr=/\d\d\d\d?/,ur=/\d\d\d\d\d\d?/,cr=/\d{1,3}/,fr=/\d{1,4}/,dr=/[+-]?\d{1,6}/,pr=/\d+/,hr=/[+-]?\d+/,mr=/Z|[+-]\d\d:?\d\d/gi,gr=/Z|[+-]\d\d(?::?\d\d)?/gi,vr=/[+-]?\d+(\.\d{1,3})?/,$r=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,yr={},br={},wr=0,xr=1,Cr=2,Er=3,kr=4,Sr=5,_r=6,Mr=7,Tr=8;R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),R("MMMM",0,0,function(e){return this.localeData().months(this,e)}),k("month","M"),U("M",sr),U("MM",sr,rr),U("MMM",function(e,t){return t.monthsShortRegex(e)}),U("MMMM",function(e,t){return t.monthsRegex(e)}),V(["M","MM"],function(e,t){t[xr]=g(e)-1}),V(["MMM","MMMM"],function(e,t,n,r){var i=n._locale.monthsParse(e,r,n._strict);null!=i?t[xr]=i:l(n).invalidMonth=e});var Dr=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Ar="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Or="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Nr=$r,Rr=$r,Ir={};e.suppressDeprecationWarnings=!1;var Pr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Lr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Fr=/Z|[+-]\d\d(?::?\d\d)?/,Ur=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],jr=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Hr=/^\/?Date\((\-?\d+)/i;e.createFromInputFallback=ie("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),R("Y",0,0,function(){var e=this.year();return 9999>=e?""+e:"+"+e}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),k("year","y"),U("Y",hr),U("YY",sr,rr),U("YYYY",fr,or),U("YYYYY",dr,ar),U("YYYYYY",dr,ar),V(["YYYYY","YYYYYY"],wr),V("YYYY",function(t,n){n[wr]=2===t.length?e.parseTwoDigitYear(t):g(t)}),V("YY",function(t,n){n[wr]=e.parseTwoDigitYear(t)}),V("Y",function(e,t){t[wr]=parseInt(e,10)}),e.parseTwoDigitYear=function(e){return g(e)+(g(e)>68?1900:2e3)};var qr=T("FullYear",!1);e.ISO_8601=function(){};var Vr=ie("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var e=Te.apply(null,arguments);return this.isValid()&&e.isValid()?this>e?this:e:c()}),Br=ie("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var e=Te.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:c()}),zr=function(){return Date.now?Date.now():+new Date};Ie("Z",":"),Ie("ZZ",""),U("Z",gr),U("ZZ",gr),V(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Pe(gr,e)});var Yr=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Wr=/(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Gr=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ze.fn=Ne.prototype;var Kr=et(1,"add"),Zr=et(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Jr=ie("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Nt("gggg","weekYear"),Nt("ggggg","weekYear"),Nt("GGGG","isoWeekYear"),Nt("GGGGG","isoWeekYear"),k("weekYear","gg"),k("isoWeekYear","GG"),U("G",hr),U("g",hr),U("GG",sr,rr),U("gg",sr,rr),U("GGGG",fr,or),U("gggg",fr,or),U("GGGGG",dr,ar),U("ggggg",dr,ar),B(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,r){t[r.substr(0,2)]=g(e)}),B(["gg","GG"],function(t,n,r,i){n[i]=e.parseTwoDigitYear(t)}),R("Q",0,"Qo","quarter"),k("quarter","Q"),U("Q",nr),V("Q",function(e,t){t[xr]=3*(g(e)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),k("week","w"),k("isoWeek","W"),U("w",sr),U("ww",sr,rr),U("W",sr),U("WW",sr,rr),B(["w","ww","W","WW"],function(e,t,n,r){t[r.substr(0,1)]=g(e)});var Xr={dow:0,doy:6};R("D",["DD",2],"Do","date"),k("date","D"),U("D",sr),U("DD",sr,rr),U("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),V(["D","DD"],Cr),V("Do",function(e,t){t[Cr]=g(e.match(sr)[0],10)});var Qr=T("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),R("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),R("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),k("day","d"),k("weekday","e"),k("isoWeekday","E"),U("d",sr),U("e",sr),U("E",sr),U("dd",$r),U("ddd",$r),U("dddd",$r),B(["dd","ddd","dddd"],function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:l(n).invalidWeekday=e}),B(["d","e","E"],function(e,t,n,r){t[r]=g(e)});var ei="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ti="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ni="Su_Mo_Tu_We_Th_Fr_Sa".split("_");R("DDD",["DDDD",3],"DDDo","dayOfYear"),k("dayOfYear","DDD"),U("DDD",cr),U("DDDD",ir),V(["DDD","DDDD"],function(e,t,n){n._dayOfYear=g(e)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,tn),R("hmm",0,0,function(){return""+tn.apply(this)+N(this.minutes(),2)}),R("hmmss",0,0,function(){return""+tn.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),nn("a",!0),nn("A",!1),k("hour","h"),U("a",rn),U("A",rn),U("H",sr),U("h",sr),U("HH",sr,rr),U("hh",sr,rr),U("hmm",lr),U("hmmss",ur),U("Hmm",lr),U("Hmmss",ur),V(["H","HH"],Er),V(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),V(["h","hh"],function(e,t,n){t[Er]=g(e),l(n).bigHour=!0}),V("hmm",function(e,t,n){var r=e.length-2;t[Er]=g(e.substr(0,r)),t[kr]=g(e.substr(r)),l(n).bigHour=!0}),V("hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[Er]=g(e.substr(0,r)),t[kr]=g(e.substr(r,2)),t[Sr]=g(e.substr(i)),l(n).bigHour=!0}),V("Hmm",function(e,t,n){var r=e.length-2;t[Er]=g(e.substr(0,r)),t[kr]=g(e.substr(r))}),V("Hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[Er]=g(e.substr(0,r)),t[kr]=g(e.substr(r,2)),t[Sr]=g(e.substr(i))});var ri=/[ap]\.?m?\.?/i,ii=T("Hours",!0);R("m",["mm",2],0,"minute"),k("minute","m"),U("m",sr),U("mm",sr,rr),V(["m","mm"],kr);var oi=T("Minutes",!1);R("s",["ss",2],0,"second"),k("second","s"),U("s",sr),U("ss",sr,rr),V(["s","ss"],Sr);var ai=T("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}), +k("millisecond","ms"),U("S",cr,nr),U("SS",cr,rr),U("SSS",cr,ir);var si;for(si="SSSS";si.length<=9;si+="S")U(si,pr);for(si="S";si.length<=9;si+="S")V(si,sn);var li=T("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var ui=p.prototype;ui.add=Kr,ui.calendar=nt,ui.clone=rt,ui.diff=ct,ui.endOf=xt,ui.format=ht,ui.from=mt,ui.fromNow=gt,ui.to=vt,ui.toNow=$t,ui.get=O,ui.invalidAt=At,ui.isAfter=it,ui.isBefore=ot,ui.isBetween=at,ui.isSame=st,ui.isSameOrAfter=lt,ui.isSameOrBefore=ut,ui.isValid=Tt,ui.lang=Jr,ui.locale=yt,ui.localeData=bt,ui.max=Br,ui.min=Vr,ui.parsingFlags=Dt,ui.set=O,ui.startOf=wt,ui.subtract=Zr,ui.toArray=St,ui.toObject=_t,ui.toDate=kt,ui.toISOString=pt,ui.toJSON=Mt,ui.toString=dt,ui.unix=Et,ui.valueOf=Ct,ui.creationData=Ot,ui.year=qr,ui.isLeapYear=de,ui.weekYear=Rt,ui.isoWeekYear=It,ui.quarter=ui.quarters=jt,ui.month=J,ui.daysInMonth=X,ui.week=ui.weeks=Bt,ui.isoWeek=ui.isoWeeks=zt,ui.weeksInYear=Lt,ui.isoWeeksInYear=Pt,ui.date=Qr,ui.day=ui.days=Jt,ui.weekday=Xt,ui.isoWeekday=Qt,ui.dayOfYear=en,ui.hour=ui.hours=ii,ui.minute=ui.minutes=oi,ui.second=ui.seconds=ai,ui.millisecond=ui.milliseconds=li,ui.utcOffset=Ue,ui.utc=He,ui.local=qe,ui.parseZone=Ve,ui.hasAlignedHourOffset=Be,ui.isDST=ze,ui.isDSTShifted=Ye,ui.isLocal=We,ui.isUtcOffset=Ge,ui.isUtc=Ke,ui.isUTC=Ke,ui.zoneAbbr=ln,ui.zoneName=un,ui.dates=ie("dates accessor is deprecated. Use date instead.",Qr),ui.months=ie("months accessor is deprecated. Use month instead",J),ui.years=ie("years accessor is deprecated. Use year instead",qr),ui.zone=ie("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",je);var ci=ui,fi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},di={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},pi=/\d{1,2}/,hi={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},mi=$.prototype;mi._calendar=fi,mi.calendar=dn,mi._longDateFormat=di,mi.longDateFormat=pn,mi._invalidDate="Invalid date",mi.invalidDate=hn,mi._ordinal="%d",mi.ordinal=mn,mi._ordinalParse=pi,mi.preparse=gn,mi.postformat=gn,mi._relativeTime=hi,mi.relativeTime=vn,mi.pastFuture=$n,mi.set=yn,mi.months=W,mi._months=Ar,mi.monthsShort=G,mi._monthsShort=Or,mi.monthsParse=K,mi._monthsRegex=Rr,mi.monthsRegex=ee,mi._monthsShortRegex=Nr,mi.monthsShortRegex=Q,mi.week=Ht,mi._week=Xr,mi.firstDayOfYear=Vt,mi.firstDayOfWeek=qt,mi.weekdays=Wt,mi._weekdays=ei,mi.weekdaysMin=Kt,mi._weekdaysMin=ni,mi.weekdaysShort=Gt,mi._weekdaysShort=ti,mi.weekdaysParse=Zt,mi.isPM=on,mi._meridiemParse=ri,mi.meridiem=an,x("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===g(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),e.lang=ie("moment.lang is deprecated. Use moment.locale instead.",x),e.langData=ie("moment.langData is deprecated. Use moment.localeData instead.",E);var gi=Math.abs,vi=Ln("ms"),$i=Ln("s"),yi=Ln("m"),bi=Ln("h"),wi=Ln("d"),xi=Ln("w"),Ci=Ln("M"),Ei=Ln("y"),ki=Un("milliseconds"),Si=Un("seconds"),_i=Un("minutes"),Mi=Un("hours"),Ti=Un("days"),Di=Un("months"),Ai=Un("years"),Oi=Math.round,Ni={s:45,m:45,h:22,d:26,M:11},Ri=Math.abs,Ii=Ne.prototype;return Ii.abs=_n,Ii.add=Tn,Ii.subtract=Dn,Ii.as=In,Ii.asMilliseconds=vi,Ii.asSeconds=$i,Ii.asMinutes=yi,Ii.asHours=bi,Ii.asDays=wi,Ii.asWeeks=xi,Ii.asMonths=Ci,Ii.asYears=Ei,Ii.valueOf=Pn,Ii._bubble=On,Ii.get=Fn,Ii.milliseconds=ki,Ii.seconds=Si,Ii.minutes=_i,Ii.hours=Mi,Ii.days=Ti,Ii.weeks=jn,Ii.months=Di,Ii.years=Ai,Ii.humanize=Bn,Ii.toISOString=zn,Ii.toString=zn,Ii.toJSON=zn,Ii.locale=yt,Ii.localeData=bt,Ii.toIsoString=ie("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",zn),Ii.lang=Jr,R("X",0,0,"unix"),R("x",0,0,"valueOf"),U("x",hr),U("X",vr),V("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),V("x",function(e,t,n){n._d=new Date(g(e))}),e.version="2.11.1",function(e){Yn=e}(Te),e.fn=ci,e.min=Ae,e.max=Oe,e.now=zr,e.utc=a,e.unix=cn,e.months=xn,e.isDate=n,e.locale=x,e.invalid=c,e.duration=Ze,e.isMoment=h,e.weekdays=En,e.parseZone=fn,e.localeData=E,e.isDuration=Re,e.monthsShort=Cn,e.weekdaysMin=Sn,e.defineLocale=C,e.weekdaysShort=kn,e.normalizeUnits=S,e.relativeTimeThreshold=Vn,e.prototype=ci,e}),define("common/bundles/vendors",["common/angular","common/angularAnimate","common/angularBootstrap","common/angular-file-upload","common/angulartics","common/angulartics-google-tag-manager","common/angularMocks","common/angularResource","common/angularRoute","common/angularXeditable","common/text-angular","common/ui-select","common/d3","common/lodash","common/moment"],function(){}),define("common/modules/apis",["common/angular"],function(e){"use strict";return e.module("common.apis",[])}),define("common/services/api",["common/angular","common/lodash","common/modules/apis"],function(e,t,n){"use strict";n.factory("api",["$cacheFactory","$log","$http","$httpParamSerializer","$q","$timeout",function(n,r,i,o,a,s){function l(e){return e.data.is_error?(r.error(e.data),a.reject(e.data.error_message)):e.data}function u(e){var n={options:{limit:0}};return JSON.stringify(t.merge(n,e||{}))}r.debug("api");return{extend:function(t){return e.extend(Object.create(this),t)},getAll:function(e,n,i,o,s,l,u){return r.debug("api.all"),n=n||{},l=l||"get",a.all([function(){var r=t.assign({},n,s||{},{options:t.assign({},n.options,{sort:o||"id DESC"})});return i&&(r.options.offset=(i.page-1)*i.size,r.options.limit=i.size),this.sendGET(e,l,r,u)}.bind(this)(),function(){if(!i)return a.resolve();var r=t.assign({},n,{return:"id"});return r=t.omit(r,function(e,n){return t.startsWith(n,"api.")}),this.sendGET(e,l,r,u)}.bind(this)()]).then(function(e){var n=e[0],r=i?e[1]:n;return{list:n.values,total:r.count,allIds:t.compact(r.values.map(function(e){return e.id})).join(",")}})},mockGET:function(e,t){var n=a.defer();return s(function(){n.resolve(e)},t||0),n.promise},mockPOST:function(e,t){return this.mockGET.apply(this,arguments)},sendGET:function(e,t,r,a){var s={action:t,entity:e,json:u(r),sequential:1};return!1===a&&n.get("$http").remove("/civicrm/ajax/rest?"+o(s)),i({method:"GET",url:"/civicrm/ajax/rest",cache:!0,responseType:"json",params:s}).then(l)},sendPOST:function(e,t,n){return r.debug("api.sendPOST"),i({method:"POST",url:"/civicrm/ajax/rest",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},responseType:"json",data:{json:u(n),sequential:1,entity:e,action:t},transformRequest:o}).then(l)}}}])}),define("common/services/api/appraisal",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("api.appraisal",["$log","api",function(e,t){return e.debug("api.appraisal"),t.extend({all:function(t,n,r){return e.debug("api.appraisal.api"),this.getAll("Appraisal",t,n,r)},create:function(t){return e.debug("api.appraisal.create"),this.sendPOST("Appraisal","create",t).then(function(e){return e.values[0]})},find:function(t){return e.debug("api.appraisal.find"),this.sendGET("Appraisal","get",{id:""+t},!1).then(function(e){return e.values[0]})}})}])}),define("common/services/api/option-group",["common/lodash","common/modules/apis","common/services/api"],function(e,t){"use strict";t.factory("api.optionGroup",["$log","api",function(t,n){function r(t){return t.values.map(function(t){var n=e.clone(t);return n.option_group_name=n["option_group_id.name"],delete n["option_group_id.name"],n})}function i(t){return e.transform(t,function(e,t){var n=t.option_group_name;e[n]=e[n]||[],e[n].push(t)})}return t.debug("api.optionGroup"),n.extend({valuesOf:function(t,n){var o=e.isArray(t);return this.sendGET("OptionValue","get",{"option_group_id.name":{IN:o?t:[t]},is_active:"1",return:["option_group_id.name","option_group_id","id","name","label","value","weight","is_active","is_reserved"]},n).then(r).then(function(e){return o?i(e):e})}})}])}),define("common/services/api/appraisal-cycle",["common/lodash","common/modules/apis","common/services/api","common/services/api/option-group"],function(e,t){"use strict";t.factory("api.appraisal-cycle",["$q","$log","api","api.optionGroup",function(t,n,r,i){return n.debug("api.appraisal-cycle"),r.extend({all:function(e,t,r){return n.debug("api.appraisal-cycle.all"),this.getAll("AppraisalCycle",e,t,r,{"api.AppraisalCycle.getappraisalsperstep":{}})},create:function(t){return n.debug("api.appraisal-cycle.create"),this.sendPOST("AppraisalCycle","create",e.assign(t,{"api.AppraisalCycle.getappraisalsperstep":{}})).then(function(e){return e.values[0]})},find:function(e){n.debug("api.appraisal-cycle.find");var t={id:""+e,"api.AppraisalCycle.getappraisalsperstep":{}};return this.sendGET("AppraisalCycle","get",t,!1).then(function(e){return e.values[0]})},grades:function(){return n.debug("grades"),this.mockGET([{label:1,value:17},{label:2,value:74},{label:3,value:90},{label:4,value:30}])},statuses:function(){return n.debug("api.appraisal-cycle.statuses"),i.valuesOf("appraisal_status")},statusOverview:function(e){return n.debug("api.appraisal-cycle.statusOverview"),this.sendGET("AppraisalCycle","getstatusoverview",e).then(function(e){return e.values})},update:function(t){return n.debug("api.appraisal-cycle.update"),this.sendPOST("AppraisalCycle","create",e.assign(t,{"api.AppraisalCycle.getappraisalsperstep":{}})).then(function(e){return e.values[0]})},total:function(e){return n.debug("api.appraisal-cycle.total"),this.sendGET("AppraisalCycle","getcount",e||{}).then(function(e){return e.result})},types:function(){return n.debug("api.appraisal-cycle.types"),i.valuesOf("appraisal_cycle_type")}})}])}),define("common/services/api/contact-job-role-api.api",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("ContactJobRoleAPI",["$log","api",function(e,t){return e.debug("ContactJobRoleAPI"),t.extend({all:function(t,n,r,i){return e.debug("ContactJobRoleAPI.all()"),this.getAll("ContactHrJobRoles",t,n,r,i)}})}])}),define("common/bundles/apis",["common/services/api/appraisal","common/services/api/appraisal-cycle","common/services/api/contact-job-role-api.api","common/services/api/option-group"],function(){}),define("common/modules/services",["common/angular","common/angular-file-upload"],function(e){"use strict";return e.module("common.services",["angularFileUpload"])}),define("common/services/before-hash-query-params.service",["common/lodash","common/modules/services"],function(e,t){"use strict";t.factory("beforeHashQueryParams",["$log","$window",function(t,n){function r(e){var t=e||n.location.href,r=o(t);return-1===r.indexOf("?")?{}:i(a(r))}function i(t){return t.length?e.transform(t,function(e,t){var n=t.split("=");n[0]&&(e[n[0]]=n[1]?decodeURI(n[1]):null)},{}):{}}function o(e){var t=e.indexOf("#");return e.substring(0,-1!==t?t:e.length)}function a(e){var t=e.indexOf("?");return e.substr(t+1).split("&")}return t.debug("Service: beforeHashQueryParams"),{parse:r}}])}),function(e){define("common/services/check-permissions",["common/lodash","common/modules/services"],function(t,n){"use strict";n.factory("checkPermissions",["$q",function(n){return function(r){return r=t.isArray(r)?r:[r],n.resolve(r.every(function(t){return e.checkPerm(t)}))}}])})}(CRM),function(e){define("common/services/crm-ang.service",["common/lodash","common/modules/services"],function(t,n){"use strict";function r(t,n){return e.loadForm(t,n)}n.factory("crmAngService",function(){return{loadForm:r}})})}(CRM),define("common/services/detect-device.service",["common/modules/services"],function(e){"use strict";e.factory("detectDevice",[function(){return{isMobile:function(){return document.getElementsByTagName("body")[0].classList.contains("mobile")}}}])}),define("common/services/dom-event-trigger",["common/modules/services"],function(e){"use strict";!function(t){e.factory("DOMEventTrigger",function(){return function(e,n){t(document).trigger(e,n)}})}(CRM.$)}),define("common/services/file-mime-types",["common/lodash","common/modules/services"],function(e,t){"use strict";t.factory("fileMimeTypes",["$q",function(e){var t={txt:"plain",png:"png",jpeg:"jpeg",bmp:"bmp",gif:"gif",pdf:"pdf",doc:"msword",docx:"vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"vnd.ms-excel",xlsx:"vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"vnd.ms-powerpoint",pptx:"vnd.openxmlformats-officedocument.presentationml.presentation"};return{getMimeTypeFor:function(n){return e.resolve(t[n])}}}])}),define("common/services/file-upload",["common/modules/services","common/lodash","common/angular-file-upload"],function(e,t){"use strict";e.factory("FileUpload",["$q","$log","FileUploader",function(e,n,r){function i(e){throw new Error(e+" missing from parameter")}function o(e,t,r,i){n.error(" ===== Item Error: "+r+" ======"),n.error(" ===== - item ======"),n.error(e),n.error(" ===== - response ======"),n.error(t),n.error(" ===== - headers ======"),n.error(i)}function a(e){return t.defaults(e,{allowedMimeTypes:{txt:"plain",png:"png",jpeg:"jpeg",bmp:"bmp",gif:"gif",pdf:"pdf"},url:"/civicrm/ajax/attachment",queueLimit:1})}return{uploader:function(n){var s,l,u,c=[];return n?(n=a(n),s=new r({url:n.url,queueLimit:+n.queueLimit,onCompleteItem:function(e,t){c.push(t)},onCompleteAll:function(){u.resolve(c)},onErrorItem:function(e){o.apply(null,arguments),u.reject("Could not upload file: "+e.file.name)},formData:[{entity_table:n.entityTable||i("entityTable"),crm_attachment_token:n.crmAttachmentToken||i("crmAttachmentToken")}],filters:[{name:"fileFormatFilter",fn:function(e){var r=e.type.slice(e.type.lastIndexOf("/")+1);return t.includes(t.values(n.allowedMimeTypes),r)}}]}),s.uploadAll=function(){return l=s.uploadAll,function(n){return u=e.defer(),s.onBeforeUploadItem=function(e){t.each(n,function(n,r){var i={};i[t.snakeCase(r)]=n,e.formData.push(i)})},l.apply(s),u.promise}}(),s):i("custom settings")}}}])}),define("common/services/file.service",["common/modules/services"],function(e){"use strict";e.factory("fileService",["$http","$window","$log",function(e,t,n){return n.debug("Service: fileService"),{openFile:function(n){return e.get(n.url,{responseType:"arraybuffer"}).success(function(e){var r=new Blob([e],{type:n.fileType});t.navigator.msSaveOrOpenBlob?t.navigator.msSaveOrOpenBlob(r,n.name):t.open(URL.createObjectURL(r),"_blank")})}}}])}),define("common/services/hr-settings",["common/modules/services"],function(e){"use strict";e.factory("HR_settings",function(){return{DATE_FORMAT:null}})}),function(e){define("common/services/notification.service",["common/lodash","common/modules/services"],function(t,n){"use strict";n.factory("notificationService",function(){return t(["alert","success","info","error"]).map(function(t){return[t,function(n,r,i){return e.alert(r,n,t,i)}]}).zipObject().value()})})}(CRM),define("common/services/pub-sub",["common/modules/services"],function(e){"use strict";var t=Object.create(null);e.factory("pubSub",["$rootScope",function(e){return{subscribe:function(n,r){var i;return t[n]=t[n]||[],r.$rootScope=e,i=t[n].push(r)-1,{remove:function(){delete t[n][i]}}},publish:function(e,n){t[e]&&(n=void 0!=n?n:{},t[e].forEach(function(e){e.$rootScope.$applyAsync(function(){e(n)})}))}}}])}),define("common/bundles/services",["common/services/before-hash-query-params.service","common/services/check-permissions","common/services/crm-ang.service","common/services/detect-device.service","common/services/dom-event-trigger","common/services/file-mime-types","common/services/file-upload","common/services/file.service","common/services/hr-settings","common/services/notification.service","common/services/pub-sub"],function(){}),define("common/modules/components",["common/angular"],function(e){return e.module("common.components",[])}),define("common/components/heatmap.component",["common/lodash","common/moment","common/modules/components"],function(e,t,n){function r(){function n(e){e.values&&(u(),l(),c())}function r(){return Object.values(d.values).filter(function(e){return!1!==e})}function i(e,t){return e.reduce(function(e,n){return Math.abs(n.value-t)');r(n,t),e.after(n)}function r(e,n){function r(){n.isOpen=!0,n.$apply()}t.isMobile()||(e.on("click",r),n.$on("$destroy",function(){e.off("click",r)}))}var i=e[0],o=i.compile;return i.compile=function(){var e=o.apply(this,arguments);return function(t,i,o){e.apply(this,arguments),n(i,t),r(i,t)}},e}]}),define("common/decorators/uib-datepicker-mobile-version.decorator",["common/moment","common/services/detect-device.service"],function(e){"use strict";return["$delegate","detectDevice",function(t,n){function r(t){return t?e(t).format("Y-MM-DD"):""}var i=t[0],o=i.compile;return i.require=["ngModel","uibDatepickerPopup"],i.compile=function(){var e=o.apply(this,arguments);return function(t,i,o,a){n.isMobile()?(i.prop("type","date"),o.ngReadonly=!1,a[0].$formatters.push(function(e){return r(e)}),t.$watch("datepickerOptions.minDate",function(e){o.$set("min",r(e))}),t.$watch("datepickerOptions.maxDate",function(e){o.$set("max",r(e))})):e.apply(this,arguments)}},t}]}),define("common/decorators/xeditable-disable-calendar-icon.decorator",[],function(){"use strict";return["$delegate",function(e){var t=e[0],n=t.compile;return t.compile=function(){var e=n.apply(this,arguments);return function(t,n,r){e.apply(this,arguments),r.eShowCalendarButton=!1}},e}]}),define("common/decorators/ui-bootstrap/uib-tabset",[],function(){"use strict";return["$delegate",function(e){return e[0].bindToController.customHeaderClass="@",e}]}),define("common/decorators/ui-bootstrap/uib-modal.decorator",["common/angular"],function(e){"use strict";return["$delegate","$document",function(e,t){function n(){var e,n=t.find("body, html");return n.addClass("chr_scroll-lock"),e=r.apply(this,arguments),e.closed.then(function(){t.find(".modal-dialog").length||n.removeClass("chr_scroll-lock")}),e}var r=e.open;return e.open=n,e}]}),define("common/decorators/uib-tooltip.decorator",["common/angular","common/angularBootstrap"],function(e){"use strict";var t,n;return["$delegate","$document","$timeout",function(r,i,o){return t=i,n=o,function(){var i=r.apply(this,arguments),o=i.compile,a="ontouchstart"in t[0].documentElement,s=a?"touchend touchcancel":"click";return i.compile=function(r,i){return function(l,u,c,f){function d(){g=e.element('
    '),u.css({position:"relative"}),g.css({position:"absolute",height:"100%",width:"100%","z-index":1,top:0,left:0}),u.append(g)}function p(){a?(g.on("touchend touchcancel",function(){m("source",!0,50),!l.open&&h()}),t.find("body").on("touchend touchcancel",function(e){e.target!==g[0]&&(m("source",!1,0),m("tooltip",!1,0))}),g.on("click",function(e){e.stopPropagation()})):(u.on("mouseenter",function(){m("source",!0,0),!l.open&&h()}),u.on("mouseleave",function(){m("source",!1,100)}),u.on("click",function(){m("source",!1,0),m("tooltip",!1,0)}))}function h(){var e;n(function(){e=t.find(".tooltip-clickable-template:visible:last"),a||(e.on("mouseenter",function(){m("tooltip",!0,0)}),e.on("mouseleave",function(){m("tooltip",!1,100)})),e.on(s,function(){m("source",!1,0),m("tooltip",!1,0)})})}function m(e,t,r){n(function(){l[e+"_hovered"]=t,l.open=l.source_hovered||l.tooltip_hovered,u.trigger("custom"+(l.open?"Show":"Hide")),a&&g[l.open?"hide":"show"]()},r)}var g,v=u.attr("uib-tooltip-clickable");v&&function(){c.tooltipTrigger="customShow",c.tooltipAnimation=!1}(),o(r,i)(l,u,c,f),v&&function(){a&&d(),p()}()}},i}}]}),define("common/modules/templates",["common/angular"],function(e){"use strict";return e.module("common.templates",[]).run(["$templateCache",function(e){e.put("dialog.html",'\n\n\n'),e.put("help-text.html",'\n \n \n\n'),e.put("loading.html",'
    \n
    \n
    \n
    \n'),e.put("time-amount-picker.html",'
    \n
    \n \n \n
    \n h\n
    \n \n \n
    \n m\n
    \n'),e.put("timepicker-select.html",'\n\n'),e.put("civihr-ui-select/choices.tpl.html",'
      \n
    • \n
      \n
        \n
      • \n
        \n
      • \n
      \n
    • \n
    \n'),e.put("civihr-ui-select/match-multiple.tpl.html",'\n
  • \n \n \n
  • \n
    \n'),e.put("civihr-ui-select/match.tpl.html",'\n {{$select.contactList ? \'-select-\' : $select.placeholder}}\n \n \n \n\n'),e.put("civihr-ui-select/select-contacts-multiple.tpl.html",'
    \n
    \n
      \n \n
    • \n \n
    • \n
    \n\n \n\n \n
    \n
    \n'),e.put("civihr-ui-select/select-contacts.tpl.html",'
    \n
    \n \n
    \n'),e.put("civihr-ui-select/select-multiple.tpl.html",'
    \n
    \n
      \n \n
    • \n \n
    • \n
    \n \n
    \n
    \n'), +e.put("civihr-ui-select/select.tpl.html",'
    \n
    \n \n
    \n'),e.put("components/heatmap.html",'
      \n
    • \n {{day.name.short}}\n
    • \n
    \n'),e.put("components/notification-badge.html",'\n {{badge.count}}\n\n\n'),e.put("contact-actions/contact-actions.html",'
    \n \n \n
    \n'),e.put("contact-actions/modals/form.html",'\n \n \n \n\n')}])}),define("common/modules/controllers",["common/angular","common/angularBootstrap","common/modules/apis"],function(e){"use strict";return e.module("common.controllers",["ui.bootstrap","common.apis"])}),define("common/modules/directives",["common/angular","common/decorators/ui-select-focus.decorator","common/decorators/uib-datepicker-calendar-icon.decorator","common/decorators/uib-datepicker-mobile-version.decorator","common/decorators/xeditable-disable-calendar-icon.decorator","common/decorators/ui-bootstrap/uib-tabset","common/decorators/ui-bootstrap/uib-modal.decorator","common/decorators/uib-tooltip.decorator","common/angularBootstrap","common/angularXeditable","common/ui-select","common/modules/templates","common/modules/controllers","common/modules/services","common/modules/apis"],function(e,t,n,r,i,o,a,s){"use strict";return e.module("common.directives",["common.templates","common.controllers","ui.select","ui.bootstrap","xeditable"]).config(["$provide","$uibTooltipProvider",function(e,l){l.setTriggers({customShow:"customHide"}),e.decorator("uibDatepickerPopupDirective",r),e.decorator("uibDatepickerPopupDirective",n),e.decorator("uibTabsetDirective",o),e.decorator("$uibModal",a),e.decorator("editableBsdateDirective",i),e.decorator("uiSelectDirective",t),e.decorator("$uibTooltip",s)}]).run(["$templateCache",function(e){var t="uib/template/tabs/tabset.html",n=jQuery(e.get(t));n.find("ul").addClass("{{tabset.customHeaderClass}}"),e.put(t,n.wrap("
    ").parent().html())}])}),define("common/services/api/contact-actions",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("api.contactActions",["$q","api",function(e,t){function n(e,n){return t.sendGET(e,"getoptions",{field:n,context:"search"}).then(function(e){return e.values})}function r(e){return t.sendGET("UFField","get",{uf_group_id:e,is_active:!0}).then(function(e){return e.values})}function i(n,r){return e(function(e,i){if(r.contact_type=n,r.email)return t.sendGET("CustomField","get",{return:["id"],custom_group_id:"Emergency_Contacts",name:"email"}).then(function(t){r["custom_"+t.id]=r.email,delete r.email,e()});e()}).then(function(){return t.sendPOST("Contact","create",r).then(function(e){return e.values[0]})})}return t.extend({getOptions:{forContactType:function(){return n.call(this,"Contact","contact_type")},forGroup:function(){return n.call(this,"GroupContact","group_id")},forTag:function(){return n.call(this,"EntityTag","tag_id")},forStateProvince:function(){return n.call(this,"Address","state_province_id")},forCountry:function(){return n.call(this,"Address","country_id")},forGender:function(){return n.call(this,"Contact","gender_id")},forDeceased:function(){return n.call(this,"Contact","is_deceased")}},save:{newIndividual:function(e){return i.call(this,"Individual",e)},newOrganization:function(e){return i.call(this,"Organization",e)},newHousehold:function(e){return i.call(this,"Household",e)}},getFormFields:{forNewIndividual:function(){return r.call(this,"new_individual")},forNewOrganization:function(){return r.call(this,"new_organization")},forNewHousehold:function(){return r.call(this,"new_household")}}})}])}),define("common/controllers/contact-actions/modal-ctrl",[],function(){"use strict";return function(e,t){this.errorMsg="",this.loading=!0,this.formFields=[],this.init=function(e){e().then(function(e){this.loading=!1,this.formFields=e}.bind(this)).catch(function(){this.loading=!1,this.errorMsg="Error while loading form fields"}.bind(this))},this.cancel=function(){t.dismiss("cancel")},this.save=function(n,r){this.loading=!0,n(this.formFields.reduce(function(e,t){return e[t.field_name]=t.value,e},{})).then(function(n){this.loading=!1,e.$broadcast(r,n),t.dismiss("cancel")}.bind(this)).catch(function(){this.loading=!1,this.errorMsg="Error while saving data"}.bind(this))}}}),define("common/controllers/contact-actions/new-individual-ctrl",["common/modules/controllers","common/controllers/contact-actions/modal-ctrl","common/services/api/contact-actions"],function(e,t){"use strict";function n(e,n,r){var i=this;t.call(i,e,n),i.title="New Individual",i.init(r.getFormFields.forNewIndividual),i.submit=function(){i.save(r.save.newIndividual,"newIndividualCreated")}}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,e.controller("NewIndividualModalCtrl",["$rootScope","$uibModalInstance","api.contactActions",n])}),define("common/controllers/contact-actions/new-household-ctrl",["common/modules/controllers","common/controllers/contact-actions/modal-ctrl","common/services/api/contact-actions"],function(e,t){"use strict";function n(e,n,r){var i=this;t.call(i,e,n),i.title="New Household",i.init(r.getFormFields.forNewHousehold),i.submit=function(){i.save(r.save.newHousehold,"newHouseholdCreated")}}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,e.controller("NewHouseholdModalCtrl",["$rootScope","$uibModalInstance","api.contactActions",n])}),define("common/controllers/contact-actions/new-organization-ctrl",["common/modules/controllers","common/controllers/contact-actions/modal-ctrl","common/services/api/contact-actions"],function(e,t){"use strict";function n(e,n,r){var i=this;t.call(i,e,n),i.title="New Organization",i.init(r.getFormFields.forNewOrganization),i.submit=function(){i.save(r.save.newOrganization,"newOrganizationCreated")}}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,e.controller("NewOrganizationModalCtrl",["$rootScope","$uibModalInstance","api.contactActions",n])}),define("common/controllers/contact-actions/contact-actions-ctrl",["common/modules/controllers","common/services/api/contact-actions","common/controllers/contact-actions/new-individual-ctrl","common/controllers/contact-actions/new-household-ctrl","common/controllers/contact-actions/new-organization-ctrl"],function(e){"use strict";e.controller("ContactActionsCtrl",["$scope","$rootElement","$uibModal","api.contactActions",function(e,t,n,r){var i=this;e.$watch(function(){return i.refineSearch.selected},function(t,n){t!==n&&e.$emit("contactRefineSearch",{field:t.field?t.field.label:null,option:t.option?t.option.value:null})},!0),i.refineSearch={selected:{field:null,option:null},availableFields:[{label:"Contact Type",getOptions:r.getOptions.forContactType},{label:"Group",getOptions:r.getOptions.forGroup},{label:"Tag",getOptions:r.getOptions.forTag},{label:"State / Province",getOptions:r.getOptions.forStateProvince},{label:"Country",getOptions:r.getOptions.forCountry},{label:"Gender",getOptions:r.getOptions.forGender},{label:"Deceased",getOptions:r.getOptions.forDeceased}],availableOptions:{refresh:function(){i.refineSearch.selected.field?(this.options=null,i.refineSearch.selected.field.getOptions().then(function(e){this.options=e}.bind(this))):this.options=[]},options:[]}},i.showNewIndividualModal=function(){n.open({appendTo:t.children().eq(0),controller:"NewIndividualModalCtrl",controllerAs:"$ctrl",bindToController:!0,templateUrl:"contact-actions/modals/form.html"})},i.showNewHouseholdModal=function(){n.open({appendTo:t.children().eq(0),controller:"NewHouseholdModalCtrl",controllerAs:"$ctrl",bindToController:!0,templateUrl:"contact-actions/modals/form.html"})},i.showNewOrganizationModal=function(){n.open({appendTo:t.children().eq(0),controller:"NewOrganizationModalCtrl",controllerAs:"$ctrl",bindToController:!0,templateUrl:"contact-actions/modals/form.html"})}}])}),define("common/directives/prevent-animations",["common/modules/directives"],function(e){"use strict";e.directive("preventAnimations",["$animate",function(e){return{restrict:"A",link:function(t,n,r){e.enabled(n,!1)}}}])}),define("common/directives/loading",["common/modules/directives","common/directives/prevent-animations"],function(e){"use strict";e.directive("crmLoading",["$templateCache",function(e){return{scope:{show:"="},restrict:"E",replace:!0,transclude:!0,template:e.get("loading.html")}}])}),define("common/directives/contact-actions/contact-actions",["common/modules/directives","common/controllers/contact-actions/contact-actions-ctrl","common/directives/loading"],function(e){"use strict";e.directive("contactActions",[function(){return{restrict:"E",templateUrl:"contact-actions/contact-actions.html",controller:"ContactActionsCtrl",controllerAs:"$ctrl",link:function(e,t,n){e.$ctrl.refineSearchVisible=t.parent().parent()[0].hasAttribute("refine-search")}}}])}),define("common/directives/help-text.directive",["common/lodash","common/moment","common/modules/directives","common/services/notification.service"],function(e,t,n){function r(e,t){function n(){var n=e.getHelpText();t.info(e.title||r,n)}var r="Help";this.displayHelpText=n}function i(e,t,n){function r(){return t.find(".help-text").html()}e.getHelpText=r}n.directive("helpText",["$templateCache",function(e){return{restrict:"E",scope:{title:"@?"},transclude:!0,controller:r,controllerAs:"helpText",template:e.get("help-text.html"),link:i}}]),r.$inject=["$scope","notificationService"]}),define("common/directives/scroll-shadows.directive",["common/angular","common/modules/directives"],function(e,t){"use strict";function n(t,n,r){function i(){u(),a(),l(),s()}function o(){var e=f.width(),t=p+"__shadows--show-left",n=p+"__shadows--show-right",r=d.scrollLeft(),i=d.width();if(e<=i)return void d.removeClass(t+" "+n);d[r>0?"addClass":"removeClass"](t),d[r
    ').parent(),d=f.wrap('
    ').parent(),d.wrap('
    ')}var f,d,p="chr_scroll-shadows";!function(){c(),i(),o()}()}t.directive("scrollShadows",[function(){return{restrict:"A",controller:n}}]),n.$inject=["$element","$scope","$window"]}),define("common/directives/timepicker-select.directive",["common/moment","common/modules/directives"],function(e,t){"use strict";function n(t){function n(){var n=+t.timepickerSelectInterval||1,i=e.duration(t.timepickerSelectTimeFrom||"00:00"),o=e.duration(t.timepickerSelectTimeTo||"23:59");for(r.options=[];i.asMinutes()<=o.asMinutes();){var a=e.utc(i.asMilliseconds());r.options.push(a.format("HH:mm")),i.add(n,"minutes")}}var r=this;r.placeholder=t.timepickerSelectPlaceholder,r.options=[],t.$watchGroup(["timepickerSelectTimeFrom","timepickerSelectTimeTo","timepickerSelectInterval"],function(){n()})}t.directive("timepickerSelect",["$templateCache",function(e){return{scope:{timepickerSelectPlaceholder:"@",timepickerSelectTimeFrom:"<",timepickerSelectTimeTo:"<",timepickerSelectInterval:"<"},restrict:"A",controllerAs:"selector",controller:["$scope",n],template:e.get("timepicker-select.html")}}]),n.$inject=["$scope"]}),define("common/directives/time-amount-picker.directive",["common/lodash","common/modules/directives"],function(e,t){"use strict";function n(t){function n(){var e=Math.floor(c);for(d.hoursOptions=[];e<=f;)d.hoursOptions.push(e),e++}function r(){var e,t,n,r=0;for(d.minutesOptions=[];r<60;)t=+d.selectedHours===Math.floor(c)&&rf%1*60,e=t||n,!e&&d.minutesOptions.push(r),r+=u;l()}function i(){u=+t.interval||1,c=isNaN(+t.minAmount)?0:+t.minAmount,f=isNaN(+t.maxAmount)?24:+t.maxAmount,n(),r()}function o(){""!==d.selectedHours&&""!==d.selectedMinutes&&(t.value=+d.selectedHours+d.selectedMinutes/60)}function a(){t.$watch("disabled",function(e){d.disabled=e}),t.$watch("value",function(){s(),i()}),t.$watchGroup(["minAmount","maxAmount","interval"],function(){i()})}function s(){void 0!==t.value&&(d.selectedHours=""+Math.floor(t.value),d.selectedMinutes=""+Math.floor(t.value%1*60)),o()}function l(){d.selectedMinutese.last(d.minutesOptions)&&(d.selectedMinutes=""+e.last(d.minutesOptions))}var u,c,f,d=this;d.hoursOptions=[],d.minutesOptions=[],d.selectedHours="",d.selectedMinutes="",d.buildMinutesOptions=r,d.calculateSelectedValue=o,function(){s(),i(),a()}()}t.directive("timeAmountPicker",["$templateCache",function(e){return{scope:{minAmount:".75?Math.floor(.25*Math.ceil(e/.25))+"h":"",n=e%1&&e%1<=.75&&e%1>0?.25*Math.ceil(e%1/.25)*60+"m":"",r+t+(t&&n?" ":"")+n)}};return function(t,n){var r=void 0===t?0:parseFloat(t);if(isNaN(r))throw new Error("Value must be a number or a numeric string: "+t);return e[n](r)}})}),define("common/bundles/filters",["common/filters/time-unit-applier.filter"],function(){}),define("common/decorators/angular-date/datepicker-popup",["common/lodash"],function(e){return["$delegate","HR_settings",function(t,n){"use strict";var r=t[0].link;return t[0].compile=function(){return function(t,i,o,a){o.uibDatepickerPopup=o.uibDatepickerPopup||n.DATE_FORMAT||"yyyy-MM-dd",o.showButtonBar=o.showButtonBar||!1,t.datepickerOptions=e.assign({formatDayHeader:"E",showWeeks:!1,startingDay:1},t.datepickerOptions),r.apply(this,arguments)}},t}]}),define("common/decorators/angular-date/date-filter",[],function(){"use strict";return["$delegate",function(e){var t=e;return function(){if("E"===arguments[1]){var e=Array.prototype.slice.call(arguments);return e[1]="EEE",t.apply(this,e)[0]}return t.apply(this,arguments)}}]}),function(e){define("common/modules/angular-date",["common/angular","common/decorators/angular-date/datepicker-popup","common/decorators/angular-date/date-filter","common/modules/services","common/angularBootstrap","common/modules/templates"],function(t,n,r){"use strict";function i(t){var n="uib/template/datepicker/"+t+".html",r=o.get(n);r=r.replace(/glyphicon glyphicon-chevron-(left|right)/gm,"fa fa-chevron-$1"),"day"===t&&(r=function(t){return e(t).find('th[ng-if="showWeeks"]').parent().css({"border-top":"1px solid #DDD"}),e(t).prop("outerHTML")}(e.parseHTML(r))),o.put(n,r)}var o;return t.module("common.angularDate",["common.services","ui.bootstrap","common.templates"]).config(["$provide",function(e){e.decorator("uibDatepickerPopupDirective",n),e.decorator("dateFilter",r)}]).run(["$templateCache",function(e){o=e,["day","month","year"].forEach(i)}])})}(CRM.$),define("common/services/angular-date/date-format",["common/angular","common/modules/angular-date","common/services/hr-settings"],function(e,t){"use strict";t.factory("DateFormat",["$q","HR_settings",function(e,t){return{dateFormat:null,getDateFormat:function(){return this.dateFormat?e.when(this.dateFormat):e.when("dd/MM/yyyy").catch(function(){return"yyyy-MM-dd"}).then(function(e){return t.DATE_FORMAT=e,this.dateFormat=e,e}.bind(this))}}}])}),define("common/filters/angular-date/format-date",["common/moment","common/modules/angular-date","common/services/hr-settings"],function(e,t){"use strict";t.filter("formatDate",["HR_settings",function(t){var n=["DD-MM-YYYY","DD-MM-YYYY HH:mm:ss","YYYY-MM-DD","YYYY-MM-DD HH:mm:ss","DD/MM/YYYY","x","YYYY-MM-DD HH:mm:ss"];return function(r,i,o){var a,s=i||t.DATE_FORMAT||"YYYY-MM-DD",l=e(0);return r instanceof Date&&(r=e(r).format("YYYY-MM-DD HH:mm:ss")),a=e(r,n,!0),a.isValid()&&!a.isSame(l)?i===Date?a.toDate():a.format(s.toUpperCase())+("hours"===o?" "+a.format("HH:mm"):""):"Unspecified"}}])}),define("common/directives/angular-date/date-input",["common/modules/angular-date","common/filters/angular-date/format-date"],function(e){"use strict";e.directive("dateInput",["$filter",function(e){return{require:"ngModel",link:function(t,n,r,i){function o(t){var n=e("formatDate")(t);return n="Unspecified"==n?"":n}i.$formatters.push(o),i.$parsers=[]}}}])}),define("common/bundles/angular-date",["common/services/angular-date/date-format","common/filters/angular-date/format-date","common/directives/angular-date/date-input"],function(){}),define("common/modules/routers/compu-ng-route",["common/angular","common/angularRoute"],function(e){"use strict";return e.module("compuNgRoute",["ngRoute"]).config(["$routeProvider",function(t){var n=t.when;t.resolveForAll=function(e){return t.commonResolve=e,t},t.when=function(r,i){return e.extend(i.resolve||{},t.commonResolve||{}),n.call(t,r,i)}}])}),"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(e,t,n){"use strict";function r(e,t){return z(new(z(function(){},{prototype:e})),t)}function i(e){return B(arguments,function(t){t!==e&&B(t,function(t,n){e.hasOwnProperty(n)||(e[n]=t)})}),e}function o(e,t){var n=[];for(var r in e.path){if(e.path[r]!==t.path[r])break;n.push(e.path[r])}return n}function a(e){if(Object.keys)return Object.keys(e);var t=[];return B(e,function(e,n){t.push(n)}),t}function s(e,t){if(Array.prototype.indexOf)return e.indexOf(t,Number(arguments[2])||0);var n=e.length>>>0,r=Number(arguments[2])||0;for((r=r<0?Math.ceil(r):Math.floor(r))<0&&(r+=n);r=0||(c.push(i[d]),u[i[d]]=e[i[d]]);return z({},u,t)}function u(e,t,n){if(!n){n=[];for(var r in e)n.push(r)}for(var i=0;i "));if(y[n]=r,H(e))v.push(n,[function(){return t.get(e)}],u);else{var i=t.annotate(e);B(i,function(e){e!==n&&l.hasOwnProperty(e)&&p(l[e],e)}),v.push(n,e,i)}$.pop(),y[n]=o}}function h(e){return q(e)&&e.then&&e.$$promises}if(!q(l))throw new Error("'invocables' must be an object");var g=a(l||{}),v=[],$=[],y={};return B(l,p),l=$=y=null,function(r,o,a){function s(){--b||(w||i(y,o.$$values),p.$$values=y,p.$$promises=p.$$promises||!0,delete p.$$inheritedValues,u.resolve(y))}function l(e){p.$$failure=e,u.reject(e)}if(h(r)&&a===n&&(a=o,o=r,r=null),r){if(!q(r))throw new Error("'locals' must be an object")}else r=c;if(o){if(!h(o))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else o=f;var u=e.defer(),p=m(u.promise),$=p.$$promises={},y=z({},r),b=1+v.length/3,w=!1;if(m(p),U(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i(y,d(o.$$inheritedValues,g)),z($,o.$$promises),o.$$values?(w=i(y,d(o.$$values,g)),p.$$inheritedValues=d(o.$$values,g),s()):(o.$$inheritedValues&&(p.$$inheritedValues=d(o.$$inheritedValues,g)),o.then(s,l));for(var x=0,C=v.length;x=0));)$=o(v.id,v.type,v.cfg,"path"),f+=a(v.segment,$.type.pattern.source,$.squash,$.isOptional),p.push(v.segment),d=u.lastIndex;y=e.substring(d);var b=y.indexOf("?");if(b>=0){var w=this.sourceSearch=y.substring(b);if(y=y.substring(0,b),this.sourcePath=e.substring(0,d+b),w.length>0)for(d=0;l=c.exec(w);)v=s(l,!0),$=o(v.id,v.type,v.cfg,"search"),d=u.lastIndex}else this.sourcePath=e,this.sourceSearch="";f+=a(y)+(!1===t.strict?"/?":"")+"$",p.push(y),this.regexp=new RegExp(f,t.caseInsensitive?"i":n),this.prefix=p[0],this.$$paramNames=g}function b(e){z(this,e)}function w(){function e(e){return null!=e?e.toString().replace(/(~|\/)/g,function(e){return{"~":"~~","/":"~2F"}[e]}):e}function i(e){return null!=e?e.toString().replace(/(~~|~2F)/g,function(e){return{"~~":"~","~2F":"/"}[e]}):e}function o(){return{strict:m,caseInsensitive:d}}function l(e){return j(e)||V(e)&&j(e[e.length-1])}function u(){for(;x.length;){var e=x.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");t.extend(v[e.name],f.invoke(e.def))}}function c(e){z(this,e||{})}G=this;var f,d=!1,m=!0,g=!1,v={},$=!0,x=[],C={string:{encode:e,decode:i,is:function(e){return null==e||!U(e)||"string"==typeof e},pattern:/[^\/]*/},int:{encode:e,decode:function(e){return parseInt(e,10)},is:function(e){return e!==n&&null!==e&&this.decode(e.toString())===e},pattern:/-?\d+/},bool:{encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:function(e){return!0===e||!1===e},pattern:/0|1/},date:{encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):n},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):n},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return this.is(e)&&this.is(t)&&e.toISOString()===t.toISOString()},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:{encode:t.toJson,decode:t.fromJson,is:t.isObject,equals:t.equals,pattern:/[^\/]*/},any:{encode:t.identity,decode:t.identity,equals:t.equals,pattern:/.*/}};w.$$getDefaultValue=function(e){if(!l(e.value))return e.value;if(!f)throw new Error("Injectable functions cannot be called at configuration time");return f.invoke(e.value)},this.caseInsensitive=function(e){return U(e)&&(d=e),d},this.strictMode=function(e){return U(e)&&(m=e),m},this.defaultSquashPolicy=function(e){if(!U(e))return g;if(!0!==e&&!1!==e&&!H(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return g=e,e},this.compile=function(e,t){return new y(e,z(o(),t))},this.isMatcher=function(e){if(!q(e))return!1;var t=!0;return B(y.prototype,function(n,r){j(n)&&(t=t&&U(e[r])&&j(e[r]))}),t},this.type=function(e,t,n){if(!U(t))return v[e];if(v.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return v[e]=new b(z({name:e},t)),n&&(x.push({name:e,def:n}),$||u()),this},B(C,function(e,t){v[t]=new b(z({name:t},e))}),v=r(v,{}),this.$get=["$injector",function(e){return f=e,$=!1,u(),B(C,function(e,t){v[t]||(v[t]=new b(e))}),this}],this.Param=function(e,r,i,o){function u(){if(!f)throw new Error("Injectable functions cannot be called at configuration time");var e=f.invoke(i.$$fn);if(null!==e&&e!==n&&!m.type.is(e))throw new Error("Default value ("+e+") for parameter '"+m.id+"' is not an instance of Type ("+m.type.name+")") +;return e}function c(e){function t(e){return function(t){return t.from===e}}return e=function(e){var n=h(p(m.replace,t(e)),function(e){return e.to});return n.length?n[0]:e}(e),U(e)?m.type.$normalize(e):u()}function d(){return"{Param:"+e+" "+r+" squash: '"+w+"' optional: "+y+"}"}var m=this;i=function(e){var t=q(e)?a(e):[];return-1===s(t,"value")&&-1===s(t,"type")&&-1===s(t,"squash")&&-1===s(t,"array")&&(e={value:e}),e.$$fn=l(e.value)?e.value:function(){return e.value},e}(i),r=function(n,r,i){if(n.type&&r)throw new Error("Param '"+e+"' has two type configurations.");return r||(n.type?t.isString(n.type)?v[n.type]:n.type instanceof b?n.type:new b(n.type):"config"===i?v.any:v.string)}(i,r,o);var $=function(){var t={array:"search"===o&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return z(t,n,i).array}();r=$?r.$asArray($,"search"===o):r,"string"!==r.name||$||"path"!==o||i.value!==n||(i.value="");var y=i.value!==n,w=function(e,t){var n=e.squash;if(!t||!1===n)return!1;if(!U(n)||null==n)return g;if(!0===n||H(n))return n;throw new Error("Invalid squash policy: '"+n+"'. Valid policies: false, true, or arbitrary string")}(i,y),x=function(e,t,r,i){var o,a,l=[{from:"",to:r||t?n:""},{from:null,to:r||t?n:""}];return o=V(e.replace)?e.replace:[],H(i)&&o.push({from:i,to:n}),a=h(o,function(e){return e.from}),p(l,function(e){return-1===s(a,e.from)}).concat(o)}(i,$,y,w);z(this,{id:e,type:r,location:o,array:$,squash:w,replace:x,isOptional:y,value:c,dynamic:n,config:i,toString:d})},c.prototype={$$new:function(){return r(this,z(new c,{$$parent:this}))},$$keys:function(){for(var e=[],t=[],n=this,r=a(c.prototype);n;)t.push(n),n=n.$$parent;return t.reverse(),B(t,function(t){B(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return B(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return B(r.$$keys(),function(i){var o=e&&e[i],a=t&&t[i];r[i].type.equals(o,a)||(n=!1)}),n},$$validates:function(e){var r,i,o,a,s,l=this.$$keys();for(r=0;r=0)throw new Error("State must have a valid name");if(S.hasOwnProperty(n))throw new Error("State '"+n+"' is already defined");var i=-1!==n.indexOf(".")?n.substring(0,n.lastIndexOf(".")):H(t.parent)?t.parent:q(t.parent)&&H(t.parent.name)?t.parent.name:"";if(i&&!S[i])return p(i,t.self);for(var o in T)j(T[o])&&(t[o]=T[o](t,T.$delegates[o]));return S[n]=t,!t[M]&&t.url&&e.when(t.url,["$match","$stateParams",function(e,n){k.$current.navigable==t&&u(e,n)||k.transitionTo(t,e,{inherit:!0,location:!1})}]),g(n),t}function $(e){return e.indexOf("*")>-1}function y(e){for(var t=e.split("."),n=k.$current.name.split("."),r=0,i=t.length;r=O;r--)a=g[r],a.self.onExit&&s.invoke(a.self.onExit,a.self,a.locals.globals),a.locals=null;for(r=O;r2?u.enter(e,null,n).then(r):u.enter(e,null,n,r)},leave:function(e,n){t.version.minor>2?u.leave(e).then(n):u.leave(e,n)}};if(l){var r=l&&l(n,e);return{enter:function(e,t,n){r.enter(e,null,t),n()},leave:function(e,t){r.leave(e),t()}}}return function(){return{enter:function(e,t,n){t.after(e),n()},leave:function(e,t){e.remove(),t()}}}()}var s=function(){return n.has?function(e){return n.has(e)?n.get(e):null}:function(e){try{return n.get(e)}catch(e){return null}}}(),l=s("$animator"),u=s("$animate");return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(n,s,l){return function(n,s,u){function c(){if(d&&(d.remove(),d=null),h&&(h.$destroy(),h=null),p){var e=p.data("$uiViewAnim");$.leave(p,function(){e.$$animLeave.resolve(),d=null}),d=p,p=null}}function f(a){var f,d=M(n,u,s,i),y=d&&e.$current&&e.$current.locals[d];if(a||y!==m){f=n.$new(),m=e.$current.locals[d],f.$emit("$viewContentLoading",d);var b=l(f,function(e){var i=o.defer(),a=o.defer(),l={$animEnter:i.promise,$animLeave:a.promise,$$animLeave:a};e.data("$uiViewAnim",l),$.enter(e,s,function(){i.resolve(),h&&h.$emit("$viewContentAnimationEnded"),(t.isDefined(v)&&!v||n.$eval(v))&&r(e)}),c()});p=b,h=f,h.$emit("$viewContentLoaded",d),h.$eval(g)}}var d,p,h,m,g=u.onload||"",v=u.autoscroll,$=a(u,n);s.inheritedData("$uiView"),n.$on("$stateChangeSuccess",function(){f(!1)}),f(!0)}}}}function _(e,n,r,i){return{restrict:"ECA",priority:-400,compile:function(o){var a=o.html();return o.empty?o.empty():o[0].innerHTML=null,function(o,s,l){var u=r.$current,c=M(o,l,s,i),f=u&&u.locals[c];if(!f)return s.html(a),void e(s.contents())(o);s.data("$uiView",{name:c,state:f.$$state}),s.html(f.$template?f.$template:a);var d=t.extend({},f);o[f.$$resolveAs]=d;var p=e(s.contents());if(f.$$controller){f.$scope=o,f.$element=s;var h=n(f.$$controller,f);f.$$controllerAs&&(o[f.$$controllerAs]=h,o[f.$$controllerAs][f.$$resolveAs]=d),j(h.$onInit)&&h.$onInit(),s.data("$ngControllerController",h),s.children().data("$ngControllerController",h)}p(o)}}}}function M(e,t,n,r){var i=r(t.uiView||t.name||"")(e),o=n.inheritedData("$uiView");return i.indexOf("@")>=0?i:i+"@"+(o?o.state.name:"")}function T(e,t){var n,r=e.match(/^\s*({[^}]*})\s*$/);if(r&&(e=t+"("+r[1]+")"),!(n=e.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/))||4!==n.length)throw new Error("Invalid state ref '"+e+"'");return{state:n[1],paramExpr:n[3]||null}}function D(e){var t=e.parent().inheritedData("$uiView");if(t&&t.state&&t.state.name)return t.state}function A(e){var t="[object SVGAnimatedString]"===Object.prototype.toString.call(e.prop("href")),n="FORM"===e[0].nodeName;return{attr:n?"action":t?"xlink:href":"href",isAnchor:"A"===e.prop("tagName").toUpperCase(),clickable:!n}}function O(e,t,n,r,i){return function(o){var a=o.which||o.button,s=i();if(!(a>1||o.ctrlKey||o.metaKey||o.shiftKey||e.attr("target"))){var l=n(function(){t.go(s.state,s.params,s.options)});o.preventDefault();var u=r.isAnchor&&!s.href?1:0;o.preventDefault=function(){u--<=0&&n.cancel(l)}}}}function N(e,t){return{relative:D(e)||t.$current,inherit:!0}}function R(e,n){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(r,i,o,a){var s,l=T(o.uiSref,e.current.name),u={state:l.state,href:null,params:null},c=A(i),f=a[1]||a[0],d=null;u.options=z(N(i,e),o.uiSrefOpts?r.$eval(o.uiSrefOpts):{});var p=function(n){n&&(u.params=t.copy(n)),u.href=e.href(l.state,u.params,u.options),d&&d(),f&&(d=f.$$addStateInfo(l.state,u.params)),null!==u.href&&o.$set(c.attr,u.href)};l.paramExpr&&(r.$watch(l.paramExpr,function(e){e!==u.params&&p(e)},!0),u.params=t.copy(r.$eval(l.paramExpr))),p(),c.clickable&&(s=O(i,e,n,c,function(){return u}),i[i.on?"on":"bind"]("click",s),r.$on("$destroy",function(){i[i.off?"off":"unbind"]("click",s)}))}}}function I(e,t){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,r,i,o){function a(t){d.state=t[0],d.params=t[1],d.options=t[2],d.href=e.href(d.state,d.params,d.options),p&&p(),u&&(p=u.$$addStateInfo(d.state,d.params)),d.href&&i.$set(l.attr,d.href)}var s,l=A(r),u=o[1]||o[0],c=[i.uiState,i.uiStateParams||null,i.uiStateOpts||null],f="["+c.map(function(e){return e||"null"}).join(", ")+"]",d={state:null,params:null,options:null,href:null},p=null;n.$watch(f,a,!0),a(n.$eval(f)),l.clickable&&(s=O(r,e,t,l,function(){return d}),r[r.on?"on":"bind"]("click",s),n.$on("$destroy",function(){r[r.off?"off":"unbind"]("click",s)}))}}}function P(e,t,n){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(t,r,i,o){function a(t,n,i){var o=e.get(t,D(r)),a=s(t,n),l={state:o||{name:t},params:n,hash:a};return m.push(l),g[a]=i,function(){var e=m.indexOf(l);-1!==e&&m.splice(e,1)}}function s(e,n){if(!H(e))throw new Error("state should be a string");return q(n)?e+W(n):(n=t.$eval(n),q(n)?e+W(n):e)}function l(){for(var e=0;e0)){var n=a(e,t,h);return l(),n}},t.$on("$stateChangeSuccess",l),l()}]}}function L(e){var t=function(t,n){return e.is(t,n)};return t.$stateful=!0,t}function F(e){var t=function(t,n,r){return e.includes(t,n,r)};return t.$stateful=!0,t}var U=t.isDefined,j=t.isFunction,H=t.isString,q=t.isObject,V=t.isArray,B=t.forEach,z=t.extend,Y=t.copy,W=t.toJson;t.module("ui.router.util",["ng"]),t.module("ui.router.router",["ui.router.util"]),t.module("ui.router.state",["ui.router.router","ui.router.util"]),t.module("ui.router",["ui.router.state"]),t.module("ui.router.compat",["ui.router"]),g.$inject=["$q","$injector"],t.module("ui.router.util").service("$resolve",g),t.module("ui.router.util").provider("$templateFactory",v);var G;y.prototype.concat=function(e,t){var n={caseInsensitive:G.caseInsensitive(),strict:G.strictMode(),squash:G.defaultSquashPolicy()};return new y(this.sourcePath+e+this.sourceSearch,z(n,t),this)},y.prototype.toString=function(){return this.source},y.prototype.exec=function(e,t){var n=this.regexp.exec(e);if(!n)return null;t=t||{};var r,i,o,a=this.parameters(),s=a.length,l=this.segments.length-1,u={};if(l!==n.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var c,f;for(r=0;r=":n(e.from)}:{"<=":n(e.to)}}function s(t){return t?(t=this.compactFilters(t),e.transform(t,function(e,t,n){t.from||t.to?e[n]=a(t):t.in||t.nin?e[n]=l(t):e[n]=t},{})):null}function l(e){return e.in?{IN:e.in}:{"NOT IN":e.nin}}return{compactFilters:r,extend:i,processFilters:s}})}),define("common/models/contact-job-role.model",["common/modules/models","common/models/model","common/instances/contact-job-role-instance.instance","common/services/api/contact-job-role-api.api"],function(e){"use strict";e.factory("ContactJobRole",["$log","Model","ContactJobRoleAPI","ContactJobRoleInstance",function(e,t,n,r){return e.debug("ContactJobRole"),t.extend({all:function(e){return n.all(e).then(function(e){return e.list.map(function(e){return r.init(e,!0)})})}})}])}),define("common/models/instances/group-instance",["common/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("GroupInstance",["ModelInstance",function(e){var t=["id","name","title","description"];return e.extend({fromAPIFilter:function(e,n,r){_.includes(t,r)&&(e[r]=this[r])}})}])}),define("common/mocks/module",["common/angular"],function(e){"use strict";return e.module("common.mocks",[])}),define("common/mocks/services/api/group-mock",["common/lodash","common/mocks/module"],function(e,t){"use strict";t.factory("api.group.mock",["$q",function(t){function n(e){var n=t.defer();return n.resolve(e),n.promise}return{all:function(e,t,r){var i,o,a;return i=r||this.mockedGroups().list,e&&(i=i.filter(function(t){return Object.keys(e).every(function(n){return t[n]===e[n]})})),t&&(o=(t.page-1)*t.size,a=o+t.size,i=i.slice(o,a)),n({list:i,total:i.length,allIds:i.map(function(e){return e.id}).join(",")})},find:function(e,t){return n(t||this.mockedGroups().list.filter(function(t){return t.id===e})[0])},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedGroups:function(){return{total:5,list:[{id:"1",name:"Administrators",title:"Administrators",description:"Contacts in this group are assigned Administrator role permissions.",is_active:"1",visibility:"User and User Admin Only",group_type:["1"],is_hidden:"0",is_reserved:"0"},{id:"2",name:"Newsletter Subscribers",title:"Newsletter Subscribers",is_active:'"1',visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"3",name:"Summer Program Volunteers",title:"Summer Program Volunteers",is_active:"1",visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"4",name:"Advisory Board",title:"Advisory Board",is_active:"1",visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"5",name:"Case_Resources",title:"Case Resources",description:"Contacts in this group are listed with their phone number and email when viewing case. You also can send copies of case activities to these contacts.",is_active:"1",visibility:"User and User Admin Only",where_clause:"...",select_tables:"...",where_tables:"...",group_type:"2",is_hidden:"0",is_reserved:"0"}]}}}}])}),define("common/mocks/data/contact.data",[],function(){return{all:{is_error:0,version:3,count:26,values:[{id:"1",contact_id:"1",display_name:"Dr. Kiara Jensen-Parker",email:"kh.jensen-parker@testing.info",contact_type:"Individual"},{id:"2",contact_id:"2",display_name:"jacobc82@lol.co.pl",email:"cruz.v.jacob@spamalot.com",contact_type:"Individual"},{id:"3",contact_id:"3",display_name:"Mei Müller-Nielsen",email:"mz.mller-nielsen75@infomail.co.pl",contact_type:"Individual"},{id:"4",contact_id:"4",display_name:"Ms. Brigette Deforest",email:"deforest.p.brigette9@fakemail.info",contact_type:"Individual"},{id:"5",contact_id:"5",display_name:"robertsc@testing.net",email:"clintr56@mymail.org",contact_type:"Individual"},{id:"6",contact_id:"6",display_name:"Dr. Allen Samuels Sr.",email:"samuelsa@mymail.org",contact_type:"Individual"},{id:"7",contact_id:"7",display_name:"Mei Wilson",email:"wilson.u.mei59@sample.org",contact_type:"Individual"},{id:"8",contact_id:"8", +display_name:"Dr. Betty Díaz",email:"dazb@sample.co.nz",contact_type:"Individual"},{id:"9",contact_id:"9",display_name:"Bob Jones-Dimitrov",email:"bobj@testmail.biz",contact_type:"Individual"},{id:"10",contact_id:"10",display_name:"Truman Samuels III",email:"trumans@spamalot.org",contact_type:"Individual"},{id:"11",contact_id:"11",display_name:"Iris Wagner",email:"iwagner75@notmail.info",contact_type:"Individual"},{id:"12",contact_id:"12",display_name:"Mr. Rosario McReynolds",email:"rosariomcreynolds@testmail.org",contact_type:"Individual"},{id:"13",contact_id:"13",display_name:"Shad Jones-Dimitrov III",email:"shadj@lol.net",contact_type:"Individual"},{id:"14",contact_id:"14",display_name:"Toby Cruz Sr.",email:"",contact_type:"Individual"},{id:"15",contact_id:"15",display_name:"lareedaz61@testing.com",email:"lareedaz61@testing.com",contact_type:"Individual"},{id:"16",contact_id:"16",display_name:"Dr. Jay Deforest",email:"jayd@fishmail.org",contact_type:"Individual"},{id:"17",contact_id:"17",display_name:"Mr. Norris Cruz",email:"norriscruz@spamalot.info",contact_type:"Individual"},{id:"18",contact_id:"18",display_name:"herminiac@fishmail.com",email:"herminiac@fishmail.com",contact_type:"Individual"},{id:"19",contact_id:"19",display_name:"Ashley Terrell",email:"terrell.ashley@testmail.info",contact_type:"Individual"},{id:"20",contact_id:"20",display_name:"Kandace Parker-Díaz",email:"parker-daz.kandace67@fishmail.co.uk",contact_type:"Individual"},{id:"21",contact_id:"21",display_name:"Nicole Samuels",email:"ng.samuels@testmail.net",contact_type:"Individual"},{id:"22",contact_id:"22",display_name:"Dr. Kandace Wattson",email:"kandacewattson@testing.info",contact_type:"Individual"},{id:"23",contact_id:"23",display_name:"Brittney Cruz",email:"cruz.brittney@spamalot.co.nz",contact_type:"Individual"},{id:"24",contact_id:"24",display_name:"Shauna Olsen",email:"",contact_type:"Individual"},{id:"202",contact_id:"202",display_name:"civihr_staff@compucorp.co.uk",email:"civihr_staff@compucorp.co.uk",contact_type:"Individual"},{id:"203",contact_id:"203",display_name:"civihr_manager@compucorp.co.uk",email:"civihr_manager@compucorp.co.uk",contact_type:"Individual"}]}}}),define("common/mocks/services/api/contact-mock",["common/lodash","common/mocks/module","common/mocks/data/contact.data"],function(e,t,n){"use strict";t.factory("api.contact.mock",["$q",function(t){function r(e){var n=t.defer();return n.resolve(e),n.promise}return{all:function(t,i,o,a,s){var l,u,c;return l=s||n.all.values,t&&(l=l.filter(function(n){return Object.keys(t).every(function(r){return null===t[r]||("display_name"===r?new RegExp(t[r],"i").test(n[r]):t[r].IN?e.includes(t[r].IN,n[r]):n[r]===t[r])})})),i&&(u=(i.page-1)*i.size,c=u+i.size,l=l.slice(u,c)),r({list:l,total:l.length,allIds:l.map(function(e){return e.id}).join(",")})},find:function(e,t){return r(t||n.all.values.filter(function(t){return t.id===e})[0])},leaveManagees:function(){return r(this.mockedContacts().list)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedContacts:function(){var e=n.all.values;return{total:e.length,list:e.map(function(e){return e})}}}}])}),define("common/mocks/services/api/group-contact-mock",["common/lodash","common/mocks/module","common/mocks/services/api/contact-mock","common/mocks/services/api/group-mock"],function(e,t){"use strict";t.factory("api.group-contact.mock",["$q","api.contact.mock","api.group.mock",function(t,n,r){function i(t){return e.sample(t)}function o(e){var n=t.defer();return n.resolve(e),n.promise}var a=n.mockedContacts().list,s=r.mockedGroups().list;return{all:function(e,t,n){var r,i,a;return r=n||this.mockedGroupsContacts.list,e&&(r=r.filter(function(t){return Object.keys(e).every(function(n){return t[n]===e[n]})})),t&&(i=(t.page-1)*t.size,a=i+t.size,r=r.slice(i,a)),o({list:r,total:r.length,allIds:r.map(function(e){return e.id}).join(",")})},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedGroupsContacts:{total:a.length,list:function(){var e=1;return a.map(function(t){return{id:""+e++,group_id:i(s).id,contact_id:t.id,status:"Added"}})}()}}}])}),define("common/models/group",["common/modules/models","common/models/model","common/models/instances/group-instance","common/mocks/services/api/group-mock","common/mocks/services/api/group-contact-mock"],function(e){"use strict";e.factory("Group",["Model","api.group.mock","api.group-contact.mock","GroupInstance",function(e,t,n,r){return e.extend({all:function(e,n){return t.all(this.processFilters(e),n).then(function(e){return e.list=e.list.map(function(e){return r.init(e,!0)}),e})},find:function(e){return t.find(e).then(function(e){return r.init(e,!0)})},contactIdsOf:function(e){return n.all({group_id:e}).then(function(e){return e.list.map(function(e){return e.contact_id})})}})}])}),define("common/models/instances/job-role-instance",["common/lodash","common/moment","common/modules/models-instances","common/models/instances/instance"],function(e,t,n){"use strict";n.factory("JobRoleInstance",["ModelInstance","HR_settings",function(n,r){return n.extend({fromAPIFilter:function(n,i,o){var a=r.DATE_FORMAT.toUpperCase();e.endsWith(o,"_date")?n[o]=t(this[o],"YYYY-MM-DD HH:mm:ss").format(a):"api.HRJobContract.getsingle"===o?(n.contact_id=this[o].contact_id,n.job_contract_id=this[o].id):n[o]=this[o]},toAPIFilter:function(n,i,o){var a=["contact_id","job_contract_id"],s=r.DATE_FORMAT.toUpperCase();if(e.endsWith(o,"_date"))n[o]=t(this[o],s).format("YYYY-MM-DD HH:mm:ss");else{if(e.includes(a,o))return;n[o]=this[o]}}})}])}),define("common/services/api/job-role",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("api.job-role",["$log","api",function(e,t){return e.debug("api.jobRole"),t.extend({all:function(t,n,r,i){return e.debug("api.jobRole.api"),this.getAll("HrJobRoles",t,n,r,i)},find:function(t){return e.debug("api.jobRole.find"),this.sendGET("HRJobRole","get",{id:""+t},!1).then(function(e){return e.values[0]})}})}])}),define("common/models/job-role",["common/modules/models","common/models/model","common/models/instances/job-role-instance","common/services/api/job-role"],function(e){"use strict";e.factory("JobRole",["Model","api.job-role","JobRoleInstance",function(e,t,n){return e.extend({all:function(e,r){return t.all(this.processFilters(e),r).then(function(e){return e.list=e.list.map(function(e){return n.init(e,!0)}),e})},find:function(e){return t.find(e).then(function(e){return n.init(e,!0)})}})}])}),function(e,t){define("common/models/session.model",["common/modules/models","common/models/model"],function(n){"use strict";n.factory("Session",["$log","$q","Model",function(n,r,i){return n.debug("Session"),i.extend({get:function(){var n={contactId:e.vars.session?e.vars.session.contact_id:t.settings.currentCiviCRMUserId};if(!n.contactId)throw new Error("Session Error: *Logged In Contact Id* is not defined");return r.resolve(n)}})}])})}(CRM,window.Drupal),define("common/services/api/contact",["common/modules/apis","common/services/api"],function(e){"use strict";e.factory("api.contact",["$log","api",function(e,t){return e.debug("api.contact"),t.extend({all:function(t,n,r,i){return e.debug("api.contact.api"),this.getAll("Contact",t,n,r,i)},find:function(t){return e.debug("api.contact.find"),this.sendGET("Contact","get",{id:""+t},!1).then(function(e){return e.values[0]})},leaveManagees:function(t,n){return e.debug("api.contact.leaveManagees"),n=_.assign({},n,{managed_by:t}),this.sendGET("Contact","getleavemanagees",n).then(function(e){return e.values})}})}])}),define("common/models/instances/contact-instance",["common/lodash","common/modules/models-instances","common/models/instances/instance","common/services/api/contact"],function(e,t){"use strict";t.factory("ContactInstance",["ModelInstance","api.contact",function(t,n){return t.extend({leaveManagees:function(e){return n.leaveManagees(this.id,e)},checkIfSelfLeaveApprover:function(){return this.leaveManagees().then(function(t){return!!e.find(t,{id:this.id})}.bind(this))}})}])}),define("common/models/contact",["common/lodash","common/modules/models","common/models/model","common/models/contact-job-role.model","common/models/group","common/models/job-role","common/models/session.model","common/models/instances/contact-instance","common/services/api/contact"],function(e,t){"use strict";t.factory("Contact",["$q","api.contact","ContactInstance","ContactJobRole","Group","JobRole","Model","Session",function(t,n,r,i,o,a,s,l){function u(t,n){return!e.isEmpty(e.intersection(e.keys(t),n))}function c(e){return i.all(e).then(function(e){return e.map(function(e){return e.contact_id})})}function f(t,n){return e(t).omit(p).omit(h).assign({id:{in:e.intersection.apply(null,n)}}).value()}function d(n){var r=t.defer(),i=[];return n=this.compactFilters(n),u(n,h)&&i.push(c(e.pick(n,h))),u(n,p)&&i.push(o.contactIdsOf(n.group_id)),e.isEmpty(i)?r.resolve(this.processFilters(n)):t.all(i).then(function(e){n=f(n,e),r.resolve(this.processFilters(n))}.bind(this)),r.promise}var p=["group_id"],h=["region","department","level_type","location"];return s.extend({all:function(e,t,i,o){return d.call(this,e).then(function(e){return e&&e.id&&!e.id.IN.length?{list:[]}:n.all(e,t,i,o)}).then(function(e){return e.list=e.list.map(function(e){return r.init(e,!0)}),e})},find:function(e){return n.find(e).then(function(e){return r.init(e,!0)})},getLoggedIn:function(){return l.get().then(function(e){return this.find(e.contactId)}.bind(this))},leaveManagees:function(e,t){return d.call(this,t).then(function(t){return t&&t.id&&!t.id.IN.length?[]:n.leaveManagees(e,t)})}})}])}),define("common/models/instances/contract-instance",["common/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("ContractInstance",["ModelInstance",function(e){return e.extend({})}])}),define("common/services/api/contract",["common/lodash","common/modules/apis","common/services/api"],function(e,t){"use strict";t.factory("api.contract",["$log","api",function(t,n){function r(t){var n=e.clone(t);return n.info=n["api.HRJobContract.getfulldetails"],delete n["api.HRJobContract.getfulldetails"],n}return t.debug("api.contract"),n.extend({all:function(e){return t.debug("ContractAPI.all"),e=e||{},e["api.HRJobContract.getfulldetails"]={jobcontract_id:"$value.id"},e.deleted=0,this.sendGET("HRJobContract","get",e,!1).then(function(e){return e.values}).then(function(e){return e=e.map(r)})}})}])}),define("common/models/contract",["common/modules/models","common/models/model","common/models/instances/contract-instance","common/services/api/contract"],function(e){"use strict";e.factory("Contract",["$log","Model","api.contract","ContractInstance",function(e,t,n,r){return e.debug("Contract"),t.extend({all:function(e){return n.all(e).then(function(e){return e.map(function(e){return r.init(e,!0)})})}})}])}),define("common/models/option-group",["common/modules/models","common/models/model","common/services/api/option-group"],function(e){"use strict";e.factory("OptionGroup",["Model","api.optionGroup",function(e,t){return e.extend({valuesOf:function(e,n){return t.valuesOf(e,n)}})}])}),define("common/bundles/models",["common/instances/contact-job-role-instance.instance","common/models/model","common/models/contact","common/models/contact-job-role.model","common/models/contract","common/models/group","common/models/job-role","common/models/option-group","common/models/session.model","common/models/instances/instance","common/models/instances/contact-instance","common/models/instances/contract-instance","common/models/instances/group-instance","common/models/instances/job-role-instance"],function(){}),define("common/services/dialog/dialog",["common/lodash","common/modules/services"],function(e,t){"use strict";function n(t,n,r){function i(i){var o;if(!e.isObject(i))throw new Error("Dialog Service: Options passed should be an object");return o=n.children(),t.open({appendTo:o.length?o.eq(0):n,size:"sm",controller:"DialogController",template:r.get("dialog.html"),resolve:{options:function(){return i}}}).result}return{open:i}}t.factory("dialog",n),n.$inject=["$uibModal","$rootElement","$templateCache"]}),define("common/controllers/dialog/dialog-ctrl",["common/lodash","common/modules/controllers"],function(e,t){"use strict";function n(t,n,r,i){function o(t){e.assign(n,e.defaultsDeep(t,{title:"CiviHR",msg:"",copyConfirm:"",copyCancel:"",classConfirm:"btn-primary",loading:!1}))}function a(){r.close(!1)}function s(){n.loading=!0,r.closed.then(n.onCloseAfterConfirm),t.resolve().then(n.onConfirm).then(function(){r.close(!0)})}n.cancel=a,n.confirm=s,function(){o(i),i.optionsPromise&&i.optionsPromise().then(function(e){o(e)})}()}t.controller("DialogController",n),n.$inject=["$q","$scope","$uibModalInstance","options"]}),define("common/modules/dialog",["common/angular","common/services/dialog/dialog","common/controllers/dialog/dialog-ctrl","common/angularBootstrap","common/directives/loading","common/modules/templates"],function(e){"use strict";return e.module("common.dialog",["ui.bootstrap","common.directives","common.templates"])}),define("common/decorators/xeditable-civi/editable-directive-factory",[],function(){"use strict";return["$delegate",function(e){return function(t){var n=e(t);return n.compile=function(e){var t,r=e[0].attributes.getNamedItem("ng-href");return e.append(''),r&&(t=angular.element(""),t.text("Follow link"),t.attr(r.nodeName,r.value),t.attr("ng-click","$event.stopPropagation();"),t.addClass("editable-link"),e.append(t),e.addClass("editable-with-link")),{post:n.link}},n}}]}),define("common/directives/xeditable-civi/editable-ta",[],function(){"use strict";return["editableDirectiveFactory","$timeout",function(e,t){var n,r;return r=e({directiveName:"editableTa",inputTpl:"",render:function(){this.parent.render.call(this),this.inputEl.parent().parent().removeClass("form-inline"),this.inputEl.addClass("editable-ta"),this.inputEl.attr("ng-model","ta.$data"),this.inputEl.attr("ta-toolbar",this.attrs.eTaToolbar||'[["bold","italics","underline","strikeThrough","ul","ol","undo","redo","clear"]]'),t(function(){this.inputEl.find("textarea").hide()}.bind(this),0)},save:function(){this.scope.$data=this.scope.ta.$data,this.parent.save.call(this)},setLocalValue:function(){this.parent.setLocalValue.call(this),this.scope.ta.$data=this.scope.$data}}),n=r.link,r.link=function(e,t,r,i){return e.ta={},n(e,t,r,i)},r}]}),define("common/modules/xeditable-civi",["common/angular","common/decorators/xeditable-civi/editable-directive-factory","common/directives/xeditable-civi/editable-ta","common/angularXeditable","common/text-angular"],function(e,t,n){"use strict";return e.module("xeditable-civi",["xeditable","textAngular"]).directive("editableTa",n)}); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/org.civicrm.reqangular/js/dist/reqangular.min.js.map \ No newline at end of file diff --git a/org.civicrm.reqangular/js/dist/reqangular.mocks.min.js b/org.civicrm.reqangular/js/dist/reqangular.mocks.min.js index 6c1c143d012..b3210b8af7b 100644 --- a/org.civicrm.reqangular/js/dist/reqangular.mocks.min.js +++ b/org.civicrm.reqangular/js/dist/reqangular.mocks.min.js @@ -1 +1 @@ -define("common/mocks/module",["common/angular"],function(e){"use strict";return e.module("common.mocks",[])}),define("common/mocks/models/instances/session-mock",["common/mocks/module"],function(e){"use strict";e.service("SessionMock",["$q",function(e){function a(){return e.resolve(i)}var i={contactId:999};return{get:a,sessionObject:i}}])}),define("common/mocks/services/hr-settings-mock",["common/mocks/module"],function(e){"use strict";e.factory("HR_settingsMock",function(){return{DATE_FORMAT:"dd/MM/yyyy"}})}),define("common/mocks/services/api/appraisal-mock",["common/lodash","common/angular","common/mocks/module"],function(e,a,i){"use strict";i.factory("api.appraisal.mock",["$q",function(i){function t(e){var a=i.defer();return a.resolve(e),a.promise}return{all:function(e,a,i){var n,l,o;return n=i||this.mockedAppraisals().list,e&&(n=n.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),a&&(l=(a.page-1)*a.size,o=l+a.size,n=n.slice(l,o)),t({list:n,total:n.length,allIds:n.map(function(e){return e.id}).join(",")})},create:function(e,i){return t(i||function(){var i=a.copy(e);return i.id=""+Math.ceil(5e3*Math.random()),i.createdAt=Date.now(),i}())},find:function(e,a){return t(a||this.mockedAppraisals().list.filter(function(a){return a.id===e})[0])},overdue:function(e){var a=this.mockedAppraisals().list.slice(0,5);return t({list:a,total:a.length,allIds:a.map(function(e){return e.id}).join(",")})},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedAppraisals:function(){return{total:10,list:[{id:"3451",appraisal_cycle_id:"1",self_appraisal_due:"2016-01-01",manager_appraisal_due:"2016-02-02",grade_due:"2016-03-03",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"2",original_id:"3451",created_date:"2015-01-01",is_current:"1",contact:{id:"201",display_name:"Contact #1"},manager:{id:"301",display_name:"Manager #1"},role:{title:"Role #1",level:"Level #1",location:"Location #1"}},{id:"3452",appraisal_cycle_id:"1",self_appraisal_due:"2016-02-02",manager_appraisal_due:"2016-03-03",grade_due:"2016-04-04",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"3",original_id:"3452",created_date:"2015-02-02",is_current:"1",contact:{id:"202",display_name:"Contact #2"},manager:{id:"302",display_name:"Manager #2"},role:{title:"Role #2",level:"Level #2",location:"Location #2"}},{id:"3453",appraisal_cycle_id:"1",self_appraisal_due:"2016-03-03",manager_appraisal_due:"2016-04-04",grade_due:"2016-05-05",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"2",original_id:"3453",created_date:"2015-03-03",is_current:"1",contact:{id:"203",display_name:"Contact #3"},manager:{id:"303",display_name:"Manager #3"},role:{title:"Role #3",level:"Level #3",location:"Location #3"}},{id:"3454",appraisal_cycle_id:"2",self_appraisal_due:"2016-04-04",manager_appraisal_due:"2016-05-05",grade_due:"2016-06-06",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"3",original_id:"3454",created_date:"2015-04-04",is_current:"1",contact:{id:"204",display_name:"Contact #4"},manager:{id:"304",display_name:"Manager #4"},role:{title:"Role #4",level:"Level #1",location:"Location #1"}},{id:"3455",appraisal_cycle_id:"2",self_appraisal_due:"2016-05-05",manager_appraisal_due:"2016-06-06",grade_due:"2016-07-07",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3455",created_date:"2015-05-05",is_current:"1",contact:{id:"205",display_name:"Contact #5"},manager:{id:"305",display_name:"Manager #5"},role:{title:"Role #5",level:"Level #2",location:"Location #2"}},{id:"3456",appraisal_cycle_id:"2",self_appraisal_due:"2016-06-06",manager_appraisal_due:"2016-07-07",grade_due:"2016-08-08",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3456",created_date:"2015-06-06",is_current:"0",contact:{id:"206",display_name:"Contact #6"},manager:{id:"306",display_name:"Manager #6"},role:{title:"Role #6",level:"Level #3",location:"Location #3"}},{id:"3457",appraisal_cycle_id:"2",self_appraisal_due:"2016-07-07",manager_appraisal_due:"2016-08-08",grade_due:"2016-09-09",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3457",created_date:"2015-07-07",is_current:"0",contact:{id:"207",display_name:"Contact #7"},manager:{id:"307",display_name:"Manager #7"},role:{title:"Role #7",level:"Level #1",location:"Location #1"}},{id:"3458",appraisal_cycle_id:"1",self_appraisal_due:"2016-08-08",manager_appraisal_due:"2016-09-09",grade_due:"2016-10-10",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3458",created_date:"2015-08-08",is_current:"0",contact:{id:"208",display_name:"Contact #8"},manager:{id:"308",display_name:"Manager #8"},role:{title:"Role #8",level:"Level #2",location:"Location #2"}},{id:"3459",appraisal_cycle_id:"1",self_appraisal_due:"2016-09-09",manager_appraisal_due:"2016-10-10",grade_due:"2016-11-11",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"3",original_id:"3459",created_date:"2015-09-09",is_current:"1",contact:{id:"209",display_name:"Contact #9"},manager:{id:"309",display_name:"Manager #9"},role:{title:"Role #9",level:"Level #3",location:"Location #3"}},{id:"3460",appraisal_cycle_id:"3",self_appraisal_due:"2016-10-10",manager_appraisal_due:"2016-11-11",grade_due:"2016-12-12",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3460",created_date:"2015-10-10",is_current:"1",contact:{id:"213",display_name:"Contact #10"},manager:{id:"313",display_name:"Manager #10"},role:{title:"Role #10",level:"Level #1",location:"Location #1"}}]}}}}])}),define("common/mocks/services/api/appraisal-cycle-mock",["common/lodash","common/angular","common/mocks/module"],function(e,a,i){"use strict";i.factory("api.appraisal-cycle.mock",["$q",function(i){function t(e){var a=i.defer();return a.resolve(e),a.promise}return{all:function(e,a,i){var n,l,o;return n=i||this.mockedCycles().list,e&&(n=n.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),a&&(l=(a.page-1)*a.size,o=l+a.size,n=n.slice(l,o)),t({list:n,total:n.length,allIds:n.map(function(e){return e.id}).join(",")})},create:function(e,i){return t(i||function(){var i=a.copy(e);return i.id=""+Math.ceil(5e3*Math.random()),i.createdAt=Date.now(),i}())},find:function(e,a){return t(a||this.mockedCycles().list.filter(function(a){return a.id===e})[0])},grades:function(e){var a=[{label:"1",value:30},{label:"2",value:10},{label:"3",value:55},{label:"4",value:87},{label:"5",value:54}];return t(e||a)},statuses:function(e){var a=[{id:"1",label:"status 1",value:"1",weight:"1"},{id:"2",label:"status 2",value:"2",weight:"2"}];return t(e||a)},statusOverview:function(e){return t([{status_id:1,status_name:"Awaiting self appraisal",contacts_count:{due:4,overdue:2}},{status_id:2,status_name:"Awaiting manager appraisal",contacts_count:{due:10,overdue:6}},{status_id:3,status_name:"Awaiting grade",contacts_count:{due:20,overdue:12}},{status_id:4,status_name:"Awaiting HR approval",contacts_count:{due:7,overdue:3}},{status_id:5,status_name:"Complete",contacts_count:{due:13,overdue:8}}])},update:function(e,i,n){return t(n||function(){var t=this.mockedCycles().list.filter(function(a){return a.id===e})[0];return a.extend({},t,i)}.bind(this)())},total:function(e,a){var i=this.mockedCycles().list;return e&&(i=i.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),t(i.length)},types:function(e){var a=[{id:"1",label:"type 1",value:"1",weight:"1"},{id:"2",label:"type 2",value:"2",weight:"2"},{id:"3",label:"type 3",value:"3",weight:"3"}];return t(e||a)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedCycles:function(){return{total:10,list:[{id:"42131",cycle_name:"Appraisal Cycle 1",cycle_is_active:!0,cycle_type_id:"2",cycle_start_date:"2014-01-01",cycle_end_date:"2015-01-01",cycle_self_appraisal_due:"2016-01-01",cycle_manager_appraisal_due:"2016-01-02",cycle_grade_due:"2016-01-03"},{id:"42132",cycle_name:"Appraisal Cycle 2",cycle_is_active:!0,cycle_type_id:"1",cycle_start_date:"2014-02-02",cycle_end_date:"2015-02-02",cycle_self_appraisal_due:"2016-02-02",cycle_manager_appraisal_due:"2016-02-04",cycle_grade_due:"2016-02-05"},{id:"42133",cycle_name:"Appraisal Cycle 3",cycle_is_active:!0,cycle_type_id:"2",cycle_start_date:"2014-03-03",cycle_end_date:"2015-03-03",cycle_self_appraisal_due:"2016-03-06",cycle_manager_appraisal_due:"2016-03-07",cycle_grade_due:"2016-03-08"},{id:"42134",cycle_name:"Appraisal Cycle 4",cycle_is_active:!0,cycle_type_id:"3",cycle_start_date:"2014-04-04",cycle_end_date:"2015-04-04",cycle_self_appraisal_due:"2016-04-09",cycle_manager_appraisal_due:"2016-04-10",cycle_grade_due:"2016-04-11"},{id:"42135",cycle_name:"Appraisal Cycle 5",cycle_is_active:!0,cycle_type_id:"3",cycle_start_date:"2014-05-05",cycle_end_date:"2015-05-05",cycle_self_appraisal_due:"2016-05-12",cycle_manager_appraisal_due:"2016-05-13",cycle_grade_due:"2016-05-14"},{id:"42136",cycle_name:"Appraisal Cycle 6",cycle_is_active:!1,cycle_type_id:"1",cycle_start_date:"2014-06-06",cycle_end_date:"2015-06-06",cycle_self_appraisal_due:"2016-06-15",cycle_manager_appraisal_due:"2016-06-16",cycle_grade_due:"2016-06-17"},{id:"4217",cycle_name:"Appraisal Cycle 7",cycle_is_active:!1,cycle_type_id:"2",cycle_start_date:"2014-07-07",cycle_end_date:"2015-07-07",cycle_self_appraisal_due:"2016-07-18",cycle_manager_appraisal_due:"2016-07-19",cycle_grade_due:"2016-07-20"},{id:"42138",cycle_name:"Appraisal Cycle 8",cycle_is_active:!0,cycle_type_id:"1",cycle_start_date:"2014-08-08",cycle_end_date:"2015-08-08",cycle_self_appraisal_due:"2016-08-21",cycle_manager_appraisal_due:"2016-08-22",cycle_grade_due:"2016-08-23"},{id:"42139",cycle_name:"Appraisal Cycle 9",cycle_is_active:!0,cycle_type_id:"1",cycle_start_date:"2014-09-09",cycle_end_date:"2015-09-09",cycle_self_appraisal_due:"2016-09-24",cycle_manager_appraisal_due:"2016-09-25",cycle_grade_due:"2016-09-26"},{id:"421310",cycle_name:"Appraisal Cycle 10",cycle_is_active:!0,cycle_type_id:"4",cycle_start_date:"2014-10-10",cycle_end_date:"2015-10-10",cycle_self_appraisal_due:"2016-10-27",cycle_manager_appraisal_due:"2016-10-28",cycle_grade_due:"2016-10-29"}]}}}}])}),define("common/mocks/data/contact.data",[],function(){return{all:{is_error:0,version:3,count:26,values:[{id:"1",contact_id:"1",display_name:"Dr. Kiara Jensen-Parker",email:"kh.jensen-parker@testing.info",contact_type:"Individual"},{id:"2",contact_id:"2",display_name:"jacobc82@lol.co.pl",email:"cruz.v.jacob@spamalot.com",contact_type:"Individual"},{id:"3",contact_id:"3",display_name:"Mei Müller-Nielsen",email:"mz.mller-nielsen75@infomail.co.pl",contact_type:"Individual"},{id:"4",contact_id:"4",display_name:"Ms. Brigette Deforest",email:"deforest.p.brigette9@fakemail.info",contact_type:"Individual"},{id:"5",contact_id:"5",display_name:"robertsc@testing.net",email:"clintr56@mymail.org",contact_type:"Individual"},{id:"6",contact_id:"6",display_name:"Dr. Allen Samuels Sr.",email:"samuelsa@mymail.org",contact_type:"Individual"},{id:"7",contact_id:"7",display_name:"Mei Wilson",email:"wilson.u.mei59@sample.org",contact_type:"Individual"},{id:"8",contact_id:"8",display_name:"Dr. Betty Díaz",email:"dazb@sample.co.nz",contact_type:"Individual"},{id:"9",contact_id:"9",display_name:"Bob Jones-Dimitrov",email:"bobj@testmail.biz",contact_type:"Individual"},{id:"10",contact_id:"10",display_name:"Truman Samuels III",email:"trumans@spamalot.org",contact_type:"Individual"},{id:"11",contact_id:"11",display_name:"Iris Wagner",email:"iwagner75@notmail.info",contact_type:"Individual"},{id:"12",contact_id:"12",display_name:"Mr. Rosario McReynolds",email:"rosariomcreynolds@testmail.org",contact_type:"Individual"},{id:"13",contact_id:"13",display_name:"Shad Jones-Dimitrov III",email:"shadj@lol.net",contact_type:"Individual"},{id:"14",contact_id:"14",display_name:"Toby Cruz Sr.",email:"",contact_type:"Individual"},{id:"15",contact_id:"15",display_name:"lareedaz61@testing.com",email:"lareedaz61@testing.com",contact_type:"Individual"},{id:"16",contact_id:"16",display_name:"Dr. Jay Deforest",email:"jayd@fishmail.org",contact_type:"Individual"},{id:"17",contact_id:"17",display_name:"Mr. Norris Cruz",email:"norriscruz@spamalot.info",contact_type:"Individual"},{id:"18",contact_id:"18",display_name:"herminiac@fishmail.com",email:"herminiac@fishmail.com",contact_type:"Individual"},{id:"19",contact_id:"19",display_name:"Ashley Terrell",email:"terrell.ashley@testmail.info",contact_type:"Individual"},{id:"20",contact_id:"20",display_name:"Kandace Parker-Díaz",email:"parker-daz.kandace67@fishmail.co.uk",contact_type:"Individual"},{id:"21",contact_id:"21",display_name:"Nicole Samuels",email:"ng.samuels@testmail.net",contact_type:"Individual"},{id:"22",contact_id:"22",display_name:"Dr. Kandace Wattson",email:"kandacewattson@testing.info",contact_type:"Individual"},{id:"23",contact_id:"23",display_name:"Brittney Cruz",email:"cruz.brittney@spamalot.co.nz",contact_type:"Individual"},{id:"24",contact_id:"24",display_name:"Shauna Olsen",email:"",contact_type:"Individual"},{id:"202",contact_id:"202",display_name:"civihr_staff@compucorp.co.uk",email:"civihr_staff@compucorp.co.uk",contact_type:"Individual"},{id:"203",contact_id:"203",display_name:"civihr_manager@compucorp.co.uk",email:"civihr_manager@compucorp.co.uk",contact_type:"Individual"}]}}}),define("common/mocks/services/api/contact-mock",["common/lodash","common/mocks/module","common/mocks/data/contact.data"],function(e,a,i){"use strict";a.factory("api.contact.mock",["$q",function(a){function t(e){var i=a.defer();return i.resolve(e),i.promise}return{all:function(a,n,l,o,c){var r,_,s;return r=c||i.all.values,a&&(r=r.filter(function(i){return Object.keys(a).every(function(t){return null===a[t]||("display_name"===t?new RegExp(a[t],"i").test(i[t]):a[t].IN?e.includes(a[t].IN,i[t]):i[t]===a[t])})})),n&&(_=(n.page-1)*n.size,s=_+n.size,r=r.slice(_,s)),t({list:r,total:r.length,allIds:r.map(function(e){return e.id}).join(",")})},find:function(e,a){return t(a||i.all.values.filter(function(a){return a.id===e})[0])},leaveManagees:function(){return t(this.mockedContacts().list)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedContacts:function(){var e=i.all.values;return{total:e.length,list:e.map(function(e){return e})}}}}])}),define("common/mocks/data/contract.data",["common/lodash"],function(e){return{all:{is_error:0,version:3,count:3,values:[{id:"24",contact_id:"208",is_primary:"1",deleted:"0",is_current:"1","api.HRJobContract.getfulldetails":{details:{id:"27",position:"Developer",title:"Developer",funding_notes:null,contract_type:"Contractor",period_start_date:"2017-06-01",period_end_date:"2017-08-04",end_reason:"3",notice_amount:null,notice_unit:null,notice_amount_employee:null,notice_unit_employee:null,location:null,jobcontract_revision_id:"33"},hour:{id:"27",location_standard_hours:"1",hours_type:null,hours_amount:null,hours_unit:null,hours_fte:"0",fte_num:"0",fte_denom:"0",jobcontract_revision_id:"33"},pay:{id:"24",pay_scale:null,is_paid:"0",pay_amount:null,pay_unit:null,pay_currency:null,pay_annualized_est:null,pay_is_auto_est:"0",annual_benefits:[],annual_deductions:[],pay_cycle:null,pay_per_cycle_gross:null,pay_per_cycle_net:null,jobcontract_revision_id:"33"},health:{id:"24",provider:null,plan_type:null,description:null,dependents:null,provider_life_insurance:null,plan_type_life_insurance:null,description_life_insurance:null,dependents_life_insurance:null,jobcontract_revision_id:"33",healthplan_type_label:null,lifeplan_type_label:null},pension:{id:"25",is_enrolled:null,ee_contrib_pct:null,er_contrib_pct:null,pension_type:null,ee_contrib_abs:null,ee_evidence_note:null,jobcontract_revision_id:"33"},leave:[{id:"70",leave_type:"1",leave_amount:"20",add_public_holidays:"1",jobcontract_revision_id:"33"},{id:"71",leave_type:"2",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"33"},{id:"72",leave_type:"3",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"33"}]}},{id:"209",contact_id:"208",is_primary:"0",deleted:"0",is_current:"0","api.HRJobContract.getfulldetails":{details:{id:"209",position:"Director",title:"Director",funding_notes:null,contract_type:"Contractor",period_start_date:"2018-09-09",period_end_date:"2018-11-10",end_reason:"3",notice_amount:null,notice_unit:null,notice_amount_employee:null,notice_unit_employee:null,location:null,jobcontract_revision_id:"34"},hour:{id:"28",location_standard_hours:"1",hours_type:null,hours_amount:null,hours_unit:null,hours_fte:"0",fte_num:"0",fte_denom:"0",jobcontract_revision_id:"34"},pay:{id:"25",pay_scale:null,is_paid:"0",pay_amount:null,pay_unit:null,pay_currency:null,pay_annualized_est:null,pay_is_auto_est:"0",annual_benefits:[],annual_deductions:[],pay_cycle:null,pay_per_cycle_gross:null,pay_per_cycle_net:null,jobcontract_revision_id:"34"},health:{id:"25",provider:null,plan_type:null,description:null,dependents:null,provider_life_insurance:null,plan_type_life_insurance:null,description_life_insurance:null,dependents_life_insurance:null,jobcontract_revision_id:"34",healthplan_type_label:null,lifeplan_type_label:null},pension:{id:"26",is_enrolled:null,ee_contrib_pct:null,er_contrib_pct:null,pension_type:null,ee_contrib_abs:null,ee_evidence_note:null,jobcontract_revision_id:"34"},leave:[{id:"76",leave_type:"1",leave_amount:"20",add_public_holidays:"1",jobcontract_revision_id:"34"},{id:"77",leave_type:"2",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"34"},{id:"78",leave_type:"3",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"34"}]}},{id:"25",contact_id:"208",is_primary:"0",deleted:"0",is_current:"1","api.HRJobContract.getfulldetails":{details:{id:"28",position:"Team Lead",title:"Team Lead",funding_notes:null,contract_type:"Contractor",period_start_date:"2017-09-09",period_end_date:"2017-11-10",end_reason:"3",notice_amount:null,notice_unit:null,notice_amount_employee:null,notice_unit_employee:null,location:null,jobcontract_revision_id:"34"},hour:{id:"28",location_standard_hours:"1",hours_type:null,hours_amount:null,hours_unit:null,hours_fte:"0",fte_num:"0",fte_denom:"0",jobcontract_revision_id:"34"},pay:{id:"25",pay_scale:null,is_paid:"0",pay_amount:null,pay_unit:null,pay_currency:null,pay_annualized_est:null,pay_is_auto_est:"0",annual_benefits:[],annual_deductions:[],pay_cycle:null,pay_per_cycle_gross:null,pay_per_cycle_net:null,jobcontract_revision_id:"34"},health:{id:"25",provider:null,plan_type:null,description:null,dependents:null,provider_life_insurance:null,plan_type_life_insurance:null,description_life_insurance:null,dependents_life_insurance:null,jobcontract_revision_id:"34",healthplan_type_label:null,lifeplan_type_label:null},pension:{id:"26",is_enrolled:null,ee_contrib_pct:null,er_contrib_pct:null,pension_type:null,ee_contrib_abs:null,ee_evidence_note:null,jobcontract_revision_id:"34"},leave:[{id:"73",leave_type:"1",leave_amount:"20",add_public_holidays:"1",jobcontract_revision_id:"34"},{id:"74",leave_type:"2",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"34"},{id:"75",leave_type:"3",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"34"}]}}]}}}),define("common/mocks/services/api/contract-mock",["common/lodash","common/mocks/module","common/mocks/data/contract.data"],function(e,a,i){"use strict";a.factory("api.contract.mock",["$q",function(a){function t(a){var i=e.clone(a);return i.info=i["api.HRJobContract.getfulldetails"],delete i["api.HRJobContract.getfulldetails"],i}return{all:function(e){return a(function(e,a){e(i.all.values.map(t))})},mockedContracts:function(){return i.all.values.map(t)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))}}}])}),define("common/mocks/services/api/option-group-mock",["common/lodash","common/mocks/module"],function(e,a){"use strict";a.factory("api.optionGroup.mock",["$q",function(a){function i(e){var i=a.defer();return i.resolve(e),i.promise}return{valuesOf:function(a){var t;return t=e.isArray(a)?e.pick(this.mockedOptionValues(),a):this.mockedOptionValues()[a],i(t)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedOptionValues:function(){return{hrjc_department:[{id:"1",option_group_id:"1",is_reserved:"1",is_active:"1",label:"Finance",name:"finance",option_group_name:"hrjc_department",value:"1",weight:"1"},{id:"2",option_group_id:"1",is_reserved:"1",is_active:"1",label:"HR",name:"hr",option_group_name:"hrjc_department",value:"2",weight:"2"},{id:"3",option_group_id:"1",is_reserved:"1",is_active:"1",label:"IT",name:"it",option_group_name:"hrjc_department",value:"3",weight:"3"},{id:"4",option_group_id:"1",is_reserved:"1",is_active:"1",label:"Fundraising",name:"fundraising",option_group_name:"hrjc_department",value:"4",weight:"4"},{id:"5",option_group_id:"1",is_reserved:"1",is_active:"1",label:"Marketing",name:"marketing",option_group_name:"hrjc_department",value:"5",weight:"5"}],hrjc_level_type:[{id:"6",option_group_id:"2",is_reserved:"1",is_active:"1",label:"Senior Manager",name:"seniormanager",option_group_name:"hrjc_level_type",value:"1",weight:"1"},{id:"7",option_group_id:"2",is_reserved:"1",is_active:"1",label:"Junior Manager",name:"juniormanager",option_group_name:"hrjc_level_type",value:"2",weight:"2"},{id:"8",option_group_id:"2",is_reserved:"1",is_active:"1",label:"Senior Staff",name:"seniorstaff",option_group_name:"hrjc_level_type",value:"3",weight:"3"},{id:"9",option_group_id:"2",is_reserved:"1",is_active:"1",label:"Junior Manager",name:"juniorstaff",option_group_name:"hrjc_level_type",value:"4",weight:"4"}],hrjc_location:[{id:"10",option_group_id:"3",is_reserved:"1",is_active:"1",label:"Headquarters",name:"headquarters",option_group_name:"hrjc_location",value:"1",weight:"1"},{id:"11",option_group_id:"3",is_reserved:"1",is_active:"1",label:"Home or Home-Office",name:"home",option_group_name:"hrjc_location",value:"2",weight:"2"}],hrjc_region:[{id:"12",option_group_id:"4",is_reserved:"1",is_active:"1",label:"Region #1",name:"region1",option_group_name:"hrjc_region",value:"1",weight:"1"},{id:"13",option_group_id:"4",is_reserved:"1",is_active:"1",label:"Region #2",name:"region2",option_group_name:"hrjc_region",value:"2",weight:"2"}],hrleaveandabsences_absence_type_calculation_unit:[{id:"14",option_group_id:"5",is_reserved:"1",is_active:"1",label:"Days",name:"days",option_group_name:"hrleaveandabsences_absence_type_calculation_unit",value:"1",weight:"1"},{id:"15",option_group_id:"5",is_reserved:"1",is_active:"1",label:"Hours",name:"hours",option_group_name:"hrleaveandabsences_absence_type_calculation_unit",value:"2",weight:"2"}]}}}}])}),define("common/mocks/services/api/contact-job-role-api.api.mock",["common/lodash","common/mocks/module","common/mocks/services/api/contact-mock","common/mocks/services/api/option-group-mock"],function(e,a){"use strict";a.factory("ContactJobRoleAPIMock",["$q","api.contact.mock","api.optionGroup.mock",function(a,i,t){var n=i.mockedContacts().list,l=t.mockedOptionValues();return{all:function(e,i,t){var n,l,o;return n=t||this.mockedContactJobRoles.list,e&&(n=n.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),i&&(l=(i.page-1)*i.size,o=l+i.size,n=n.slice(l,o)),a.resolve({list:n})},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedContactJobRoles:{list:function(){var a=0;return n.map(function(i){return a+=Math.ceil(100*Math.random()),{id:""+a,title:"Job Role #"+a,department:e.sample(l.hrjc_department).id,level_type:e.sample(l.hrjc_level_type).id,location:e.sample(l.hrjc_location).id,contact_id:i.id}})}()}}}])}),define("common/mocks/services/api/group-mock",["common/lodash","common/mocks/module"],function(e,a){"use strict";a.factory("api.group.mock",["$q",function(a){function i(e){var i=a.defer();return i.resolve(e),i.promise}return{all:function(e,a,t){var n,l,o;return n=t||this.mockedGroups().list,e&&(n=n.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),a&&(l=(a.page-1)*a.size,o=l+a.size,n=n.slice(l,o)),i({list:n,total:n.length,allIds:n.map(function(e){return e.id}).join(",")})},find:function(e,a){return i(a||this.mockedGroups().list.filter(function(a){return a.id===e})[0])},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedGroups:function(){return{total:5,list:[{id:"1",name:"Administrators",title:"Administrators",description:"Contacts in this group are assigned Administrator role permissions.",is_active:"1",visibility:"User and User Admin Only",group_type:["1"],is_hidden:"0",is_reserved:"0"},{id:"2",name:"Newsletter Subscribers",title:"Newsletter Subscribers",is_active:'"1',visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"3",name:"Summer Program Volunteers",title:"Summer Program Volunteers",is_active:"1",visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"4",name:"Advisory Board",title:"Advisory Board",is_active:"1",visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"5",name:"Case_Resources",title:"Case Resources",description:"Contacts in this group are listed with their phone number and email when viewing case. You also can send copies of case activities to these contacts.",is_active:"1",visibility:"User and User Admin Only",where_clause:"...",select_tables:"...",where_tables:"...",group_type:"2",is_hidden:"0",is_reserved:"0"}]}}}}])}),define("common/mocks/services/api/group-contact-mock",["common/lodash","common/mocks/module","common/mocks/services/api/contact-mock","common/mocks/services/api/group-mock"],function(e,a){"use strict";a.factory("api.group-contact.mock",["$q","api.contact.mock","api.group.mock",function(a,i,t){function n(a){return e.sample(a)}function l(e){var i=a.defer();return i.resolve(e),i.promise}var o=i.mockedContacts().list,c=t.mockedGroups().list;return{all:function(e,a,i){var t,n,o;return t=i||this.mockedGroupsContacts.list,e&&(t=t.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),a&&(n=(a.page-1)*a.size,o=n+a.size,t=t.slice(n,o)),l({list:t,total:t.length,allIds:t.map(function(e){return e.id}).join(",")})},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedGroupsContacts:{total:o.length,list:function(){var e=1;return o.map(function(a){return{id:""+e++,group_id:n(c).id,contact_id:a.id,status:"Added"}})}()}}}])}),define("common/mocks/data/file-uploader.data",[],function(){return{response:{file:{is_error:0,version:3,count:1,id:1,values:{1:{id:"1",name:"PCHR_101089347_200217_0949.pdf",mime_type:"application/pdf",description:"",upload_date:"2017-02-21 14:29:58",entity_table:"civicrm_hrleaveandabsences_leave_request",entity_id:"1",url:"http://civicrm.host/index.php?q=civicrm/file&reset=1&id=1&eid=1"},2:{id:"2",name:"SampleTextFile.txt",mime_type:"text/plain",description:"",upload_date:"2017-02-21 14:31:58",entity_table:"civicrm_hrleaveandabsences_leave_request",entity_id:"1",url:"http://civicrm.host/index.php?q=civicrm/file&reset=1&id=2&eid=1"}}}}}}),define("common/mocks/services/file-uploader-mock",["common/mocks/module","common/mocks/data/file-uploader.data"],function(e,a){"use strict";e.factory("FileUploaderMock",function(){return function(e){function i(){this.onCompleteItem({},a.response),this.onCompleteAll()}return{uploadAll:function(){i.call(this)},onCompleteItem:e.onCompleteItem,onCompleteAll:e.onCompleteAll,onErrorItem:e.onErrorItem,filters:e.filters,onBeforeUploadItem:function(){}}}})}); \ No newline at end of file +define("common/mocks/module",["common/angular"],function(e){"use strict";return e.module("common.mocks",[])}),define("common/mocks/models/instances/session-mock",["common/mocks/module"],function(e){"use strict";e.service("SessionMock",["$q",function(e){function a(){return e.resolve(i)}var i={contactId:"1"};return{get:a,sessionObject:i}}])}),define("common/mocks/services/hr-settings-mock",["common/mocks/module"],function(e){"use strict";e.factory("HR_settingsMock",function(){return{DATE_FORMAT:"dd/MM/yyyy"}})}),define("common/mocks/services/api/appraisal-mock",["common/lodash","common/angular","common/mocks/module"],function(e,a,i){"use strict";i.factory("api.appraisal.mock",["$q",function(i){function t(e){var a=i.defer();return a.resolve(e),a.promise}return{all:function(e,a,i){var n,l,o;return n=i||this.mockedAppraisals().list,e&&(n=n.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),a&&(l=(a.page-1)*a.size,o=l+a.size,n=n.slice(l,o)),t({list:n,total:n.length,allIds:n.map(function(e){return e.id}).join(",")})},create:function(e,i){return t(i||function(){var i=a.copy(e);return i.id=""+Math.ceil(5e3*Math.random()),i.createdAt=Date.now(),i}())},find:function(e,a){return t(a||this.mockedAppraisals().list.filter(function(a){return a.id===e})[0])},overdue:function(e){var a=this.mockedAppraisals().list.slice(0,5);return t({list:a,total:a.length,allIds:a.map(function(e){return e.id}).join(",")})},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedAppraisals:function(){return{total:10,list:[{id:"3451",appraisal_cycle_id:"1",self_appraisal_due:"2016-01-01",manager_appraisal_due:"2016-02-02",grade_due:"2016-03-03",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"2",original_id:"3451",created_date:"2015-01-01",is_current:"1",contact:{id:"201",display_name:"Contact #1"},manager:{id:"301",display_name:"Manager #1"},role:{title:"Role #1",level:"Level #1",location:"Location #1"}},{id:"3452",appraisal_cycle_id:"1",self_appraisal_due:"2016-02-02",manager_appraisal_due:"2016-03-03",grade_due:"2016-04-04",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"3",original_id:"3452",created_date:"2015-02-02",is_current:"1",contact:{id:"202",display_name:"Contact #2"},manager:{id:"302",display_name:"Manager #2"},role:{title:"Role #2",level:"Level #2",location:"Location #2"}},{id:"3453",appraisal_cycle_id:"1",self_appraisal_due:"2016-03-03",manager_appraisal_due:"2016-04-04",grade_due:"2016-05-05",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"2",original_id:"3453",created_date:"2015-03-03",is_current:"1",contact:{id:"203",display_name:"Contact #3"},manager:{id:"303",display_name:"Manager #3"},role:{title:"Role #3",level:"Level #3",location:"Location #3"}},{id:"3454",appraisal_cycle_id:"2",self_appraisal_due:"2016-04-04",manager_appraisal_due:"2016-05-05",grade_due:"2016-06-06",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"3",original_id:"3454",created_date:"2015-04-04",is_current:"1",contact:{id:"204",display_name:"Contact #4"},manager:{id:"304",display_name:"Manager #4"},role:{title:"Role #4",level:"Level #1",location:"Location #1"}},{id:"3455",appraisal_cycle_id:"2",self_appraisal_due:"2016-05-05",manager_appraisal_due:"2016-06-06",grade_due:"2016-07-07",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3455",created_date:"2015-05-05",is_current:"1",contact:{id:"205",display_name:"Contact #5"},manager:{id:"305",display_name:"Manager #5"},role:{title:"Role #5",level:"Level #2",location:"Location #2"}},{id:"3456",appraisal_cycle_id:"2",self_appraisal_due:"2016-06-06",manager_appraisal_due:"2016-07-07",grade_due:"2016-08-08",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3456",created_date:"2015-06-06",is_current:"0",contact:{id:"206",display_name:"Contact #6"},manager:{id:"306",display_name:"Manager #6"},role:{title:"Role #6",level:"Level #3",location:"Location #3"}},{id:"3457",appraisal_cycle_id:"2",self_appraisal_due:"2016-07-07",manager_appraisal_due:"2016-08-08",grade_due:"2016-09-09",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3457",created_date:"2015-07-07",is_current:"0",contact:{id:"207",display_name:"Contact #7"},manager:{id:"307",display_name:"Manager #7"},role:{title:"Role #7",level:"Level #1",location:"Location #1"}},{id:"3458",appraisal_cycle_id:"1",self_appraisal_due:"2016-08-08",manager_appraisal_due:"2016-09-09",grade_due:"2016-10-10",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3458",created_date:"2015-08-08",is_current:"0",contact:{id:"208",display_name:"Contact #8"},manager:{id:"308",display_name:"Manager #8"},role:{title:"Role #8",level:"Level #2",location:"Location #2"}},{id:"3459",appraisal_cycle_id:"1",self_appraisal_due:"2016-09-09",manager_appraisal_due:"2016-10-10",grade_due:"2016-11-11",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"3",original_id:"3459",created_date:"2015-09-09",is_current:"1",contact:{id:"209",display_name:"Contact #9"},manager:{id:"309",display_name:"Manager #9"},role:{title:"Role #9",level:"Level #3",location:"Location #3"}},{id:"3460",appraisal_cycle_id:"3",self_appraisal_due:"2016-10-10",manager_appraisal_due:"2016-11-11",grade_due:"2016-12-12",due_changed:"0",meeting_completed:"0",approved_by_employee:"0",status_id:"1",original_id:"3460",created_date:"2015-10-10",is_current:"1",contact:{id:"213",display_name:"Contact #10"},manager:{id:"313",display_name:"Manager #10"},role:{title:"Role #10",level:"Level #1",location:"Location #1"}}]}}}}])}),define("common/mocks/services/api/appraisal-cycle-mock",["common/lodash","common/angular","common/mocks/module"],function(e,a,i){"use strict";i.factory("api.appraisal-cycle.mock",["$q",function(i){function t(e){var a=i.defer();return a.resolve(e),a.promise}return{all:function(e,a,i){var n,l,o;return n=i||this.mockedCycles().list,e&&(n=n.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),a&&(l=(a.page-1)*a.size,o=l+a.size,n=n.slice(l,o)),t({list:n,total:n.length,allIds:n.map(function(e){return e.id}).join(",")})},create:function(e,i){return t(i||function(){var i=a.copy(e);return i.id=""+Math.ceil(5e3*Math.random()),i.createdAt=Date.now(),i}())},find:function(e,a){return t(a||this.mockedCycles().list.filter(function(a){return a.id===e})[0])},grades:function(e){var a=[{label:"1",value:30},{label:"2",value:10},{label:"3",value:55},{label:"4",value:87},{label:"5",value:54}];return t(e||a)},statuses:function(e){var a=[{id:"1",label:"status 1",value:"1",weight:"1"},{id:"2",label:"status 2",value:"2",weight:"2"}];return t(e||a)},statusOverview:function(e){return t([{status_id:1,status_name:"Awaiting self appraisal",contacts_count:{due:4,overdue:2}},{status_id:2,status_name:"Awaiting manager appraisal",contacts_count:{due:10,overdue:6}},{status_id:3,status_name:"Awaiting grade",contacts_count:{due:20,overdue:12}},{status_id:4,status_name:"Awaiting HR approval",contacts_count:{due:7,overdue:3}},{status_id:5,status_name:"Complete",contacts_count:{due:13,overdue:8}}])},update:function(e,i,n){return t(n||function(){var t=this.mockedCycles().list.filter(function(a){return a.id===e})[0];return a.extend({},t,i)}.bind(this)())},total:function(e,a){var i=this.mockedCycles().list;return e&&(i=i.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),t(i.length)},types:function(e){var a=[{id:"1",label:"type 1",value:"1",weight:"1"},{id:"2",label:"type 2",value:"2",weight:"2"},{id:"3",label:"type 3",value:"3",weight:"3"}];return t(e||a)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedCycles:function(){return{total:10,list:[{id:"42131",cycle_name:"Appraisal Cycle 1",cycle_is_active:!0,cycle_type_id:"2",cycle_start_date:"2014-01-01",cycle_end_date:"2015-01-01",cycle_self_appraisal_due:"2016-01-01",cycle_manager_appraisal_due:"2016-01-02",cycle_grade_due:"2016-01-03"},{id:"42132",cycle_name:"Appraisal Cycle 2",cycle_is_active:!0,cycle_type_id:"1",cycle_start_date:"2014-02-02",cycle_end_date:"2015-02-02",cycle_self_appraisal_due:"2016-02-02",cycle_manager_appraisal_due:"2016-02-04",cycle_grade_due:"2016-02-05"},{id:"42133",cycle_name:"Appraisal Cycle 3",cycle_is_active:!0,cycle_type_id:"2",cycle_start_date:"2014-03-03",cycle_end_date:"2015-03-03",cycle_self_appraisal_due:"2016-03-06",cycle_manager_appraisal_due:"2016-03-07",cycle_grade_due:"2016-03-08"},{id:"42134",cycle_name:"Appraisal Cycle 4",cycle_is_active:!0,cycle_type_id:"3",cycle_start_date:"2014-04-04",cycle_end_date:"2015-04-04",cycle_self_appraisal_due:"2016-04-09",cycle_manager_appraisal_due:"2016-04-10",cycle_grade_due:"2016-04-11"},{id:"42135",cycle_name:"Appraisal Cycle 5",cycle_is_active:!0,cycle_type_id:"3",cycle_start_date:"2014-05-05",cycle_end_date:"2015-05-05",cycle_self_appraisal_due:"2016-05-12",cycle_manager_appraisal_due:"2016-05-13",cycle_grade_due:"2016-05-14"},{id:"42136",cycle_name:"Appraisal Cycle 6",cycle_is_active:!1,cycle_type_id:"1",cycle_start_date:"2014-06-06",cycle_end_date:"2015-06-06",cycle_self_appraisal_due:"2016-06-15",cycle_manager_appraisal_due:"2016-06-16",cycle_grade_due:"2016-06-17"},{id:"4217",cycle_name:"Appraisal Cycle 7",cycle_is_active:!1,cycle_type_id:"2",cycle_start_date:"2014-07-07",cycle_end_date:"2015-07-07",cycle_self_appraisal_due:"2016-07-18",cycle_manager_appraisal_due:"2016-07-19",cycle_grade_due:"2016-07-20"},{id:"42138",cycle_name:"Appraisal Cycle 8",cycle_is_active:!0,cycle_type_id:"1",cycle_start_date:"2014-08-08",cycle_end_date:"2015-08-08",cycle_self_appraisal_due:"2016-08-21",cycle_manager_appraisal_due:"2016-08-22",cycle_grade_due:"2016-08-23"},{id:"42139",cycle_name:"Appraisal Cycle 9",cycle_is_active:!0,cycle_type_id:"1",cycle_start_date:"2014-09-09",cycle_end_date:"2015-09-09",cycle_self_appraisal_due:"2016-09-24",cycle_manager_appraisal_due:"2016-09-25",cycle_grade_due:"2016-09-26"},{id:"421310",cycle_name:"Appraisal Cycle 10",cycle_is_active:!0,cycle_type_id:"4",cycle_start_date:"2014-10-10",cycle_end_date:"2015-10-10",cycle_self_appraisal_due:"2016-10-27",cycle_manager_appraisal_due:"2016-10-28",cycle_grade_due:"2016-10-29"}]}}}}])}),define("common/mocks/data/contact.data",[],function(){return{all:{is_error:0,version:3,count:26,values:[{id:"1",contact_id:"1",display_name:"Dr. Kiara Jensen-Parker",email:"kh.jensen-parker@testing.info",contact_type:"Individual"},{id:"2",contact_id:"2",display_name:"jacobc82@lol.co.pl",email:"cruz.v.jacob@spamalot.com",contact_type:"Individual"},{id:"3",contact_id:"3",display_name:"Mei Müller-Nielsen",email:"mz.mller-nielsen75@infomail.co.pl",contact_type:"Individual"},{id:"4",contact_id:"4",display_name:"Ms. Brigette Deforest",email:"deforest.p.brigette9@fakemail.info",contact_type:"Individual"},{id:"5",contact_id:"5",display_name:"robertsc@testing.net",email:"clintr56@mymail.org",contact_type:"Individual"},{id:"6",contact_id:"6",display_name:"Dr. Allen Samuels Sr.",email:"samuelsa@mymail.org",contact_type:"Individual"},{id:"7",contact_id:"7",display_name:"Mei Wilson",email:"wilson.u.mei59@sample.org",contact_type:"Individual"},{id:"8",contact_id:"8",display_name:"Dr. Betty Díaz",email:"dazb@sample.co.nz",contact_type:"Individual"},{id:"9",contact_id:"9",display_name:"Bob Jones-Dimitrov",email:"bobj@testmail.biz",contact_type:"Individual"},{id:"10",contact_id:"10",display_name:"Truman Samuels III",email:"trumans@spamalot.org",contact_type:"Individual"},{id:"11",contact_id:"11",display_name:"Iris Wagner",email:"iwagner75@notmail.info",contact_type:"Individual"},{id:"12",contact_id:"12",display_name:"Mr. Rosario McReynolds",email:"rosariomcreynolds@testmail.org",contact_type:"Individual"},{id:"13",contact_id:"13",display_name:"Shad Jones-Dimitrov III",email:"shadj@lol.net",contact_type:"Individual"},{id:"14",contact_id:"14",display_name:"Toby Cruz Sr.",email:"",contact_type:"Individual"},{id:"15",contact_id:"15",display_name:"lareedaz61@testing.com",email:"lareedaz61@testing.com",contact_type:"Individual"},{id:"16",contact_id:"16",display_name:"Dr. Jay Deforest",email:"jayd@fishmail.org",contact_type:"Individual"},{id:"17",contact_id:"17",display_name:"Mr. Norris Cruz",email:"norriscruz@spamalot.info",contact_type:"Individual"},{id:"18",contact_id:"18",display_name:"herminiac@fishmail.com",email:"herminiac@fishmail.com",contact_type:"Individual"},{id:"19",contact_id:"19",display_name:"Ashley Terrell",email:"terrell.ashley@testmail.info",contact_type:"Individual"},{id:"20",contact_id:"20",display_name:"Kandace Parker-Díaz",email:"parker-daz.kandace67@fishmail.co.uk",contact_type:"Individual"},{id:"21",contact_id:"21",display_name:"Nicole Samuels",email:"ng.samuels@testmail.net",contact_type:"Individual"},{id:"22",contact_id:"22",display_name:"Dr. Kandace Wattson",email:"kandacewattson@testing.info",contact_type:"Individual"},{id:"23",contact_id:"23",display_name:"Brittney Cruz",email:"cruz.brittney@spamalot.co.nz",contact_type:"Individual"},{id:"24",contact_id:"24",display_name:"Shauna Olsen",email:"",contact_type:"Individual"},{id:"202",contact_id:"202",display_name:"civihr_staff@compucorp.co.uk",email:"civihr_staff@compucorp.co.uk",contact_type:"Individual"},{id:"203",contact_id:"203",display_name:"civihr_manager@compucorp.co.uk",email:"civihr_manager@compucorp.co.uk",contact_type:"Individual"}]}}}),define("common/mocks/services/api/contact-mock",["common/lodash","common/mocks/module","common/mocks/data/contact.data"],function(e,a,i){"use strict";a.factory("api.contact.mock",["$q",function(a){function t(e){var i=a.defer();return i.resolve(e),i.promise}return{all:function(a,n,l,o,c){var r,_,s;return r=c||i.all.values,a&&(r=r.filter(function(i){return Object.keys(a).every(function(t){return null===a[t]||("display_name"===t?new RegExp(a[t],"i").test(i[t]):a[t].IN?e.includes(a[t].IN,i[t]):i[t]===a[t])})})),n&&(_=(n.page-1)*n.size,s=_+n.size,r=r.slice(_,s)),t({list:r,total:r.length,allIds:r.map(function(e){return e.id}).join(",")})},find:function(e,a){return t(a||i.all.values.filter(function(a){return a.id===e})[0])},leaveManagees:function(){return t(this.mockedContacts().list)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedContacts:function(){var e=i.all.values;return{total:e.length,list:e.map(function(e){return e})}}}}])}),define("common/mocks/data/contract.data",["common/lodash"],function(e){return{all:{is_error:0,version:3,count:3,values:[{id:"24",contact_id:"208",is_primary:"1",deleted:"0",is_current:"1","api.HRJobContract.getfulldetails":{details:{id:"27",position:"Developer",title:"Developer",funding_notes:null,contract_type:"Contractor",period_start_date:"2017-06-01",period_end_date:"2017-08-04",end_reason:"3",notice_amount:null,notice_unit:null,notice_amount_employee:null,notice_unit_employee:null,location:null,jobcontract_revision_id:"33"},hour:{id:"27",location_standard_hours:"1",hours_type:null,hours_amount:null,hours_unit:null,hours_fte:"0",fte_num:"0",fte_denom:"0",jobcontract_revision_id:"33"},pay:{id:"24",pay_scale:null,is_paid:"0",pay_amount:null,pay_unit:null,pay_currency:null,pay_annualized_est:null,pay_is_auto_est:"0",annual_benefits:[],annual_deductions:[],pay_cycle:null,pay_per_cycle_gross:null,pay_per_cycle_net:null,jobcontract_revision_id:"33"},health:{id:"24",provider:null,plan_type:null,description:null,dependents:null,provider_life_insurance:null,plan_type_life_insurance:null,description_life_insurance:null,dependents_life_insurance:null,jobcontract_revision_id:"33",healthplan_type_label:null,lifeplan_type_label:null},pension:{id:"25",is_enrolled:null,ee_contrib_pct:null,er_contrib_pct:null,pension_type:null,ee_contrib_abs:null,ee_evidence_note:null,jobcontract_revision_id:"33"},leave:[{id:"70",leave_type:"1",leave_amount:"20",add_public_holidays:"1",jobcontract_revision_id:"33"},{id:"71",leave_type:"2",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"33"},{id:"72",leave_type:"3",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"33"}]}},{id:"209",contact_id:"208",is_primary:"0",deleted:"0",is_current:"0","api.HRJobContract.getfulldetails":{details:{id:"209",position:"Director",title:"Director",funding_notes:null,contract_type:"Contractor",period_start_date:"2018-09-09",period_end_date:"2018-11-10",end_reason:"3",notice_amount:null,notice_unit:null,notice_amount_employee:null,notice_unit_employee:null,location:null,jobcontract_revision_id:"34"},hour:{id:"28",location_standard_hours:"1",hours_type:null,hours_amount:null,hours_unit:null,hours_fte:"0",fte_num:"0",fte_denom:"0",jobcontract_revision_id:"34"},pay:{id:"25",pay_scale:null,is_paid:"0",pay_amount:null,pay_unit:null,pay_currency:null,pay_annualized_est:null,pay_is_auto_est:"0",annual_benefits:[],annual_deductions:[],pay_cycle:null,pay_per_cycle_gross:null,pay_per_cycle_net:null,jobcontract_revision_id:"34"},health:{id:"25",provider:null,plan_type:null,description:null,dependents:null,provider_life_insurance:null,plan_type_life_insurance:null,description_life_insurance:null,dependents_life_insurance:null,jobcontract_revision_id:"34",healthplan_type_label:null,lifeplan_type_label:null},pension:{id:"26",is_enrolled:null,ee_contrib_pct:null,er_contrib_pct:null,pension_type:null,ee_contrib_abs:null,ee_evidence_note:null,jobcontract_revision_id:"34"},leave:[{id:"76",leave_type:"1",leave_amount:"20",add_public_holidays:"1",jobcontract_revision_id:"34"},{id:"77",leave_type:"2",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"34"},{id:"78",leave_type:"3",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"34"}]}},{id:"25",contact_id:"208",is_primary:"0",deleted:"0",is_current:"1","api.HRJobContract.getfulldetails":{details:{id:"28",position:"Team Lead",title:"Team Lead",funding_notes:null,contract_type:"Contractor",period_start_date:"2017-09-09",period_end_date:"2017-11-10",end_reason:"3",notice_amount:null,notice_unit:null,notice_amount_employee:null,notice_unit_employee:null,location:null,jobcontract_revision_id:"34"},hour:{id:"28",location_standard_hours:"1",hours_type:null,hours_amount:null,hours_unit:null,hours_fte:"0",fte_num:"0",fte_denom:"0",jobcontract_revision_id:"34"},pay:{id:"25",pay_scale:null,is_paid:"0",pay_amount:null,pay_unit:null,pay_currency:null,pay_annualized_est:null,pay_is_auto_est:"0",annual_benefits:[],annual_deductions:[],pay_cycle:null,pay_per_cycle_gross:null,pay_per_cycle_net:null,jobcontract_revision_id:"34"},health:{id:"25",provider:null,plan_type:null,description:null,dependents:null,provider_life_insurance:null,plan_type_life_insurance:null,description_life_insurance:null,dependents_life_insurance:null,jobcontract_revision_id:"34",healthplan_type_label:null,lifeplan_type_label:null},pension:{id:"26",is_enrolled:null,ee_contrib_pct:null,er_contrib_pct:null,pension_type:null,ee_contrib_abs:null,ee_evidence_note:null,jobcontract_revision_id:"34"},leave:[{id:"73",leave_type:"1",leave_amount:"20",add_public_holidays:"1",jobcontract_revision_id:"34"},{id:"74",leave_type:"2",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"34"},{id:"75",leave_type:"3",leave_amount:"0",add_public_holidays:"0",jobcontract_revision_id:"34"}]}}]}}}),define("common/mocks/services/api/contract-mock",["common/lodash","common/mocks/module","common/mocks/data/contract.data"],function(e,a,i){"use strict";a.factory("api.contract.mock",["$q",function(a){function t(a){var i=e.clone(a);return i.info=i["api.HRJobContract.getfulldetails"],delete i["api.HRJobContract.getfulldetails"],i}return{all:function(e){return a(function(e,a){e(i.all.values.map(t))})},mockedContracts:function(){return i.all.values.map(t)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))}}}])}),define("common/mocks/services/api/option-group-mock",["common/lodash","common/mocks/module"],function(e,a){"use strict";a.factory("api.optionGroup.mock",["$q",function(a){function i(e){var i=a.defer();return i.resolve(e),i.promise}return{valuesOf:function(a){var t;return t=e.isArray(a)?e.pick(this.mockedOptionValues(),a):this.mockedOptionValues()[a],i(t)},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedOptionValues:function(){return{hrjc_department:[{id:"1",option_group_id:"1",is_reserved:"1",is_active:"1",label:"Finance",name:"finance",option_group_name:"hrjc_department",value:"1",weight:"1"},{id:"2",option_group_id:"1",is_reserved:"1",is_active:"1",label:"HR",name:"hr",option_group_name:"hrjc_department",value:"2",weight:"2"},{id:"3",option_group_id:"1",is_reserved:"1",is_active:"1",label:"IT",name:"it",option_group_name:"hrjc_department",value:"3",weight:"3"},{id:"4",option_group_id:"1",is_reserved:"1",is_active:"1",label:"Fundraising",name:"fundraising",option_group_name:"hrjc_department",value:"4",weight:"4"},{id:"5",option_group_id:"1",is_reserved:"1",is_active:"1",label:"Marketing",name:"marketing",option_group_name:"hrjc_department",value:"5",weight:"5"}],hrjc_level_type:[{id:"6",option_group_id:"2",is_reserved:"1",is_active:"1",label:"Senior Manager",name:"seniormanager",option_group_name:"hrjc_level_type",value:"1",weight:"1"},{id:"7",option_group_id:"2",is_reserved:"1",is_active:"1",label:"Junior Manager",name:"juniormanager",option_group_name:"hrjc_level_type",value:"2",weight:"2"},{id:"8",option_group_id:"2",is_reserved:"1",is_active:"1",label:"Senior Staff",name:"seniorstaff",option_group_name:"hrjc_level_type",value:"3",weight:"3"},{id:"9",option_group_id:"2",is_reserved:"1",is_active:"1",label:"Junior Manager",name:"juniorstaff",option_group_name:"hrjc_level_type",value:"4",weight:"4"}],hrjc_location:[{id:"10",option_group_id:"3",is_reserved:"1",is_active:"1",label:"Headquarters",name:"headquarters",option_group_name:"hrjc_location",value:"1",weight:"1"},{id:"11",option_group_id:"3",is_reserved:"1",is_active:"1",label:"Home or Home-Office",name:"home",option_group_name:"hrjc_location",value:"2",weight:"2"}],hrjc_region:[{id:"12",option_group_id:"4",is_reserved:"1",is_active:"1",label:"Region #1",name:"region1",option_group_name:"hrjc_region",value:"1",weight:"1"},{id:"13",option_group_id:"4",is_reserved:"1",is_active:"1",label:"Region #2",name:"region2",option_group_name:"hrjc_region",value:"2",weight:"2"}],hrleaveandabsences_absence_type_calculation_unit:[{id:"14",option_group_id:"5",is_reserved:"1",is_active:"1",label:"Days",name:"days",option_group_name:"hrleaveandabsences_absence_type_calculation_unit",value:"1",weight:"1"},{id:"15",option_group_id:"5",is_reserved:"1",is_active:"1",label:"Hours",name:"hours",option_group_name:"hrleaveandabsences_absence_type_calculation_unit",value:"2",weight:"2"}]}}}}])}),define("common/mocks/services/api/contact-job-role-api.api.mock",["common/lodash","common/mocks/module","common/mocks/services/api/contact-mock","common/mocks/services/api/option-group-mock"],function(e,a){"use strict";a.factory("ContactJobRoleAPIMock",["$q","api.contact.mock","api.optionGroup.mock",function(a,i,t){var n=i.mockedContacts().list,l=t.mockedOptionValues();return{all:function(e,i,t){var n,l,o;return n=t||this.mockedContactJobRoles.list,e&&(n=n.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),i&&(l=(i.page-1)*i.size,o=l+i.size,n=n.slice(l,o)),a.resolve({list:n})},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedContactJobRoles:{list:function(){var a=0;return n.map(function(i){return a+=Math.ceil(100*Math.random()),{id:""+a,title:"Job Role #"+a,department:e.sample(l.hrjc_department).id,level_type:e.sample(l.hrjc_level_type).id,location:e.sample(l.hrjc_location).id,contact_id:i.id}})}()}}}])}),define("common/mocks/services/api/group-mock",["common/lodash","common/mocks/module"],function(e,a){"use strict";a.factory("api.group.mock",["$q",function(a){function i(e){var i=a.defer();return i.resolve(e),i.promise}return{all:function(e,a,t){var n,l,o;return n=t||this.mockedGroups().list,e&&(n=n.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),a&&(l=(a.page-1)*a.size,o=l+a.size,n=n.slice(l,o)),i({list:n,total:n.length,allIds:n.map(function(e){return e.id}).join(",")})},find:function(e,a){return i(a||this.mockedGroups().list.filter(function(a){return a.id===e})[0])},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedGroups:function(){return{total:5,list:[{id:"1",name:"Administrators",title:"Administrators",description:"Contacts in this group are assigned Administrator role permissions.",is_active:"1",visibility:"User and User Admin Only",group_type:["1"],is_hidden:"0",is_reserved:"0"},{id:"2",name:"Newsletter Subscribers",title:"Newsletter Subscribers",is_active:'"1',visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"3",name:"Summer Program Volunteers",title:"Summer Program Volunteers",is_active:"1",visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"4",name:"Advisory Board",title:"Advisory Board",is_active:"1",visibility:"Public Pages",where_clause:"...",select_tables:"...",where_tables:"...",group_type:["1","2"],is_hidden:"0",is_reserved:"0"},{id:"5",name:"Case_Resources",title:"Case Resources",description:"Contacts in this group are listed with their phone number and email when viewing case. You also can send copies of case activities to these contacts.",is_active:"1",visibility:"User and User Admin Only",where_clause:"...",select_tables:"...",where_tables:"...",group_type:"2",is_hidden:"0",is_reserved:"0"}]}}}}])}),define("common/mocks/services/api/group-contact-mock",["common/lodash","common/mocks/module","common/mocks/services/api/contact-mock","common/mocks/services/api/group-mock"],function(e,a){"use strict";a.factory("api.group-contact.mock",["$q","api.contact.mock","api.group.mock",function(a,i,t){function n(a){return e.sample(a)}function l(e){var i=a.defer();return i.resolve(e),i.promise}var o=i.mockedContacts().list,c=t.mockedGroups().list;return{all:function(e,a,i){var t,n,o;return t=i||this.mockedGroupsContacts.list,e&&(t=t.filter(function(a){return Object.keys(e).every(function(i){return a[i]===e[i]})})),a&&(n=(a.page-1)*a.size,o=n+a.size,t=t.slice(n,o)),l({list:t,total:t.length,allIds:t.map(function(e){return e.id}).join(",")})},spyOnMethods:function(){e.functions(this).forEach(function(e){spyOn(this,e).and.callThrough()}.bind(this))},mockedGroupsContacts:{total:o.length,list:function(){var e=1;return o.map(function(a){return{id:""+e++,group_id:n(c).id,contact_id:a.id,status:"Added"}})}()}}}])}),define("common/mocks/data/file-uploader.data",[],function(){return{response:{file:{is_error:0,version:3,count:1,id:1,values:{1:{id:"1",name:"PCHR_101089347_200217_0949.pdf",mime_type:"application/pdf",description:"",upload_date:"2017-02-21 14:29:58",entity_table:"civicrm_hrleaveandabsences_leave_request",entity_id:"1",url:"http://civicrm.host/index.php?q=civicrm/file&reset=1&id=1&eid=1"},2:{id:"2",name:"SampleTextFile.txt",mime_type:"text/plain",description:"",upload_date:"2017-02-21 14:31:58",entity_table:"civicrm_hrleaveandabsences_leave_request",entity_id:"1",url:"http://civicrm.host/index.php?q=civicrm/file&reset=1&id=2&eid=1"}}}}}}),define("common/mocks/services/file-uploader-mock",["common/mocks/module","common/mocks/data/file-uploader.data"],function(e,a){"use strict";e.factory("FileUploaderMock",function(){return function(e){function i(){this.onCompleteItem({},a.response),this.onCompleteAll()}return{uploadAll:function(){i.call(this)},onCompleteItem:e.onCompleteItem,onCompleteAll:e.onCompleteAll,onErrorItem:e.onErrorItem,filters:e.filters,onBeforeUploadItem:function(){}}}})}); \ No newline at end of file diff --git a/org.civicrm.reqangular/js/src/common/bundles/vendors.js b/org.civicrm.reqangular/js/src/common/bundles/vendors.js index fdd6d28a88a..8027d65c146 100644 --- a/org.civicrm.reqangular/js/src/common/bundles/vendors.js +++ b/org.civicrm.reqangular/js/src/common/bundles/vendors.js @@ -1,7 +1,6 @@ /* eslint-env amd */ define([ - 'common/require', 'common/angular', 'common/angularAnimate', 'common/angularBootstrap', diff --git a/org.civicrm.reqangular/js/src/common/components/notification-badge.component.js b/org.civicrm.reqangular/js/src/common/components/notification-badge.component.js index 3d47d69b240..ef9f3b77b28 100644 --- a/org.civicrm.reqangular/js/src/common/components/notification-badge.component.js +++ b/org.civicrm.reqangular/js/src/common/components/notification-badge.component.js @@ -25,10 +25,12 @@ define([ var vm = this; vm.count = 0; - (function init () { + vm.$onInit = $onInit; + + function $onInit () { initListeners(); fetchCount(); - })(); + } /** * Fetch count of records which matches the filter diff --git a/org.civicrm.reqangular/js/src/common/models/contact.js b/org.civicrm.reqangular/js/src/common/models/contact.js index 7dff83b595e..46254074e03 100644 --- a/org.civicrm.reqangular/js/src/common/models/contact.js +++ b/org.civicrm.reqangular/js/src/common/models/contact.js @@ -7,14 +7,15 @@ define([ 'common/models/contact-job-role.model', 'common/models/group', 'common/models/job-role', + 'common/models/session.model', 'common/models/instances/contact-instance', 'common/services/api/contact' ], function (_, models) { 'use strict'; models.factory('Contact', [ - '$q', 'Model', 'api.contact', 'Group', 'JobRole', 'ContactJobRole', 'ContactInstance', - function ($q, Model, contactAPI, Group, JobRole, ContactJobRole, instance) { + '$q', 'api.contact', 'ContactInstance', 'ContactJobRole', 'Group', 'JobRole', 'Model', 'Session', + function ($q, contactAPI, instance, ContactJobRole, Group, JobRole, Model, Session) { var groupFiltersKeys = ['group_id']; var jobRoleFiltersKeys = ['region', 'department', 'level_type', 'location']; @@ -149,6 +150,18 @@ define([ }); }, + /** + * Resolves the instance of the currently logged in contact + * + * @return {Promise} resolves with {ContactInstance} + */ + getLoggedIn: function () { + return Session.get() + .then(function (loggedInContact) { + return this.find(loggedInContact.contactId); + }.bind(this)); + }, + /** * Finds all the contacts managed by the sent contact id * diff --git a/org.civicrm.reqangular/js/src/common/models/instances/contact-instance.js b/org.civicrm.reqangular/js/src/common/models/instances/contact-instance.js index 1d741ba1208..cde17a8bf7d 100644 --- a/org.civicrm.reqangular/js/src/common/models/instances/contact-instance.js +++ b/org.civicrm.reqangular/js/src/common/models/instances/contact-instance.js @@ -1,8 +1,11 @@ +/* eslint-env amd, jasmine */ + define([ + 'common/lodash', 'common/modules/models-instances', 'common/models/instances/instance', - 'common/services/api/contact', -], function (instances) { + 'common/services/api/contact' +], function (_, instances) { 'use strict'; instances.factory('ContactInstance', ['ModelInstance', 'api.contact', @@ -16,6 +19,18 @@ define([ */ leaveManagees: function (params) { return ContactAPI.leaveManagees(this.id, params); + }, + + /** + * Checks if the contact is a self leave approver + * + * @return {Promise} resolved with a {Boolean} + */ + checkIfSelfLeaveApprover: function () { + return this.leaveManagees() + .then(function (contactLeaveManagees) { + return !!_.find(contactLeaveManagees, { id: this.id }); + }.bind(this)); } }); }]); diff --git a/org.civicrm.reqangular/js/src/common/vendor/angular/angular-animate.min.js b/org.civicrm.reqangular/js/src/common/vendor/angular/angular-animate.min.js index cabd0cfe67f..3c83695e515 100644 --- a/org.civicrm.reqangular/js/src/common/vendor/angular/angular-animate.min.js +++ b/org.civicrm.reqangular/js/src/common/vendor/angular/angular-animate.min.js @@ -1,57 +1,57 @@ /* - AngularJS v1.5.9 - (c) 2010-2016 Google, Inc. http://angularjs.org + AngularJS v1.7.2 + (c) 2010-2018 Google, Inc. http://angularjs.org License: MIT */ -(function(R,B){'use strict';function Da(a,b,c){if(!a)throw Ma("areq",b||"?",c||"required");return a}function Ea(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;X(a)&&(a=a.join(" "));X(b)&&(b=b.join(" "));return a+" "+b}function Na(a){var b={};a&&(a.to||a.from)&&(b.to=a.to,b.from=a.from);return b}function Y(a,b,c){var d="";a=X(a)?a:a&&G(a)&&a.length?a.split(/\s+/):[];s(a,function(a,l){a&&0=a&&(a=e,e=0,b.push(k),k=[]);k.push(g.fn);g.children.forEach(function(a){e++;c.push(a)});a--}k.length&&b.push(k);return b}(c)}var u=[],C=Z(a);return function(n,Q,t){function H(a){a= -a.hasAttribute("ng-animate-ref")?[a]:a.querySelectorAll("[ng-animate-ref]");var b=[];s(a,function(a){var c=a.getAttribute("ng-animate-ref");c&&c.length&&b.push(a)});return b}function T(a){var b=[],c={};s(a,function(a,d){var h=y(a.element),e=0<=["enter","move"].indexOf(a.event),h=a.structural?H(h):[];if(h.length){var k=e?"to":"from";s(h,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]||{};c[b][k]={animationID:d,element:F(a)}})}else b.push(a)});var d={},e={};s(c,function(c,k){var r=c.from, -p=c.to;if(r&&p){var z=a[r.animationID],g=a[p.animationID],A=r.animationID.toString();if(!e[A]){var n=e[A]={structural:!0,beforeStart:function(){z.beforeStart();g.beforeStart()},close:function(){z.close();g.close()},classes:O(z.classes,g.classes),from:z,to:g,anchors:[]};n.classes.length?b.push(n):(b.push(z),b.push(g))}e[A].anchors.push({out:r.element,"in":p.element})}else r=r?r.animationID:p.animationID,p=r.toString(),d[p]||(d[p]=!0,b.push(a[r]))});return b}function O(a,b){a=a.split(" ");b=b.split(" "); -for(var c=[],d=0;d=R&&b>=m&&(F=!0,k())}function N(){function b(){if(!w){M(!1);s(x,function(a){h.style[a[0]]=a[1]});T(a,f);e.addClass(a,ea);if(q.recalculateTimingStyles){na= -h.className+" "+ga;ia=B(h,na);D=H(h,na,ia);ca=D.maxDelay;J=Math.max(ca,0);m=D.maxDuration;if(0===m){k();return}q.hasTransitions=0l.expectedEndTime)?n.cancel(l.timer):g.push(k)}N&&(p=n(c,p,!1),g[0]={timer:p,expectedEndTime:d},g.push(k),a.data("$$animateCss",g));if(fa.length)a.on(fa.join(" "),z);f.to&&(f.cleanupStyles&&Ka(A,h,Object.keys(f.to)),Ga(a,f))}}function c(){var b=a.data("$$animateCss");if(b){for(var d=1;d=a&&(a=h,h=0,b.push(e),e=[]);e.push(g.fn);g.children.forEach(function(a){h++;c.push(a)});a--}e.length&&b.push(e);return b}(c)}var l=[],J=X(a);return function(r,m,v){function E(a){a=a.hasAttribute("ng-animate-ref")? +[a]:a.querySelectorAll("[ng-animate-ref]");var b=[];t(a,function(a){var c=a.getAttribute("ng-animate-ref");c&&c.length&&b.push(a)});return b}function h(a){var b=[],c={};t(a,function(a,d){var k=I(a.element),h=0<=["enter","move"].indexOf(a.event),k=a.structural?E(k):[];if(k.length){var e=h?"to":"from";t(k,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]||{};c[b][e]={animationID:d,element:z(a)}})}else b.push(a)});var d={},h={};t(c,function(c,e){var g=c.from,q=c.to;if(g&&q){var C=a[g.animationID], +p=a[q.animationID],y=g.animationID.toString();if(!h[y]){var n=h[y]={structural:!0,beforeStart:function(){C.beforeStart();p.beforeStart()},close:function(){C.close();p.close()},classes:L(C.classes,p.classes),from:C,to:p,anchors:[]};n.classes.length?b.push(n):(b.push(C),b.push(p))}h[y].anchors.push({out:g.element,"in":q.element})}else g=g?g.animationID:q.animationID,q=g.toString(),d[q]||(d[q]=!0,b.push(a[g]))});return b}function L(a,b){a=a.split(" ");b=b.split(" ");for(var c=[],d=0;d=P&&b>=M&&(ba=!0,n()))}function ga(){function b(){if(!L){K(!1);t(x,function(a){k.style[a[0]]=a[1]});h(a,f); +g.addClass(a,ca);if(s.recalculateTimingStyles){ma=k.getAttribute("class")+" "+fa;ja=m(k,ma);A=E(k,ma,ja);$=A.maxDelay;w=Math.max($,0);M=A.maxDuration;if(0===M){n();return}s.hasTransitions=0F.expectedEndTime)?r.cancel(F.timer):e.push(n)}p&&(l=r(c,l,!1),e[0]={timer:l,expectedEndTime:d},e.push(n),a.data("$$animateCss",e));if(ea.length)a.on(ea.join(" "),y);f.to&&(f.cleanupStyles&&Ma(q,k,Object.keys(f.to)),Ia(a,f))}}function c(){var b= +a.data("$$animateCss");if(b){for(var d=1;d 4, - args = hasParams ? Array.prototype.slice.call(arguments, 4) : [], - iteration = 0, - skipApply = (angular.isDefined(invokeApply) && !invokeApply), - deferred = (skipApply ? $$q : $q).defer(), - promise = deferred.promise; - - count = (angular.isDefined(count)) ? count : 0; - promise.then(null, null, (!hasParams) ? fn : function() { - fn.apply(null, args); - }); + angular.mock.$IntervalProvider = function () { + this.$get = ['$browser', '$rootScope', '$q', '$$q', + function ($browser, $rootScope, $q, $$q) { + var repeatFns = [], + nextRepeatId = 0, + now = 0; + + var $interval = function (fn, delay, count, invokeApply) { + var hasParams = arguments.length > 4, + args = hasParams ? Array.prototype.slice.call(arguments, 4) : [], + iteration = 0, + skipApply = (angular.isDefined(invokeApply) && !invokeApply), + deferred = (skipApply ? $$q : $q).defer(), + promise = deferred.promise; + + count = (angular.isDefined(count)) ? count : 0; + promise.then(null, function () {}, (!hasParams) ? fn : function () { + fn.apply(null, args); + }); - promise.$$intervalId = nextRepeatId; + promise.$$intervalId = nextRepeatId; - function tick() { - deferred.notify(iteration++); + function tick () { + deferred.notify(iteration++); - if (count > 0 && iteration >= count) { - var fnIndex; - deferred.resolve(iteration); + if (count > 0 && iteration >= count) { + var fnIndex; + deferred.resolve(iteration); - angular.forEach(repeatFns, function(fn, index) { - if (fn.id === promise.$$intervalId) fnIndex = index; - }); + angular.forEach(repeatFns, function (fn, index) { + if (fn.id === promise.$$intervalId) fnIndex = index; + }); - if (angular.isDefined(fnIndex)) { - repeatFns.splice(fnIndex, 1); - } - } + if (angular.isDefined(fnIndex)) { + repeatFns.splice(fnIndex, 1); + } + } - if (skipApply) { - $browser.defer.flush(); - } else { - $rootScope.$apply(); - } - } + if (skipApply) { + $browser.defer.flush(); + } else { + $rootScope.$apply(); + } + } - repeatFns.push({ - nextTime:(now + delay), - delay: delay, - fn: tick, - id: nextRepeatId, - deferred: deferred - }); - repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;}); + repeatFns.push({ + nextTime: (now + (delay || 0)), + delay: delay || 1, + fn: tick, + id: nextRepeatId, + deferred: deferred + }); + repeatFns.sort(function (a, b) { return a.nextTime - b.nextTime; }); - nextRepeatId++; - return promise; - }; - /** + nextRepeatId++; + return promise; + }; + /** * @ngdoc method * @name $interval#cancel * @@ -514,24 +524,25 @@ angular.mock.$IntervalProvider = function() { * @param {promise} promise A promise from calling the `$interval` function. * @returns {boolean} Returns `true` if the task was successfully cancelled. */ - $interval.cancel = function(promise) { - if (!promise) return false; - var fnIndex; + $interval.cancel = function (promise) { + if (!promise) return false; + var fnIndex; - angular.forEach(repeatFns, function(fn, index) { - if (fn.id === promise.$$intervalId) fnIndex = index; - }); + angular.forEach(repeatFns, function (fn, index) { + if (fn.id === promise.$$intervalId) fnIndex = index; + }); - if (angular.isDefined(fnIndex)) { - repeatFns[fnIndex].deferred.reject('canceled'); - repeatFns.splice(fnIndex, 1); - return true; - } + if (angular.isDefined(fnIndex)) { + repeatFns[fnIndex].deferred.promise.then(undefined, function () {}); + repeatFns[fnIndex].deferred.reject('canceled'); + repeatFns.splice(fnIndex, 1); + return true; + } - return false; - }; + return false; + }; - /** + /** * @ngdoc method * @name $interval#flush * @description @@ -542,66 +553,70 @@ angular.mock.$IntervalProvider = function() { * * @return {number} The amount of time moved forward. */ - $interval.flush = function(millis) { - now += millis; - while (repeatFns.length && repeatFns[0].nextTime <= now) { - var task = repeatFns[0]; - task.fn(); - task.nextTime += task.delay; - repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;}); - } - return millis; - }; - - return $interval; - }]; -}; + $interval.flush = function (millis) { + var before = now; + now += millis; + while (repeatFns.length && repeatFns[0].nextTime <= now) { + var task = repeatFns[0]; + task.fn(); + if (task.nextTime === before) { + // this can only happen the first time + // a zero-delay interval gets triggered + task.nextTime++; + } + task.nextTime += task.delay; + repeatFns.sort(function (a, b) { return a.nextTime - b.nextTime; }); + } + return millis; + }; + return $interval; + }]; + }; -function jsonStringToDate(string) { + function jsonStringToDate (string) { // The R_ISO8061_STR regex is never going to fit into the 100 char limit! // eslit-disable-next-line max-len - var R_ISO8061_STR = /^(-?\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/; + var R_ISO8061_STR = /^(-?\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/; - var match; - if ((match = string.match(R_ISO8061_STR))) { - var date = new Date(0), + var match; + if ((match = string.match(R_ISO8061_STR))) { + var date = new Date(0), tzHour = 0, - tzMin = 0; - if (match[9]) { - tzHour = toInt(match[9] + match[10]); - tzMin = toInt(match[9] + match[11]); + tzMin = 0; + if (match[9]) { + tzHour = toInt(match[9] + match[10]); + tzMin = toInt(match[9] + match[11]); + } + date.setUTCFullYear(toInt(match[1]), toInt(match[2]) - 1, toInt(match[3])); + date.setUTCHours(toInt(match[4] || 0) - tzHour, + toInt(match[5] || 0) - tzMin, + toInt(match[6] || 0), + toInt(match[7] || 0)); + return date; } - date.setUTCFullYear(toInt(match[1]), toInt(match[2]) - 1, toInt(match[3])); - date.setUTCHours(toInt(match[4] || 0) - tzHour, - toInt(match[5] || 0) - tzMin, - toInt(match[6] || 0), - toInt(match[7] || 0)); - return date; - } - return string; -} - -function toInt(str) { - return parseInt(str, 10); -} - -function padNumberInMock(num, digits, trim) { - var neg = ''; - if (num < 0) { - neg = '-'; - num = -num; + return string; } - num = '' + num; - while (num.length < digits) num = '0' + num; - if (trim) { - num = num.substr(num.length - digits); + + function toInt (str) { + return parseInt(str, 10); } - return neg + num; -} + function padNumberInMock (num, digits, trim) { + var neg = ''; + if (num < 0) { + neg = '-'; + num = -num; + } + num = '' + num; + while (num.length < digits) num = '0' + num; + if (trim) { + num = num.substr(num.length - digits); + } + return neg + num; + } -/** + /** * @ngdoc type * @name angular.mock.TzDate * @description @@ -638,136 +653,135 @@ function padNumberInMock(num, digits, trim) { * ``` * */ -angular.mock.TzDate = function(offset, timestamp) { - var self = new Date(0); - if (angular.isString(timestamp)) { - var tsStr = timestamp; + angular.mock.TzDate = function (offset, timestamp) { + var self = new Date(0); + if (angular.isString(timestamp)) { + var tsStr = timestamp; - self.origDate = jsonStringToDate(timestamp); + self.origDate = jsonStringToDate(timestamp); - timestamp = self.origDate.getTime(); - if (isNaN(timestamp)) { + timestamp = self.origDate.getTime(); + if (isNaN(timestamp)) { // eslint-disable-next-line no-throw-literal - throw { - name: 'Illegal Argument', - message: 'Arg \'' + tsStr + '\' passed into TzDate constructor is not a valid date string' - }; + throw { + name: 'Illegal Argument', + message: 'Arg \'' + tsStr + '\' passed into TzDate constructor is not a valid date string' + }; + } + } else { + self.origDate = new Date(timestamp); } - } else { - self.origDate = new Date(timestamp); - } - var localOffset = new Date(timestamp).getTimezoneOffset(); - self.offsetDiff = localOffset * 60 * 1000 - offset * 1000 * 60 * 60; - self.date = new Date(timestamp + self.offsetDiff); + var localOffset = new Date(timestamp).getTimezoneOffset(); + self.offsetDiff = localOffset * 60 * 1000 - offset * 1000 * 60 * 60; + self.date = new Date(timestamp + self.offsetDiff); - self.getTime = function() { - return self.date.getTime() - self.offsetDiff; - }; + self.getTime = function () { + return self.date.getTime() - self.offsetDiff; + }; - self.toLocaleDateString = function() { - return self.date.toLocaleDateString(); - }; + self.toLocaleDateString = function () { + return self.date.toLocaleDateString(); + }; - self.getFullYear = function() { - return self.date.getFullYear(); - }; + self.getFullYear = function () { + return self.date.getFullYear(); + }; - self.getMonth = function() { - return self.date.getMonth(); - }; + self.getMonth = function () { + return self.date.getMonth(); + }; - self.getDate = function() { - return self.date.getDate(); - }; + self.getDate = function () { + return self.date.getDate(); + }; - self.getHours = function() { - return self.date.getHours(); - }; + self.getHours = function () { + return self.date.getHours(); + }; - self.getMinutes = function() { - return self.date.getMinutes(); - }; + self.getMinutes = function () { + return self.date.getMinutes(); + }; - self.getSeconds = function() { - return self.date.getSeconds(); - }; + self.getSeconds = function () { + return self.date.getSeconds(); + }; - self.getMilliseconds = function() { - return self.date.getMilliseconds(); - }; + self.getMilliseconds = function () { + return self.date.getMilliseconds(); + }; - self.getTimezoneOffset = function() { - return offset * 60; - }; + self.getTimezoneOffset = function () { + return offset * 60; + }; - self.getUTCFullYear = function() { - return self.origDate.getUTCFullYear(); - }; + self.getUTCFullYear = function () { + return self.origDate.getUTCFullYear(); + }; - self.getUTCMonth = function() { - return self.origDate.getUTCMonth(); - }; + self.getUTCMonth = function () { + return self.origDate.getUTCMonth(); + }; - self.getUTCDate = function() { - return self.origDate.getUTCDate(); - }; + self.getUTCDate = function () { + return self.origDate.getUTCDate(); + }; - self.getUTCHours = function() { - return self.origDate.getUTCHours(); - }; + self.getUTCHours = function () { + return self.origDate.getUTCHours(); + }; - self.getUTCMinutes = function() { - return self.origDate.getUTCMinutes(); - }; + self.getUTCMinutes = function () { + return self.origDate.getUTCMinutes(); + }; - self.getUTCSeconds = function() { - return self.origDate.getUTCSeconds(); - }; + self.getUTCSeconds = function () { + return self.origDate.getUTCSeconds(); + }; - self.getUTCMilliseconds = function() { - return self.origDate.getUTCMilliseconds(); - }; + self.getUTCMilliseconds = function () { + return self.origDate.getUTCMilliseconds(); + }; - self.getDay = function() { - return self.date.getDay(); - }; + self.getDay = function () { + return self.date.getDay(); + }; - // provide this method only on browsers that already have it - if (self.toISOString) { - self.toISOString = function() { - return padNumberInMock(self.origDate.getUTCFullYear(), 4) + '-' + + // provide this method only on browsers that already have it + if (self.toISOString) { + self.toISOString = function () { + return padNumberInMock(self.origDate.getUTCFullYear(), 4) + '-' + padNumberInMock(self.origDate.getUTCMonth() + 1, 2) + '-' + padNumberInMock(self.origDate.getUTCDate(), 2) + 'T' + padNumberInMock(self.origDate.getUTCHours(), 2) + ':' + padNumberInMock(self.origDate.getUTCMinutes(), 2) + ':' + padNumberInMock(self.origDate.getUTCSeconds(), 2) + '.' + padNumberInMock(self.origDate.getUTCMilliseconds(), 3) + 'Z'; - }; - } + }; + } - //hide all methods not implemented in this mock that the Date prototype exposes - var unimplementedMethods = ['getUTCDay', + // hide all methods not implemented in this mock that the Date prototype exposes + var unimplementedMethods = ['getUTCDay', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toJSON', 'toLocaleFormat', 'toLocaleString', 'toLocaleTimeString', 'toSource', 'toString', 'toTimeString', 'toUTCString', 'valueOf']; - angular.forEach(unimplementedMethods, function(methodName) { - self[methodName] = function() { - throw new Error('Method \'' + methodName + '\' is not implemented in the TzDate mock'); - }; - }); - - return self; -}; + angular.forEach(unimplementedMethods, function (methodName) { + self[methodName] = function () { + throw new Error('Method \'' + methodName + '\' is not implemented in the TzDate mock'); + }; + }); -//make "tzDateInstance instanceof Date" return true -angular.mock.TzDate.prototype = Date.prototype; + return self; + }; + // make "tzDateInstance instanceof Date" return true + angular.mock.TzDate.prototype = Date.prototype; -/** + /** * @ngdoc service * @name $animate * @@ -777,94 +791,94 @@ angular.mock.TzDate.prototype = Date.prototype; * * You need to require the `ngAnimateMock` module in your test suite for instance `beforeEach(module('ngAnimateMock'))` */ -angular.mock.animate = angular.module('ngAnimateMock', ['ng']) - - .config(['$provide', function($provide) { + angular.mock.animate = angular.module('ngAnimateMock', ['ng']) + .info({ angularVersion: '1.7.2' }) - $provide.factory('$$forceReflow', function() { - function reflowFn() { - reflowFn.totalReflows++; - } - reflowFn.totalReflows = 0; - return reflowFn; - }); + .config(['$provide', function ($provide) { + $provide.factory('$$forceReflow', function () { + function reflowFn () { + reflowFn.totalReflows++; + } + reflowFn.totalReflows = 0; + return reflowFn; + }); - $provide.factory('$$animateAsyncRun', function() { - var queue = []; - var queueFn = function() { - return function(fn) { - queue.push(fn); + $provide.factory('$$animateAsyncRun', function () { + var queue = []; + var queueFn = function () { + return function (fn) { + queue.push(fn); + }; }; - }; - queueFn.flush = function() { - if (queue.length === 0) return false; + queueFn.flush = function () { + if (queue.length === 0) return false; - for (var i = 0; i < queue.length; i++) { - queue[i](); - } - queue = []; + for (var i = 0; i < queue.length; i++) { + queue[i](); + } + queue = []; - return true; - }; - return queueFn; - }); + return true; + }; + return queueFn; + }); - $provide.decorator('$$animateJs', ['$delegate', function($delegate) { - var runners = []; + $provide.decorator('$$animateJs', ['$delegate', function ($delegate) { + var runners = []; - var animateJsConstructor = function() { - var animator = $delegate.apply($delegate, arguments); - // If no javascript animation is found, animator is undefined - if (animator) { - runners.push(animator); - } - return animator; - }; + var animateJsConstructor = function () { + var animator = $delegate.apply($delegate, arguments); + // If no javascript animation is found, animator is undefined + if (animator) { + runners.push(animator); + } + return animator; + }; - animateJsConstructor.$closeAndFlush = function() { - runners.forEach(function(runner) { - runner.end(); - }); - runners = []; - }; + animateJsConstructor.$closeAndFlush = function () { + runners.forEach(function (runner) { + runner.end(); + }); + runners = []; + }; - return animateJsConstructor; - }]); + return animateJsConstructor; + }]); - $provide.decorator('$animateCss', ['$delegate', function($delegate) { - var runners = []; + $provide.decorator('$animateCss', ['$delegate', function ($delegate) { + var runners = []; - var animateCssConstructor = function(element, options) { - var animator = $delegate(element, options); - runners.push(animator); - return animator; - }; + var animateCssConstructor = function (element, options) { + var animator = $delegate(element, options); + runners.push(animator); + return animator; + }; - animateCssConstructor.$closeAndFlush = function() { - runners.forEach(function(runner) { - runner.end(); - }); - runners = []; - }; + animateCssConstructor.$closeAndFlush = function () { + runners.forEach(function (runner) { + runner.end(); + }); + runners = []; + }; - return animateCssConstructor; - }]); + return animateCssConstructor; + }]); - $provide.decorator('$animate', ['$delegate', '$timeout', '$browser', '$$rAF', '$animateCss', '$$animateJs', - '$$forceReflow', '$$animateAsyncRun', '$rootScope', - function($delegate, $timeout, $browser, $$rAF, $animateCss, $$animateJs, - $$forceReflow, $$animateAsyncRun, $rootScope) { - var animate = { - queue: [], - cancel: $delegate.cancel, - on: $delegate.on, - off: $delegate.off, - pin: $delegate.pin, - get reflows() { - return $$forceReflow.totalReflows; - }, - enabled: $delegate.enabled, - /** + $provide.decorator('$animate', ['$delegate', '$timeout', '$browser', '$$rAF', '$animateCss', '$$animateJs', + '$$forceReflow', '$$animateAsyncRun', '$rootScope', + function ($delegate, $timeout, $browser, $$rAF, $animateCss, $$animateJs, + $$forceReflow, $$animateAsyncRun, $rootScope) { + var animate = { + queue: [], + cancel: $delegate.cancel, + on: $delegate.on, + off: $delegate.off, + pin: $delegate.pin, + get reflows () { + return $$forceReflow.totalReflows; + }, + enabled: $delegate.enabled, + /** * @ngdoc method * @name $animate#closeAndFlush * @description @@ -872,18 +886,18 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng']) * This method will close all pending animations (both {@link ngAnimate#javascript-based-animations Javascript} * and {@link ngAnimate.$animateCss CSS}) and it will also flush any remaining animation frames and/or callbacks. */ - closeAndFlush: function() { - // we allow the flush command to swallow the errors - // because depending on whether CSS or JS animations are - // used, there may not be a RAF flush. The primary flush - // at the end of this function must throw an exception - // because it will track if there were pending animations - this.flush(true); - $animateCss.$closeAndFlush(); - $$animateJs.$closeAndFlush(); - this.flush(); - }, - /** + closeAndFlush: function () { + // we allow the flush command to swallow the errors + // because depending on whether CSS or JS animations are + // used, there may not be a RAF flush. The primary flush + // at the end of this function must throw an exception + // because it will track if there were pending animations + this.flush(true); + $animateCss.$closeAndFlush(); + $$animateJs.$closeAndFlush(); + this.flush(); + }, + /** * @ngdoc method * @name $animate#flush * @description @@ -892,118 +906,116 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng']) * an animation or conclude an animation. Note that this will not actually close an * actively running animation (see {@link ngMock.$animate#closeAndFlush `closeAndFlush()`} for that). */ - flush: function(hideErrors) { - $rootScope.$digest(); - - var doNextRun, somethingFlushed = false; - do { - doNextRun = false; - - if ($$rAF.queue.length) { - $$rAF.flush(); - doNextRun = somethingFlushed = true; - } + flush: function (hideErrors) { + $rootScope.$digest(); - if ($$animateAsyncRun.flush()) { - doNextRun = somethingFlushed = true; - } - } while (doNextRun); + var doNextRun, somethingFlushed = false; + do { + doNextRun = false; - if (!somethingFlushed && !hideErrors) { - throw new Error('No pending animations ready to be closed or flushed'); - } + if ($$rAF.queue.length) { + $$rAF.flush(); + doNextRun = somethingFlushed = true; + } - $rootScope.$digest(); - } - }; + if ($$animateAsyncRun.flush()) { + doNextRun = somethingFlushed = true; + } + } while (doNextRun); - angular.forEach( - ['animate','enter','leave','move','addClass','removeClass','setClass'], function(method) { - animate[method] = function() { - animate.queue.push({ - event: method, - element: arguments[0], - options: arguments[arguments.length - 1], - args: arguments - }); - return $delegate[method].apply($delegate, arguments); - }; - }); + if (!somethingFlushed && !hideErrors) { + throw new Error('No pending animations ready to be closed or flushed'); + } - return animate; + $rootScope.$digest(); + } + }; + + angular.forEach( + ['animate', 'enter', 'leave', 'move', 'addClass', 'removeClass', 'setClass'], function (method) { + animate[method] = function () { + animate.queue.push({ + event: method, + element: arguments[0], + options: arguments[arguments.length - 1], + args: arguments + }); + return $delegate[method].apply($delegate, arguments); + }; + }); + + return animate; + }]); }]); - }]); - - -/** + /** * @ngdoc function * @name angular.mock.dump * @description * * *NOTE*: This is not an injectable instance, just a globally available function. * - * Method for serializing common angular objects (scope, elements, etc..) into strings. + * Method for serializing common AngularJS objects (scope, elements, etc..) into strings. * It is useful for logging objects to the console when debugging. * * @param {*} object - any object to turn into string. * @return {string} a serialized string of the argument */ -angular.mock.dump = function(object) { - return serialize(object); + angular.mock.dump = function (object) { + return serialize(object); - function serialize(object) { - var out; + function serialize (object) { + var out; - if (angular.isElement(object)) { - object = angular.element(object); - out = angular.element('
    '); - angular.forEach(object, function(element) { - out.append(angular.element(element).clone()); - }); - out = out.html(); - } else if (angular.isArray(object)) { - out = []; - angular.forEach(object, function(o) { - out.push(serialize(o)); - }); - out = '[ ' + out.join(', ') + ' ]'; - } else if (angular.isObject(object)) { - if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) { - out = serializeScope(object); - } else if (object instanceof Error) { - out = object.stack || ('' + object.name + ': ' + object.message); - } else { + if (angular.isElement(object)) { + object = angular.element(object); + out = angular.element('
    '); + angular.forEach(object, function (element) { + out.append(angular.element(element).clone()); + }); + out = out.html(); + } else if (angular.isArray(object)) { + out = []; + angular.forEach(object, function (o) { + out.push(serialize(o)); + }); + out = '[ ' + out.join(', ') + ' ]'; + } else if (angular.isObject(object)) { + if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) { + out = serializeScope(object); + } else if (object instanceof Error) { + out = object.stack || ('' + object.name + ': ' + object.message); + } else { // TODO(i): this prevents methods being logged, // we should have a better way to serialize objects - out = angular.toJson(object, true); + out = angular.toJson(object, true); + } + } else { + out = String(object); } - } else { - out = String(object); - } - return out; - } + return out; + } - function serializeScope(scope, offset) { - offset = offset || ' '; - var log = [offset + 'Scope(' + scope.$id + '): {']; - for (var key in scope) { - if (Object.prototype.hasOwnProperty.call(scope, key) && !key.match(/^(\$|this)/)) { - log.push(' ' + key + ': ' + angular.toJson(scope[key])); + function serializeScope (scope, offset) { + offset = offset || ' '; + var log = [offset + 'Scope(' + scope.$id + '): {']; + for (var key in scope) { + if (Object.prototype.hasOwnProperty.call(scope, key) && !key.match(/^(\$|this)/)) { + log.push(' ' + key + ': ' + angular.toJson(scope[key])); + } } + var child = scope.$$childHead; + while (child) { + log.push(serializeScope(child, offset + ' ')); + child = child.$$nextSibling; + } + log.push('}'); + return log.join('\n' + offset); } - var child = scope.$$childHead; - while (child) { - log.push(serializeScope(child, offset + ' ')); - child = child.$$nextSibling; - } - log.push('}'); - return log.join('\n' + offset); - } -}; + }; -/** + /** * @ngdoc service * @name $httpBackend * @description @@ -1016,7 +1028,7 @@ angular.mock.dump = function(object) { *
    * * During unit testing, we want our unit tests to run quickly and have no external dependencies so - * we don’t want to send [XHR](https://developer.mozilla.org/en/xmlhttprequest) or + * we don’t want to send [XHR](https://developer.mozilla.org/en/xmlhttprequest) or * [JSONP](http://en.wikipedia.org/wiki/JSONP) requests to a real server. All we really need is * to verify whether a certain request has been sent or not, or alternatively just let the * application make requests, respond with pre-trained responses and assert that the end result is @@ -1025,7 +1037,7 @@ angular.mock.dump = function(object) { * This mock implementation can be used to respond with static or dynamic responses via the * `expect` and `when` apis and their shortcuts (`expectGET`, `whenPOST`, etc). * - * When an Angular application needs some data from a server, it calls the $http service, which + * When an AngularJS application needs some data from a server, it calls the $http service, which * sends the request to a real server using $httpBackend service. With dependency injection, it is * easy to inject $httpBackend mock (which has the same API as $httpBackend) and use it to verify * the requests and respond with some testing data without sending a request to a real server. @@ -1120,6 +1132,8 @@ angular.mock.dump = function(object) { $http.get('/auth.py').then(function(response) { authToken = response.headers('A-Token'); $scope.user = response.data; + }).catch(function() { + $scope.status = 'Failed...'; }); $scope.saveMessage = function(message) { @@ -1128,7 +1142,7 @@ angular.mock.dump = function(object) { $http.post('/add-msg.py', message, { headers: headers } ).then(function(response) { $scope.status = ''; - })['catch'](function() { + }).catch(function() { $scope.status = 'Failed...'; }); }; @@ -1162,20 +1176,17 @@ angular.mock.dump = function(object) { }; })); - afterEach(function() { $httpBackend.verifyNoOutstandingExpectation(); $httpBackend.verifyNoOutstandingRequest(); }); - it('should fetch authentication token', function() { $httpBackend.expectGET('/auth.py'); var controller = createController(); $httpBackend.flush(); }); - it('should fail authentication', function() { // Notice how you can change the response even after it was set @@ -1187,12 +1198,11 @@ angular.mock.dump = function(object) { expect($rootScope.status).toBe('Failed...'); }); - it('should send msg to server', function() { var controller = createController(); $httpBackend.flush(); - // now you don’t care about the authentication, but + // now you don’t care about the authentication, but // the controller will still send the request and // $httpBackend will respond without you having to // specify the expectation and response for this request @@ -1204,7 +1214,6 @@ angular.mock.dump = function(object) { expect($rootScope.status).toBe(''); }); - it('should send auth header', function() { var controller = createController(); $httpBackend.flush(); @@ -1301,11 +1310,10 @@ angular.mock.dump = function(object) { }); ``` */ -angular.mock.$HttpBackendProvider = function() { - this.$get = ['$rootScope', '$timeout', createHttpBackendMock]; -}; + angular.mock.$httpBackendDecorator = + ['$rootScope', '$timeout', '$delegate', createHttpBackendMock]; -/** + /** * General factory function for $httpBackend mock. * Returns instance for unit testing (when no arguments specified): * - passing through is disabled @@ -1319,115 +1327,130 @@ angular.mock.$HttpBackendProvider = function() { * @param {Object=} $browser Auto-flushing enabled if specified * @return {Object} Instance of $httpBackend mock */ -function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { - var definitions = [], + function createHttpBackendMock ($rootScope, $timeout, $delegate, $browser) { + var definitions = [], expectations = [], + matchLatestDefinition = false, responses = [], responsesPush = angular.bind(responses, responses.push), - copy = angular.copy; - - function createResponse(status, data, headers, statusText) { - if (angular.isFunction(status)) return status; - - return function() { - return angular.isNumber(status) - ? [status, data, headers, statusText] - : [200, status, data, headers]; - }; - } - - // TODO(vojta): change params to: method, url, data, headers, callback - function $httpBackend(method, url, data, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) { + copy = angular.copy, + // We cache the original backend so that if both ngMock and ngMockE2E override the + // service the ngMockE2E version can pass through to the real backend + originalHttpBackend = $delegate.$$originalHttpBackend || $delegate; + + function createResponse (status, data, headers, statusText) { + if (angular.isFunction(status)) return status; + + return function () { + return angular.isNumber(status) + ? [status, data, headers, statusText, 'complete'] + : [200, status, data, headers, 'complete']; + }; + } - var xhr = new MockXhr(), + // TODO(vojta): change params to: method, url, data, headers, callback + function $httpBackend (method, url, data, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) { + var xhr = new MockXhr(), expectation = expectations[0], wasExpected = false; - xhr.$$events = eventHandlers; - xhr.upload.$$events = uploadEventHandlers; + xhr.$$events = eventHandlers; + xhr.upload.$$events = uploadEventHandlers; - function prettyPrint(data) { - return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp) + function prettyPrint (data) { + return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp) ? data : angular.toJson(data); - } + } - function wrapResponse(wrapped) { - if (!$browser && timeout) { - if (timeout.then) { - timeout.then(handleTimeout); - } else { - $timeout(handleTimeout, timeout); + function wrapResponse (wrapped) { + if (!$browser && timeout) { + if (timeout.then) { + timeout.then(function () { + handlePrematureEnd(angular.isDefined(timeout.$$timeoutId) ? 'timeout' : 'abort'); + }); + } else { + $timeout(function () { + handlePrematureEnd('timeout'); + }, timeout); + } } - } - return handleResponse; + handleResponse.description = method + ' ' + url; + return handleResponse; - function handleResponse() { - var response = wrapped.response(method, url, data, headers, wrapped.params(url)); - xhr.$$respHeaders = response[2]; - callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(), - copy(response[3] || '')); - } + function handleResponse () { + var response = wrapped.response(method, url, data, headers, wrapped.params(url)); + xhr.$$respHeaders = response[2]; + callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(), + copy(response[3] || ''), copy(response[4])); + } - function handleTimeout() { - for (var i = 0, ii = responses.length; i < ii; i++) { - if (responses[i] === handleResponse) { - responses.splice(i, 1); - callback(-1, undefined, ''); - break; + function handlePrematureEnd (reason) { + for (var i = 0, ii = responses.length; i < ii; i++) { + if (responses[i] === handleResponse) { + responses.splice(i, 1); + callback(-1, undefined, '', undefined, reason); + break; + } } } } - } - if (expectation && expectation.match(method, url)) { - if (!expectation.matchData(data)) { - throw new Error('Expected ' + expectation + ' with different data\n' + + if (expectation && expectation.match(method, url)) { + if (!expectation.matchData(data)) { + throw new Error('Expected ' + expectation + ' with different data\n' + 'EXPECTED: ' + prettyPrint(expectation.data) + '\nGOT: ' + data); - } + } - if (!expectation.matchHeaders(headers)) { - throw new Error('Expected ' + expectation + ' with different headers\n' + + if (!expectation.matchHeaders(headers)) { + throw new Error('Expected ' + expectation + ' with different headers\n' + 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: ' + prettyPrint(headers)); - } + } - expectations.shift(); + expectations.shift(); - if (expectation.response) { - responses.push(wrapResponse(expectation)); - return; + if (expectation.response) { + responses.push(wrapResponse(expectation)); + return; + } + wasExpected = true; } - wasExpected = true; - } - var i = -1, definition; - while ((definition = definitions[++i])) { - if (definition.match(method, url, data, headers || {})) { - if (definition.response) { + var i = matchLatestDefinition ? definitions.length : -1, definition; + + while ((definition = definitions[matchLatestDefinition ? --i : ++i])) { + if (definition.match(method, url, data, headers || {})) { + if (definition.response) { // if $browser specified, we do auto flush all requests - ($browser ? $browser.defer : responsesPush)(wrapResponse(definition)); - } else if (definition.passThrough) { - $delegate(method, url, data, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers); - } else throw new Error('No response defined !'); - return; + ($browser ? $browser.defer : responsesPush)(wrapResponse(definition)); + } else if (definition.passThrough) { + originalHttpBackend(method, url, data, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers); + } else throw new Error('No response defined !'); + return; + } } - } - throw wasExpected ? - new Error('No response defined !') : - new Error('Unexpected request: ' + method + ' ' + url + '\n' + + var error = wasExpected + ? new Error('No response defined !') + : new Error('Unexpected request: ' + method + ' ' + url + '\n' + (expectation ? 'Expected ' + expectation : 'No more request expected')); - } - /** + // In addition to be being converted to a rejection, this error also needs to be passed to + // the $exceptionHandler and be rethrown (so that the test fails). + error.$$passToExceptionHandler = true; + + throw error; + } + + /** * @ngdoc method * @name $httpBackend#when * @description * Creates a new backend definition. * * @param {string} method HTTP method. - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives * data string and returns true if the data is as expected. @@ -1438,133 +1461,181 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. * - * - respond – + * - respond – * ```js * {function([status,] data[, headers, statusText]) * | function(function(method, url, data, headers, params)} * ``` - * – The respond method takes a set of static data to be returned or a function that can + * – The respond method takes a set of static data to be returned or a function that can * return an array containing response status (number), response data (Array|Object|string), * response headers (Object), and the text for the status (string). The respond method returns * the `requestHandler` object for possible overrides. */ - $httpBackend.when = function(method, url, data, headers, keys) { - var definition = new MockHttpExpectation(method, url, data, headers, keys), + $httpBackend.when = function (method, url, data, headers, keys) { + assertArgDefined(arguments, 1, 'url'); + + var definition = new MockHttpExpectation(method, url, data, headers, keys), chain = { - respond: function(status, data, headers, statusText) { + respond: function (status, data, headers, statusText) { definition.passThrough = undefined; definition.response = createResponse(status, data, headers, statusText); return chain; } }; - if ($browser) { - chain.passThrough = function() { - definition.response = undefined; - definition.passThrough = true; - return chain; - }; - } + if ($browser) { + chain.passThrough = function () { + definition.response = undefined; + definition.passThrough = true; + return chain; + }; + } - definitions.push(definition); - return chain; - }; + definitions.push(definition); + return chain; + }; - /** + /** + * @ngdoc method + * @name $httpBackend#matchLatestDefinition + * @description + * This method can be used to change which mocked responses `$httpBackend` returns, when defining + * them with {@link ngMock.$httpBackend#when $httpBackend.when()} (and shortcut methods). + * By default, `$httpBackend` returns the first definition that matches. When setting + * `$http.matchLatestDefinition(true)`, it will use the last response that matches, i.e. the + * one that was added last. + * + * ```js + * hb.when('GET', '/url1').respond(200, 'content', {}); + * hb.when('GET', '/url1').respond(201, 'another', {}); + * hb('GET', '/url1'); // receives "content" + * + * $http.matchLatestDefinition(true) + * hb('GET', '/url1'); // receives "another" + * + * hb.when('GET', '/url1').respond(201, 'onemore', {}); + * hb('GET', '/url1'); // receives "onemore" + * ``` + * + * This is useful if a you have a default response that is overriden inside specific tests. + * + * Note that different from config methods on providers, `matchLatestDefinition()` can be changed + * even when the application is already running. + * + * @param {Boolean=} value value to set, either `true` or `false`. Default is `false`. + * If omitted, it will return the current value. + * @return {$httpBackend|Boolean} self when used as a setter, and the current value when used + * as a getter + */ + $httpBackend.matchLatestDefinitionEnabled = function (value) { + if (isDefined(value)) { + matchLatestDefinition = value; + return this; + } else { + return matchLatestDefinition; + } + }; + + /** * @ngdoc method * @name $httpBackend#whenGET * @description * Creates a new backend definition for GET requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. - * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current definition. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#whenHEAD * @description * Creates a new backend definition for HEAD requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. - * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current definition. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#whenDELETE * @description * Creates a new backend definition for DELETE requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. - * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current definition. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#whenPOST * @description * Creates a new backend definition for POST requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives * data string and returns true if the data is as expected. - * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current definition. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#whenPUT * @description * Creates a new backend definition for PUT requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives * data string and returns true if the data is as expected. - * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current definition. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#whenJSONP * @description * Creates a new backend definition for JSONP requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - createShortMethods('when'); + createShortMethods('when'); - /** + /** * @ngdoc method * @name $httpBackend#whenRoute * @description @@ -1574,51 +1645,52 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @param {string} url HTTP url string that supports colon param matching. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in - * order to change how a matched request is handled. See #when for more info. + * order to change how a matched request is handled. + * See {@link ngMock.$httpBackend#when `when`} for more info. */ - $httpBackend.whenRoute = function(method, url) { - var pathObj = parseRoute(url); - return $httpBackend.when(method, pathObj.regexp, undefined, undefined, pathObj.keys); - }; + $httpBackend.whenRoute = function (method, url) { + var pathObj = parseRoute(url); + return $httpBackend.when(method, pathObj.regexp, undefined, undefined, pathObj.keys); + }; - function parseRoute(url) { - var ret = { - regexp: url - }, - keys = ret.keys = []; - - if (!url || !angular.isString(url)) return ret; - - url = url - .replace(/([().])/g, '\\$1') - .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) { - var optional = option === '?' ? option : null; - var star = option === '*' ? option : null; - keys.push({ name: key, optional: !!optional }); - slash = slash || ''; - return '' - + (optional ? '' : slash) - + '(?:' - + (optional ? slash : '') - + (star && '(.+?)' || '([^/]+)') - + (optional || '') - + ')' - + (optional || ''); - }) - .replace(/([\/$\*])/g, '\\$1'); - - ret.regexp = new RegExp('^' + url, 'i'); - return ret; - } + function parseRoute (url) { + var ret = { + regexp: url + }, + keys = ret.keys = []; + + if (!url || !angular.isString(url)) return ret; + + url = url + .replace(/([().])/g, '\\$1') + .replace(/(\/)?:(\w+)([?*])?/g, function (_, slash, key, option) { + var optional = option === '?' ? option : null; + var star = option === '*' ? option : null; + keys.push({ name: key, optional: !!optional }); + slash = slash || ''; + return '' + + (optional ? '' : slash) + + '(?:' + + (optional ? slash : '') + + (star && '(.+?)' || '([^/]+)') + + (optional || '') + + ')' + + (optional || ''); + }) + .replace(/([/$*])/g, '\\$1'); + + ret.regexp = new RegExp('^' + url, 'i'); + return ret; + } - /** + /** * @ngdoc method * @name $httpBackend#expect * @description * Creates a new request expectation. * * @param {string} method HTTP method. - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that * receives data string and returns true if the data is as expected, or Object if request body @@ -1630,144 +1702,152 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. * - * - respond – + * - respond – * ``` * { function([status,] data[, headers, statusText]) * | function(function(method, url, data, headers, params)} * ``` - * – The respond method takes a set of static data to be returned or a function that can + * – The respond method takes a set of static data to be returned or a function that can * return an array containing response status (number), response data (Array|Object|string), * response headers (Object), and the text for the status (string). The respond method returns * the `requestHandler` object for possible overrides. */ - $httpBackend.expect = function(method, url, data, headers, keys) { - var expectation = new MockHttpExpectation(method, url, data, headers, keys), + $httpBackend.expect = function (method, url, data, headers, keys) { + assertArgDefined(arguments, 1, 'url'); + + var expectation = new MockHttpExpectation(method, url, data, headers, keys), chain = { - respond: function(status, data, headers, statusText) { + respond: function (status, data, headers, statusText) { expectation.response = createResponse(status, data, headers, statusText); return chain; } }; - expectations.push(expectation); - return chain; - }; + expectations.push(expectation); + return chain; + }; - /** + /** * @ngdoc method * @name $httpBackend#expectGET * @description * Creates a new request expectation for GET requests. For more info see `expect()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url - * and returns true if the url matches the current definition. - * @param {Object=} headers HTTP headers. + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url + * and returns true if the url matches the current expectation. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current expectation. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. See #expect for more info. */ - /** + /** * @ngdoc method * @name $httpBackend#expectHEAD * @description * Creates a new request expectation for HEAD requests. For more info see `expect()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url - * and returns true if the url matches the current definition. - * @param {Object=} headers HTTP headers. + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url + * and returns true if the url matches the current expectation. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current expectation. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#expectDELETE * @description * Creates a new request expectation for DELETE requests. For more info see `expect()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url - * and returns true if the url matches the current definition. - * @param {Object=} headers HTTP headers. + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url + * and returns true if the url matches the current expectation. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current expectation. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#expectPOST * @description * Creates a new request expectation for POST requests. For more info see `expect()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url - * and returns true if the url matches the current definition. + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url + * and returns true if the url matches the current expectation. * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that * receives data string and returns true if the data is as expected, or Object if request body * is in JSON format. - * @param {Object=} headers HTTP headers. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current expectation. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#expectPUT * @description * Creates a new request expectation for PUT requests. For more info see `expect()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url - * and returns true if the url matches the current definition. + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url + * and returns true if the url matches the current expectation. * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that * receives data string and returns true if the data is as expected, or Object if request body * is in JSON format. - * @param {Object=} headers HTTP headers. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current expectation. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#expectPATCH * @description * Creates a new request expectation for PATCH requests. For more info see `expect()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url - * and returns true if the url matches the current definition. + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url + * and returns true if the url matches the current expectation. * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that * receives data string and returns true if the data is as expected, or Object if request body * is in JSON format. - * @param {Object=} headers HTTP headers. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current expectation. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - /** + /** * @ngdoc method * @name $httpBackend#expectJSONP * @description * Creates a new request expectation for JSONP requests. For more info see `expect()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives an url - * and returns true if the url matches the current definition. + * @param {string|RegExp|function(string)=} url HTTP url or function that receives an url + * and returns true if the url matches the current expectation. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in * order to change how a matched request is handled. */ - createShortMethods('expect'); + createShortMethods('expect'); - /** + /** * @ngdoc method * @name $httpBackend#expectRoute * @description @@ -1777,15 +1857,15 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @param {string} url HTTP url string that supports colon param matching. * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. You can save this object for later use and invoke `respond` again in - * order to change how a matched request is handled. See #expect for more info. + * order to change how a matched request is handled. + * See {@link ngMock.$httpBackend#expect `expect`} for more info. */ - $httpBackend.expectRoute = function(method, url) { - var pathObj = parseRoute(url); - return $httpBackend.expect(method, pathObj.regexp, undefined, undefined, pathObj.keys); - }; - + $httpBackend.expectRoute = function (method, url) { + var pathObj = parseRoute(url); + return $httpBackend.expect(method, pathObj.regexp, undefined, undefined, pathObj.keys); + }; - /** + /** * @ngdoc method * @name $httpBackend#flush * @description @@ -1802,28 +1882,27 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @param {number=} [skip=0] - Number of pending requests to skip. For example, a value of `5` * would skip the first 5 pending requests and start flushing from the 6th onwards. */ - $httpBackend.flush = function(count, skip, digest) { - if (digest !== false) $rootScope.$digest(); + $httpBackend.flush = function (count, skip, digest) { + if (digest !== false) $rootScope.$digest(); - skip = skip || 0; - if (skip >= responses.length) throw new Error('No pending request to flush !'); + skip = skip || 0; + if (skip >= responses.length) throw new Error('No pending request to flush !'); - if (angular.isDefined(count) && count !== null) { - while (count--) { - var part = responses.splice(skip, 1); - if (!part.length) throw new Error('No more pending request to flush !'); - part[0](); - } - } else { - while (responses.length > skip) { - responses.splice(skip, 1)[0](); + if (angular.isDefined(count) && count !== null) { + while (count--) { + var part = responses.splice(skip, 1); + if (!part.length) throw new Error('No more pending request to flush !'); + part[0](); + } + } else { + while (responses.length > skip) { + responses.splice(skip, 1)[0](); + } } - } - $httpBackend.verifyNoOutstandingExpectation(digest); - }; - + $httpBackend.verifyNoOutstandingExpectation(digest); + }; - /** + /** * @ngdoc method * @name $httpBackend#verifyNoOutstandingExpectation * @description @@ -1837,15 +1916,14 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * afterEach($httpBackend.verifyNoOutstandingExpectation); * ``` */ - $httpBackend.verifyNoOutstandingExpectation = function(digest) { - if (digest !== false) $rootScope.$digest(); - if (expectations.length) { - throw new Error('Unsatisfied requests: ' + expectations.join(', ')); - } - }; - + $httpBackend.verifyNoOutstandingExpectation = function (digest) { + if (digest !== false) $rootScope.$digest(); + if (expectations.length) { + throw new Error('Unsatisfied requests: ' + expectations.join(', ')); + } + }; - /** + /** * @ngdoc method * @name $httpBackend#verifyNoOutstandingRequest * @description @@ -1858,14 +1936,16 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * afterEach($httpBackend.verifyNoOutstandingRequest); * ``` */ - $httpBackend.verifyNoOutstandingRequest = function() { - if (responses.length) { - throw new Error('Unflushed requests: ' + responses.length); - } - }; - + $httpBackend.verifyNoOutstandingRequest = function (digest) { + if (digest !== false) $rootScope.$digest(); + if (responses.length) { + var unflushedDescriptions = responses.map(function (res) { return res.description; }); + throw new Error('Unflushed requests: ' + responses.length + '\n ' + + unflushedDescriptions.join('\n ')); + } + }; - /** + /** * @ngdoc method * @name $httpBackend#resetExpectations * @description @@ -1873,204 +1953,222 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * call resetExpectations during a multiple-phase test when you want to reuse the same instance of * $httpBackend mock. */ - $httpBackend.resetExpectations = function() { - expectations.length = 0; - responses.length = 0; - }; + $httpBackend.resetExpectations = function () { + expectations.length = 0; + responses.length = 0; + }; - return $httpBackend; + $httpBackend.$$originalHttpBackend = originalHttpBackend; + return $httpBackend; - function createShortMethods(prefix) { - angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) { - $httpBackend[prefix + method] = function(url, headers, keys) { - return $httpBackend[prefix](method, url, undefined, headers, keys); - }; - }); + function createShortMethods (prefix) { + angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function (method) { + $httpBackend[prefix + method] = function (url, headers, keys) { + assertArgDefined(arguments, 0, 'url'); - angular.forEach(['PUT', 'POST', 'PATCH'], function(method) { - $httpBackend[prefix + method] = function(url, data, headers, keys) { - return $httpBackend[prefix](method, url, data, headers, keys); - }; - }); - } -} + // Change url to `null` if `undefined` to stop it throwing an exception further down + if (angular.isUndefined(url)) url = null; + + return $httpBackend[prefix](method, url, undefined, headers, keys); + }; + }); + + angular.forEach(['PUT', 'POST', 'PATCH'], function (method) { + $httpBackend[prefix + method] = function (url, data, headers, keys) { + assertArgDefined(arguments, 0, 'url'); -function MockHttpExpectation(method, url, data, headers, keys) { + // Change url to `null` if `undefined` to stop it throwing an exception further down + if (angular.isUndefined(url)) url = null; - function getUrlParams(u) { - var params = u.slice(u.indexOf('?') + 1).split('&'); - return params.sort(); + return $httpBackend[prefix](method, url, data, headers, keys); + }; + }); + } } - function compareUrl(u) { - return (url.slice(0, url.indexOf('?')) === u.slice(0, u.indexOf('?')) && - getUrlParams(url).join() === getUrlParams(u).join()); + function assertArgDefined (args, index, name) { + if (args.length > index && angular.isUndefined(args[index])) { + throw new Error('Undefined argument `' + name + '`; the argument is provided but not defined'); + } } - this.data = data; - this.headers = headers; + function MockHttpExpectation (method, url, data, headers, keys) { + function getUrlParams (u) { + var params = u.slice(u.indexOf('?') + 1).split('&'); + return params.sort(); + } - this.match = function(m, u, d, h) { - if (method !== m) return false; - if (!this.matchUrl(u)) return false; - if (angular.isDefined(d) && !this.matchData(d)) return false; - if (angular.isDefined(h) && !this.matchHeaders(h)) return false; - return true; - }; + function compareUrl (u) { + return (url.slice(0, url.indexOf('?')) === u.slice(0, u.indexOf('?')) && + getUrlParams(url).join() === getUrlParams(u).join()); + } - this.matchUrl = function(u) { - if (!url) return true; - if (angular.isFunction(url.test)) return url.test(u); - if (angular.isFunction(url)) return url(u); - return (url === u || compareUrl(u)); - }; + this.data = data; + this.headers = headers; - this.matchHeaders = function(h) { - if (angular.isUndefined(headers)) return true; - if (angular.isFunction(headers)) return headers(h); - return angular.equals(headers, h); - }; + this.match = function (m, u, d, h) { + if (method !== m) return false; + if (!this.matchUrl(u)) return false; + if (angular.isDefined(d) && !this.matchData(d)) return false; + if (angular.isDefined(h) && !this.matchHeaders(h)) return false; + return true; + }; - this.matchData = function(d) { - if (angular.isUndefined(data)) return true; - if (data && angular.isFunction(data.test)) return data.test(d); - if (data && angular.isFunction(data)) return data(d); - if (data && !angular.isString(data)) { - return angular.equals(angular.fromJson(angular.toJson(data)), angular.fromJson(d)); - } - // eslint-disable-next-line eqeqeq - return data == d; - }; + this.matchUrl = function (u) { + if (!url) return true; + if (angular.isFunction(url.test)) return url.test(u); + if (angular.isFunction(url)) return url(u); + return (url === u || compareUrl(u)); + }; - this.toString = function() { - return method + ' ' + url; - }; + this.matchHeaders = function (h) { + if (angular.isUndefined(headers)) return true; + if (angular.isFunction(headers)) return headers(h); + return angular.equals(headers, h); + }; + + this.matchData = function (d) { + if (angular.isUndefined(data)) return true; + if (data && angular.isFunction(data.test)) return data.test(d); + if (data && angular.isFunction(data)) return data(d); + if (data && !angular.isString(data)) { + return angular.equals(angular.fromJson(angular.toJson(data)), angular.fromJson(d)); + } + // eslint-disable-next-line eqeqeq + return data == d; + }; + + this.toString = function () { + return method + ' ' + url; + }; - this.params = function(u) { - return angular.extend(parseQuery(), pathParams()); + this.params = function (u) { + return angular.extend(parseQuery(), pathParams()); - function pathParams() { - var keyObj = {}; - if (!url || !angular.isFunction(url.test) || !keys || keys.length === 0) return keyObj; + function pathParams () { + var keyObj = {}; + if (!url || !angular.isFunction(url.test) || !keys || keys.length === 0) return keyObj; - var m = url.exec(u); - if (!m) return keyObj; - for (var i = 1, len = m.length; i < len; ++i) { - var key = keys[i - 1]; - var val = m[i]; - if (key && val) { - keyObj[key.name || key] = val; + var m = url.exec(u); + if (!m) return keyObj; + for (var i = 1, len = m.length; i < len; ++i) { + var key = keys[i - 1]; + var val = m[i]; + if (key && val) { + keyObj[key.name || key] = val; + } } - } - return keyObj; - } + return keyObj; + } - function parseQuery() { - var obj = {}, key_value, key, + function parseQuery () { + var obj = {}, key_value, key, queryStr = u.indexOf('?') > -1 - ? u.substring(u.indexOf('?') + 1) - : ''; - - angular.forEach(queryStr.split('&'), function(keyValue) { - if (keyValue) { - key_value = keyValue.replace(/\+/g,'%20').split('='); - key = tryDecodeURIComponent(key_value[0]); - if (angular.isDefined(key)) { - var val = angular.isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true; - if (!hasOwnProperty.call(obj, key)) { - obj[key] = val; - } else if (angular.isArray(obj[key])) { - obj[key].push(val); - } else { - obj[key] = [obj[key],val]; + ? u.substring(u.indexOf('?') + 1) + : ''; + + angular.forEach(queryStr.split('&'), function (keyValue) { + if (keyValue) { + key_value = keyValue.replace(/\+/g, '%20').split('='); + key = tryDecodeURIComponent(key_value[0]); + if (angular.isDefined(key)) { + var val = angular.isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true; + if (!hasOwnProperty.call(obj, key)) { + obj[key] = val; + } else if (angular.isArray(obj[key])) { + obj[key].push(val); + } else { + obj[key] = [obj[key], val]; + } } } - } - }); - return obj; - } - function tryDecodeURIComponent(value) { - try { - return decodeURIComponent(value); - } catch (e) { + }); + return obj; + } + function tryDecodeURIComponent (value) { + try { + return decodeURIComponent(value); + } catch (e) { // Ignore any invalid uri component + } } - } - }; -} - -function createMockXhr() { - return new MockXhr(); -} + }; + } -function MockXhr() { + function createMockXhr () { + return new MockXhr(); + } + function MockXhr () { // hack for testing $http, $httpBackend - MockXhr.$$lastInstance = this; - - this.open = function(method, url, async) { - this.$$method = method; - this.$$url = url; - this.$$async = async; - this.$$reqHeaders = {}; - this.$$respHeaders = {}; - }; + MockXhr.$$lastInstance = this; - this.send = function(data) { - this.$$data = data; - }; + this.open = function (method, url, async) { + this.$$method = method; + this.$$url = url; + this.$$async = async; + this.$$reqHeaders = {}; + this.$$respHeaders = {}; + }; - this.setRequestHeader = function(key, value) { - this.$$reqHeaders[key] = value; - }; + this.send = function (data) { + this.$$data = data; + }; + + this.setRequestHeader = function (key, value) { + this.$$reqHeaders[key] = value; + }; - this.getResponseHeader = function(name) { + this.getResponseHeader = function (name) { // the lookup must be case insensitive, // that's why we try two quick lookups first and full scan last - var header = this.$$respHeaders[name]; - if (header) return header; + var header = this.$$respHeaders[name]; + if (header) return header; - name = angular.lowercase(name); - header = this.$$respHeaders[name]; - if (header) return header; + name = angular.$$lowercase(name); + header = this.$$respHeaders[name]; + if (header) return header; - header = undefined; - angular.forEach(this.$$respHeaders, function(headerVal, headerName) { - if (!header && angular.lowercase(headerName) === name) header = headerVal; - }); - return header; - }; - - this.getAllResponseHeaders = function() { - var lines = []; + header = undefined; + angular.forEach(this.$$respHeaders, function (headerVal, headerName) { + if (!header && angular.$$lowercase(headerName) === name) header = headerVal; + }); + return header; + }; - angular.forEach(this.$$respHeaders, function(value, key) { - lines.push(key + ': ' + value); - }); - return lines.join('\n'); - }; + this.getAllResponseHeaders = function () { + var lines = []; - this.abort = angular.noop; + angular.forEach(this.$$respHeaders, function (value, key) { + lines.push(key + ': ' + value); + }); + return lines.join('\n'); + }; - // This section simulates the events on a real XHR object (and the upload object) - // When we are testing $httpBackend (inside the angular project) we make partial use of this - // but store the events directly ourselves on `$$events`, instead of going through the `addEventListener` - this.$$events = {}; - this.addEventListener = function(name, listener) { - if (angular.isUndefined(this.$$events[name])) this.$$events[name] = []; - this.$$events[name].push(listener); - }; + this.abort = function () { + if (isFunction(this.onabort)) { + this.onabort(); + } + }; - this.upload = { - $$events: {}, - addEventListener: this.addEventListener - }; -} + // This section simulates the events on a real XHR object (and the upload object) + // When we are testing $httpBackend (inside the AngularJS project) we make partial use of this + // but store the events directly ourselves on `$$events`, instead of going through the `addEventListener` + this.$$events = {}; + this.addEventListener = function (name, listener) { + if (angular.isUndefined(this.$$events[name])) this.$$events[name] = []; + this.$$events[name].push(listener); + }; + this.upload = { + $$events: {}, + addEventListener: this.addEventListener + }; + } -/** + /** * @ngdoc service * @name $timeout * @description @@ -2079,8 +2177,7 @@ function MockXhr() { * that adds a "flush" and "verifyNoPendingTasks" methods. */ -angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function($delegate, $browser) { - + angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function ($delegate, $browser) { /** * @ngdoc method * @name $timeout#flush @@ -2090,83 +2187,82 @@ angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function($delegate, $ * * @param {number=} delay maximum timeout amount to flush up until */ - $delegate.flush = function(delay) { - $browser.defer.flush(delay); - }; + $delegate.flush = function (delay) { + $browser.defer.flush(delay); + }; - /** + /** * @ngdoc method * @name $timeout#verifyNoPendingTasks * @description * * Verifies that there are no pending tasks that need to be flushed. */ - $delegate.verifyNoPendingTasks = function() { - if ($browser.deferredFns.length) { - throw new Error('Deferred tasks to flush (' + $browser.deferredFns.length + '): ' + + $delegate.verifyNoPendingTasks = function () { + if ($browser.deferredFns.length) { + throw new Error('Deferred tasks to flush (' + $browser.deferredFns.length + '): ' + formatPendingTasksAsString($browser.deferredFns)); - } - }; + } + }; - function formatPendingTasksAsString(tasks) { - var result = []; - angular.forEach(tasks, function(task) { - result.push('{id: ' + task.id + ', time: ' + task.time + '}'); - }); + function formatPendingTasksAsString (tasks) { + var result = []; + angular.forEach(tasks, function (task) { + result.push('{id: ' + task.id + ', time: ' + task.time + '}'); + }); - return result.join(', '); - } + return result.join(', '); + } - return $delegate; -}]; + return $delegate; + }]; -angular.mock.$RAFDecorator = ['$delegate', function($delegate) { - var rafFn = function(fn) { - var index = rafFn.queue.length; - rafFn.queue.push(fn); - return function() { - rafFn.queue.splice(index, 1); + angular.mock.$RAFDecorator = ['$delegate', function ($delegate) { + var rafFn = function (fn) { + var index = rafFn.queue.length; + rafFn.queue.push(fn); + return function () { + rafFn.queue.splice(index, 1); + }; }; - }; - rafFn.queue = []; - rafFn.supported = $delegate.supported; + rafFn.queue = []; + rafFn.supported = $delegate.supported; - rafFn.flush = function() { - if (rafFn.queue.length === 0) { - throw new Error('No rAF callbacks present'); - } + rafFn.flush = function () { + if (rafFn.queue.length === 0) { + throw new Error('No rAF callbacks present'); + } - var length = rafFn.queue.length; - for (var i = 0; i < length; i++) { - rafFn.queue[i](); - } + var length = rafFn.queue.length; + for (var i = 0; i < length; i++) { + rafFn.queue[i](); + } - rafFn.queue = rafFn.queue.slice(i); - }; + rafFn.queue = rafFn.queue.slice(i); + }; - return rafFn; -}]; + return rafFn; + }]; -/** + /** * */ -var originalRootElement; -angular.mock.$RootElementProvider = function() { - this.$get = ['$injector', function($injector) { - originalRootElement = angular.element('
    ').data('$injector', $injector); - return originalRootElement; - }]; -}; + var originalRootElement; + angular.mock.$RootElementProvider = function () { + this.$get = ['$injector', function ($injector) { + originalRootElement = angular.element('
    ').data('$injector', $injector); + return originalRootElement; + }]; + }; -/** + /** * @ngdoc service * @name $controller * @description * A decorator for {@link ng.$controller} with additional `bindings` parameter, useful when testing * controllers of directives that use {@link $compile#-bindtocontroller- `bindToController`}. * - * * ## Example * * ```js @@ -2184,18 +2280,24 @@ angular.mock.$RootElementProvider = function() { * // Controller definition ... * * myMod.controller('MyDirectiveController', ['$log', function($log) { - * $log.info(this.name); + * this.log = function() { + * $log.info(this.name); + * }; * }]); * * * // In a test ... * * describe('myDirectiveController', function() { - * it('should write the bound name to the log', inject(function($controller, $log) { - * var ctrl = $controller('MyDirectiveController', { /* no locals */ }, { name: 'Clark Kent' }); - * expect(ctrl.name).toEqual('Clark Kent'); - * expect($log.info.logs).toEqual(['Clark Kent']); - * })); + * describe('log()', function() { + * it('should write the bound name to the log', inject(function($controller, $log) { + * var ctrl = $controller('MyDirectiveController', { /* no locals */ }, { name: 'Clark Kent' }); + * ctrl.log(); + * + * expect(ctrl.name).toEqual('Clark Kent'); + * expect($log.info.logs).toEqual(['Clark Kent']); + * })); + * }); * }); * * ``` @@ -2206,45 +2308,51 @@ angular.mock.$RootElementProvider = function() { * * * check if a controller with given name is registered via `$controllerProvider` * * check if evaluating the string on the current scope returns a constructor - * * if $controllerProvider#allowGlobals, check `window[constructor]` on the global - * `window` object (not recommended) * * The string can use the `controller as property` syntax, where the controller instance is published * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this * to work correctly. * * @param {Object} locals Injection locals for Controller. - * @param {Object=} bindings Properties to add to the controller before invoking the constructor. This is used - * to simulate the `bindToController` feature and simplify certain kinds of tests. + * @param {Object=} bindings Properties to add to the controller instance. This is used to simulate + * the `bindToController` feature and simplify certain kinds of tests. * @return {Object} Instance of given controller. */ -angular.mock.$ControllerDecorator = ['$delegate', function($delegate) { - return function(expression, locals, later, ident) { - if (later && typeof later === 'object') { - var instantiate = $delegate(expression, locals, true, ident); - angular.extend(instantiate.instance, later); - - var instance = instantiate(); - if (instance !== instantiate.instance) { - angular.extend(instance, later); - } + function createControllerDecorator () { + angular.mock.$ControllerDecorator = ['$delegate', function ($delegate) { + return function (expression, locals, later, ident) { + if (later && typeof later === 'object') { + var instantiate = $delegate(expression, locals, true, ident); + var instance = instantiate(); + angular.extend(instance, later); + return instance; + } + return $delegate(expression, locals, later, ident); + }; + }]; - return instance; - } - return $delegate(expression, locals, later, ident); - }; -}]; + return angular.mock.$ControllerDecorator; + } -/** + /** * @ngdoc service * @name $componentController * @description - * A service that can be used to create instances of component controllers. - *
    + * A service that can be used to create instances of component controllers. Useful for unit-testing. + * * Be aware that the controller will be instantiated and attached to the scope as specified in * the component definition object. If you do not provide a `$scope` object in the `locals` param * then the helper will create a new isolated scope as a child of `$rootScope`. - *
    + * + * If you are using `$element` or `$attrs` in the controller, make sure to provide them as `locals`. + * The `$element` must be a jqLite-wrapped DOM element, and `$attrs` should be an object that + * has all properties / functions that you are using in the controller. If this is getting too complex, + * you should compile the component instead and access the component's controller via the + * {@link angular.element#methods `controller`} function. + * + * See also the section on {@link guide/component#unit-testing-component-controllers unit-testing component controllers} + * in the guide. + * * @param {string} componentName the name of the component whose controller we want to instantiate * @param {Object} locals Injection locals for Controller. * @param {Object=} bindings Properties to add to the controller before invoking the constructor. This is used @@ -2252,56 +2360,51 @@ angular.mock.$ControllerDecorator = ['$delegate', function($delegate) { * @param {string=} ident Override the property name to use when attaching the controller to the scope. * @return {Object} Instance of requested controller. */ -angular.mock.$ComponentControllerProvider = ['$compileProvider', - function ComponentControllerProvider($compileProvider) { - this.$get = ['$controller','$injector', '$rootScope', function($controller, $injector, $rootScope) { - return function $componentController(componentName, locals, bindings, ident) { - // get all directives associated to the component name - var directives = $injector.get(componentName + 'Directive'); - // look for those directives that are components - var candidateDirectives = directives.filter(function(directiveInfo) { - // components have controller, controllerAs and restrict:'E' - return directiveInfo.controller && directiveInfo.controllerAs && directiveInfo.restrict === 'E'; - }); - // check if valid directives found - if (candidateDirectives.length === 0) { - throw new Error('No component found'); - } - if (candidateDirectives.length > 1) { - throw new Error('Too many components found'); - } - // get the info of the component - var directiveInfo = candidateDirectives[0]; - // create a scope if needed - locals = locals || {}; - locals.$scope = locals.$scope || $rootScope.$new(true); - return $controller(directiveInfo.controller, locals, bindings, ident || directiveInfo.controllerAs); - }; - }]; -}]; - + angular.mock.$ComponentControllerProvider = ['$compileProvider', + function ComponentControllerProvider ($compileProvider) { + this.$get = ['$controller', '$injector', '$rootScope', function ($controller, $injector, $rootScope) { + return function $componentController (componentName, locals, bindings, ident) { + // get all directives associated to the component name + var directives = $injector.get(componentName + 'Directive'); + // look for those directives that are components + var candidateDirectives = directives.filter(function (directiveInfo) { + // components have controller, controllerAs and restrict:'E' + return directiveInfo.controller && directiveInfo.controllerAs && directiveInfo.restrict === 'E'; + }); + // check if valid directives found + if (candidateDirectives.length === 0) { + throw new Error('No component found'); + } + if (candidateDirectives.length > 1) { + throw new Error('Too many components found'); + } + // get the info of the component + var directiveInfo = candidateDirectives[0]; + // create a scope if needed + locals = locals || {}; + locals.$scope = locals.$scope || $rootScope.$new(true); + return $controller(directiveInfo.controller, locals, bindings, ident || directiveInfo.controllerAs); + }; + }]; + }]; -/** + /** * @ngdoc module * @name ngMock * @packageName angular-mocks * @description * - * # ngMock - * - * The `ngMock` module provides support to inject and mock Angular services into unit tests. - * In addition, ngMock also extends various core ng services such that they can be + * The `ngMock` module provides support to inject and mock AngularJS services into unit tests. + * In addition, ngMock also extends various core AngularJS services such that they can be * inspected and controlled in a synchronous manner within test code. * - * - *
    - * * @installation * * First, download the file: * * [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g. * `"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-mocks.js"` * * [NPM](https://www.npmjs.com/) e.g. `npm install angular-mocks@X.Y.Z` + * * [Yarn](https://yarnpkg.com) e.g. `yarn add angular-mocks@X.Y.Z` * * [Bower](http://bower.io) e.g. `bower install angular-mocks#X.Y.Z` * * [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g. * `"//code.angularjs.org/X.Y.Z/angular-mocks.js"` @@ -2325,38 +2428,37 @@ angular.mock.$ComponentControllerProvider = ['$compileProvider', * Including the `angular-mocks.js` file automatically adds the `ngMock` module, so your tests * are ready to go! */ -angular.module('ngMock', ['ng']).provider({ - $browser: angular.mock.$BrowserProvider, - $exceptionHandler: angular.mock.$ExceptionHandlerProvider, - $log: angular.mock.$LogProvider, - $interval: angular.mock.$IntervalProvider, - $httpBackend: angular.mock.$HttpBackendProvider, - $rootElement: angular.mock.$RootElementProvider, - $componentController: angular.mock.$ComponentControllerProvider -}).config(['$provide', function($provide) { - $provide.decorator('$timeout', angular.mock.$TimeoutDecorator); - $provide.decorator('$$rAF', angular.mock.$RAFDecorator); - $provide.decorator('$rootScope', angular.mock.$RootScopeDecorator); - $provide.decorator('$controller', angular.mock.$ControllerDecorator); -}]); + angular.module('ngMock', ['ng']).provider({ + $browser: angular.mock.$BrowserProvider, + $exceptionHandler: angular.mock.$ExceptionHandlerProvider, + $log: angular.mock.$LogProvider, + $interval: angular.mock.$IntervalProvider, + $rootElement: angular.mock.$RootElementProvider, + $componentController: angular.mock.$ComponentControllerProvider + }).config(['$provide', '$compileProvider', function ($provide, $compileProvider) { + $provide.decorator('$timeout', angular.mock.$TimeoutDecorator); + $provide.decorator('$$rAF', angular.mock.$RAFDecorator); + $provide.decorator('$rootScope', angular.mock.$RootScopeDecorator); + $provide.decorator('$controller', createControllerDecorator($compileProvider)); + $provide.decorator('$httpBackend', angular.mock.$httpBackendDecorator); + }]).info({ angularVersion: '1.7.2' }); -/** + /** * @ngdoc module * @name ngMockE2E * @module ngMockE2E * @packageName angular-mocks * @description * - * The `ngMockE2E` is an angular module which contains mocks suitable for end-to-end testing. + * The `ngMockE2E` is an AngularJS module which contains mocks suitable for end-to-end testing. * Currently there is only one mock present in this module - * the {@link ngMockE2E.$httpBackend e2e $httpBackend} mock. */ -angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { - $provide.value('$httpBackend', angular.injector(['ng']).get('$httpBackend')); - $provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator); -}]); + angular.module('ngMockE2E', ['ng']).config(['$provide', function ($provide) { + $provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator); + }]).info({ angularVersion: '1.7.2' }); -/** + /** * @ngdoc service * @name $httpBackend * @module ngMockE2E @@ -2401,14 +2503,14 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * phones.push(phone); * return [200, phone, {}]; * }); - * $httpBackend.whenGET(/^\/templates\//).passThrough(); // Requests for templare are handled by the real server + * $httpBackend.whenGET(/^\/templates\//).passThrough(); // Requests for templates are handled by the real server * //... * }); * ``` * * Afterwards, bootstrap your app with this new module. * - * ## Example + * @example * * * var myApp = angular.module('myApp', []); @@ -2471,7 +2573,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * */ -/** + /** * @ngdoc method * @name $httpBackend#when * @module ngMockE2E @@ -2479,9 +2581,10 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * Creates a new backend definition. * * @param {string} method HTTP method. - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. - * @param {(string|RegExp)=} data HTTP request body. + * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives + * data string and returns true if the data is as expected. * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header * object and returns true if the headers match the current definition. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on @@ -2490,28 +2593,28 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * control how a matched request is handled. You can save this object for later use and invoke * `respond` or `passThrough` again in order to change how a matched request is handled. * - * - respond – + * - respond – * ``` * { function([status,] data[, headers, statusText]) * | function(function(method, url, data, headers, params)} * ``` - * – The respond method takes a set of static data to be returned or a function that can return + * – The respond method takes a set of static data to be returned or a function that can return * an array containing response status (number), response data (Array|Object|string), response * headers (Object), and the text for the status (string). - * - passThrough – `{function()}` – Any request matching a backend definition with + * - passThrough – `{function()}` – Any request matching a backend definition with * `passThrough` handler will be passed through to the real backend (an XHR request will be made * to the server.) * - Both methods return the `requestHandler` object for possible overrides. */ -/** + /** * @ngdoc method * @name $httpBackend#whenGET * @module ngMockE2E * @description * Creates a new backend definition for GET requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(Object|function(Object))=} headers HTTP headers. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on @@ -2521,14 +2624,14 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * `respond` or `passThrough` again in order to change how a matched request is handled. */ -/** + /** * @ngdoc method * @name $httpBackend#whenHEAD * @module ngMockE2E * @description * Creates a new backend definition for HEAD requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(Object|function(Object))=} headers HTTP headers. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on @@ -2538,14 +2641,14 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * `respond` or `passThrough` again in order to change how a matched request is handled. */ -/** + /** * @ngdoc method * @name $httpBackend#whenDELETE * @module ngMockE2E * @description * Creates a new backend definition for DELETE requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(Object|function(Object))=} headers HTTP headers. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on @@ -2555,16 +2658,17 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * `respond` or `passThrough` again in order to change how a matched request is handled. */ -/** + /** * @ngdoc method * @name $httpBackend#whenPOST * @module ngMockE2E * @description * Creates a new backend definition for POST requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. - * @param {(string|RegExp)=} data HTTP request body. + * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives + * data string and returns true if the data is as expected. * @param {(Object|function(Object))=} headers HTTP headers. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on * {@link ngMock.$httpBackend $httpBackend mock}. @@ -2573,16 +2677,17 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * `respond` or `passThrough` again in order to change how a matched request is handled. */ -/** + /** * @ngdoc method * @name $httpBackend#whenPUT * @module ngMockE2E * @description * Creates a new backend definition for PUT requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. - * @param {(string|RegExp)=} data HTTP request body. + * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives + * data string and returns true if the data is as expected. * @param {(Object|function(Object))=} headers HTTP headers. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on * {@link ngMock.$httpBackend $httpBackend mock}. @@ -2591,16 +2696,17 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * `respond` or `passThrough` again in order to change how a matched request is handled. */ -/** + /** * @ngdoc method * @name $httpBackend#whenPATCH * @module ngMockE2E * @description * Creates a new backend definition for PATCH requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. - * @param {(string|RegExp)=} data HTTP request body. + * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives + * data string and returns true if the data is as expected. * @param {(Object|function(Object))=} headers HTTP headers. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on * {@link ngMock.$httpBackend $httpBackend mock}. @@ -2609,14 +2715,14 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * `respond` or `passThrough` again in order to change how a matched request is handled. */ -/** + /** * @ngdoc method * @name $httpBackend#whenJSONP * @module ngMockE2E * @description * Creates a new backend definition for JSONP requests. For more info see `when()`. * - * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * @param {string|RegExp|function(string)=} url HTTP url or function that receives a url * and returns true if the url matches the current definition. * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on * {@link ngMock.$httpBackend $httpBackend mock}. @@ -2624,7 +2730,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * control how a matched request is handled. You can save this object for later use and invoke * `respond` or `passThrough` again in order to change how a matched request is handled. */ -/** + /** * @ngdoc method * @name $httpBackend#whenRoute * @module ngMockE2E @@ -2637,12 +2743,44 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * control how a matched request is handled. You can save this object for later use and invoke * `respond` or `passThrough` again in order to change how a matched request is handled. */ -angular.mock.e2e = {}; -angular.mock.e2e.$httpBackendDecorator = + /** + * @ngdoc method + * @name $httpBackend#matchLatestDefinition + * @module ngMockE2E + * @description + * This method can be used to change which mocked responses `$httpBackend` returns, when defining + * them with {@link ngMock.$httpBackend#when $httpBackend.when()} (and shortcut methods). + * By default, `$httpBackend` returns the first definition that matches. When setting + * `$http.matchLatestDefinition(true)`, it will use the last response that matches, i.e. the + * one that was added last. + * + * ```js + * hb.when('GET', '/url1').respond(200, 'content', {}); + * hb.when('GET', '/url1').respond(201, 'another', {}); + * hb('GET', '/url1'); // receives "content" + * + * $http.matchLatestDefinition(true) + * hb('GET', '/url1'); // receives "another" + * + * hb.when('GET', '/url1').respond(201, 'onemore', {}); + * hb('GET', '/url1'); // receives "onemore" + * ``` + * + * This is useful if a you have a default response that is overriden inside specific tests. + * + * Note that different from config methods on providers, `matchLatestDefinition()` can be changed + * even when the application is already running. + * + * @param {Boolean=} value value to set, either `true` or `false`. Default is `false`. + * If omitted, it will return the current value. + * @return {$httpBackend|Boolean} self when used as a setter, and the current value when used + * as a getter + */ + angular.mock.e2e = {}; + angular.mock.e2e.$httpBackendDecorator = ['$rootScope', '$timeout', '$delegate', '$browser', createHttpBackendMock]; - -/** + /** * @ngdoc type * @name $rootScope.Scope * @module ngMock @@ -2653,18 +2791,17 @@ angular.mock.e2e.$httpBackendDecorator = * * In addition to all the regular `Scope` methods, the following helper methods are available: */ -angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { + angular.mock.$RootScopeDecorator = ['$delegate', function ($delegate) { + var $rootScopePrototype = Object.getPrototypeOf($delegate); - var $rootScopePrototype = Object.getPrototypeOf($delegate); + $rootScopePrototype.$countChildScopes = countChildScopes; + $rootScopePrototype.$countWatchers = countWatchers; - $rootScopePrototype.$countChildScopes = countChildScopes; - $rootScopePrototype.$countWatchers = countWatchers; + return $delegate; - return $delegate; + // ------------------------------------------------------------------------------------------ // - // ------------------------------------------------------------------------------------------ // - - /** + /** * @ngdoc method * @name $rootScope.Scope#$countChildScopes * @module ngMock @@ -2676,26 +2813,25 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { * * @returns {number} Total number of child scopes. */ - function countChildScopes() { - var count = 0; // exclude the current scope - var pendingChildHeads = [this.$$childHead]; - var currentScope; - - while (pendingChildHeads.length) { - currentScope = pendingChildHeads.shift(); - - while (currentScope) { - count += 1; - pendingChildHeads.push(currentScope.$$childHead); - currentScope = currentScope.$$nextSibling; + function countChildScopes () { + var count = 0; // exclude the current scope + var pendingChildHeads = [this.$$childHead]; + var currentScope; + + while (pendingChildHeads.length) { + currentScope = pendingChildHeads.shift(); + + while (currentScope) { + count += 1; + pendingChildHeads.push(currentScope.$$childHead); + currentScope = currentScope.$$nextSibling; + } } - } - - return count; - } + return count; + } - /** + /** * @ngdoc method * @name $rootScope.Scope#$countWatchers * @this $rootScope.Scope @@ -2708,48 +2844,46 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { * * @returns {number} Total number of watchers. */ - function countWatchers() { - var count = this.$$watchers ? this.$$watchers.length : 0; // include the current scope - var pendingChildHeads = [this.$$childHead]; - var currentScope; - - while (pendingChildHeads.length) { - currentScope = pendingChildHeads.shift(); - - while (currentScope) { - count += currentScope.$$watchers ? currentScope.$$watchers.length : 0; - pendingChildHeads.push(currentScope.$$childHead); - currentScope = currentScope.$$nextSibling; + function countWatchers () { + var count = this.$$watchers ? this.$$watchers.length : 0; // include the current scope + var pendingChildHeads = [this.$$childHead]; + var currentScope; + + while (pendingChildHeads.length) { + currentScope = pendingChildHeads.shift(); + + while (currentScope) { + count += currentScope.$$watchers ? currentScope.$$watchers.length : 0; + pendingChildHeads.push(currentScope.$$childHead); + currentScope = currentScope.$$nextSibling; + } } - } - return count; - } -}]; - - -(function(jasmineOrMocha) { + return count; + } + }]; - if (!jasmineOrMocha) { - return; - } + (function (jasmineOrMocha) { + if (!jasmineOrMocha) { + return; + } - var currentSpec = null, + var currentSpec = null, injectorState = new InjectorState(), annotatedFunctions = [], - wasInjectorCreated = function() { + wasInjectorCreated = function () { return !!currentSpec; }; - angular.mock.$$annotate = angular.injector.$$annotate; - angular.injector.$$annotate = function(fn) { - if (typeof fn === 'function' && !fn.$inject) { - annotatedFunctions.push(fn); - } - return angular.mock.$$annotate.apply(this, arguments); - }; + angular.mock.$$annotate = angular.injector.$$annotate; + angular.injector.$$annotate = function (fn) { + if (typeof fn === 'function' && !fn.$inject) { + annotatedFunctions.push(fn); + } + return angular.mock.$$annotate.apply(this, arguments); + }; - /** + /** * @ngdoc function * @name angular.mock.module * @description @@ -2769,45 +2903,45 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { * {@link auto.$provide $provide}.value, the key being the string name (or token) to associate * with the value on the injector. */ - var module = window.module = angular.mock.module = function() { - var moduleFns = Array.prototype.slice.call(arguments, 0); - return wasInjectorCreated() ? workFn() : workFn; - ///////////////////// - function workFn() { - if (currentSpec.$injector) { - throw new Error('Injector already created, can not register a module!'); - } else { - var fn, modules = currentSpec.$modules || (currentSpec.$modules = []); - angular.forEach(moduleFns, function(module) { - if (angular.isObject(module) && !angular.isArray(module)) { - fn = ['$provide', function($provide) { - angular.forEach(module, function(value, key) { - $provide.value(key, value); - }); - }]; - } else { - fn = module; - } - if (currentSpec.$providerInjector) { - currentSpec.$providerInjector.invoke(fn); - } else { - modules.push(fn); - } - }); + var module = window.module = angular.mock.module = function () { + var moduleFns = Array.prototype.slice.call(arguments, 0); + return wasInjectorCreated() ? workFn() : workFn; + /// ////////////////// + function workFn () { + if (currentSpec.$injector) { + throw new Error('Injector already created, can not register a module!'); + } else { + var fn, modules = currentSpec.$modules || (currentSpec.$modules = []); + angular.forEach(moduleFns, function (module) { + if (angular.isObject(module) && !angular.isArray(module)) { + fn = ['$provide', function ($provide) { + angular.forEach(module, function (value, key) { + $provide.value(key, value); + }); + }]; + } else { + fn = module; + } + if (currentSpec.$providerInjector) { + currentSpec.$providerInjector.invoke(fn); + } else { + modules.push(fn); + } + }); + } } - } - }; + }; - module.$$beforeAllHook = (window.before || window.beforeAll); - module.$$afterAllHook = (window.after || window.afterAll); + module.$$beforeAllHook = (window.before || window.beforeAll); + module.$$afterAllHook = (window.after || window.afterAll); - // purely for testing ngMock itself - module.$$currentSpec = function(to) { - if (arguments.length === 0) return to; - currentSpec = to; - }; + // purely for testing ngMock itself + module.$$currentSpec = function (to) { + if (arguments.length === 0) return to; + currentSpec = to; + }; - /** + /** * @ngdoc function * @name angular.mock.module.sharedInjector * @description @@ -2859,105 +2993,99 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { * * ``` */ - module.sharedInjector = function() { - if (!(module.$$beforeAllHook && module.$$afterAllHook)) { - throw Error('sharedInjector() cannot be used unless your test runner defines beforeAll/afterAll'); - } - - var initialized = false; - - module.$$beforeAllHook(/** @this */ function() { - if (injectorState.shared) { - injectorState.sharedError = Error('sharedInjector() cannot be called inside a context that has already called sharedInjector()'); - throw injectorState.sharedError; + module.sharedInjector = function () { + if (!(module.$$beforeAllHook && module.$$afterAllHook)) { + throw Error('sharedInjector() cannot be used unless your test runner defines beforeAll/afterAll'); } - initialized = true; - currentSpec = this; - injectorState.shared = true; - }); - module.$$afterAllHook(function() { - if (initialized) { - injectorState = new InjectorState(); - module.$$cleanup(); - } else { - injectorState.sharedError = null; - } - }); - }; + var initialized = false; - module.$$beforeEach = function() { - if (injectorState.shared && currentSpec && currentSpec !== this) { - var state = currentSpec; - currentSpec = this; - angular.forEach(['$injector','$modules','$providerInjector', '$injectorStrict'], function(k) { - currentSpec[k] = state[k]; - state[k] = null; + module.$$beforeAllHook(/** @this */ function () { + if (injectorState.shared) { + injectorState.sharedError = Error('sharedInjector() cannot be called inside a context that has already called sharedInjector()'); + throw injectorState.sharedError; + } + initialized = true; + currentSpec = this; + injectorState.shared = true; }); - } else { - currentSpec = this; - originalRootElement = null; - annotatedFunctions = []; - } - }; - module.$$afterEach = function() { - if (injectorState.cleanupAfterEach()) { - module.$$cleanup(); - } - }; - - module.$$cleanup = function() { - var injector = currentSpec.$injector; + module.$$afterAllHook(function () { + if (initialized) { + injectorState = new InjectorState(); + module.$$cleanup(); + } else { + injectorState.sharedError = null; + } + }); + }; - annotatedFunctions.forEach(function(fn) { - delete fn.$inject; - }); + module.$$beforeEach = function () { + if (injectorState.shared && currentSpec && currentSpec !== this) { + var state = currentSpec; + currentSpec = this; + angular.forEach(['$injector', '$modules', '$providerInjector', '$injectorStrict'], function (k) { + currentSpec[k] = state[k]; + state[k] = null; + }); + } else { + currentSpec = this; + originalRootElement = null; + annotatedFunctions = []; + } + }; - angular.forEach(currentSpec.$modules, function(module) { - if (module && module.$$hashKey) { - module.$$hashKey = undefined; + module.$$afterEach = function () { + if (injectorState.cleanupAfterEach()) { + module.$$cleanup(); } - }); + }; + + module.$$cleanup = function () { + var injector = currentSpec.$injector; + + annotatedFunctions.forEach(function (fn) { + delete fn.$inject; + }); - currentSpec.$injector = null; - currentSpec.$modules = null; - currentSpec.$providerInjector = null; - currentSpec = null; + currentSpec.$injector = null; + currentSpec.$modules = null; + currentSpec.$providerInjector = null; + currentSpec = null; - if (injector) { + if (injector) { // Ensure `$rootElement` is instantiated, before checking `originalRootElement` - var $rootElement = injector.get('$rootElement'); - var rootNode = $rootElement && $rootElement[0]; - var cleanUpNodes = !originalRootElement ? [] : [originalRootElement[0]]; - if (rootNode && (!originalRootElement || rootNode !== originalRootElement[0])) { - cleanUpNodes.push(rootNode); - } - angular.element.cleanData(cleanUpNodes); + var $rootElement = injector.get('$rootElement'); + var rootNode = $rootElement && $rootElement[0]; + var cleanUpNodes = !originalRootElement ? [] : [originalRootElement[0]]; + if (rootNode && (!originalRootElement || rootNode !== originalRootElement[0])) { + cleanUpNodes.push(rootNode); + } + angular.element.cleanData(cleanUpNodes); - // Ensure `$destroy()` is available, before calling it - // (a mocked `$rootScope` might not implement it (or not even be an object at all)) - var $rootScope = injector.get('$rootScope'); - if ($rootScope && $rootScope.$destroy) $rootScope.$destroy(); - } + // Ensure `$destroy()` is available, before calling it + // (a mocked `$rootScope` might not implement it (or not even be an object at all)) + var $rootScope = injector.get('$rootScope'); + if ($rootScope && $rootScope.$destroy) $rootScope.$destroy(); + } - // clean up jquery's fragment cache - angular.forEach(angular.element.fragments, function(val, key) { - delete angular.element.fragments[key]; - }); + // clean up jquery's fragment cache + angular.forEach(angular.element.fragments, function (val, key) { + delete angular.element.fragments[key]; + }); - MockXhr.$$lastInstance = null; + MockXhr.$$lastInstance = null; - angular.forEach(angular.callbacks, function(val, key) { - delete angular.callbacks[key]; - }); - angular.callbacks.$$counter = 0; - }; + angular.forEach(angular.callbacks, function (val, key) { + delete angular.callbacks[key]; + }); + angular.callbacks.$$counter = 0; + }; - (window.beforeEach || window.setup)(module.$$beforeEach); - (window.afterEach || window.teardown)(module.$$afterEach); + (window.beforeEach || window.setup)(module.$$beforeEach); + (window.afterEach || window.teardown)(module.$$afterEach); - /** + /** * @ngdoc function * @name angular.mock.inject * @description @@ -2981,7 +3109,7 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { * These are ignored by the injector when the reference name is resolved. * * For example, the parameter `_myService_` would be resolved as the reference `myService`. - * Since it is available in the function body as _myService_, we can then assign it to a variable + * Since it is available in the function body as `_myService_`, we can then assign it to a variable * defined in an outer scope. * * ``` @@ -3043,96 +3171,344 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { * @param {...Function} fns any number of functions which will be injected using the injector. */ + var ErrorAddingDeclarationLocationStack = function ErrorAddingDeclarationLocationStack (e, errorForStack) { + this.message = e.message; + this.name = e.name; + if (e.line) this.line = e.line; + if (e.sourceId) this.sourceId = e.sourceId; + if (e.stack && errorForStack) { this.stack = e.stack + '\n' + errorForStack.stack; } + if (e.stackArray) this.stackArray = e.stackArray; + }; + ErrorAddingDeclarationLocationStack.prototype = Error.prototype; - - var ErrorAddingDeclarationLocationStack = function ErrorAddingDeclarationLocationStack(e, errorForStack) { - this.message = e.message; - this.name = e.name; - if (e.line) this.line = e.line; - if (e.sourceId) this.sourceId = e.sourceId; - if (e.stack && errorForStack) - this.stack = e.stack + '\n' + errorForStack.stack; - if (e.stackArray) this.stackArray = e.stackArray; - }; - ErrorAddingDeclarationLocationStack.prototype = Error.prototype; - - window.inject = angular.mock.inject = function() { - var blockFns = Array.prototype.slice.call(arguments, 0); - var errorForStack = new Error('Declaration Location'); - // IE10+ and PhanthomJS do not set stack trace information, until the error is thrown - if (!errorForStack.stack) { - try { - throw errorForStack; - } catch (e) { /* empty */ } - } - return wasInjectorCreated() ? WorkFn.call(currentSpec) : WorkFn; - ///////////////////// - function WorkFn() { - var modules = currentSpec.$modules || []; - var strictDi = !!currentSpec.$injectorStrict; - modules.unshift(['$injector', function($injector) { - currentSpec.$providerInjector = $injector; - }]); - modules.unshift('ngMock'); - modules.unshift('ng'); - var injector = currentSpec.$injector; - if (!injector) { - if (strictDi) { + window.inject = angular.mock.inject = function () { + var blockFns = Array.prototype.slice.call(arguments, 0); + var errorForStack = new Error('Declaration Location'); + // IE10+ and PhanthomJS do not set stack trace information, until the error is thrown + if (!errorForStack.stack) { + try { + throw errorForStack; + } catch (e) { /* empty */ } + } + return wasInjectorCreated() ? WorkFn.call(currentSpec) : WorkFn; + /// ////////////////// + function WorkFn () { + var modules = currentSpec.$modules || []; + var strictDi = !!currentSpec.$injectorStrict; + modules.unshift(['$injector', function ($injector) { + currentSpec.$providerInjector = $injector; + }]); + modules.unshift('ngMock'); + modules.unshift('ng'); + var injector = currentSpec.$injector; + if (!injector) { + if (strictDi) { // If strictDi is enabled, annotate the providerInjector blocks - angular.forEach(modules, function(moduleFn) { - if (typeof moduleFn === 'function') { - angular.injector.$$annotate(moduleFn); - } - }); + angular.forEach(modules, function (moduleFn) { + if (typeof moduleFn === 'function') { + angular.injector.$$annotate(moduleFn); + } + }); + } + injector = currentSpec.$injector = angular.injector(modules, strictDi); + currentSpec.$injectorStrict = strictDi; } - injector = currentSpec.$injector = angular.injector(modules, strictDi); - currentSpec.$injectorStrict = strictDi; - } - for (var i = 0, ii = blockFns.length; i < ii; i++) { - if (currentSpec.$injectorStrict) { + for (var i = 0, ii = blockFns.length; i < ii; i++) { + if (currentSpec.$injectorStrict) { // If the injector is strict / strictDi, and the spec wants to inject using automatic // annotation, then annotate the function here. - injector.annotate(blockFns[i]); + injector.annotate(blockFns[i]); + } + try { + injector.invoke(blockFns[i] || angular.noop, this); + } catch (e) { + if (e.stack && errorForStack) { + throw new ErrorAddingDeclarationLocationStack(e, errorForStack); + } + throw e; + } finally { + errorForStack = null; + } } - try { - injector.invoke(blockFns[i] || angular.noop, this); - } catch (e) { - if (e.stack && errorForStack) { - throw new ErrorAddingDeclarationLocationStack(e, errorForStack); + } + }; + + angular.mock.inject.strictDi = function (value) { + value = arguments.length ? !!value : true; + return wasInjectorCreated() ? workFn() : workFn; + + function workFn () { + if (value !== currentSpec.$injectorStrict) { + if (currentSpec.$injector) { + throw new Error('Injector already created, can not modify strict annotations'); + } else { + currentSpec.$injectorStrict = value; } - throw e; - } finally { - errorForStack = null; } } + }; + + function InjectorState () { + this.shared = false; + this.sharedError = null; + + this.cleanupAfterEach = function () { + return !this.shared || this.sharedError; + }; } - }; + })(window.jasmine || window.mocha); + + 'use strict'; + + (function () { + /** + * @ngdoc function + * @name browserTrigger + * @description + * + * This is a global (window) function that is only available when the {@link ngMock} module is + * included. + * + * It can be used to trigger a native browser event on an element, which is useful for unit testing. + * + * + * @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement + * @param {string=} eventType Optional event type. If none is specified, the function tries + * to determine the right event type for the element, e.g. `change` for + * `input[text]`. + * @param {Object=} eventData An optional object which contains additional event data that is used + * when creating the event: + * + * - `bubbles`: [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles). + * Not applicable to all events. + * + * - `cancelable`: [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable). + * Not applicable to all events. + * + * - `charcode`: [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode) + * for keyboard events (keydown, keypress, and keyup). + * + * - `elapsedTime`: the elapsedTime for + * [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent) + * and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent). + * + * - `keycode`: [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode) + * for keyboard events (keydown, keypress, and keyup). + * + * - `keys`: an array of possible modifier keys (ctrl, alt, shift, meta) for + * [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and + * keyboard events (keydown, keypress, and keyup). + * + * - `relatedTarget`: the + * [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget) + * for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent). + * + * - `which`: [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which) + * for keyboard events (keydown, keypress, and keyup). + * + * - `x`: x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) + * and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent). + * + * - `y`: y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) + * and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent). + * + */ + window.browserTrigger = function browserTrigger (element, eventType, eventData) { + if (element && !element.nodeName) element = element[0]; + if (!element) return; + + eventData = eventData || {}; + var relatedTarget = eventData.relatedTarget || element; + var keys = eventData.keys; + var x = eventData.x; + var y = eventData.y; + + var inputType = (element.type) ? element.type.toLowerCase() : null, + nodeName = element.nodeName.toLowerCase(); + if (!eventType) { + eventType = { + 'text': 'change', + 'textarea': 'change', + 'hidden': 'change', + 'password': 'change', + 'button': 'click', + 'submit': 'click', + 'reset': 'click', + 'image': 'click', + 'checkbox': 'click', + 'radio': 'click', + 'select-one': 'change', + 'select-multiple': 'change', + '_default_': 'click' + }[inputType || '_default_']; + } + if (nodeName === 'option') { + element.parentNode.value = element.value; + element = element.parentNode; + eventType = 'change'; + } - angular.mock.inject.strictDi = function(value) { - value = arguments.length ? !!value : true; - return wasInjectorCreated() ? workFn() : workFn; + keys = keys || []; + function pressed (key) { + return keys.indexOf(key) !== -1; + } - function workFn() { - if (value !== currentSpec.$injectorStrict) { - if (currentSpec.$injector) { - throw new Error('Injector already created, can not modify strict annotations'); + var evnt; + if (/transitionend/.test(eventType)) { + if (window.WebKitTransitionEvent) { + evnt = new window.WebKitTransitionEvent(eventType, eventData); + evnt.initEvent(eventType, eventData.bubbles, true); + } else { + try { + evnt = new window.TransitionEvent(eventType, eventData); + } catch (e) { + evnt = window.document.createEvent('TransitionEvent'); + evnt.initTransitionEvent(eventType, eventData.bubbles, null, null, eventData.elapsedTime || 0); + } + } + } else if (/animationend/.test(eventType)) { + if (window.WebKitAnimationEvent) { + evnt = new window.WebKitAnimationEvent(eventType, eventData); + evnt.initEvent(eventType, eventData.bubbles, true); } else { - currentSpec.$injectorStrict = value; + try { + evnt = new window.AnimationEvent(eventType, eventData); + } catch (e) { + evnt = window.document.createEvent('AnimationEvent'); + evnt.initAnimationEvent(eventType, eventData.bubbles, null, null, eventData.elapsedTime || 0); + } + } + } else if (/touch/.test(eventType) && supportsTouchEvents()) { + evnt = createTouchEvent(element, eventType, x, y); + } else if (/key/.test(eventType)) { + evnt = window.document.createEvent('Events'); + evnt.initEvent(eventType, eventData.bubbles, eventData.cancelable); + evnt.view = window; + evnt.ctrlKey = pressed('ctrl'); + evnt.altKey = pressed('alt'); + evnt.shiftKey = pressed('shift'); + evnt.metaKey = pressed('meta'); + evnt.keyCode = eventData.keyCode; + evnt.charCode = eventData.charCode; + evnt.which = eventData.which; + } else if (/composition/.test(eventType)) { + try { + evnt = new window.CompositionEvent(eventType, { + data: eventData.data + }); + } catch (e) { + // Support: IE9+ + evnt = window.document.createEvent('CompositionEvent', {}); + evnt.initCompositionEvent( + eventType, + eventData.bubbles, + eventData.cancelable, + window, + eventData.data, + null + ); } + } else { + evnt = window.document.createEvent('MouseEvents'); + x = x || 0; + y = y || 0; + evnt.initMouseEvent(eventType, true, true, window, 0, x, y, x, y, pressed('ctrl'), + pressed('alt'), pressed('shift'), pressed('meta'), 0, relatedTarget); } - } - }; - function InjectorState() { - this.shared = false; - this.sharedError = null; + /* we're unable to change the timeStamp value directly so this + * is only here to allow for testing where the timeStamp value is + * read */ + evnt.$manualTimeStamp = eventData.timeStamp; + + if (!evnt) return; - this.cleanupAfterEach = function() { - return !this.shared || this.sharedError; + if (!eventData.bubbles || supportsEventBubblingInDetachedTree() || isAttachedToDocument(element)) { + return element.dispatchEvent(evnt); + } else { + triggerForPath(element, evnt); + } }; - } -})(window.jasmine || window.mocha); + function supportsTouchEvents () { + if ('_cached' in supportsTouchEvents) { + return supportsTouchEvents._cached; + } + if (!window.document.createTouch || !window.document.createTouchList) { + supportsTouchEvents._cached = false; + return false; + } + try { + window.document.createEvent('TouchEvent'); + } catch (e) { + supportsTouchEvents._cached = false; + return false; + } + supportsTouchEvents._cached = true; + return true; + } + + function createTouchEvent (element, eventType, x, y) { + var evnt = new window.Event(eventType); + x = x || 0; + y = y || 0; + + var touch = window.document.createTouch(window, element, Date.now(), x, y, x, y); + var touches = window.document.createTouchList(touch); + + evnt.touches = touches; + + return evnt; + } + + function supportsEventBubblingInDetachedTree () { + if ('_cached' in supportsEventBubblingInDetachedTree) { + return supportsEventBubblingInDetachedTree._cached; + } + supportsEventBubblingInDetachedTree._cached = false; + var doc = window.document; + if (doc) { + var parent = doc.createElement('div'), + child = parent.cloneNode(); + parent.appendChild(child); + parent.addEventListener('e', function () { + supportsEventBubblingInDetachedTree._cached = true; + }); + var evnt = window.document.createEvent('Events'); + evnt.initEvent('e', true, true); + child.dispatchEvent(evnt); + } + return supportsEventBubblingInDetachedTree._cached; + } + + function triggerForPath (element, evnt) { + var stop = false; + + var _stopPropagation = evnt.stopPropagation; + evnt.stopPropagation = function () { + stop = true; + _stopPropagation.apply(evnt, arguments); + }; + patchEventTargetForBubbling(evnt, element); + do { + element.dispatchEvent(evnt); + // eslint-disable-next-line no-unmodified-loop-condition + } while (!stop && (element = element.parentNode)); + } + + function patchEventTargetForBubbling (event, target) { + event._target = target; + Object.defineProperty(event, 'target', {get: function () { return this._target; }}); + } + function isAttachedToDocument (element) { + while ((element = element.parentNode)) { + if (element === window) { + return true; + } + } + return false; + } + })(); })(window, window.angular); diff --git a/org.civicrm.reqangular/js/src/common/vendor/angular/angular-resource.min.js b/org.civicrm.reqangular/js/src/common/vendor/angular/angular-resource.min.js index caecdd40624..1dfb0add7da 100644 --- a/org.civicrm.reqangular/js/src/common/vendor/angular/angular-resource.min.js +++ b/org.civicrm.reqangular/js/src/common/vendor/angular/angular-resource.min.js @@ -1,15 +1,15 @@ /* - AngularJS v1.5.9 - (c) 2010-2016 Google, Inc. http://angularjs.org + AngularJS v1.7.2 + (c) 2010-2018 Google, Inc. http://angularjs.org License: MIT */ -(function(P,d){'use strict';function G(t,g){g=g||{};d.forEach(g,function(d,q){delete g[q]});for(var q in t)!t.hasOwnProperty(q)||"$"===q.charAt(0)&&"$"===q.charAt(1)||(g[q]=t[q]);return g}var z=d.$$minErr("$resource"),M=/^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;d.module("ngResource",["ng"]).provider("$resource",function(){var t=/^https?:\/\/[^\/]*/,g=this;this.defaults={stripTrailingSlashes:!0,cancellable:!1,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"}, -"delete":{method:"DELETE"}}};this.$get=["$http","$log","$q","$timeout",function(q,L,H,I){function A(d,h){return encodeURIComponent(d).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,h?"%20":"+")}function B(d,h){this.template=d;this.defaults=v({},g.defaults,h);this.urlParams={}}function J(e,h,n,k){function b(a,c){var b={};c=v({},h,c);u(c,function(c,h){x(c)&&(c=c(a));var f;if(c&&c.charAt&&"@"===c.charAt(0)){f=a;var l=c.substr(1);if(null==l||""===l|| -"hasOwnProperty"===l||!M.test("."+l))throw z("badmember",l);for(var l=l.split("."),m=0,k=l.length;m>>0,d=Number(arguments[2])||0;for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if(d in a&&a[d]===b)return d;return-1}function i(a,b,c,d){var e,i=f(c,d),j={},k=[];for(var l in i)if(i[l].params&&(e=g(i[l].params),e.length))for(var m in e)h(k,e[m])>=0||(k.push(e[m]),j[e[m]]=a[e[m]]);return N({},j,b)}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e "));if(s[c]=d,J(a))q.push(c,[function(){return b.get(a)}],j);else{var e=b.annotate(a);M(e,function(a){a!==c&&i.hasOwnProperty(a)&&n(i[a],a)}),q.push(c,a,e)}r.pop(),s[c]=f}}function o(a){return K(a)&&a.then&&a.$$promises}if(!K(i))throw new Error("'invocables' must be an object");var p=g(i||{}),q=[],r=[],s={};return M(i,n),i=r=s=null,function(d,f,g){function h(){--u||(v||e(t,f.$$values),r.$$values=t,r.$$promises=r.$$promises||!0,delete r.$$inheritedValues,n.resolve(t))}function i(a){r.$$failure=a,n.reject(a)}function j(c,e,f){function j(a){l.reject(a),i(a)}function k(){if(!H(r.$$failure))try{l.resolve(b.invoke(e,g,t)),l.promise.then(function(a){t[c]=a,h()},j)}catch(a){j(a)}}var l=a.defer(),m=0;M(f,function(a){s.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,s[a].then(function(b){t[a]=b,--m||k()},j))}),m||k(),s[c]=l.promise}if(o(d)&&g===c&&(g=f,f=d,d=null),d){if(!K(d))throw new Error("'locals' must be an object")}else d=k;if(f){if(!o(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=l;var n=a.defer(),r=n.promise,s=r.$$promises={},t=N({},d),u=1+q.length/3,v=!1;if(H(f.$$failure))return i(f.$$failure),r;f.$$inheritedValues&&e(t,m(f.$$inheritedValues,p)),N(s,f.$$promises),f.$$values?(v=e(t,m(f.$$values,p)),r.$$inheritedValues=m(f.$$values,p),h()):(f.$$inheritedValues&&(r.$$inheritedValues=m(f.$$inheritedValues,p)),f.then(h,i));for(var w=0,x=q.length;x>w;w+=3)d.hasOwnProperty(q[w])?h():j(q[w],q[w+1],q[w+2]);return r}},this.resolve=function(a,b,c,d){return this.study(a)(b,c,d)}}function q(a,b,c){this.fromConfig=function(a,b,c){return H(a.template)?this.fromString(a.template,b):H(a.templateUrl)?this.fromUrl(a.templateUrl,b):H(a.templateProvider)?this.fromProvider(a.templateProvider,b,c):null},this.fromString=function(a,b){return I(a)?a(b):a},this.fromUrl=function(c,d){return I(c)&&(c=c(d)),null==c?null:a.get(c,{cache:b,headers:{Accept:"text/html"}}).then(function(a){return a.data})},this.fromProvider=function(a,b,d){return c.invoke(a,null,d||{params:b})}}function r(a,b,e){function f(b,c,d,e){if(q.push(b),o[b])return o[b];if(!/^\w+(-+\w+)*(?:\[\])?$/.test(b))throw new Error("Invalid parameter name '"+b+"' in pattern '"+a+"'");if(p[b])throw new Error("Duplicate parameter name '"+b+"' in pattern '"+a+"'");return p[b]=new P.Param(b,c,d,e),p[b]}function g(a,b,c,d){var e=["",""],f=a.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!b)return f;switch(c){case!1:e=["(",")"+(d?"?":"")];break;case!0:e=["?(",")?"];break;default:e=["("+c+"|",")?"]}return f+e[0]+b+e[1]}function h(e,f){var g,h,i,j,k;return g=e[2]||e[3],k=b.params[g],i=a.substring(m,e.index),h=f?e[4]:e[4]||("*"==e[1]?".*":null),j=P.type(h||"string")||d(P.type("string"),{pattern:new RegExp(h,b.caseInsensitive?"i":c)}),{id:g,regexp:h,segment:i,type:j,cfg:k}}b=N({params:{}},K(b)?b:{});var i,j=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,k=/([:]?)([\w\[\]-]+)|\{([\w\[\]-]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l="^",m=0,n=this.segments=[],o=e?e.params:{},p=this.params=e?e.params.$$new():new P.ParamSet,q=[];this.source=a;for(var r,s,t;(i=j.exec(a))&&(r=h(i,!1),!(r.segment.indexOf("?")>=0));)s=f(r.id,r.type,r.cfg,"path"),l+=g(r.segment,s.type.pattern.source,s.squash,s.isOptional),n.push(r.segment),m=j.lastIndex;t=a.substring(m);var u=t.indexOf("?");if(u>=0){var v=this.sourceSearch=t.substring(u);if(t=t.substring(0,u),this.sourcePath=a.substring(0,m+u),v.length>0)for(m=0;i=k.exec(v);)r=h(i,!0),s=f(r.id,r.type,r.cfg,"search"),m=j.lastIndex}else this.sourcePath=a,this.sourceSearch="";l+=g(t)+(b.strict===!1?"/?":"")+"$",n.push(t),this.regexp=new RegExp(l,b.caseInsensitive?"i":c),this.prefix=n[0],this.$$paramNames=q}function s(a){N(this,a)}function t(){function a(a){return null!=a?a.toString().replace(/\//g,"%2F"):a}function e(a){return null!=a?a.toString().replace(/%2F/g,"/"):a}function f(){return{strict:p,caseInsensitive:m}}function i(a){return I(a)||L(a)&&I(a[a.length-1])}function j(){for(;w.length;){var a=w.shift();if(a.pattern)throw new Error("You cannot override a type's .pattern at runtime.");b.extend(u[a.name],l.invoke(a.def))}}function k(a){N(this,a||{})}P=this;var l,m=!1,p=!0,q=!1,u={},v=!0,w=[],x={string:{encode:a,decode:e,is:function(a){return null==a||!H(a)||"string"==typeof a},pattern:/[^/]*/},"int":{encode:a,decode:function(a){return parseInt(a,10)},is:function(a){return H(a)&&this.decode(a.toString())===a},pattern:/\d+/},bool:{encode:function(a){return a?1:0},decode:function(a){return 0!==parseInt(a,10)},is:function(a){return a===!0||a===!1},pattern:/0|1/},date:{encode:function(a){return this.is(a)?[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2)].join("-"):c},decode:function(a){if(this.is(a))return a;var b=this.capture.exec(a);return b?new Date(b[1],b[2]-1,b[3]):c},is:function(a){return a instanceof Date&&!isNaN(a.valueOf())},equals:function(a,b){return this.is(a)&&this.is(b)&&a.toISOString()===b.toISOString()},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:{encode:b.toJson,decode:b.fromJson,is:b.isObject,equals:b.equals,pattern:/[^/]*/},any:{encode:b.identity,decode:b.identity,equals:b.equals,pattern:/.*/}};t.$$getDefaultValue=function(a){if(!i(a.value))return a.value;if(!l)throw new Error("Injectable functions cannot be called at configuration time");return l.invoke(a.value)},this.caseInsensitive=function(a){return H(a)&&(m=a),m},this.strictMode=function(a){return H(a)&&(p=a),p},this.defaultSquashPolicy=function(a){if(!H(a))return q;if(a!==!0&&a!==!1&&!J(a))throw new Error("Invalid squash policy: "+a+". Valid policies: false, true, arbitrary-string");return q=a,a},this.compile=function(a,b){return new r(a,N(f(),b))},this.isMatcher=function(a){if(!K(a))return!1;var b=!0;return M(r.prototype,function(c,d){I(c)&&(b=b&&H(a[d])&&I(a[d]))}),b},this.type=function(a,b,c){if(!H(b))return u[a];if(u.hasOwnProperty(a))throw new Error("A type named '"+a+"' has already been defined.");return u[a]=new s(N({name:a},b)),c&&(w.push({name:a,def:c}),v||j()),this},M(x,function(a,b){u[b]=new s(N({name:b},a))}),u=d(u,{}),this.$get=["$injector",function(a){return l=a,v=!1,j(),M(x,function(a,b){u[b]||(u[b]=new s(a))}),this}],this.Param=function(a,b,d,e){function f(a){var b=K(a)?g(a):[],c=-1===h(b,"value")&&-1===h(b,"type")&&-1===h(b,"squash")&&-1===h(b,"array");return c&&(a={value:a}),a.$$fn=i(a.value)?a.value:function(){return a.value},a}function j(b,c,d){if(b.type&&c)throw new Error("Param '"+a+"' has two type configurations.");return c?c:b.type?b.type instanceof s?b.type:new s(b.type):"config"===d?u.any:u.string}function k(){var b={array:"search"===e?"auto":!1},c=a.match(/\[\]$/)?{array:!0}:{};return N(b,c,d).array}function m(a,b){var c=a.squash;if(!b||c===!1)return!1;if(!H(c)||null==c)return q;if(c===!0||J(c))return c;throw new Error("Invalid squash policy: '"+c+"'. Valid policies: false, true, or arbitrary string")}function p(a,b,d,e){var f,g,i=[{from:"",to:d||b?c:""},{from:null,to:d||b?c:""}];return f=L(a.replace)?a.replace:[],J(e)&&f.push({from:e,to:c}),g=o(f,function(a){return a.from}),n(i,function(a){return-1===h(g,a.from)}).concat(f)}function r(){if(!l)throw new Error("Injectable functions cannot be called at configuration time");var a=l.invoke(d.$$fn);if(null!==a&&a!==c&&!w.type.is(a))throw new Error("Default value ("+a+") for parameter '"+w.id+"' is not an instance of Type ("+w.type.name+")");return a}function t(a){function b(a){return function(b){return b.from===a}}function c(a){var c=o(n(w.replace,b(a)),function(a){return a.to});return c.length?c[0]:a}return a=c(a),H(a)?w.type.$normalize(a):r()}function v(){return"{Param:"+a+" "+b+" squash: '"+z+"' optional: "+y+"}"}var w=this;d=f(d),b=j(d,b,e);var x=k();b=x?b.$asArray(x,"search"===e):b,"string"!==b.name||x||"path"!==e||d.value!==c||(d.value="");var y=d.value!==c,z=m(d,y),A=p(d,x,y,z);N(this,{id:a,type:b,location:e,array:x,squash:z,replace:A,isOptional:y,value:t,dynamic:c,config:d,toString:v})},k.prototype={$$new:function(){return d(this,N(new k,{$$parent:this}))},$$keys:function(){for(var a=[],b=[],c=this,d=g(k.prototype);c;)b.push(c),c=c.$$parent;return b.reverse(),M(b,function(b){M(g(b),function(b){-1===h(a,b)&&-1===h(d,b)&&a.push(b)})}),a},$$values:function(a){var b={},c=this;return M(c.$$keys(),function(d){b[d]=c[d].value(a&&a[d])}),b},$$equals:function(a,b){var c=!0,d=this;return M(d.$$keys(),function(e){var f=a&&a[e],g=b&&b[e];d[e].type.equals(f,g)||(c=!1)}),c},$$validates:function(a){var d,e,f,g,h,i=this.$$keys();for(d=0;de;e++)if(b(j[e]))return;k&&b(k)}}function n(){return i=i||e.$on("$locationChangeSuccess",m)}var o,p=g.baseHref(),q=d.url();return l||n(),{sync:function(){m()},listen:function(){return n()},update:function(a){return a?void(q=d.url()):void(d.url()!==q&&(d.url(q),d.replace()))},push:function(a,b,e){var f=a.format(b||{});null!==f&&b&&b["#"]&&(f+="#"+b["#"]),d.url(f),o=e&&e.$$avoidResync?d.url():c,e&&e.replace&&d.replace()},href:function(c,e,f){if(!c.validates(e))return null;var g=a.html5Mode();b.isObject(g)&&(g=g.enabled);var i=c.format(e);if(f=f||{},g||null===i||(i="#"+a.hashPrefix()+i),null!==i&&e&&e["#"]&&(i+="#"+e["#"]),i=h(i,g,f.absolute),!f.absolute||!i)return i;var j=!g&&i?"/":"",k=d.port();return k=80===k||443===k?"":":"+k,[d.protocol(),"://",d.host(),k,j,i].join("")}}}var i,j=[],k=null,l=!1;this.rule=function(a){if(!I(a))throw new Error("'rule' must be a function");return j.push(a),this},this.otherwise=function(a){if(J(a)){var b=a;a=function(){return b}}else if(!I(a))throw new Error("'rule' must be a function");return k=a,this},this.when=function(a,b){var c,h=J(b);if(J(a)&&(a=d.compile(a)),!h&&!I(b)&&!L(b))throw new Error("invalid 'handler' in when()");var i={matcher:function(a,b){return h&&(c=d.compile(b),b=["$match",function(a){return c.format(a)}]),N(function(c,d){return g(c,b,a.exec(d.path(),d.search()))},{prefix:J(a.prefix)?a.prefix:""})},regex:function(a,b){if(a.global||a.sticky)throw new Error("when() RegExp must not be global or sticky");return h&&(c=b,b=["$match",function(a){return f(c,a)}]),N(function(c,d){return g(c,b,a.exec(d.path()))},{prefix:e(a)})}},j={matcher:d.isMatcher(a),regex:a instanceof RegExp};for(var k in j)if(j[k])return this.rule(i[k](a,b));throw new Error("invalid 'what' in when()")},this.deferIntercept=function(a){a===c&&(a=!0),l=a},this.$get=h,h.$inject=["$location","$rootScope","$injector","$browser"]}function v(a,e){function f(a){return 0===a.indexOf(".")||0===a.indexOf("^")}function m(a,b){if(!a)return c;var d=J(a),e=d?a:a.name,g=f(e);if(g){if(!b)throw new Error("No reference point given for path '"+e+"'");b=m(b);for(var h=e.split("."),i=0,j=h.length,k=b;j>i;i++)if(""!==h[i]||0!==i){if("^"!==h[i])break;if(!k.parent)throw new Error("Path '"+e+"' not valid for state '"+b.name+"'");k=k.parent}else k=b;h=h.slice(i).join("."),e=k.name+(k.name&&h?".":"")+h}var l=z[e];return!l||!d&&(d||l!==a&&l.self!==a)?c:l}function n(a,b){A[a]||(A[a]=[]),A[a].push(b)}function p(a){for(var b=A[a]||[];b.length;)q(b.shift())}function q(b){b=d(b,{self:b,resolve:b.resolve||{},toString:function(){return this.name}});var c=b.name;if(!J(c)||c.indexOf("@")>=0)throw new Error("State must have a valid name");if(z.hasOwnProperty(c))throw new Error("State '"+c+"'' is already defined");var e=-1!==c.indexOf(".")?c.substring(0,c.lastIndexOf(".")):J(b.parent)?b.parent:K(b.parent)&&J(b.parent.name)?b.parent.name:"";if(e&&!z[e])return n(e,b.self);for(var f in C)I(C[f])&&(b[f]=C[f](b,C.$delegates[f]));return z[c]=b,!b[B]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){y.$current.navigable==b&&j(a,c)||y.transitionTo(b,a,{inherit:!0,location:!1})}]),p(c),b}function r(a){return a.indexOf("*")>-1}function s(a){for(var b=a.split("."),c=y.$current.name.split("."),d=0,e=b.length;e>d;d++)"*"===b[d]&&(c[d]="*");return"**"===b[0]&&(c=c.slice(h(c,b[1])),c.unshift("**")),"**"===b[b.length-1]&&(c.splice(h(c,b[b.length-2])+1,Number.MAX_VALUE),c.push("**")),b.length!=c.length?!1:c.join("")===b.join("")}function t(a,b){return J(a)&&!H(b)?C[a]:I(b)&&J(a)?(C[a]&&!C.$delegates[a]&&(C.$delegates[a]=C[a]),C[a]=b,this):this}function u(a,b){return K(a)?b=a:b.name=a,q(b),this}function v(a,e,f,h,l,n,p,q,t){function u(b,c,d,f){var g=a.$broadcast("$stateNotFound",b,c,d);if(g.defaultPrevented)return p.update(),D;if(!g.retry)return null;if(f.$retry)return p.update(),E;var h=y.transition=e.when(g.retry);return h.then(function(){return h!==y.transition?A:(b.options.$retry=!0,y.transitionTo(b.to,b.toParams,b.options))},function(){return D}),p.update(),h}function v(a,c,d,g,i,j){function m(){var c=[];return M(a.views,function(d,e){var g=d.resolve&&d.resolve!==a.resolve?d.resolve:{};g.$template=[function(){return f.load(e,{view:d,locals:i.globals,params:n,notify:j.notify})||""}],c.push(l.resolve(g,i.globals,i.resolve,a).then(function(c){if(I(d.controllerProvider)||L(d.controllerProvider)){var f=b.extend({},g,i.globals);c.$$controller=h.invoke(d.controllerProvider,null,f)}else c.$$controller=d.controller;c.$$state=a,c.$$controllerAs=d.controllerAs,i[e]=c}))}),e.all(c).then(function(){return i.globals})}var n=d?c:k(a.params.$$keys(),c),o={$stateParams:n};i.resolve=l.resolve(a.resolve,o,i.resolve,a);var p=[i.resolve.then(function(a){i.globals=a})];return g&&p.push(g),e.all(p).then(m).then(function(a){return i})}var A=e.reject(new Error("transition superseded")),C=e.reject(new Error("transition prevented")),D=e.reject(new Error("transition aborted")),E=e.reject(new Error("transition failed"));return x.locals={resolve:null,globals:{$stateParams:{}}},y={params:{},current:x.self,$current:x,transition:null},y.reload=function(a){return y.transitionTo(y.current,n,{reload:a||!0,inherit:!1,notify:!0})},y.go=function(a,b,c){return y.transitionTo(a,b,N({inherit:!0,relative:y.$current},c))},y.transitionTo=function(b,c,f){c=c||{},f=N({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},f||{});var g,j=y.$current,l=y.params,o=j.path,q=m(b,f.relative),r=c["#"];if(!H(q)){var s={to:b,toParams:c,options:f},t=u(s,j.self,l,f);if(t)return t;if(b=s.to,c=s.toParams,f=s.options,q=m(b,f.relative),!H(q)){if(!f.relative)throw new Error("No such state '"+b+"'");throw new Error("Could not resolve '"+b+"' from state '"+f.relative+"'")}}if(q[B])throw new Error("Cannot transition to abstract state '"+b+"'");if(f.inherit&&(c=i(n,c||{},y.$current,q)),!q.params.$$validates(c))return E;c=q.params.$$values(c),b=q;var z=b.path,D=0,F=z[D],G=x.locals,I=[];if(f.reload){if(J(f.reload)||K(f.reload)){if(K(f.reload)&&!f.reload.name)throw new Error("Invalid reload state object");var L=f.reload===!0?o[0]:m(f.reload);if(f.reload&&!L)throw new Error("No such reload state '"+(J(f.reload)?f.reload:f.reload.name)+"'");for(;F&&F===o[D]&&F!==L;)G=I[D]=F.locals,D++,F=z[D]}}else for(;F&&F===o[D]&&F.ownParams.$$equals(c,l);)G=I[D]=F.locals,D++,F=z[D];if(w(b,c,j,l,G,f))return r&&(c["#"]=r),y.params=c,O(y.params,n),f.location&&b.navigable&&b.navigable.url&&(p.push(b.navigable.url,c,{$$avoidResync:!0,replace:"replace"===f.location}),p.update(!0)),y.transition=null,e.when(y.current);if(c=k(b.params.$$keys(),c||{}),f.notify&&a.$broadcast("$stateChangeStart",b.self,c,j.self,l).defaultPrevented)return a.$broadcast("$stateChangeCancel",b.self,c,j.self,l),p.update(),C;for(var M=e.when(G),P=D;P=D;d--)g=o[d],g.self.onExit&&h.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=D;d=0?e:e+"@"+(f?f.state.name:"")}function B(a,b){var c,d=a.match(/^\s*({[^}]*})\s*$/);if(d&&(a=b+"("+d[1]+")"),c=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!c||4!==c.length)throw new Error("Invalid state ref '"+a+"'");return{state:c[1],paramExpr:c[3]||null}}function C(a){var b=a.parent().inheritedData("$uiView");return b&&b.state&&b.state.name?b.state:void 0}function D(a,c){var d=["location","inherit","reload","absolute"];return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(e,f,g,h){var i=B(g.uiSref,a.current.name),j=null,k=C(f)||a.$current,l="[object SVGAnimatedString]"===Object.prototype.toString.call(f.prop("href"))?"xlink:href":"href",m=null,n="A"===f.prop("tagName").toUpperCase(),o="FORM"===f[0].nodeName,p=o?"action":l,q=!0,r={relative:k,inherit:!0},s=e.$eval(g.uiSrefOpts)||{};b.forEach(d,function(a){a in s&&(r[a]=s[a])});var t=function(c){if(c&&(j=b.copy(c)),q){m=a.href(i.state,j,r);var d=h[1]||h[0];return d&&d.$$addStateInfo(i.state,j),null===m?(q=!1,!1):void g.$set(p,m)}};i.paramExpr&&(e.$watch(i.paramExpr,function(a,b){a!==j&&t(a)},!0),j=b.copy(e.$eval(i.paramExpr))),t(),o||f.bind("click",function(b){var d=b.which||b.button;if(!(d>1||b.ctrlKey||b.metaKey||b.shiftKey||f.attr("target"))){var e=c(function(){a.go(i.state,j,r)});b.preventDefault();var g=n&&!m?1:0;b.preventDefault=function(){g--<=0&&c.cancel(e)}}})}}}function E(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs",function(b,d,e){function f(){g()?d.addClass(i):d.removeClass(i)}function g(){for(var a=0;ae;e++){g=h[e];var l=this.params[g],m=d[e+1];for(f=0;fe;e++)g=h[e],k[g]=this.params[g].value(b[g]);return k},r.prototype.parameters=function(a){return H(a)?this.params[a]||null:this.$$paramNames},r.prototype.validates=function(a){return this.params.$$validates(a)},r.prototype.format=function(a){function b(a){return encodeURIComponent(a).replace(/-/g,function(a){return"%5C%"+a.charCodeAt(0).toString(16).toUpperCase()})}a=a||{};var c=this.segments,d=this.parameters(),e=this.params;if(!this.validates(a))return null;var f,g=!1,h=c.length-1,i=d.length,j=c[0];for(f=0;i>f;f++){var k=h>f,l=d[f],m=e[l],n=m.value(a[l]),p=m.isOptional&&m.type.equals(m.value(),n),q=p?m.squash:!1,r=m.type.encode(n);if(k){var s=c[f+1];if(q===!1)null!=r&&(j+=L(r)?o(r,b).join("-"):encodeURIComponent(r)),j+=s;else if(q===!0){var t=j.match(/\/$/)?/\/?(.*)/:/(.*)/;j+=s.match(t)[1]}else J(q)&&(j+=q+s)}else{if(null==r||p&&q!==!1)continue;L(r)||(r=[r]),r=o(r,encodeURIComponent).join("&"+l+"="),j+=(g?"&":"?")+(l+"="+r),g=!0}}return j},s.prototype.is=function(a,b){return!0},s.prototype.encode=function(a,b){return a},s.prototype.decode=function(a,b){return a},s.prototype.equals=function(a,b){return a==b},s.prototype.$subPattern=function(){var a=this.pattern.toString();return a.substr(1,a.length-2)},s.prototype.pattern=/.*/,s.prototype.toString=function(){return"{Type:"+this.name+"}"},s.prototype.$normalize=function(a){return this.is(a)?a:this.decode(a)},s.prototype.$asArray=function(a,b){function d(a,b){function d(a,b){return function(){return a[b].apply(a,arguments)}}function e(a){return L(a)?a:H(a)?[a]:[]}function f(a){switch(a.length){case 0:return c;case 1:return"auto"===b?a[0]:a;default:return a}}function g(a){return!a}function h(a,b){return function(c){c=e(c);var d=o(c,a);return b===!0?0===n(d,g).length:f(d)}}function i(a){return function(b,c){var d=e(b),f=e(c);if(d.length!==f.length)return!1;for(var g=0;g>>0,d=Number(arguments[2])||0;for(d=d<0?Math.ceil(d):Math.floor(d),d<0&&(d+=c);d=0||(k.push(e[m]),j[e[m]]=a[e[m]]);return T({},j,b)}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e "));if(t[c]=d,P(a))r.push(c,[function(){return b.get(a)}],j);else{var e=b.annotate(a);S(e,function(a){a!==c&&i.hasOwnProperty(a)&&n(i[a],a)}),r.push(c,a,e)}s.pop(),t[c]=f}}function o(a){return Q(a)&&a.then&&a.$$promises}if(!Q(i))throw new Error("'invocables' must be an object");var q=g(i||{}),r=[],s=[],t={};return S(i,n),i=s=t=null,function(d,f,g){function h(){--v||(w||e(u,f.$$values),s.$$values=u,s.$$promises=s.$$promises||!0,delete s.$$inheritedValues,n.resolve(u))}function i(a){s.$$failure=a,n.reject(a)}function j(c,e,f){function j(a){l.reject(a),i(a)}function k(){if(!N(s.$$failure))try{l.resolve(b.invoke(e,g,u)),l.promise.then(function(a){u[c]=a,h()},j)}catch(a){j(a)}}var l=a.defer(),m=0;S(f,function(a){t.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,t[a].then(function(b){u[a]=b,--m||k()},j))}),m||k(),t[c]=p(l.promise)}if(o(d)&&g===c&&(g=f,f=d,d=null),d){if(!Q(d))throw new Error("'locals' must be an object")}else d=k;if(f){if(!o(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=l;var n=a.defer(),s=p(n.promise),t=s.$$promises={},u=T({},d),v=1+r.length/3,w=!1;if(p(s),N(f.$$failure))return i(f.$$failure),s;f.$$inheritedValues&&e(u,m(f.$$inheritedValues,q)),T(t,f.$$promises),f.$$values?(w=e(u,m(f.$$values,q)),s.$$inheritedValues=m(f.$$values,q),h()):(f.$$inheritedValues&&(s.$$inheritedValues=m(f.$$inheritedValues,q)),f.then(h,i));for(var x=0,y=r.length;x=0));)s=f(r.id,r.type,r.cfg,"path"),l+=g(r.segment,s.type.pattern.source,s.squash,s.isOptional),n.push(r.segment),m=j.lastIndex;t=a.substring(m);var u=t.indexOf("?");if(u>=0){var v=this.sourceSearch=t.substring(u);if(t=t.substring(0,u),this.sourcePath=a.substring(0,m+u),v.length>0)for(m=0;i=k.exec(v);)r=h(i,!0),s=f(r.id,r.type,r.cfg,"search"),m=j.lastIndex}else this.sourcePath=a,this.sourceSearch="";l+=g(t)+(!1===b.strict?"/?":"")+"$",n.push(t),this.regexp=new RegExp(l,b.caseInsensitive?"i":c),this.prefix=n[0],this.$$paramNames=q}function u(a){T(this,a)}function v(){function a(a){return null!=a?a.toString().replace(/(~|\/)/g,function(a){return{"~":"~~","/":"~2F"}[a]}):a}function e(a){return null!=a?a.toString().replace(/(~~|~2F)/g,function(a){return{"~~":"~","~2F":"/"}[a]}):a}function f(){return{strict:p,caseInsensitive:m}}function i(a){return O(a)||R(a)&&O(a[a.length-1])}function j(){for(;w.length;){var a=w.shift();if(a.pattern)throw new Error("You cannot override a type's .pattern at runtime.");b.extend(r[a.name],l.invoke(a.def))}}function k(a){T(this,a||{})}W=this;var l,m=!1,p=!0,q=!1,r={},s=!0,w=[],x={string:{encode:a,decode:e,is:function(a){return null==a||!N(a)||"string"==typeof a},pattern:/[^\/]*/},int:{encode:a,decode:function(a){return parseInt(a,10)},is:function(a){return a!==c&&null!==a&&this.decode(a.toString())===a},pattern:/-?\d+/},bool:{encode:function(a){return a?1:0},decode:function(a){return 0!==parseInt(a,10)},is:function(a){return!0===a||!1===a},pattern:/0|1/},date:{encode:function(a){return this.is(a)?[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2)].join("-"):c},decode:function(a){if(this.is(a))return a;var b=this.capture.exec(a);return b?new Date(b[1],b[2]-1,b[3]):c},is:function(a){return a instanceof Date&&!isNaN(a.valueOf())},equals:function(a,b){return this.is(a)&&this.is(b)&&a.toISOString()===b.toISOString()},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:{encode:b.toJson,decode:b.fromJson,is:b.isObject,equals:b.equals,pattern:/[^\/]*/},any:{encode:b.identity,decode:b.identity,equals:b.equals,pattern:/.*/}};v.$$getDefaultValue=function(a){if(!i(a.value))return a.value;if(!l)throw new Error("Injectable functions cannot be called at configuration time");return l.invoke(a.value)},this.caseInsensitive=function(a){return N(a)&&(m=a),m},this.strictMode=function(a){return N(a)&&(p=a),p},this.defaultSquashPolicy=function(a){if(!N(a))return q;if(!0!==a&&!1!==a&&!P(a))throw new Error("Invalid squash policy: "+a+". Valid policies: false, true, arbitrary-string");return q=a,a},this.compile=function(a,b){return new t(a,T(f(),b))},this.isMatcher=function(a){if(!Q(a))return!1;var b=!0;return S(t.prototype,function(c,d){O(c)&&(b=b&&N(a[d])&&O(a[d]))}),b},this.type=function(a,b,c){if(!N(b))return r[a];if(r.hasOwnProperty(a))throw new Error("A type named '"+a+"' has already been defined.");return r[a]=new u(T({name:a},b)),c&&(w.push({name:a,def:c}),s||j()),this},S(x,function(a,b){r[b]=new u(T({name:b},a))}),r=d(r,{}),this.$get=["$injector",function(a){return l=a,s=!1,j(),S(x,function(a,b){r[b]||(r[b]=new u(a))}),this}],this.Param=function(a,d,e,f){function j(a){var b=Q(a)?g(a):[];return-1===h(b,"value")&&-1===h(b,"type")&&-1===h(b,"squash")&&-1===h(b,"array")&&(a={value:a}),a.$$fn=i(a.value)?a.value:function(){return a.value},a}function k(c,d,e){if(c.type&&d)throw new Error("Param '"+a+"' has two type configurations.");return d||(c.type?b.isString(c.type)?r[c.type]:c.type instanceof u?c.type:new u(c.type):"config"===e?r.any:r.string)}function m(){var b={array:"search"===f&&"auto"},c=a.match(/\[\]$/)?{array:!0}:{};return T(b,c,e).array}function p(a,b){var c=a.squash;if(!b||!1===c)return!1;if(!N(c)||null==c)return q;if(!0===c||P(c))return c;throw new Error("Invalid squash policy: '"+c+"'. Valid policies: false, true, or arbitrary string")}function s(a,b,d,e){var f,g,i=[{from:"",to:d||b?c:""},{from:null,to:d||b?c:""}];return f=R(a.replace)?a.replace:[],P(e)&&f.push({from:e,to:c}),g=o(f,function(a){return a.from}),n(i,function(a){return-1===h(g,a.from)}).concat(f)}function t(){if(!l)throw new Error("Injectable functions cannot be called at configuration time");var a=l.invoke(e.$$fn);if(null!==a&&a!==c&&!x.type.is(a))throw new Error("Default value ("+a+") for parameter '"+x.id+"' is not an instance of Type ("+x.type.name+")");return a}function v(a){function b(a){return function(b){return b.from===a}}function c(a){var c=o(n(x.replace,b(a)),function(a){return a.to});return c.length?c[0]:a}return a=c(a),N(a)?x.type.$normalize(a):t()}function w(){return"{Param:"+a+" "+d+" squash: '"+A+"' optional: "+z+"}"}var x=this;e=j(e),d=k(e,d,f);var y=m();d=y?d.$asArray(y,"search"===f):d,"string"!==d.name||y||"path"!==f||e.value!==c||(e.value="");var z=e.value!==c,A=p(e,z),B=s(e,y,z,A);T(this,{id:a,type:d,location:f,array:y,squash:A,replace:B,isOptional:z,value:v,dynamic:c,config:e,toString:w})},k.prototype={$$new:function(){return d(this,T(new k,{$$parent:this}))},$$keys:function(){for(var a=[],b=[],c=this,d=g(k.prototype);c;)b.push(c),c=c.$$parent;return b.reverse(),S(b,function(b){S(g(b),function(b){-1===h(a,b)&&-1===h(d,b)&&a.push(b)})}),a},$$values:function(a){var b={},c=this;return S(c.$$keys(),function(d){b[d]=c[d].value(a&&a[d])}),b},$$equals:function(a,b){var c=!0,d=this;return S(d.$$keys(),function(e){var f=a&&a[e],g=b&&b[e];d[e].type.equals(f,g)||(c=!1)}),c},$$validates:function(a){var d,e,f,g,h,i=this.$$keys();for(d=0;d=0)throw new Error("State must have a valid name");if(A.hasOwnProperty(c))throw new Error("State '"+c+"' is already defined");var e=-1!==c.indexOf(".")?c.substring(0,c.lastIndexOf(".")):P(b.parent)?b.parent:Q(b.parent)&&P(b.parent.name)?b.parent.name:"";if(e&&!A[e])return n(e,b.self);for(var f in D)O(D[f])&&(b[f]=D[f](b,D.$delegates[f]));return A[c]=b,!b[C]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){z.$current.navigable==b&&j(a,c)||z.transitionTo(b,a,{inherit:!0,location:!1})}]),q(c),b}function s(a){return a.indexOf("*")>-1}function t(a){for(var b=a.split("."),c=z.$current.name.split("."),d=0,e=b.length;d=G;d--)g=q[d],g.self.onExit&&h.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=G;d2?k.enter(a,null,c).then(d):k.enter(a,null,c,d)},leave:function(a,c){b.version.minor>2?k.leave(a).then(c):k.leave(a,c)}};if(j){var e=j&&j(c,a);return{enter:function(a,b,c){e.enter(a,null,b),c()},leave:function(a,b){e.leave(a),b()}}}return d()}var i=g(),j=i("$animator"),k=i("$animate");return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(c,g,i){return function(c,g,j){function k(){if(m&&(m.remove(),m=null),o&&(o.$destroy(),o=null),n){var a=n.data("$uiViewAnim");s.leave(n,function(){a.$$animLeave.resolve(),m=null}),m=n,n=null}}function l(h){var l,m=C(c,j,g,e),t=m&&a.$current&&a.$current.locals[m];if(h||t!==p){l=c.$new(),p=a.$current.locals[m],l.$emit("$viewContentLoading",m);var u=i(l,function(a){var e=f.defer(),h=f.defer(),i={$animEnter:e.promise,$animLeave:h.promise,$$animLeave:h};a.data("$uiViewAnim",i),s.enter(a,g,function(){e.resolve(),o&&o.$emit("$viewContentAnimationEnded"),(b.isDefined(r)&&!r||c.$eval(r))&&d(a)}),k()});n=u,o=l,o.$emit("$viewContentLoaded",m),o.$eval(q)}}var m,n,o,p,q=j.onload||"",r=j.autoscroll,s=h(j,c);g.inheritedData("$uiView");c.$on("$stateChangeSuccess",function(){l(!1)}),l(!0)}}}}function B(a,c,d,e){return{restrict:"ECA",priority:-400,compile:function(f){var g=f.html();return f.empty?f.empty():f[0].innerHTML=null,function(f,h,i){var j=d.$current,k=C(f,i,h,e),l=j&&j.locals[k];if(!l)return h.html(g),void a(h.contents())(f);h.data("$uiView",{name:k,state:l.$$state}),h.html(l.$template?l.$template:g);var m=b.extend({},l);f[l.$$resolveAs]=m;var n=a(h.contents());if(l.$$controller){l.$scope=f,l.$element=h;var o=c(l.$$controller,l);l.$$controllerAs&&(f[l.$$controllerAs]=o,f[l.$$controllerAs][l.$$resolveAs]=m),O(o.$onInit)&&o.$onInit(),h.data("$ngControllerController",o),h.children().data("$ngControllerController",o)}n(f)}}}}function C(a,b,c,d){var e=d(b.uiView||b.name||"")(a),f=c.inheritedData("$uiView");return e.indexOf("@")>=0?e:e+"@"+(f?f.state.name:"")}function D(a,b){var c,d=a.match(/^\s*({[^}]*})\s*$/);if(d&&(a=b+"("+d[1]+")"),!(c=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/))||4!==c.length)throw new Error("Invalid state ref '"+a+"'");return{state:c[1],paramExpr:c[3]||null}}function E(a){var b=a.parent().inheritedData("$uiView");if(b&&b.state&&b.state.name)return b.state}function F(a){var b="[object SVGAnimatedString]"===Object.prototype.toString.call(a.prop("href")),c="FORM"===a[0].nodeName;return{attr:c?"action":b?"xlink:href":"href",isAnchor:"A"===a.prop("tagName").toUpperCase(),clickable:!c}}function G(a,b,c,d,e){return function(f){var g=f.which||f.button,h=e();if(!(g>1||f.ctrlKey||f.metaKey||f.shiftKey||a.attr("target"))){var i=c(function(){b.go(h.state,h.params,h.options)});f.preventDefault();var j=d.isAnchor&&!h.href?1:0;f.preventDefault=function(){j--<=0&&c.cancel(i)}}}}function H(a,b){return{relative:E(a)||b.$current,inherit:!0}}function I(a,c){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(d,e,f,g){var h,i=D(f.uiSref,a.current.name),j={state:i.state,href:null,params:null},k=F(e),l=g[1]||g[0],m=null;j.options=T(H(e,a),f.uiSrefOpts?d.$eval(f.uiSrefOpts):{});var n=function(c){c&&(j.params=b.copy(c)),j.href=a.href(i.state,j.params,j.options),m&&m(),l&&(m=l.$$addStateInfo(i.state,j.params)),null!==j.href&&f.$set(k.attr,j.href)};i.paramExpr&&(d.$watch(i.paramExpr,function(a){a!==j.params&&n(a)},!0),j.params=b.copy(d.$eval(i.paramExpr))),n(),k.clickable&&(h=G(e,a,c,k,function(){return j}),e[e.on?"on":"bind"]("click",h),d.$on("$destroy",function(){e[e.off?"off":"unbind"]("click",h)}))}}}function J(a,b){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(c,d,e,f){function g(b){m.state=b[0],m.params=b[1],m.options=b[2],m.href=a.href(m.state,m.params,m.options),n&&n(),j&&(n=j.$$addStateInfo(m.state,m.params)),m.href&&e.$set(i.attr,m.href)}var h,i=F(d),j=f[1]||f[0],k=[e.uiState,e.uiStateParams||null,e.uiStateOpts||null],l="["+k.map(function(a){return a||"null"}).join(", ")+"]",m={state:null,params:null,options:null,href:null},n=null;c.$watch(l,g,!0),g(c.$eval(l)),i.clickable&&(h=G(d,a,b,i,function(){return m}),d[d.on?"on":"bind"]("click",h),c.$on("$destroy",function(){d[d.off?"off":"unbind"]("click",h)}))}}}function K(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(b,d,e,f){function g(b,c,e){var f=a.get(b,E(d)),g=h(b,c),i={state:f||{name:b},params:c,hash:g};return p.push(i),q[g]=e,function(){var a=p.indexOf(i);-1!==a&&p.splice(a,1)}}function h(a,c){if(!P(a))throw new Error("state should be a string");return Q(c)?a+V(c):(c=b.$eval(c),Q(c)?a+V(c):a)}function i(){for(var a=0;a0)){var c=g(a,b,o);return i(),c}},b.$on("$stateChangeSuccess",i),i()}]}}function L(a){var b=function(b,c){return a.is(b,c)};return b.$stateful=!0,b}function M(a){var b=function(b,c,d){return a.includes(b,c,d)};return b.$stateful=!0,b}var N=b.isDefined,O=b.isFunction,P=b.isString,Q=b.isObject,R=b.isArray,S=b.forEach,T=b.extend,U=b.copy,V=b.toJson;b.module("ui.router.util",["ng"]),b.module("ui.router.router",["ui.router.util"]),b.module("ui.router.state",["ui.router.router","ui.router.util"]),b.module("ui.router",["ui.router.state"]),b.module("ui.router.compat",["ui.router"]),q.$inject=["$q","$injector"],b.module("ui.router.util").service("$resolve",q),b.module("ui.router.util").provider("$templateFactory",r);var W;t.prototype.concat=function(a,b){var c={caseInsensitive:W.caseInsensitive(),strict:W.strictMode(),squash:W.defaultSquashPolicy()};return new t(this.sourcePath+a+this.sourceSearch,T(c,b),this)},t.prototype.toString=function(){return this.source},t.prototype.exec=function(a,b){function c(a){function b(a){return a.split("").reverse().join("")}function c(a){return a.replace(/\\-/g,"-")}return o(o(b(a).split(/-(?!\\)/),b),c).reverse()}var d=this.regexp.exec(a);if(!d)return null;b=b||{};var e,f,g,h=this.parameters(),i=h.length,j=this.segments.length-1,k={};if(j!==d.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var l,m;for(e=0;e").append(a).html();try{return a[0].nodeType===Ma?P(d):d.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+P(b)})}catch(c){return P(d)}}function Gc(a){try{return decodeURIComponent(a)}catch(b){}}function Hc(a){var b={};q((a||"").split("&"),function(a){var c,e,f;a&&(e=a=a.replace(/\+/g,"%20"), -c=a.indexOf("="),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=Gc(e),u(e)&&(f=u(f)?Gc(f):!0,sa.call(b,e)?K(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function Wb(a){var b=[];q(a,function(a,c){K(a)?q(a,function(a){b.push(ca(c,!0)+(!0===a?"":"="+ca(a,!0)))}):b.push(ca(c,!0)+(!0===a?"":"="+ca(a,!0)))});return b.length?b.join("&"):""}function tb(a){return ca(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ca(a,b){return encodeURIComponent(a).replace(/%40/gi, -"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,b?"%20":"+")}function te(a,b){var d,c,e=Na.length;for(c=0;c protocol indicates an extension, document.location.href does not match."))}function Ic(a,b,d){I(d)||(d={});d=R({strictDi:!1},d);var c=function(){a=E(a);if(a.injector()){var c=a[0]===B.document?"document":wa(a);throw va("btstrpd",c.replace(//,">"));}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);d.debugInfoEnabled&&b.push(["$compileProvider",function(a){a.debugInfoEnabled(!0)}]); -b.unshift("ng");c=eb(b,d.strictDi);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;B&&e.test(B.name)&&(d.debugInfoEnabled=!0,B.name=B.name.replace(e,""));if(B&&!f.test(B.name))return c();B.name=B.name.replace(f,"");ga.resumeBootstrap=function(a){q(a,function(a){b.push(a)});return c()};F(ga.resumeDeferredBootstrap)&&ga.resumeDeferredBootstrap()}function we(){B.name= -"NG_ENABLE_DEBUG_INFO!"+B.name;B.location.reload()}function xe(a){a=ga.element(a).injector();if(!a)throw va("test");return a.get("$$testability")}function Jc(a,b){b=b||"_";return a.replace(ye,function(a,c){return(c?b:"")+a.toLowerCase()})}function ze(){var a;if(!Kc){var b=ub();(xa=z(b)?B.jQuery:b?B[b]:void 0)&&xa.fn.on?(E=xa,R(xa.fn,{scope:Oa.scope,isolateScope:Oa.isolateScope,controller:Oa.controller,injector:Oa.injector,inheritedData:Oa.inheritedData}),a=xa.cleanData,xa.cleanData=function(b){for(var c, -e=0,f;null!=(f=b[e]);e++)(c=xa._data(f,"events"))&&c.$destroy&&xa(f).triggerHandler("$destroy");a(b)}):E=T;ga.element=E;Kc=!0}}function vb(a,b,d){if(!a)throw va("areq",b||"?",d||"required");return a}function Pa(a,b,d){d&&K(a)&&(a=a[a.length-1]);vb(F(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Qa(a,b){if("hasOwnProperty"===a)throw va("badname",b);}function Lc(a,b,d){if(!b)return a;b=b.split(".");for(var c,e=a,f=b.length,g=0;g")+c[2];for(c=c[0];c--;)d=d.lastChild;f=bb(f,d.childNodes);d=e.firstChild;d.textContent=""}else f.push(b.createTextNode(a));e.textContent="";e.innerHTML="";q(f,function(a){e.appendChild(a)});return e}function Wc(a,b){var d=a.parentNode;d&&d.replaceChild(b,a);b.appendChild(a)}function T(a){if(a instanceof T)return a;var b;H(a)&&(a=U(a),b=!0);if(!(this instanceof T)){if(b&&"<"!==a.charAt(0))throw Zb("nosel");return new T(a)}if(b){b=B.document;var d;a=(d=cg.exec(a))? -[b.createElement(d[1])]:(d=Vc(a,b))?d.childNodes:[]}Xc(this,a)}function $b(a){return a.cloneNode(!0)}function zb(a,b){b||gb(a);if(a.querySelectorAll)for(var d=a.querySelectorAll("*"),c=0,e=d.length;c=Fa?!1:"function"===typeof a&&/^(?:class\b|constructor\()/.test(Function.prototype.toString.call(a)+" ");return d?(c.unshift(null),new (Function.prototype.bind.apply(a, -c))):a.apply(b,c)},instantiate:function(a,b,c){var d=K(a)?a[a.length-1]:a;a=e(a,b,c);a.unshift(null);return new (Function.prototype.bind.apply(d,a))},get:d,annotate:eb.$$annotate,has:function(b){return n.hasOwnProperty(b+"Provider")||a.hasOwnProperty(b)}}}b=!0===b;var k={},l=[],m=new Ra([],!0),n={$provide:{provider:d(c),factory:d(f),service:d(function(a,b){return f(a,["$injector",function(a){return a.instantiate(b)}])}),value:d(function(a,b){return f(a,ma(b),!1)}),constant:d(function(a,b){Qa(a,"constant"); -n[a]=b;x[a]=b}),decorator:function(a,b){var c=p.get(a+"Provider"),d=c.$get;c.$get=function(){var a=t.invoke(d,c);return t.invoke(b,null,{$delegate:a})}}}},p=n.$injector=h(n,function(a,b){ga.isString(b)&&l.push(b);throw Da("unpr",l.join(" <- "));}),x={},J=h(x,function(a,b){var c=p.get(a+"Provider",b);return t.invoke(c.$get,c,void 0,a)}),t=J;n.$injectorProvider={$get:ma(J)};var s=g(a),t=J.get("$injector");t.strictDi=b;q(s,function(a){a&&t.invoke(a)});return t}function mf(){var a=!0;this.disableAutoScrolling= -function(){a=!1};this.$get=["$window","$location","$rootScope",function(b,d,c){function e(a){var b=null;Array.prototype.some.call(a,function(a){if("a"===ua(a))return b=a,!0});return b}function f(a){if(a){a.scrollIntoView();var c;c=g.yOffset;F(c)?c=c():Tb(c)?(c=c[0],c="fixed"!==b.getComputedStyle(c).position?0:c.getBoundingClientRect().bottom):Z(c)||(c=0);c&&(a=a.getBoundingClientRect().top,b.scrollBy(0,a-c))}else b.scrollTo(0,0)}function g(a){a=H(a)?a:d.hash();var b;a?(b=h.getElementById(a))?f(b): -(b=e(h.getElementsByName(a)))?f(b):"top"===a&&f(null):f(null)}var h=b.document;a&&c.$watch(function(){return d.hash()},function(a,b){a===b&&""===a||eg(function(){c.$evalAsync(g)})});return g}]}function jb(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;K(a)&&(a=a.join(" "));K(b)&&(b=b.join(" "));return a+" "+b}function ng(a){H(a)&&(a=a.split(" "));var b=S();q(a,function(a){a.length&&(b[a]=!0)});return b}function Ea(a){return I(a)?a:{}}function og(a,b,d,c){function e(a){try{a.apply(null,ta.call(arguments, -1))}finally{if(J--,0===J)for(;t.length;)try{t.pop()()}catch(b){d.error(b)}}}function f(){w=null;g();h()}function g(){s=O();s=z(s)?null:s;oa(s,A)&&(s=A);A=s}function h(){if(y!==k.url()||D!==s)y=k.url(),D=s,q(L,function(a){a(k.url(),s)})}var k=this,l=a.location,m=a.history,n=a.setTimeout,p=a.clearTimeout,x={};k.isMock=!1;var J=0,t=[];k.$$completeOutstandingRequest=e;k.$$incOutstandingRequestCount=function(){J++};k.notifyWhenNoOutstandingRequests=function(a){0===J?a():t.push(a)};var s,D,y=l.href,ib= -b.find("base"),w=null,O=c.history?function(){try{return m.state}catch(a){}}:C;g();D=s;k.url=function(b,d,e){z(e)&&(e=null);l!==a.location&&(l=a.location);m!==a.history&&(m=a.history);if(b){var f=D===e;if(y===b&&(!c.history||f))return k;var h=y&&Ja(y)===Ja(b);y=b;D=e;!c.history||h&&f?(h||(w=b),d?l.replace(b):h?(d=l,e=b.indexOf("#"),e=-1===e?"":b.substr(e),d.hash=e):l.href=b,l.href!==b&&(w=b)):(m[d?"replaceState":"pushState"](e,"",b),g(),D=s);w&&(w=b);return k}return w||l.href.replace(/%27/g,"'")}; -k.state=function(){return s};var L=[],Q=!1,A=null;k.onUrlChange=function(b){if(!Q){if(c.history)E(a).on("popstate",f);E(a).on("hashchange",f);Q=!0}L.push(b);return b};k.$$applicationDestroyed=function(){E(a).off("hashchange popstate",f)};k.$$checkUrlChange=h;k.baseHref=function(){var a=ib.attr("href");return a?a.replace(/^(https?:)?\/\/[^\/]*/,""):""};k.defer=function(a,b){var c;J++;c=n(function(){delete x[c];e(a)},b||0);x[c]=!0;return c};k.defer.cancel=function(a){return x[a]?(delete x[a],p(a),e(C), -!0):!1}}function tf(){this.$get=["$window","$log","$sniffer","$document",function(a,b,d,c){return new og(a,c,b,d)}]}function uf(){this.$get=function(){function a(a,c){function e(a){a!==n&&(p?p===a&&(p=a.n):p=a,f(a.n,a.p),f(a,n),n=a,n.n=null)}function f(a,b){a!==b&&(a&&(a.p=b),b&&(b.n=a))}if(a in b)throw N("$cacheFactory")("iid",a);var g=0,h=R({},c,{id:a}),k=S(),l=c&&c.capacity||Number.MAX_VALUE,m=S(),n=null,p=null;return b[a]={put:function(a,b){if(!z(b)){if(ll&&this.remove(p.key);return b}},get:function(a){if(l";b=pa.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);d.value=c;a.attributes.setNamedItem(d)}function Ha(a,b){try{a.addClass(b)}catch(c){}}function $(a,b,c,d,e){a instanceof E||(a=E(a));for(var f=/\S+/,g=0,h=a.length;g").append(a).html())):c?Oa.clone.call(a):a;if(g)for(var h in g)d.data("$"+h+"Controller",g[h].instance);$.$$addScopeInfo(d,b);c&&c(d,b);l&&l(b,d,d,f);return d}}function Aa(a,b,c,d,e,f){function g(a,c,d,e){var f,k,l,m,p,y,x;if(n)for(x=Array(c.length), -m=0;mv.priority)break;if(u=v.scope)v.templateUrl||(I(u)?(X("new/isolated scope",A||y,v,G),A=v):X("new/isolated scope",A,v,G)),y=y||v;w=v.name;if(!Ga&&(v.replace&&(v.templateUrl||v.template)||v.transclude&&!v.$$tlb)){for(u=C+1;Ga=a[u++];)if(Ga.transclude&&!Ga.$$tlb||Ga.replace&& -(Ga.templateUrl||Ga.template)){Ha=!0;break}Ga=!0}!v.templateUrl&&v.controller&&(u=v.controller,x=x||S(),X("'"+w+"' controller",x[w],v,G),x[w]=v);if(u=v.transclude)if(Q=!0,v.$$tlb||(X("transclusion",t,v,G),t=v),"element"===u)J=!0,n=v.priority,M=G,G=d.$$element=E($.$$createComment(w,d[w])),b=G[0],ca(f,ta.call(M,0),b),M[0].$$parentNode=M[0].parentNode,O=fc(Ha,M,e,n,g&&g.name,{nonTlbTranscludeDirective:t});else{var ha=S();M=E($b(b)).contents();if(I(u)){M=[];var N=S(),P=S();q(u,function(a,b){var c="?"=== -a.charAt(0);a=c?a.substring(1):a;N[a]=b;ha[b]=null;P[b]=c});q(G.contents(),function(a){var b=N[Ba(ua(a))];b?(P[b]=!0,ha[b]=ha[b]||[],ha[b].push(a)):M.push(a)});q(P,function(a,b){if(!a)throw da("reqslot",b);});for(var Sa in ha)ha[Sa]&&(ha[Sa]=fc(Ha,ha[Sa],e))}G.empty();O=fc(Ha,M,e,void 0,void 0,{needsNewScope:v.$$isolateScope||v.$$newScope});O.$$slots=ha}if(v.template)if(D=!0,X("template",L,v,G),L=v,u=F(v.template)?v.template(G,d):v.template,u=za(u),v.replace){g=v;M=Yb.test(u)?hd(ba(v.templateNamespace, -U(u))):[];b=M[0];if(1!==M.length||1!==b.nodeType)throw da("tplrt",w,"");ca(f,G,b);Aa={$attr:{}};u=dc(b,[],Aa);var V=a.splice(C+1,a.length-(C+1));(A||y)&&W(u,A,y);a=a.concat(u).concat(V);Z(d,Aa);Aa=a.length}else G.html(u);if(v.templateUrl)D=!0,X("template",L,v,G),L=v,v.replace&&(g=v),p=aa(a.splice(C,a.length-C),G,d,f,Q&&O,h,k,{controllerDirectives:x,newScopeDirective:y!==v&&y,newIsolateScopeDirective:A,templateDirective:L,nonTlbTranscludeDirective:t}),Aa=a.length;else if(v.compile)try{r=v.compile(G, -d,O);var ec=v.$$originalDirective||v;F(r)?m(null,cb(ec,r),B,H):r&&m(cb(ec,r.pre),cb(ec,r.post),B,H)}catch(Y){c(Y,wa(G))}v.terminal&&(p.terminal=!0,n=Math.max(n,v.priority))}p.scope=y&&!0===y.scope;p.transcludeOnThisElement=Q;p.templateOnThisElement=D;p.transclude=O;l.hasElementTranscludeDirective=J;return p}function kb(a,b,c,d){var e;if(H(b)){var f=b.match(l);b=b.substring(f[0].length);var g=f[1]||f[3],f="?"===f[2];"^^"===g?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e= -g?c.inheritedData(h):c.data(h)}if(!e&&!f)throw da("ctreq",b,a);}else if(K(b))for(e=[],g=0,f=b.length;gp.priority)&&-1!==p.restrict.indexOf(g)){l&&(p=Ub(p,{$$start:l,$$end:m}));if(!p.$$bindings){var x=p,v=p,A=p.name,t={isolateScope:null,bindToController:null};I(v.scope)&&(!0===v.bindToController?(t.bindToController=d(v.scope,A,!0),t.isolateScope={}):t.isolateScope=d(v.scope,A,!1));I(v.bindToController)&& -(t.bindToController=d(v.bindToController,A,!0));if(I(t.bindToController)){var L=v.controller,G=v.controllerAs;if(!L)throw da("noctrl",A);if(!dd(L,G))throw da("noident",A);}var Q=x.$$bindings=t;I(Q.isolateScope)&&(p.$$isolateBindings=Q.isolateScope)}b.push(p);k=p}}catch(J){c(J)}}return k}function Y(b){if(f.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,e=c.length;d"+b+"";return c.childNodes[0].childNodes;default:return b}}function ia(a,b){if("srcdoc"===b)return A.HTML;var c=ua(a);if("src"===b||"ngSrc"===b){if(-1===["img","video","audio","source","track"].indexOf(c))return A.RESOURCE_URL}else if("xlinkHref"=== -b||"form"===c&&"action"===b)return A.RESOURCE_URL}function ma(a,c,d,e,f){var g=ia(a,e);f=k[e]||f;var h=b(d,!0,g,f);if(h){if("multiple"===e&&"select"===ua(a))throw da("selmulti",wa(a));c.push({priority:100,compile:function(){return{pre:function(a,c,k){c=k.$$observers||(k.$$observers=S());if(m.test(e))throw da("nodomevents");var l=k[e];l!==d&&(h=l&&b(l,!0,g,f),d=l);h&&(k[e]=h(a),(c[e]||(c[e]=[])).$$inter=!0,(k.$$observers&&k.$$observers[e].$$scope||a).$watch(h,function(a,b){"class"===e&&a!==b?k.$updateClass(a, -b):k.$set(e,a)}))}}}})}}function ca(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g=b)return a;for(;b--;)8===a[b].nodeType&&pg.call(a,b,1);return a}function dd(a,b){if(b&&H(b))return b;if(H(a)){var d=kd.exec(a);if(d)return d[3]}}function vf(){var a={},b=!1;this.has=function(b){return a.hasOwnProperty(b)};this.register=function(b,c){Qa(b,"controller");I(b)?R(a, -b):a[b]=c};this.allowGlobals=function(){b=!0};this.$get=["$injector","$window",function(d,c){function e(a,b,c,d){if(!a||!I(a.$scope))throw N("$controller")("noscp",d,b);a.$scope[b]=c}return function(f,g,h,k){var l,m,n;h=!0===h;k&&H(k)&&(n=k);if(H(f)){k=f.match(kd);if(!k)throw qg("ctrlfmt",f);m=k[1];n=n||k[3];f=a.hasOwnProperty(m)?a[m]:Lc(g.$scope,m,!0)||(b?Lc(c,m,!0):void 0);Pa(f,m,!0)}if(h)return h=(K(f)?f[f.length-1]:f).prototype,l=Object.create(h||null),n&&e(g,n,l,m||f.name),R(function(){var a= -d.invoke(f,l,g,m);a!==l&&(I(a)||F(a))&&(l=a,n&&e(g,n,l,m||f.name));return l},{instance:l,identifier:n});l=d.instantiate(f,g,m);n&&e(g,n,l,m||f.name);return l}}]}function wf(){this.$get=["$window",function(a){return E(a.document)}]}function xf(){this.$get=["$log",function(a){return function(b,d){a.error.apply(a,arguments)}}]}function hc(a){return I(a)?ba(a)?a.toISOString():db(a):a}function Cf(){this.$get=function(){return function(a){if(!a)return"";var b=[];Ac(a,function(a,c){null===a||z(a)||(K(a)? -q(a,function(a){b.push(ca(c)+"="+ca(hc(a)))}):b.push(ca(c)+"="+ca(hc(a))))});return b.join("&")}}}function Df(){this.$get=function(){return function(a){function b(a,e,f){null===a||z(a)||(K(a)?q(a,function(a,c){b(a,e+"["+(I(a)?c:"")+"]")}):I(a)&&!ba(a)?Ac(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}):d.push(ca(e)+"="+ca(hc(a))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function ic(a,b){if(H(a)){var d=a.replace(rg,"").trim();if(d){var c=b("Content-Type");(c=c&&0===c.indexOf(ld))|| -(c=(c=d.match(sg))&&tg[c[0]].test(d));c&&(a=Ec(d))}}return a}function md(a){var b=S(),d;H(a)?q(a.split("\n"),function(a){d=a.indexOf(":");var e=P(U(a.substr(0,d)));a=U(a.substr(d+1));e&&(b[e]=b[e]?b[e]+", "+a:a)}):I(a)&&q(a,function(a,d){var f=P(d),g=U(a);f&&(b[f]=b[f]?b[f]+", "+g:g)});return b}function nd(a){var b;return function(d){b||(b=md(a));return d?(d=b[P(d)],void 0===d&&(d=null),d):b}}function od(a,b,d,c){if(F(c))return c(a,b,d);q(c,function(c){a=c(a,b,d)});return a}function Bf(){var a=this.defaults= -{transformResponse:[ic],transformRequest:[function(a){return I(a)&&"[object File]"!==na.call(a)&&"[object Blob]"!==na.call(a)&&"[object FormData]"!==na.call(a)?db(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ia(jc),put:ia(jc),patch:ia(jc)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer"},b=!1;this.useApplyAsync=function(a){return u(a)?(b=!!a,this):b};var d=!0;this.useLegacyPromiseExtensions=function(a){return u(a)?(d=!!a, -this):d};var c=this.interceptors=[];this.$get=["$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector",function(e,f,g,h,k,l){function m(b){function c(a,b){for(var d=0,e=b.length;da?b:k.reject(b)}if(!I(b))throw N("$http")("badreq", -b);if(!H(b.url))throw N("$http")("badreq",b.url);var g=R({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer},b);g.headers=function(b){var c=a.headers,d=R({},b.headers),f,g,h,c=R({},c.common,c[P(b.method)]);a:for(f in c){g=P(f);for(h in d)if(P(h)===g)continue a;d[f]=c[f]}return e(d,ia(b))}(b);g.method=xb(g.method);g.paramSerializer=H(g.paramSerializer)?l.get(g.paramSerializer):g.paramSerializer;var h=[],m=[],p=k.when(g);q(J,function(a){(a.request|| -a.requestError)&&h.unshift(a.request,a.requestError);(a.response||a.responseError)&&m.push(a.response,a.responseError)});p=c(p,h);p=p.then(function(b){var c=b.headers,d=od(b.data,nd(c),void 0,b.transformRequest);z(d)&&q(c,function(a,b){"content-type"===P(b)&&delete c[b]});z(b.withCredentials)&&!z(a.withCredentials)&&(b.withCredentials=a.withCredentials);return n(b,d).then(f,f)});p=c(p,m);d?(p.success=function(a){Pa(a,"fn");p.then(function(b){a(b.data,b.status,b.headers,g)});return p},p.error=function(a){Pa(a, -"fn");p.then(null,function(b){a(b.data,b.status,b.headers,g)});return p}):(p.success=pd("success"),p.error=pd("error"));return p}function n(c,d){function g(a){if(a){var c={};q(a,function(a,d){c[d]=function(c){function d(){a(c)}b?h.$applyAsync(d):h.$$phase?d():h.$apply(d)}});return c}}function l(a,c,d,e){function f(){n(c,a,d,e)}A&&(200<=a&&300>a?A.put(M,[a,c,md(d),e]):A.remove(M));b?h.$applyAsync(f):(f(),h.$$phase||h.$apply())}function n(a,b,d,e){b=-1<=b?b:0;(200<=b&&300>b?L.resolve:L.reject)({data:a, -status:b,headers:nd(d),config:c,statusText:e})}function J(a){n(a.data,a.status,ia(a.headers()),a.statusText)}function O(){var a=m.pendingRequests.indexOf(c);-1!==a&&m.pendingRequests.splice(a,1)}var L=k.defer(),Q=L.promise,A,G,v=c.headers,M=p(c.url,c.paramSerializer(c.params));m.pendingRequests.push(c);Q.then(O,O);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(A=I(c.cache)?c.cache:I(a.cache)?a.cache:x);A&&(G=A.get(M),u(G)?G&&F(G.then)?G.then(J,J):K(G)?n(G[1],G[0],ia(G[2]), -G[3]):n(G,200,{},"OK"):A.put(M,Q));z(G)&&((G=qd(c.url)?f()[c.xsrfCookieName||a.xsrfCookieName]:void 0)&&(v[c.xsrfHeaderName||a.xsrfHeaderName]=G),e(c.method,M,d,l,v,c.timeout,c.withCredentials,c.responseType,g(c.eventHandlers),g(c.uploadEventHandlers)));return Q}function p(a,b){0=l&&(y.resolve(s),t(q.$$intervalId),delete g[q.$$intervalId]);D||a.$apply()},k);g[q.$$intervalId]=y;return q}var g={};f.cancel=function(a){return a&&a.$$intervalId in -g?(g[a.$$intervalId].reject("canceled"),b.clearInterval(a.$$intervalId),delete g[a.$$intervalId],!0):!1};return f}]}function kc(a){a=a.split("/");for(var b=a.length;b--;)a[b]=tb(a[b]);return a.join("/")}function rd(a,b){var d=Ca(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=aa(d.port)||vg[d.protocol]||null}function sd(a,b){if(wg.test(a))throw lb("badpath",a);var d="/"!==a.charAt(0);d&&(a="/"+a);var c=Ca(a);b.$$path=decodeURIComponent(d&&"/"===c.pathname.charAt(0)?c.pathname.substring(1): -c.pathname);b.$$search=Hc(c.search);b.$$hash=decodeURIComponent(c.hash);b.$$path&&"/"!==b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function ka(a,b){if(0===b.lastIndexOf(a,0))return b.substr(a.length)}function Ja(a){var b=a.indexOf("#");return-1===b?a:a.substr(0,b)}function mb(a){return a.replace(/(#.+)|#$/,"$1")}function lc(a,b,d){this.$$html5=!0;d=d||"";rd(a,this);this.$$parse=function(a){var d=ka(b,a);if(!H(d))throw lb("ipthprfx",a,b);sd(d,this);this.$$path||(this.$$path="/");this.$$compose()}; -this.$$compose=function(){var a=Wb(this.$$search),d=this.$$hash?"#"+tb(this.$$hash):"";this.$$url=kc(this.$$path)+(a?"?"+a:"")+d;this.$$absUrl=b+this.$$url.substr(1)};this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;u(f=ka(a,c))?(g=f,g=d&&u(f=ka(d,f))?b+(ka("/",f)||f):a+g):u(f=ka(b,c))?g=b+f:b===c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function mc(a,b,d){rd(a,this);this.$$parse=function(c){var e=ka(a,c)||ka(b,c),f;z(e)||"#"!==e.charAt(0)?this.$$html5?f= -e:(f="",z(e)&&(a=c,this.replace())):(f=ka(d,e),z(f)&&(f=e));sd(f,this);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;0===f.lastIndexOf(e,0)&&(f=f.replace(e,""));g.exec(f)||(c=(f=g.exec(c))?f[1]:c);this.$$path=c;this.$$compose()};this.$$compose=function(){var b=Wb(this.$$search),e=this.$$hash?"#"+tb(this.$$hash):"";this.$$url=kc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+(this.$$url?d+this.$$url:"")};this.$$parseLinkUrl=function(b,d){return Ja(a)===Ja(b)?(this.$$parse(b),!0):!1}}function td(a,b,d){this.$$html5= -!0;mc.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a===Ja(c)?f=c:(g=ka(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$compose=function(){var b=Wb(this.$$search),e=this.$$hash?"#"+tb(this.$$hash):"";this.$$url=kc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+d+this.$$url}}function Jb(a){return function(){return this[a]}}function ud(a,b){return function(d){if(z(d))return this[a];this[a]=b(d);this.$$compose();return this}} -function Hf(){var a="",b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return u(b)?(a=b,this):a};this.html5Mode=function(a){return Ia(a)?(b.enabled=a,this):I(a)?(Ia(a.enabled)&&(b.enabled=a.enabled),Ia(a.requireBase)&&(b.requireBase=a.requireBase),Ia(a.rewriteLinks)&&(b.rewriteLinks=a.rewriteLinks),this):b};this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(d,c,e,f,g){function h(a,b,d){var e=l.url(),f=l.$$state;try{c.url(a,b,d),l.$$state=c.state()}catch(g){throw l.url(e), -l.$$state=f,g;}}function k(a,b){d.$broadcast("$locationChangeSuccess",l.absUrl(),a,l.$$state,b)}var l,m;m=c.baseHref();var n=c.url(),p;if(b.enabled){if(!m&&b.requireBase)throw lb("nobase");p=n.substring(0,n.indexOf("/",n.indexOf("//")+2))+(m||"/");m=e.history?lc:td}else p=Ja(n),m=mc;var x=p.substr(0,Ja(p).lastIndexOf("/")+1);l=new m(p,x,"#"+a);l.$$parseLinkUrl(n,n);l.$$state=c.state();var J=/^\s*(javascript|mailto):/i;f.on("click",function(a){if(b.rewriteLinks&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&& -2!==a.which&&2!==a.button){for(var e=E(a.target);"a"!==ua(e[0]);)if(e[0]===f[0]||!(e=e.parent())[0])return;var h=e.prop("href"),k=e.attr("href")||e.attr("xlink:href");I(h)&&"[object SVGAnimatedString]"===h.toString()&&(h=Ca(h.animVal).href);J.test(h)||!h||e.attr("target")||a.isDefaultPrevented()||!l.$$parseLinkUrl(h,k)||(a.preventDefault(),l.absUrl()!==c.url()&&(d.$apply(),g.angular["ff-684208-preventDefault"]=!0))}});mb(l.absUrl())!==mb(n)&&c.url(l.absUrl(),!0);var t=!0;c.onUrlChange(function(a, -b){z(ka(x,a))?g.location.href=a:(d.$evalAsync(function(){var c=l.absUrl(),e=l.$$state,f;a=mb(a);l.$$parse(a);l.$$state=b;f=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;l.absUrl()===a&&(f?(l.$$parse(c),l.$$state=e,h(c,!1,e)):(t=!1,k(c,e)))}),d.$$phase||d.$digest())});d.$watch(function(){var a=mb(c.url()),b=mb(l.absUrl()),f=c.state(),g=l.$$replace,m=a!==b||l.$$html5&&e.history&&f!==l.$$state;if(t||m)t=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast("$locationChangeStart", -b,a,l.$$state,f).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=f):(m&&h(b,g,f===l.$$state?null:l.$$state),k(a,f)))});l.$$replace=!1});return l}]}function If(){var a=!0,b=this;this.debugEnabled=function(b){return u(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=d.console|| -{},e=b[a]||b.log||C;a=!1;try{a=!!e.apply}catch(k){}return a?function(){var a=[];q(arguments,function(b){a.push(c(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){a&&c.apply(b,arguments)}}()}}]}function Ta(a,b){if("__defineGetter__"===a||"__defineSetter__"===a||"__lookupGetter__"===a||"__lookupSetter__"===a||"__proto__"===a)throw ea("isecfld",b);return a}function xg(a){return a+ -""}function qa(a,b){if(a){if(a.constructor===a)throw ea("isecfn",b);if(a.window===a)throw ea("isecwindow",b);if(a.children&&(a.nodeName||a.prop&&a.attr&&a.find))throw ea("isecdom",b);if(a===Object)throw ea("isecobj",b);}return a}function vd(a,b){if(a){if(a.constructor===a)throw ea("isecfn",b);if(a===yg||a===zg||a===Ag)throw ea("isecff",b);}}function Kb(a,b){if(a&&(a===wd||a===xd||a===yd||a===zd||a===Ad||a===Bd||a===Bg||a===Cg||a===Lb||a===Dg||a===Cd||a===Eg))throw ea("isecaf",b);}function Fg(a,b){return"undefined"!== -typeof a?a:b}function Dd(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function W(a,b){var d,c,e;switch(a.type){case r.Program:d=!0;q(a.body,function(a){W(a.expression,b);d=d&&a.expression.constant});a.constant=d;break;case r.Literal:a.constant=!0;a.toWatch=[];break;case r.UnaryExpression:W(a.argument,b);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;break;case r.BinaryExpression:W(a.left,b);W(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.left.toWatch.concat(a.right.toWatch); -break;case r.LogicalExpression:W(a.left,b);W(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case r.ConditionalExpression:W(a.test,b);W(a.alternate,b);W(a.consequent,b);a.constant=a.test.constant&&a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case r.Identifier:a.constant=!1;a.toWatch=[a];break;case r.MemberExpression:W(a.object,b);a.computed&&W(a.property,b);a.constant=a.object.constant&&(!a.computed||a.property.constant);a.toWatch= -[a];break;case r.CallExpression:d=e=a.filter?!b(a.callee.name).$stateful:!1;c=[];q(a.arguments,function(a){W(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=e?c:[a];break;case r.AssignmentExpression:W(a.left,b);W(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=[a];break;case r.ArrayExpression:d=!0;c=[];q(a.elements,function(a){W(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=c;break;case r.ObjectExpression:d= -!0;c=[];q(a.properties,function(a){W(a.value,b);d=d&&a.value.constant&&!a.computed;a.value.constant||c.push.apply(c,a.value.toWatch)});a.constant=d;a.toWatch=c;break;case r.ThisExpression:a.constant=!1;a.toWatch=[];break;case r.LocalsExpression:a.constant=!1,a.toWatch=[]}}function Ed(a){if(1===a.length){a=a[0].expression;var b=a.toWatch;return 1!==b.length?b:b[0]!==a?b:void 0}}function Fd(a){return a.type===r.Identifier||a.type===r.MemberExpression}function Gd(a){if(1===a.body.length&&Fd(a.body[0].expression))return{type:r.AssignmentExpression, -left:a.body[0].expression,right:{type:r.NGValueParameter},operator:"="}}function Hd(a){return 0===a.body.length||1===a.body.length&&(a.body[0].expression.type===r.Literal||a.body[0].expression.type===r.ArrayExpression||a.body[0].expression.type===r.ObjectExpression)}function Id(a,b){this.astBuilder=a;this.$filter=b}function Jd(a,b){this.astBuilder=a;this.$filter=b}function Mb(a){return"constructor"===a}function nc(a){return F(a.valueOf)?a.valueOf():Gg.call(a)}function Jf(){var a=S(),b=S(),d={"true":!0, -"false":!1,"null":null,undefined:void 0},c,e;this.addLiteral=function(a,b){d[a]=b};this.setIdentifierFns=function(a,b){c=a;e=b;return this};this.$get=["$filter",function(f){function g(c,d,e){var g,k,J;e=e||D;switch(typeof c){case "string":J=c=c.trim();var A=e?b:a;g=A[J];if(!g){":"===c.charAt(0)&&":"===c.charAt(1)&&(k=!0,c=c.substring(2));g=e?s:t;var G=new oc(g);g=(new pc(G,f,g)).parse(c);g.constant?g.$$watchDelegate=p:k?g.$$watchDelegate=g.literal?n:m:g.inputs&&(g.$$watchDelegate=l);e&&(g=h(g));A[J]= -g}return x(g,d);case "function":return x(c,d);default:return x(C,d)}}function h(a){function b(c,d,e,f){var g=D;D=!0;try{return a(c,d,e,f)}finally{D=g}}if(!a)return a;b.$$watchDelegate=a.$$watchDelegate;b.assign=h(a.assign);b.constant=a.constant;b.literal=a.literal;for(var c=0;a.inputs&&c=this.promise.$$state.status&&d&&d.length&&a(function(){for(var a,e,f=0,g=d.length;fa)for(b in l++,f)sa.call(e,b)||(s--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$stateful=!0;var d=this,e,f,h,k=1q&&(z=4-q,u[z]||(u[z]=[]),u[z].push({msg:F(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:g,oldVal:k}));else if(a===c){s=!1;break a}}catch(E){f(E)}if(!(p=w.$$watchersCount&&w.$$childHead||w!==this&&w.$$nextSibling))for(;w!==this&&!(p=w.$$nextSibling);)w=w.$parent}while(w=p);if((s||y.length)&&!q--)throw D.$$phase=null,d("infdig",b,u);}while(s|| -y.length);for(D.$$phase=null;OFa)throw fa("iequirks");var c=ia(la);c.isEnabled=function(){return a};c.trustAs=d.trustAs;c.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b},c.valueOf=Za);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs, -f=c.getTrusted,g=c.trustAs;q(la,function(a,b){var d=P(b);c[fb("parse_as_"+d)]=function(b){return e(a,b)};c[fb("get_trusted_"+d)]=function(b){return f(a,b)};c[fb("trust_as_"+d)]=function(b){return g(a,b)}});return c}]}function Pf(){this.$get=["$window","$document",function(a,b){var d={},c=!(a.chrome&&(a.chrome.app&&a.chrome.app.runtime||!a.chrome.app&&a.chrome.runtime&&a.chrome.runtime.id))&&a.history&&a.history.pushState,e=aa((/android (\d+)/.exec(P((a.navigator||{}).userAgent))||[])[1]),f=/Boxee/i.test((a.navigator|| -{}).userAgent),g=b[0]||{},h,k=/^(Moz|webkit|ms)(?=[A-Z])/,l=g.body&&g.body.style,m=!1,n=!1;if(l){for(var p in l)if(m=k.exec(p)){h=m[0];h=h[0].toUpperCase()+h.substr(1);break}h||(h="WebkitOpacity"in l&&"webkit");m=!!("transition"in l||h+"Transition"in l);n=!!("animation"in l||h+"Animation"in l);!e||m&&n||(m=H(l.webkitTransition),n=H(l.webkitAnimation))}return{history:!(!c||4>e||f),hasEvent:function(a){if("input"===a&&11>=Fa)return!1;if(z(d[a])){var b=g.createElement("div");d[a]="on"+a in b}return d[a]}, -csp:ya(),vendorPrefix:h,transitions:m,animations:n,android:e}}]}function Rf(){var a;this.httpOptions=function(b){return b?(a=b,this):a};this.$get=["$templateCache","$http","$q","$sce",function(b,d,c,e){function f(g,h){f.totalPendingRequests++;if(!H(g)||z(b.get(g)))g=e.getTrustedResourceUrl(g);var k=d.defaults&&d.defaults.transformResponse;K(k)?k=k.filter(function(a){return a!==ic}):k===ic&&(k=null);return d.get(g,R({cache:b,transformResponse:k},a))["finally"](function(){f.totalPendingRequests--}).then(function(a){b.put(g, -a.data);return a.data},function(a){if(!h)throw Ig("tpload",g,a.status,a.statusText);return c.reject(a)})}f.totalPendingRequests=0;return f}]}function Sf(){this.$get=["$rootScope","$browser","$location",function(a,b,d){return{findBindings:function(a,b,d){a=a.getElementsByClassName("ng-binding");var g=[];q(a,function(a){var c=ga.element(a).data("$binding");c&&q(c,function(c){d?(new RegExp("(^|\\s)"+Ld(b)+"(\\s|\\||$)")).test(c)&&g.push(a):-1!==c.indexOf(b)&&g.push(a)})});return g},findModels:function(a, -b,d){for(var g=["ng-","data-ng-","ng\\:"],h=0;hc&&(c=e),c+=+a.slice(e+1),a=a.substring(0,e)):0>c&&(c= -a.length);for(e=0;a.charAt(e)===rc;e++);if(e===(g=a.length))d=[0],c=1;else{for(g--;a.charAt(g)===rc;)g--;c-=e;d=[];for(f=0;e<=g;e++,f++)d[f]=+a.charAt(e)}c>Vd&&(d=d.splice(0,Vd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function Qg(a,b,d,c){var e=a.d,f=e.length-a.i;b=z(b)?Math.min(Math.max(d,f),c):+b;d=b+a.i;c=e[d];if(0d-1){for(c=0;c>d;c--)e.unshift(0), -a.i++;e.unshift(1);a.i++}else e[d-1]++;for(;fh;)k.unshift(0),h++;0=b.lgSize&&h.unshift(k.splice(-b.lgSize, -k.length).join(""));k.length>b.gSize;)h.unshift(k.splice(-b.gSize,k.length).join(""));k.length&&h.unshift(k.join(""));k=h.join(d);f.length&&(k+=c+f.join(""));e&&(k+="e+"+e)}return 0>a&&!g?b.negPre+k+b.negSuf:b.posPre+k+b.posSuf}function Nb(a,b,d,c){var e="";if(0>a||c&&0>=a)c?a=-a+1:(a=-a,e="-");for(a=""+a;a.length-d)f+=d;0===f&&-12===d&&(f=12);return Nb(f,b,c,e)}}function nb(a, -b,d){return function(c,e){var f=c["get"+a](),g=xb((d?"STANDALONE":"")+(b?"SHORT":"")+a);return e[g][f]}}function Wd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function Xd(a){return function(b){var d=Wd(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Nb(b,a)}}function sc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Qd(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0, -h=b[8]?a.setUTCFullYear:a.setFullYear,k=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=aa(b[9]+b[10]),g=aa(b[9]+b[11]));h.call(a,aa(b[1]),aa(b[2])-1,aa(b[3]));f=aa(b[4]||0)-f;g=aa(b[5]||0)-g;h=aa(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));k.call(a,f,g,h,b)}return a}var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,d,f){var g="",h=[],k,l;d=d||"mediumDate";d=a.DATETIME_FORMATS[d]||d;H(c)&&(c=Rg.test(c)?aa(c):b(c));Z(c)&& -(c=new Date(c));if(!ba(c)||!isFinite(c.getTime()))return c;for(;d;)(l=Sg.exec(d))?(h=bb(h,l,1),d=h.pop()):(h.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=Fc(f,m),c=Vb(c,f,!0));q(h,function(b){k=Tg[b];g+=k?k(c,a.DATETIME_FORMATS,m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Kg(){return function(a,b){z(b)&&(b=2);return db(a,b)}}function Lg(){return function(a,b,d){b=Infinity===Math.abs(Number(b))?Number(b):aa(b);if(X(b))return a;Z(a)&&(a=a.toString());if(!ra(a))return a; -d=!d||isNaN(d)?0:aa(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?tc(a,d,d+b):0===d?tc(a,b,a.length):tc(a,Math.max(0,d+b),d)}}function tc(a,b,d){return H(a)?a.slice(b,d):ta.call(a,b,d)}function Sd(a){function b(b){return b.map(function(b){var c=1,d=Za;if(F(b))d=b;else if(H(b)){if("+"===b.charAt(0)||"-"===b.charAt(0))c="-"===b.charAt(0)?-1:1,b=b.substring(1);if(""!==b&&(d=a(b),d.constant))var e=d(),d=function(a){return a[e]}}return{get:d,descending:c}})}function d(a){switch(typeof a){case "number":case "boolean":case "string":return!0; -default:return!1}}function c(a,b){var c=0,d=a.type,k=b.type;if(d===k){var k=a.value,l=b.value;"string"===d?(k=k.toLowerCase(),l=l.toLowerCase()):"object"===d&&(I(k)&&(k=a.index),I(l)&&(l=b.index));k!==l&&(c=kb||37<=b&&40>=b|| -m(a,this,this.value)});if(e.hasEvent("paste"))b.on("paste cut",m)}b.on("change",l);if($d[g]&&c.$$hasNativeValidators&&g===d.type)b.on("keydown wheel mousedown",function(a){if(!k){var b=this.validity,c=b.badInput,d=b.typeMismatch;k=f.defer(function(){k=null;b.badInput===c&&b.typeMismatch===d||l(a)})}});c.$render=function(){var a=c.$isEmpty(c.$viewValue)?"":c.$viewValue;b.val()!==a&&b.val(a)}}function Qb(a,b){return function(d,c){var e,f;if(ba(d))return d;if(H(d)){'"'===d.charAt(0)&&'"'===d.charAt(d.length- -1)&&(d=d.substring(1,d.length-1));if(Ug.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(),ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},q(e,function(a,c){c=t};g.$observe("min", -function(a){t=p(a);h.$validate()})}if(u(g.max)||g.ngMax){var s;h.$validators.max=function(a){return!n(a)||z(s)||d(a)<=s};g.$observe("max",function(a){s=p(a);h.$validate()})}}}function vc(a,b,d,c){(c.$$hasNativeValidators=I(b[0].validity))&&c.$parsers.push(function(a){var c=b.prop("validity")||{};return c.badInput||c.typeMismatch?void 0:a})}function ae(a){a.$$parserName="number";a.$parsers.push(function(b){if(a.$isEmpty(b))return null;if(Vg.test(b))return parseFloat(b)});a.$formatters.push(function(b){if(!a.$isEmpty(b)){if(!Z(b))throw pb("numfmt", -b);b=b.toString()}return b})}function qb(a){u(a)&&!Z(a)&&(a=parseFloat(a));return X(a)?void 0:a}function wc(a){var b=a.toString(),d=b.indexOf(".");return-1===d?-1a&&(a=/e-(\d+)$/.exec(b))?Number(a[1]):0:b.length-d-1}function be(a,b,d,c,e){if(u(c)){a=a(c);if(!a.constant)throw pb("constexpr",d,c);return a(b)}return e}function xc(a,b){a="ngClass"+a;return["$animate",function(d){function c(a,b){var c=[],d=0;a:for(;d(?:<\/\1>|)$/,Yb=/<|&#?\w+;/,ag=/<([\w:-]+)/,bg=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,ja={option:[1,'"],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"", -""]};ja.optgroup=ja.option;ja.tbody=ja.tfoot=ja.colgroup=ja.caption=ja.thead;ja.th=ja.td;var ig=B.Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)},Oa=T.prototype={ready:function(a){function b(){d||(d=!0,a())}var d=!1;"complete"===B.document.readyState?B.setTimeout(b):(this.on("DOMContentLoaded",b),T(B).on("load",b))},toString:function(){var a=[];q(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?E(this[a]):E(this[this.length+ -a])},length:0,push:Xg,sort:[].sort,splice:[].splice},Hb={};q("multiple selected checked disabled readOnly required open".split(" "),function(a){Hb[P(a)]=a});var bd={};q("input select option textarea button form details".split(" "),function(a){bd[a]=!0});var jd={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern"};q({data:ac,removeData:gb,hasData:function(a){for(var b in hb[a.ng339])return!0;return!1},cleanData:function(a){for(var b=0,d=a.length;b/, -lg=/^[^\(]*\(\s*([^\)]*)\)/m,Yg=/,/,Zg=/^\s*(_?)(\S+?)\1\s*$/,jg=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Da=N("$injector");eb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw H(d)&&d||(d=a.name||mg(a)),Da("strictdi",d);b=cd(a);q(b[1].split(Yg),function(a){a.replace(Zg,function(a,b,d){c.push(d)})})}a.$inject=c}}else K(a)?(b=a.length-1,Pa(a[b],"fn"),c=a.slice(0,b)):Pa(a,"fn",!0);return c};var fe=N("$animate"),pf=function(){this.$get=C},qf=function(){var a= -new Ra,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=H(b)?b.split(" "):K(b)?b:[],q(b,function(b){b&&(d=!0,a[b]=c)}));return d}function f(){q(b,function(b){var c=a.get(b);if(c){var d=ng(b.attr("class")),e="",f="";q(c,function(a,b){a!==!!d[b]&&(a?e+=(e.length?" ":"")+b:f+=(f.length?" ":"")+b)});q(b,function(a){e&&Eb(a,e);f&&Db(a,f)});a.remove(b)}});b.length=0}return{enabled:C,on:C,off:C,pin:C,push:function(g,h,k,l){l&&l();k=k||{};k.from&&g.css(k.from); -k.to&&g.css(k.to);if(k.addClass||k.removeClass)if(h=k.addClass,l=k.removeClass,k=a.get(g)||{},h=e(k,h,!0),l=e(k,l,!1),h||l)a.put(g,k),b.push(g),1===b.length&&c.$$postDigest(f);g=new d;g.complete();return g}}}]},nf=["$provide",function(a){var b=this;this.$$registeredAnimations=Object.create(null);this.register=function(d,c){if(d&&"."!==d.charAt(0))throw fe("notcsel",d);var e=d+"-animation";b.$$registeredAnimations[d.substr(1)]=e;a.factory(e,c)};this.classNameFilter=function(a){if(1===arguments.length&& -(this.$$classNameFilter=a instanceof RegExp?a:null)&&/(\s+|\/)ng-animate(\s+|\/)/.test(this.$$classNameFilter.toString()))throw fe("nongcls","ng-animate");return this.$$classNameFilter};this.$get=["$$animateQueue",function(a){function b(a,c,d){if(d){var h;a:{for(h=0;h <= >= && || ! = |".split(" "),function(a){Rb[a]=!0});var ch={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},oc=function(a){this.options=a}; -oc.prototype={constructor:oc,lex:function(a){this.text=a;this.index=0;for(this.tokens=[];this.index=a&&"string"===typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"=== -a},isIdentifierStart:function(a){return this.options.isIdentifierStart?this.options.isIdentifierStart(a,this.codePointAt(a)):this.isValidIdentifierStart(a)},isValidIdentifierStart:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isIdentifierContinue:function(a){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(a,this.codePointAt(a)):this.isValidIdentifierContinue(a)},isValidIdentifierContinue:function(a,b){return this.isValidIdentifierStart(a,b)||this.isNumber(a)}, -codePointAt:function(a){return 1===a.length?a.charCodeAt(0):(a.charCodeAt(0)<<10)+a.charCodeAt(1)-56613888},peekMultichar:function(){var a=this.text.charAt(this.index),b=this.peek();if(!b)return a;var d=a.charCodeAt(0),c=b.charCodeAt(0);return 55296<=d&&56319>=d&&56320<=c&&57343>=c?a+b:a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b=u(b)?"s "+b+"-"+this.index+" ["+this.text.substring(b,d)+"]":" "+d;throw ea("lexerr",a,b,this.text); -},readNumber:function(){for(var a="",b=this.index;this.index","<=",">=");)a={type:r.BinaryExpression,operator:b.text,left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(), -b;b=this.expect("+","-");)a={type:r.BinaryExpression,operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),b;b=this.expect("*","/","%");)a={type:r.BinaryExpression,operator:b.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:r.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")): -this.expect("[")?a=this.arrayDeclaration():this.expect("{")?a=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?a=pa(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?a={type:r.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError("not a primary expression",this.peek());for(var b;b=this.expect("(","[",".");)"("===b.text?(a={type:r.CallExpression, -callee:a,arguments:this.parseArguments()},this.consume(")")):"["===b.text?(a={type:r.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")):"."===b.text?a={type:r.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var b={type:r.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(":");)a.push(this.expression());return b},parseArguments:function(){var a=[];if(")"!== -this.peekToken().text){do a.push(this.filterChain());while(this.expect(","))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier",a);return{type:r.Identifier,name:a.text}},constant:function(){return{type:r.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]");return{type:r.ArrayExpression,elements:a}}, -object:function(){var a=[],b;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;b={type:r.Property,kind:"init"};this.peek().constant?(b.key=this.constant(),b.computed=!1,this.consume(":"),b.value=this.expression()):this.peek().identifier?(b.key=this.identifier(),b.computed=!1,this.peek(":")?(this.consume(":"),b.value=this.expression()):b.value=b.key):this.peek("[")?(this.consume("["),b.key=this.expression(),this.consume("]"),b.computed=!0,this.consume(":"),b.value=this.expression()):this.throwError("invalid key", -this.peek());a.push(b)}while(this.expect(","))}this.consume("}");return{type:r.ObjectExpression,properties:a}},throwError:function(a,b){throw ea("syntax",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw ea("ueoe",this.text);var b=this.expect(a);b||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw ea("ueoe",this.text);return this.tokens[0]},peek:function(a,b, -d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c,e){if(this.tokens.length>a){a=this.tokens[a];var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1},expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},selfReferential:{"this":{type:r.ThisExpression},$locals:{type:r.LocalsExpression}}};Id.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.state={nextId:0,filters:{},expensiveChecks:b,fn:{vars:[],body:[],own:{}}, -assign:{vars:[],body:[],own:{}},inputs:[]};W(c,d.$filter);var e="",f;this.stage="assign";if(f=Gd(c))this.state.computing="assign",e=this.nextId(),this.recurse(f,e),this.return_(e),e="fn.assign="+this.generateFunction("assign","s,v,l");f=Ed(c.body);d.stage="inputs";q(f,function(a,b){var c="fn"+b;d.state[c]={vars:[],body:[],own:{}};d.state.computing=c;var e=d.nextId();d.recurse(a,e);d.return_(e);d.state.inputs.push(c);a.watchId=b});this.state.computing="fn";this.stage="main";this.recurse(c);e='"'+this.USE+ -" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+e+this.watchFns()+"return fn;";e=(new Function("$filter","ensureSafeMemberName","ensureSafeObject","ensureSafeFunction","getStringValue","ensureSafeAssignContext","ifDefined","plus","text",e))(this.$filter,Ta,qa,vd,xg,Kb,Fg,Dd,a);this.state=this.stage=void 0;e.literal=Hd(c);e.constant=c.constant;return e},USE:"use",STRICT:"strict",watchFns:function(){var a=[],b=this.state.inputs,d=this;q(b,function(b){a.push("var "+ -b+"="+d.generateFunction(b,"s"))});b.length&&a.push("fn.inputs=["+b.join(",")+"];");return a.join("")},generateFunction:function(a,b){return"function("+b+"){"+this.varsPrefix(a)+this.body(a)+"};"},filterPrefix:function(){var a=[],b=this;q(this.state.filters,function(d,c){a.push(d+"=$filter("+b.escape(c)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length?"var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")}, -recurse:function(a,b,d,c,e,f){var g,h,k=this,l,m,n;c=c||C;if(!f&&u(a.watchId))b=b||this.nextId(),this.if_("i",this.lazyAssign(b,this.computedMember("i",a.watchId)),this.lazyRecurse(a,b,d,c,e,!0));else switch(a.type){case r.Program:q(a.body,function(b,c){k.recurse(b.expression,void 0,void 0,function(a){h=a});c!==a.body.length-1?k.current().body.push(h,";"):k.return_(h)});break;case r.Literal:m=this.escape(a.value);this.assign(b,m);c(m);break;case r.UnaryExpression:this.recurse(a.argument,void 0,void 0, -function(a){h=a});m=a.operator+"("+this.ifDefined(h,0)+")";this.assign(b,m);c(m);break;case r.BinaryExpression:this.recurse(a.left,void 0,void 0,function(a){g=a});this.recurse(a.right,void 0,void 0,function(a){h=a});m="+"===a.operator?this.plus(g,h):"-"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(h,0):"("+g+")"+a.operator+"("+h+")";this.assign(b,m);c(m);break;case r.LogicalExpression:b=b||this.nextId();k.recurse(a.left,b);k.if_("&&"===a.operator?b:k.not(b),k.lazyRecurse(a.right,b)); -c(b);break;case r.ConditionalExpression:b=b||this.nextId();k.recurse(a.test,b);k.if_(b,k.lazyRecurse(a.alternate,b),k.lazyRecurse(a.consequent,b));c(b);break;case r.Identifier:b=b||this.nextId();d&&(d.context="inputs"===k.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);Ta(a.name);k.if_("inputs"===k.stage||k.not(k.getHasOwnProperty("l",a.name)),function(){k.if_("inputs"===k.stage||"s",function(){e&&1!==e&&k.if_(k.not(k.nonComputedMember("s", -a.name)),k.lazyAssign(k.nonComputedMember("s",a.name),"{}"));k.assign(b,k.nonComputedMember("s",a.name))})},b&&k.lazyAssign(b,k.nonComputedMember("l",a.name)));(k.state.expensiveChecks||Mb(a.name))&&k.addEnsureSafeObject(b);c(b);break;case r.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();k.recurse(a.object,g,void 0,function(){k.if_(k.notNull(g),function(){e&&1!==e&&k.addEnsureSafeAssignContext(g);if(a.computed)h=k.nextId(),k.recurse(a.property,h),k.getStringValue(h), -k.addEnsureSafeMemberName(h),e&&1!==e&&k.if_(k.not(k.computedMember(g,h)),k.lazyAssign(k.computedMember(g,h),"{}")),m=k.ensureSafeObject(k.computedMember(g,h)),k.assign(b,m),d&&(d.computed=!0,d.name=h);else{Ta(a.property.name);e&&1!==e&&k.if_(k.not(k.nonComputedMember(g,a.property.name)),k.lazyAssign(k.nonComputedMember(g,a.property.name),"{}"));m=k.nonComputedMember(g,a.property.name);if(k.state.expensiveChecks||Mb(a.property.name))m=k.ensureSafeObject(m);k.assign(b,m);d&&(d.computed=!1,d.name=a.property.name)}}, -function(){k.assign(b,"undefined")});c(b)},!!e);break;case r.CallExpression:b=b||this.nextId();a.filter?(h=k.filter(a.callee.name),l=[],q(a.arguments,function(a){var b=k.nextId();k.recurse(a,b);l.push(b)}),m=h+"("+l.join(",")+")",k.assign(b,m),c(b)):(h=k.nextId(),g={},l=[],k.recurse(a.callee,h,g,function(){k.if_(k.notNull(h),function(){k.addEnsureSafeFunction(h);q(a.arguments,function(a){k.recurse(a,k.nextId(),void 0,function(a){l.push(k.ensureSafeObject(a))})});g.name?(k.state.expensiveChecks||k.addEnsureSafeObject(g.context), -m=k.member(g.context,g.name,g.computed)+"("+l.join(",")+")"):m=h+"("+l.join(",")+")";m=k.ensureSafeObject(m);k.assign(b,m)},function(){k.assign(b,"undefined")});c(b)}));break;case r.AssignmentExpression:h=this.nextId();g={};if(!Fd(a.left))throw ea("lval");this.recurse(a.left,void 0,g,function(){k.if_(k.notNull(g.context),function(){k.recurse(a.right,h);k.addEnsureSafeObject(k.member(g.context,g.name,g.computed));k.addEnsureSafeAssignContext(g.context);m=k.member(g.context,g.name,g.computed)+a.operator+ -h;k.assign(b,m);c(b||m)})},1);break;case r.ArrayExpression:l=[];q(a.elements,function(a){k.recurse(a,k.nextId(),void 0,function(a){l.push(a)})});m="["+l.join(",")+"]";this.assign(b,m);c(m);break;case r.ObjectExpression:l=[];n=!1;q(a.properties,function(a){a.computed&&(n=!0)});n?(b=b||this.nextId(),this.assign(b,"{}"),q(a.properties,function(a){a.computed?(g=k.nextId(),k.recurse(a.key,g)):g=a.key.type===r.Identifier?a.key.name:""+a.key.value;h=k.nextId();k.recurse(a.value,h);k.assign(k.member(b,g, -a.computed),h)})):(q(a.properties,function(b){k.recurse(b.value,a.constant?void 0:k.nextId(),void 0,function(a){l.push(k.escape(b.key.type===r.Identifier?b.key.name:""+b.key.value)+":"+a)})}),m="{"+l.join(",")+"}",this.assign(b,m));c(b||m);break;case r.ThisExpression:this.assign(b,"s");c("s");break;case r.LocalsExpression:this.assign(b,"l");c("l");break;case r.NGValueParameter:this.assign(b,"v"),c("v")}},getHasOwnProperty:function(a,b){var d=a+"."+b,c=this.current().own;c.hasOwnProperty(d)||(c[d]= -this.nextId(!1,a+"&&("+this.escape(b)+" in "+a+")"));return c[d]},assign:function(a,b){if(a)return this.current().body.push(a,"=",b,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return"ifDefined("+a+","+this.escape(b)+")"},plus:function(a,b){return"plus("+a+","+b+")"},return_:function(a){this.current().body.push("return ",a,";")},if_:function(a,b,d){if(!0===a)b();else{var c=this.current().body; -c.push("if(",a,"){");b();c.push("}");d&&(c.push("else{"),d(),c.push("}"))}},not:function(a){return"!("+a+")"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a,b){var d=/[^$_a-zA-Z0-9]/g;return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(b)?a+"."+b:a+'["'+b.replace(d,this.stringEscapeFn)+'"]'},computedMember:function(a,b){return a+"["+b+"]"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a,b)},addEnsureSafeObject:function(a){this.current().body.push(this.ensureSafeObject(a), -";")},addEnsureSafeMemberName:function(a){this.current().body.push(this.ensureSafeMemberName(a),";")},addEnsureSafeFunction:function(a){this.current().body.push(this.ensureSafeFunction(a),";")},addEnsureSafeAssignContext:function(a){this.current().body.push(this.ensureSafeAssignContext(a),";")},ensureSafeObject:function(a){return"ensureSafeObject("+a+",text)"},ensureSafeMemberName:function(a){return"ensureSafeMemberName("+a+",text)"},ensureSafeFunction:function(a){return"ensureSafeFunction("+a+",text)"}, -getStringValue:function(a){this.assign(a,"getStringValue("+a+")")},ensureSafeAssignContext:function(a){return"ensureSafeAssignContext("+a+",text)"},lazyRecurse:function(a,b,d,c,e,f){var g=this;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(H(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+ -"'";if(Z(a))return a.toString();if(!0===a)return"true";if(!1===a)return"false";if(null===a)return"null";if("undefined"===typeof a)return"undefined";throw ea("esc");},nextId:function(a,b){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(b?"="+b:""));return d},current:function(){return this.state[this.state.computing]}};Jd.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.expression=a;this.expensiveChecks=b;W(c,d.$filter);var e,f;if(e=Gd(c))f=this.recurse(e);e=Ed(c.body); -var g;e&&(g=[],q(e,function(a,b){var c=d.recurse(a);a.input=c;g.push(c);a.watchId=b}));var h=[];q(c.body,function(a){h.push(d.recurse(a.expression))});e=0===c.body.length?C:1===c.body.length?h[0]:function(a,b){var c;q(h,function(d){c=d(a,b)});return c};f&&(e.assign=function(a,b,c){return f(a,c,b)});g&&(e.inputs=g);e.literal=Hd(c);e.constant=c.constant;return e},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case r.Literal:return this.value(a.value, -b);case r.UnaryExpression:return e=this.recurse(a.argument),this["unary"+a.operator](e,b);case r.BinaryExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case r.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case r.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),b);case r.Identifier:return Ta(a.name,f.expression),f.identifier(a.name, -f.expensiveChecks||Mb(a.name),b,d,f.expression);case r.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(Ta(a.property.name,f.expression),e=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c,e,b,d,f.expression):this.nonComputedMember(c,e,f.expensiveChecks,b,d,f.expression);case r.CallExpression:return g=[],q(a.arguments,function(a){g.push(f.recurse(a))}),a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter? -function(a,c,d,f){for(var n=[],p=0;p":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},"binary<=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<=b(c,e,f,g);return d?{value:c}:c}},"binary>=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},"binary&&":function(a,b,d){return function(c,e,f,g){c= -a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},"binary||":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},"ternary?:":function(a,b,d,c){return function(e,f,g,h){e=a(e,f,g,h)?b(e,f,g,h):d(e,f,g,h);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:void 0,name:void 0,value:a}:a}},identifier:function(a,b,d,c,e){return function(f,g,h,k){f=g&&a in g?g:f;c&&1!==c&&f&&!f[a]&&(f[a]={});g=f?f[a]:void 0;b&&qa(g,e);return d?{context:f,name:a, -value:g}:g}},computedMember:function(a,b,d,c,e){return function(f,g,h,k){var l=a(f,g,h,k),m,n;null!=l&&(m=b(f,g,h,k),m+="",Ta(m,e),c&&1!==c&&(Kb(l),l&&!l[m]&&(l[m]={})),n=l[m],qa(n,e));return d?{context:l,name:m,value:n}:n}},nonComputedMember:function(a,b,d,c,e,f){return function(g,h,k,l){g=a(g,h,k,l);e&&1!==e&&(Kb(g),g&&!g[b]&&(g[b]={}));h=null!=g?g[b]:void 0;(d||Mb(b))&&qa(h,f);return c?{context:g,name:b,value:h}:h}},inputs:function(a,b){return function(d,c,e,f){return f?f[b]:a(d,c,e)}}};var pc= -function(a,b,d){this.lexer=a;this.$filter=b;this.options=d;this.ast=new r(a,d);this.astCompiler=d.csp?new Jd(this.ast,b):new Id(this.ast,b)};pc.prototype={constructor:pc,parse:function(a){return this.astCompiler.compile(a,this.options.expensiveChecks)}};var fa=N("$sce"),la={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Ig=N("$compile"),V=B.document.createElement("a"),Nd=Ca(B.location.href);Od.$inject=["$document"];Tc.$inject=["$provide"];var Vd=22,Ud=".",rc="0";Pd.$inject=["$locale"]; -Rd.$inject=["$locale"];var Tg={yyyy:Y("FullYear",4,0,!1,!0),yy:Y("FullYear",2,0,!0,!0),y:Y("FullYear",1,0,!1,!0),MMMM:nb("Month"),MMM:nb("Month",!0),MM:Y("Month",2,1),M:Y("Month",1,1),LLLL:nb("Month",!1,!0),dd:Y("Date",2),d:Y("Date",1),HH:Y("Hours",2),H:Y("Hours",1),hh:Y("Hours",2,-12),h:Y("Hours",1,-12),mm:Y("Minutes",2),m:Y("Minutes",1),ss:Y("Seconds",2),s:Y("Seconds",1),sss:Y("Milliseconds",3),EEEE:nb("Day"),EEE:nb("Day",!0),a:function(a,b){return 12>a.getHours()?b.AMPMS[0]:b.AMPMS[1]},Z:function(a, -b,d){a=-1*d;return a=(0<=a?"+":"")+(Nb(Math[0=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},Sg=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,Rg=/^\-?\d+$/;Qd.$inject=["$locale"];var Mg=ma(P),Ng=ma(xb);Sd.$inject=["$parse"];var Ee=ma({restrict:"E",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a,b){if("a"===b[0].nodeName.toLowerCase()){var e= -"[object SVGAnimatedString]"===na.call(b.prop("href"))?"xlink:href":"href";b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),yb={};q(Hb,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!==a){var c=Ba("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!==e[c]&&d(a,b,e)});yb[c]=function(){return{restrict:"A",priority:100,link:e}}}});q(jd,function(a,b){yb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"===e.ngPattern.charAt(0)&& -(c=e.ngPattern.match(Wg))){e.$set("ngPattern",new RegExp(c[1],c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});q(["src","srcset","href"],function(a){var b=Ba("ng-"+a);yb[b]=function(){return{priority:99,link:function(d,c,e){var f=a,g=a;"href"===a&&"[object SVGAnimatedString]"===na.call(c.prop("href"))&&(g="xlinkHref",e.$attr[g]="xlink:href",f=null);e.$observe(b,function(b){b?(e.$set(g,b),Fa&&f&&c.prop(f,e[g])):"href"===a&&e.$set(g,null)})}}}});var Ob={$addControl:C,$$renameControl:function(a, -b){a.$name=b},$removeControl:C,$setValidity:C,$setDirty:C,$setPristine:C,$setSubmitted:C};Yd.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var ge=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||C}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Yd,compile:function(d,f){d.addClass(Va).addClass(rb);var g=f.name?"name":a&&f.ngForm?"ngForm":!1;return{pre:function(a,d,e,f){var n=f[0];if(!("action"in -e)){var p=function(b){a.$apply(function(){n.$commitViewValue();n.$setSubmitted()});b.preventDefault()};d[0].addEventListener("submit",p,!1);d.on("$destroy",function(){b(function(){d[0].removeEventListener("submit",p,!1)},0,!1)})}(f[1]||n.$$parentForm).$addControl(n);var q=g?c(n.$name):C;g&&(q(a,n),e.$observe(g,function(b){n.$name!==b&&(q(a,void 0),n.$$parentForm.$$renameControl(n,b),q=c(n.$name),q(a,n))}));d.on("$destroy",function(){n.$$parentForm.$removeControl(n);q(a,void 0);R(n,Ob)})}}}}}]},Fe= -ge(),Re=ge(!0),Ug=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,dh=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,eh=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,Vg=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,he=/^(\d{4,})-(\d{2})-(\d{2})$/, -ie=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,yc=/^(\d{4,})-W(\d\d)$/,je=/^(\d{4,})-(\d\d)$/,ke=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,$d=S();q(["date","datetime-local","month","time","week"],function(a){$d[a]=!0});var le={text:function(a,b,d,c,e,f){Wa(a,b,d,c,e,f);uc(c)},date:ob("date",he,Qb(he,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":ob("datetimelocal",ie,Qb(ie,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:ob("time",ke,Qb(ke,["HH","mm", -"ss","sss"]),"HH:mm:ss.sss"),week:ob("week",yc,function(a,b){if(ba(a))return a;if(H(a)){yc.lastIndex=0;var d=yc.exec(a);if(d){var c=+d[1],e=+d[2],f=d=0,g=0,h=0,k=Wd(c),e=7*(e-1);b&&(d=b.getHours(),f=b.getMinutes(),g=b.getSeconds(),h=b.getMilliseconds());return new Date(c,0,k.getDate()+e,d,f,g,h)}}return NaN},"yyyy-Www"),month:ob("month",je,Qb(je,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f){vc(a,b,d,c);Wa(a,b,d,c,e,f);ae(c);var g,h;if(u(d.min)||d.ngMin)c.$validators.min=function(a){return c.$isEmpty(a)|| -z(g)||a>=g},d.$observe("min",function(a){g=qb(a);c.$validate()});if(u(d.max)||d.ngMax)c.$validators.max=function(a){return c.$isEmpty(a)||z(h)||a<=h},d.$observe("max",function(a){h=qb(a);c.$validate()})},url:function(a,b,d,c,e,f){Wa(a,b,d,c,e,f);uc(c);c.$$parserName="url";c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||dh.test(d)}},email:function(a,b,d,c,e,f){Wa(a,b,d,c,e,f);uc(c);c.$$parserName="email";c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||eh.test(d)}}, -radio:function(a,b,d,c){z(d.name)&&b.attr("name",++sb);b.on("click",function(a){b[0].checked&&c.$setViewValue(d.value,a&&a.type)});c.$render=function(){b[0].checked=d.value===c.$viewValue};d.$observe("value",c.$render)},range:function(a,b,d,c,e,f){function g(a,c){b.attr(a,d[a]);d.$observe(a,c)}function h(a){n=qb(a);X(c.$modelValue)||(m?(a=b.val(),n>a&&(a=n,b.val(a)),c.$setViewValue(a)):c.$validate())}function k(a){p=qb(a);X(c.$modelValue)||(m?(a=b.val(),p=n}, -g("min",h));e&&(c.$validators.max=m?function(){return!0}:function(a,b){return c.$isEmpty(b)||z(p)||b<=p},g("max",k));f&&(c.$validators.step=m?function(){return!r.stepMismatch}:function(a,b){var d;if(!(d=c.$isEmpty(b)||z(q))){d=n||0;var e=q,f=Number(b);if((f|0)!==f||(d|0)!==d||(e|0)!==e){var g=Math.max(wc(f),wc(d),wc(e)),g=Math.pow(10,g),f=f*g;d*=g;e*=g}d=0===(f-d)%e}return d},g("step",l))},checkbox:function(a,b,d,c,e,f,g,h){var k=be(h,a,"ngTrueValue",d.ngTrueValue,!0),l=be(h,a,"ngFalseValue",d.ngFalseValue, -!1);b.on("click",function(a){c.$setViewValue(b[0].checked,a&&a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty=function(a){return!1===a};c.$formatters.push(function(a){return oa(a,k)});c.$parsers.push(function(a){return a?k:l})},hidden:C,button:C,submit:C,reset:C,file:C},Nc=["$browser","$sniffer","$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e,f,g,h){if(h[0]){var k=P(g.type);"range"!==k||g.hasOwnProperty("ngInputRange")||(k="text"); -(le[k]||le.text)(e,f,g,h[0],b,a,d,c)}}}}}],fh=/^(true|false|\d+)$/,jf=function(){return{restrict:"A",priority:100,compile:function(a,b){return fh.test(b.ngValue)?function(a,b,e){e.$set("value",a.$eval(e.ngValue))}:function(a,b,e){a.$watch(e.ngValue,function(a){e.$set("value",a)})}}}},Je=["$compile",function(a){return{restrict:"AC",compile:function(b){a.$$addBindingClass(b);return function(b,c,e){a.$$addBindingInfo(c,e.ngBind);c=c[0];b.$watch(e.ngBind,function(a){c.textContent=z(a)?"":a})}}}}],Le= -["$interpolate","$compile",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate));b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe("ngBindTemplate",function(a){d.textContent=z(a)?"":a})}}}}],Ke=["$sce","$parse","$compile",function(a,b,d){return{restrict:"A",compile:function(c,e){var f=b(e.ngBindHtml),g=b(e.ngBindHtml,function(b){return a.valueOf(b)});d.$$addBindingClass(c);return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml); -b.$watch(g,function(){var d=f(b);c.html(a.getTrustedHtml(d)||"")})}}}}],hf=ma({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Me=xc("",!0),Oe=xc("Odd",0),Ne=xc("Even",1),Pe=Ua({compile:function(a,b){b.$set("ngCloak",void 0);a.removeClass("ng-cloak")}}),Qe=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Sc={},gh={blur:!0,focus:!0};q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "), -function(a){var b=Ba("ng-"+a);Sc[b]=["$parse","$rootScope",function(d,c){return{restrict:"A",compile:function(e,f){var g=d(f[b],null,!0);return function(b,d){d.on(a,function(d){var e=function(){g(b,{$event:d})};gh[a]&&c.$$phase?b.$evalAsync(e):b.$apply(e)})}}}}]});var Te=["$animate","$compile",function(a,b){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(d,c,e,f,g){var h,k,l;d.$watch(e.ngIf,function(d){d?k||g(function(d,f){k=f;d[d.length++]= -b.$$createComment("end ngIf",e.ngIf);h={clone:d};a.enter(d,c.parent(),c)}):(l&&(l.remove(),l=null),k&&(k.$destroy(),k=null),h&&(l=wb(h.clone),a.leave(l).then(function(){l=null}),h=null))})}}}],Ue=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:ga.noop,compile:function(c,e){var f=e.ngInclude||e.src,g=e.onload||"",h=e.autoscroll;return function(c,e,m,n,p){var q=0,r,t,s,D=function(){t&&(t.remove(),t=null);r&& -(r.$destroy(),r=null);s&&(d.leave(s).then(function(){t=null}),t=s,s=null)};c.$watch(f,function(f){var m=function(){!u(h)||h&&!c.$eval(h)||b()},w=++q;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&w===q){var b=c.$new();n.template=a;a=p(b,function(a){D();d.enter(a,null,e).then(m)});r=b;s=a;r.$emit("$includeContentLoaded",f);c.$eval(g)}},function(){c.$$destroyed||w!==q||(D(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(D(),n.template=null)})}}}}],lf=["$compile",function(a){return{restrict:"ECA", -priority:-400,require:"ngInclude",link:function(b,d,c,e){na.call(d[0]).match(/SVG/)?(d.empty(),a(Vc(e.template,B.document).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],Ve=Ua({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),gf=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,b,d,c){var e=b.attr(d.$attr.ngList)||", ",f="false"!==d.ngTrim,g=f?U(e):e;c.$parsers.push(function(a){if(!z(a)){var b= -[];a&&q(a.split(g),function(a){a&&b.push(f?U(a):a)});return b}});c.$formatters.push(function(a){if(K(a))return a.join(e)});c.$isEmpty=function(a){return!a||!a.length}}}},rb="ng-valid",ce="ng-invalid",Va="ng-pristine",Pb="ng-dirty",ee="ng-pending",pb=N("ngModel"),hh=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(a,b,d,c,e,f,g,h,k,l){this.$modelValue=this.$viewValue=Number.NaN;this.$$rawModelValue=void 0;this.$validators={}; -this.$asyncValidators={};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$untouched=!0;this.$touched=!1;this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending=void 0;this.$name=l(d.name||"",!1)(a);this.$$parentForm=Ob;var m=e(d.ngModel),n=m.assign,p=m,r=n,J=null,t,s=this;this.$$setOptions=function(a){if((s.$options=a)&&a.getterSetter){var b=e(d.ngModel+"()"),f=e(d.ngModel+"($$$p)");p=function(a){var c=m(a);F(c)&&(c=b(a)); -return c};r=function(a,b){F(m(a))?f(a,{$$$p:b}):n(a,b)}}else if(!m.assign)throw pb("nonassign",d.ngModel,wa(c));};this.$render=C;this.$isEmpty=function(a){return z(a)||""===a||null===a||a!==a};this.$$updateEmptyClasses=function(a){s.$isEmpty(a)?(f.removeClass(c,"ng-not-empty"),f.addClass(c,"ng-empty")):(f.removeClass(c,"ng-empty"),f.addClass(c,"ng-not-empty"))};var D=0;Zd({ctrl:this,$element:c,set:function(a,b){a[b]=!0},unset:function(a,b){delete a[b]},$animate:f});this.$setPristine=function(){s.$dirty= -!1;s.$pristine=!0;f.removeClass(c,Pb);f.addClass(c,Va)};this.$setDirty=function(){s.$dirty=!0;s.$pristine=!1;f.removeClass(c,Va);f.addClass(c,Pb);s.$$parentForm.$setDirty()};this.$setUntouched=function(){s.$touched=!1;s.$untouched=!0;f.setClass(c,"ng-untouched","ng-touched")};this.$setTouched=function(){s.$touched=!0;s.$untouched=!1;f.setClass(c,"ng-touched","ng-untouched")};this.$rollbackViewValue=function(){g.cancel(J);s.$viewValue=s.$$lastCommittedViewValue;s.$render()};this.$validate=function(){if(!X(s.$modelValue)){var a= -s.$$rawModelValue,b=s.$valid,c=s.$modelValue,d=s.$options&&s.$options.allowInvalid;s.$$runValidators(a,s.$$lastCommittedViewValue,function(e){d||b===e||(s.$modelValue=e?a:void 0,s.$modelValue!==c&&s.$$writeModelToScope())})}};this.$$runValidators=function(a,b,c){function d(){var c=!0;q(s.$validators,function(d,e){var g=d(a,b);c=c&&g;f(e,g)});return c?!0:(q(s.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;q(s.$asyncValidators,function(e,g){var h=e(a,b);if(!h||!F(h.then))throw pb("nopromise", -h);f(g,void 0);c.push(h.then(function(){f(g,!0)},function(){d=!1;f(g,!1)}))});c.length?k.all(c).then(function(){g(d)},C):g(!0)}function f(a,b){h===D&&s.$setValidity(a,b)}function g(a){h===D&&c(a)}D++;var h=D;(function(){var a=s.$$parserName||"parse";if(z(t))f(a,null);else return t||(q(s.$validators,function(a,b){f(b,null)}),q(s.$asyncValidators,function(a,b){f(b,null)})),f(a,t),t;return!0})()?d()?e():g(!1):g(!1)};this.$commitViewValue=function(){var a=s.$viewValue;g.cancel(J);if(s.$$lastCommittedViewValue!== -a||""===a&&s.$$hasNativeValidators)s.$$updateEmptyClasses(a),s.$$lastCommittedViewValue=a,s.$pristine&&this.$setDirty(),this.$$parseAndValidate()};this.$$parseAndValidate=function(){var b=s.$$lastCommittedViewValue;if(t=z(b)?void 0:!0)for(var c=0;ce||c.$isEmpty(b)||b.length<=e}}}}},Qc=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=0;d.$observe("minlength",function(a){e=aa(a)||0;c.$validate()});c.$validators.minlength=function(a,b){return c.$isEmpty(b)||b.length>=e}}}}};B.angular.bootstrap?B.console&&console.log("WARNING: Tried to load angular more than once."):(ze(),Be(ga),ga.module("ngLocale",[],["$provide",function(a){function b(a){a+="";var b=a.indexOf("."); -return-1==b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "), -WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a, -c){var e=a|0,f=c;void 0===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),E(B.document).ready(function(){ue(B.document,Ic)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(''); +(function(D){'use strict';function qe(a){if(G(a))u(a.objectMaxDepth)&&(Wb.objectMaxDepth=Xb(a.objectMaxDepth)?a.objectMaxDepth:NaN),u(a.urlErrorParamsEnabled)&&Ga(a.urlErrorParamsEnabled)&&(Wb.urlErrorParamsEnabled=a.urlErrorParamsEnabled);else return Wb}function Xb(a){return aa(a)&&0c)return"...";var d=b.$$hashKey,f;if(F(a)){f=0;for(var g=a.length;f
    ").append(a).html();try{return a[0].nodeType===Ma?O(b):b.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(a,b){return"<"+O(b)})}catch(d){return O(b)}}function Uc(a){try{return decodeURIComponent(a)}catch(b){}}function gc(a){var b={};q((a||"").split("&"), +function(a){var c,e,f;a&&(e=a=a.replace(/\+/g,"%20"),c=a.indexOf("="),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=Uc(e),u(e)&&(f=u(f)?Uc(f):!0,sa.call(b,e)?F(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function hc(a){var b=[];q(a,function(a,c){F(a)?q(a,function(a){b.push(ka(c,!0)+(!0===a?"":"="+ka(a,!0)))}):b.push(ka(c,!0)+(!0===a?"":"="+ka(a,!0)))});return b.length?b.join("&"):""}function gb(a){return ka(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ka(a, +b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,b?"%20":"+")}function xe(a,b){var d,c,e=Ia.length;for(c=0;c protocol indicates an extension, document.location.href does not match."))}function Vc(a,b,d){G(d)||(d={});d=P({strictDi:!1},d);var c=function(){a=y(a);if(a.injector()){var c=a[0]===D.document?"document":Aa(a);throw Ha("btstrpd",c.replace(//,">"));}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);d.debugInfoEnabled&&b.push(["$compileProvider", +function(a){a.debugInfoEnabled(!0)}]);b.unshift("ng");c=hb(b,d.strictDi);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;D&&e.test(D.name)&&(d.debugInfoEnabled=!0,D.name=D.name.replace(e,""));if(D&&!f.test(D.name))return c();D.name=D.name.replace(f,"");fa.resumeBootstrap=function(a){q(a,function(a){b.push(a)});return c()};z(fa.resumeDeferredBootstrap)&& +fa.resumeDeferredBootstrap()}function Ae(){D.name="NG_ENABLE_DEBUG_INFO!"+D.name;D.location.reload()}function Be(a){a=fa.element(a).injector();if(!a)throw Ha("test");return a.get("$$testability")}function Wc(a,b){b=b||"_";return a.replace(Ce,function(a,c){return(c?b:"")+a.toLowerCase()})}function De(){var a;if(!Xc){var b=sb();(tb=v(b)?D.jQuery:b?D[b]:void 0)&&tb.fn.on?(y=tb,P(tb.fn,{scope:Sa.scope,isolateScope:Sa.isolateScope,controller:Sa.controller,injector:Sa.injector,inheritedData:Sa.inheritedData})): +y=W;a=y.cleanData;y.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=y._data(f).events)&&c.$destroy&&y(f).triggerHandler("$destroy");a(b)};fa.element=y;Xc=!0}}function ib(a,b,d){if(!a)throw Ha("areq",b||"?",d||"required");return a}function ub(a,b,d){d&&F(a)&&(a=a[a.length-1]);ib(z(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Na(a,b){if("hasOwnProperty"===a)throw Ha("badname",b);}function Ee(a,b,d){if(!b)return a;b=b.split("."); +for(var c,e=a,f=b.length,g=0;g")+c[2];for(c=c[0];c--;)d=d.lastChild;f=eb(f,d.childNodes);d=e.firstChild;d.textContent=""}else f.push(b.createTextNode(a));e.textContent="";e.innerHTML="";q(f,function(a){e.appendChild(a)});return e}function W(a){if(a instanceof W)return a;var b;B(a)&&(a=Q(a),b=!0);if(!(this instanceof W)){if(b&&"<"!==a.charAt(0))throw mc("nosel");return new W(a)}if(b){b=D.document;var d;a=(d=jg.exec(a))?[b.createElement(d[1])]: +(d=fd(a,b))?d.childNodes:[];nc(this,a)}else z(a)?gd(a):nc(this,a)}function oc(a){return a.cloneNode(!0)}function Ab(a,b){!b&&kc(a)&&y.cleanData([a]);a.querySelectorAll&&y.cleanData(a.querySelectorAll("*"))}function hd(a){for(var b in a)return!1;return!0}function id(a){var b=a.ng339,d=b&&Oa[b],c=d&&d.events,d=d&&d.data;d&&!hd(d)||c&&!hd(c)||(delete Oa[b],a.ng339=void 0)}function jd(a,b,d,c){if(u(c))throw mc("offargs");var e=(c=Bb(a))&&c.events,f=c&&c.handle;if(f){if(b){var g=function(b){var c=e[b]; +u(d)&&db(c||[],d);u(d)&&c&&0l&&this.remove(n.key);return b}},get:function(a){if(l";b=Ba.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);d.value=c;a.attributes.setNamedItem(d)}function u(a,b){try{a.addClass(b)}catch(c){}}function N(a,b,c,d,e){a instanceof y||(a=y(a)); +var f=Z(a,b,a,c,d,e);N.$$addScopeClass(a);var g=null;return function(b,c,d){if(!a)throw ba("multilink");ib(b,"scope");e&&e.needsNewScope&&(b=b.$parent.$new());d=d||{};var h=d.parentBoundTranscludeFn,k=d.transcludeControllers;d=d.futureParentElement;h&&h.$$boundTransclude&&(h=h.$$boundTransclude);g||(g=(d=d&&d[0])?"foreignobject"!==ta(d)&&ga.call(d).match(/SVG/)?"svg":"html":"html");d="html"!==g?y(ia(g,y("
    ").append(a).html())):c?Sa.clone.call(a):a;if(k)for(var l in k)d.data("$"+l+"Controller", +k[l].instance);N.$$addScopeInfo(d,b);c&&c(d,b);f&&f(b,d,d,h);c||(a=f=null);return d}}function Z(a,b,c,d,e,f){function g(a,c,d,e){var f,k,l,m,p,n,E;if(H)for(E=Array(c.length),m=0;ms.priority)break;if(Z=s.scope)s.templateUrl||(G(Z)?($("new/isolated scope",w||H,s,I),w=s):$("new/isolated scope",w,s,I)),H=H||s;J=s.name;if(!u&&(s.replace&&(s.templateUrl||s.template)||s.transclude&& +!s.$$tlb)){for(Z=x+1;u=a[Z++];)if(u.transclude&&!u.$$tlb||u.replace&&(u.templateUrl||u.template)){Pa=!0;break}u=!0}!s.templateUrl&&s.controller&&(C=C||U(),$("'"+J+"' controller",C[J],s,I),C[J]=s);if(Z=s.transclude)if(ma=!0,s.$$tlb||($("transclusion",t,s,I),t=s),"element"===Z)la=!0,n=s.priority,M=I,I=d.$$element=y(N.$$createComment(J,d[J])),b=I[0],ja(f,ya.call(M,0),b),Y=sc(Pa,M,e,n,g&&g.name,{nonTlbTranscludeDirective:t});else{var xa=U();if(G(Z)){M=D.document.createDocumentFragment();var O=U(),T=U(); +q(Z,function(a,b){var c="?"===a.charAt(0);a=c?a.substring(1):a;O[a]=b;xa[b]=null;T[b]=c});q(I.contents(),function(a){var b=O[wa(ta(a))];b?(T[b]=!0,xa[b]=xa[b]||D.document.createDocumentFragment(),xa[b].appendChild(a)):M.appendChild(a)});q(T,function(a,b){if(!a)throw ba("reqslot",b);});for(var X in xa)xa[X]&&(xa[X]=sc(Pa,xa[X].childNodes,e));M=M.childNodes}else M=y(oc(b)).contents();I.empty();Y=sc(Pa,M,e,void 0,void 0,{needsNewScope:s.$$isolateScope||s.$$newScope});Y.$$slots=xa}if(s.template)if(A= +!0,$("template",R,s,I),R=s,Z=z(s.template)?s.template(I,d):s.template,Z=Ia(Z),s.replace){g=s;M=lc.test(Z)?sd(ia(s.templateNamespace,Q(Z))):[];b=M[0];if(1!==M.length||1!==b.nodeType)throw ba("tplrt",J,"");ja(f,I,b);B={$attr:{}};Z=rc(b,[],B);var fa=a.splice(x+1,a.length-(x+1));(w||H)&&da(Z,w,H);a=a.concat(Z).concat(fa);ea(d,B);B=a.length}else I.html(Z);if(s.templateUrl)A=!0,$("template",R,s,I),R=s,s.replace&&(g=s),p=ha(a.splice(x,a.length-x),I,d,f,ma&&Y,h,k,{controllerDirectives:C,newScopeDirective:H!== +s&&H,newIsolateScopeDirective:w,templateDirective:R,nonTlbTranscludeDirective:t}),B=a.length;else if(s.compile)try{va=s.compile(I,d,Y);var ca=s.$$originalDirective||s;z(va)?m(null,Ra(ca,va),Ua,La):va&&m(Ra(ca,va.pre),Ra(ca,va.post),Ua,La)}catch(ga){c(ga,Aa(I))}s.terminal&&(p.terminal=!0,n=Math.max(n,s.priority))}p.scope=H&&!0===H.scope;p.transcludeOnThisElement=ma;p.templateOnThisElement=A;p.transclude=Y;l.hasElementTranscludeDirective=la;return p}function S(a,b,c,d){var e;if(B(b)){var f=b.match(l); +b=b.substring(f[0].length);var g=f[1]||f[3],f="?"===f[2];"^^"===g?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e=g?c.inheritedData(h):c.data(h)}if(!e&&!f)throw ba("ctreq",b,a);}else if(F(b))for(e=[],g=0,f=b.length;gc.priority)&&-1!==c.restrict.indexOf(e)){k&&(c=ac(c,{$$start:k,$$end:l}));if(!c.$$bindings){var H=m=c,E=c.name,C={isolateScope:null,bindToController:null};G(H.scope)&& +(!0===H.bindToController?(C.bindToController=d(H.scope,E,!0),C.isolateScope={}):C.isolateScope=d(H.scope,E,!1));G(H.bindToController)&&(C.bindToController=d(H.bindToController,E,!0));if(C.bindToController&&!H.controller)throw ba("noctrl",E);m=m.$$bindings=C;G(m.isolateScope)&&(c.$$isolateBindings=m.isolateScope)}b.push(c);m=c}}return m}function X(b){if(f.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,e=c.length;d"+b+"";return c.childNodes[0].childNodes;default:return b}}function na(a,b){if("srcdoc"===b)return R.HTML; +var c=ta(a);if("src"===b||"ngSrc"===b)return-1===["img","video","audio","source","track"].indexOf(c)?R.RESOURCE_URL:R.MEDIA_URL;if("xlinkHref"===b)return"image"===c?R.MEDIA_URL:"a"===c?R.URL:R.RESOURCE_URL;if("form"===c&&"action"===b||"base"===c&&"href"===b||"link"===c&&"href"===b)return R.RESOURCE_URL;if("a"===c&&("href"===b||"ngHref"===b))return R.URL}function oa(a,c,d,e,f){var g=na(a,e),k=h[e]||f,l=b(d,!f,g,k);if(l){if("multiple"===e&&"select"===ta(a))throw ba("selmulti",Aa(a));if(m.test(e))throw ba("nodomevents"); +c.push({priority:100,compile:function(){return{pre:function(a,c,f){c=f.$$observers||(f.$$observers=U());var h=f[e];h!==d&&(l=h&&b(h,!0,g,k),d=h);l&&(f[e]=l(a),(c[e]||(c[e]=[])).$$inter=!0,(f.$$observers&&f.$$observers[e].$$scope||a).$watch(l,function(a,b){"class"===e&&a!==b?f.$updateClass(a,b):f.$set(e,a)}))}}}})}}function ja(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g=b)return a;for(;b--;){var d=a[b];(8===d.nodeType||d.nodeType===Ma&&""===d.nodeValue.trim())&&zg.call(a,b,1)}return a}function wg(a,b){if(b&&B(b))return b;if(B(a)){var d=vd.exec(a);if(d)return d[3]}}function Cf(){var a={};this.has=function(b){return a.hasOwnProperty(b)};this.register=function(b,d){Na(b,"controller");G(b)?P(a, +b):a[b]=d};this.$get=["$injector",function(b){function d(a,b,d,g){if(!a||!G(a.$scope))throw L("$controller")("noscp",g,b);a.$scope[b]=d}return function(c,e,f,g){var k,h,l;f=!0===f;g&&B(g)&&(l=g);if(B(c)){g=c.match(vd);if(!g)throw wd("ctrlfmt",c);h=g[1];l=l||g[3];c=a.hasOwnProperty(h)?a[h]:Ee(e.$scope,h,!0);if(!c)throw wd("ctrlreg",h);ub(c,h,!0)}if(f)return f=(F(c)?c[c.length-1]:c).prototype,k=Object.create(f||null),l&&d(e,l,k,h||c.name),P(function(){var a=b.invoke(c,k,e,h);a!==k&&(G(a)||z(a))&&(k= +a,l&&d(e,l,k,h||c.name));return k},{instance:k,identifier:l});k=b.instantiate(c,e,h);l&&d(e,l,k,h||c.name);return k}}]}function Df(){this.$get=["$window",function(a){return y(a.document)}]}function Ef(){this.$get=["$document","$rootScope",function(a,b){function d(){e=c.hidden}var c=a[0],e=c&&c.hidden;a.on("visibilitychange",d);b.$on("$destroy",function(){a.off("visibilitychange",d)});return function(){return e}}]}function Ff(){this.$get=["$log",function(a){return function(b,d){a.error.apply(a,arguments)}}]} +function uc(a){return G(a)?$(a)?a.toISOString():fb(a):a}function Kf(){this.$get=function(){return function(a){if(!a)return"";var b=[];Pc(a,function(a,c){null===a||v(a)||z(a)||(F(a)?q(a,function(a){b.push(ka(c)+"="+ka(uc(a)))}):b.push(ka(c)+"="+ka(uc(a))))});return b.join("&")}}}function Lf(){this.$get=function(){return function(a){function b(a,e,f){F(a)?q(a,function(a,c){b(a,e+"["+(G(a)?c:"")+"]")}):G(a)&&!$(a)?Pc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}):(z(a)&&(a=a()),d.push(ka(e)+"="+(null== +a?"":ka(uc(a)))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function vc(a,b){if(B(a)){var d=a.replace(Ag,"").trim();if(d){var c=b("Content-Type"),c=c&&0===c.indexOf(xd),e;(e=c)||(e=(e=d.match(Bg))&&Cg[e[0]].test(d));if(e)try{a=Sc(d)}catch(f){if(!c)return a;throw Lb("baddata",a,f);}}}return a}function yd(a){var b=U(),d;B(a)?q(a.split("\n"),function(a){d=a.indexOf(":");var e=O(Q(a.substr(0,d)));a=Q(a.substr(d+1));e&&(b[e]=b[e]?b[e]+", "+a:a)}):G(a)&&q(a,function(a,d){var f=O(d),g=Q(a); +f&&(b[f]=b[f]?b[f]+", "+g:g)});return b}function zd(a){var b;return function(d){b||(b=yd(a));return d?(d=b[O(d)],void 0===d&&(d=null),d):b}}function Ad(a,b,d,c){if(z(c))return c(a,b,d);q(c,function(c){a=c(a,b,d)});return a}function Jf(){var a=this.defaults={transformResponse:[vc],transformRequest:[function(a){return G(a)&&"[object File]"!==ga.call(a)&&"[object Blob]"!==ga.call(a)&&"[object FormData]"!==ga.call(a)?fb(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ja(wc),put:ja(wc), +patch:ja(wc)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer",jsonpCallbackParam:"callback"},b=!1;this.useApplyAsync=function(a){return u(a)?(b=!!a,this):b};var d=this.interceptors=[],c=this.xsrfWhitelistedOrigins=[];this.$get=["$browser","$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector","$sce",function(e,f,g,k,h,l,m,p){function n(b){function c(a,b){for(var d=0,e=b.length;da?b:l.reject(b)}if(!G(b))throw L("$http")("badreq",b);if(!B(p.valueOf(b.url)))throw L("$http")("badreq",b.url);var g=P({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer,jsonpCallbackParam:a.jsonpCallbackParam}, +b);g.headers=function(b){var c=a.headers,e=P({},b.headers),f,g,h,c=P({},c.common,c[O(b.method)]);a:for(f in c){g=O(f);for(h in e)if(O(h)===g)continue a;e[f]=c[f]}return d(e,ja(b))}(b);g.method=wb(g.method);g.paramSerializer=B(g.paramSerializer)?m.get(g.paramSerializer):g.paramSerializer;e.$$incOutstandingRequestCount();var h=[],k=[];b=l.resolve(g);q(V,function(a){(a.request||a.requestError)&&h.unshift(a.request,a.requestError);(a.response||a.responseError)&&k.push(a.response,a.responseError)});b= +c(b,h);b=b.then(function(b){var c=b.headers,d=Ad(b.data,zd(c),void 0,b.transformRequest);v(d)&&q(c,function(a,b){"content-type"===O(b)&&delete c[b]});v(b.withCredentials)&&!v(a.withCredentials)&&(b.withCredentials=a.withCredentials);return t(b,d).then(f,f)});b=c(b,k);return b=b.finally(function(){e.$$completeOutstandingRequest(x)})}function t(c,d){function e(a){if(a){var c={};q(a,function(a,d){c[d]=function(c){function d(){a(c)}b?h.$applyAsync(d):h.$$phase?d():h.$apply(d)}});return c}}function k(a, +c,d,e,f){function g(){m(c,a,d,e,f)}Y&&(200<=a&&300>a?Y.put(N,[a,c,yd(d),e,f]):Y.remove(N));b?h.$applyAsync(g):(g(),h.$$phase||h.$apply())}function m(a,b,d,e,f){b=-1<=b?b:0;(200<=b&&300>b?V.resolve:V.reject)({data:a,status:b,headers:zd(d),config:c,statusText:e,xhrStatus:f})}function t(a){m(a.data,a.status,ja(a.headers()),a.statusText,a.xhrStatus)}function J(){var a=n.pendingRequests.indexOf(c);-1!==a&&n.pendingRequests.splice(a,1)}var V=l.defer(),M=V.promise,Y,r,va=c.headers,Pa="jsonp"===O(c.method), +N=c.url;Pa?N=p.getTrustedResourceUrl(N):B(N)||(N=p.valueOf(N));N=s(N,c.paramSerializer(c.params));Pa&&(N=C(N,c.jsonpCallbackParam));n.pendingRequests.push(c);M.then(J,J);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(Y=G(c.cache)?c.cache:G(a.cache)?a.cache:w);Y&&(r=Y.get(N),u(r)?r&&z(r.then)?r.then(t,t):F(r)?m(r[1],r[0],ja(r[2]),r[3],r[4]):m(r,200,{},"OK","complete"):Y.put(N,M));v(r)&&((r=K(c.url)?g()[c.xsrfCookieName||a.xsrfCookieName]:void 0)&&(va[c.xsrfHeaderName||a.xsrfHeaderName]= +r),f(c.method,N,d,k,va,c.timeout,c.withCredentials,c.responseType,e(c.eventHandlers),e(c.uploadEventHandlers)));return M}function s(a,b){0=l&&(K.resolve(w),C(q.$$intervalId),delete g[q.$$intervalId]);V||a.$apply()},h);g[q.$$intervalId]=K;return q}var g={};f.cancel=function(a){if(!a)return!1;if(!a.hasOwnProperty("$$intervalId"))throw Fg("badprom");if(!g.hasOwnProperty(a.$$intervalId))return!1;a=a.$$intervalId;var c=g[a];c.promise.$$state.pur=!0;c.reject("canceled");b.clearInterval(a);delete g[a];return!0}; +return f}]}function xc(a){a=a.split("/");for(var b=a.length;b--;)a[b]=gb(a[b].replace(/%2F/g,"/"));return a.join("/")}function Bd(a,b){var d=oa(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=ea(d.port)||Gg[d.protocol]||null}function Cd(a,b,d){if(Hg.test(a))throw kb("badpath",a);var c="/"!==a.charAt(0);c&&(a="/"+a);a=oa(a);for(var c=(c&&"/"===a.pathname.charAt(0)?a.pathname.substring(1):a.pathname).split("/"),e=c.length;e--;)c[e]=decodeURIComponent(c[e]),d&&(c[e]=c[e].replace(/\//g,"%2F")); +d=c.join("/");b.$$path=d;b.$$search=gc(a.search);b.$$hash=decodeURIComponent(a.hash);b.$$path&&"/"!==b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function yc(a,b){return a.slice(0,b.length)===b}function qa(a,b){if(yc(b,a))return b.substr(a.length)}function Da(a){var b=a.indexOf("#");return-1===b?a:a.substr(0,b)}function lb(a){return a.replace(/(#.+)|#$/,"$1")}function zc(a,b,d){this.$$html5=!0;d=d||"";Bd(a,this);this.$$parse=function(a){var d=qa(b,a);if(!B(d))throw kb("ipthprfx",a,b);Cd(d,this,!0); +this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=hc(this.$$search),d=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=xc(this.$$path)+(a?"?"+a:"")+d;this.$$absUrl=b+this.$$url.substr(1);this.$$urlUpdatedByLocation=!0};this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;u(f=qa(a,c))?(g=f,g=d&&u(f=qa(d,f))?b+(qa("/",f)||f):a+g):u(f=qa(b,c))?g=b+f:b===c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function Ac(a,b,d){Bd(a,this);this.$$parse= +function(c){var e=qa(a,c)||qa(b,c),f;v(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",v(e)&&(a=c,this.replace())):(f=qa(d,e),v(f)&&(f=e));Cd(f,this,!1);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;yc(f,e)&&(f=f.replace(e,""));g.exec(f)||(c=(f=g.exec(c))?f[1]:c);this.$$path=c;this.$$compose()};this.$$compose=function(){var b=hc(this.$$search),e=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=xc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+(this.$$url?d+this.$$url:"");this.$$urlUpdatedByLocation=!0};this.$$parseLinkUrl= +function(b,d){return Da(a)===Da(b)?(this.$$parse(b),!0):!1}}function Dd(a,b,d){this.$$html5=!0;Ac.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a===Da(c)?f=c:(g=qa(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$compose=function(){var b=hc(this.$$search),e=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=xc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+d+this.$$url;this.$$urlUpdatedByLocation=!0}}function Mb(a){return function(){return this[a]}} +function Ed(a,b){return function(d){if(v(d))return this[a];this[a]=b(d);this.$$compose();return this}}function Pf(){var a="!",b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return u(b)?(a=b,this):a};this.html5Mode=function(a){if(Ga(a))return b.enabled=a,this;if(G(a)){Ga(a.enabled)&&(b.enabled=a.enabled);Ga(a.requireBase)&&(b.requireBase=a.requireBase);if(Ga(a.rewriteLinks)||B(a.rewriteLinks))b.rewriteLinks=a.rewriteLinks;return this}return b};this.$get=["$rootScope","$browser", +"$sniffer","$rootElement","$window",function(d,c,e,f,g){function k(a,b,d){var e=l.url(),f=l.$$state;try{c.url(a,b,d),l.$$state=c.state()}catch(g){throw l.url(e),l.$$state=f,g;}}function h(a,b){d.$broadcast("$locationChangeSuccess",l.absUrl(),a,l.$$state,b)}var l,m;m=c.baseHref();var p=c.url(),n;if(b.enabled){if(!m&&b.requireBase)throw kb("nobase");n=p.substring(0,p.indexOf("/",p.indexOf("//")+2))+(m||"/");m=e.history?zc:Dd}else n=Da(p),m=Ac;var t=n.substr(0,Da(n).lastIndexOf("/")+1);l=new m(n,t,"#"+ +a);l.$$parseLinkUrl(p,p);l.$$state=c.state();var s=/^\s*(javascript|mailto):/i;f.on("click",function(a){var e=b.rewriteLinks;if(e&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&&2!==a.which&&2!==a.button){for(var g=y(a.target);"a"!==ta(g[0]);)if(g[0]===f[0]||!(g=g.parent())[0])return;if(!B(e)||!v(g.attr(e))){var e=g.prop("href"),h=g.attr("href")||g.attr("xlink:href");G(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=oa(e.animVal).href);s.test(e)||!e||g.attr("target")||a.isDefaultPrevented()||!l.$$parseLinkUrl(e, +h)||(a.preventDefault(),l.absUrl()!==c.url()&&d.$apply())}}});lb(l.absUrl())!==lb(p)&&c.url(l.absUrl(),!0);var C=!0;c.onUrlChange(function(a,b){yc(a,t)?(d.$evalAsync(function(){var c=l.absUrl(),e=l.$$state,f;a=lb(a);l.$$parse(a);l.$$state=b;f=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;l.absUrl()===a&&(f?(l.$$parse(c),l.$$state=e,k(c,!1,e)):(C=!1,h(c,e)))}),d.$$phase||d.$digest()):g.location.href=a});d.$watch(function(){if(C||l.$$urlUpdatedByLocation){l.$$urlUpdatedByLocation=!1; +var a=lb(c.url()),b=lb(l.absUrl()),f=c.state(),g=l.$$replace,m=a!==b||l.$$html5&&e.history&&f!==l.$$state;if(C||m)C=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,l.$$state,f).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=f):(m&&k(b,g,f===l.$$state?null:l.$$state),h(a,f)))})}l.$$replace=!1});return l}]}function Qf(){var a=!0,b=this;this.debugEnabled=function(b){return u(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){cc(a)&&(a.stack&& +f?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=d.console||{},e=b[a]||b.log||x;return function(){var a=[];q(arguments,function(b){a.push(c(b))});return Function.prototype.apply.call(e,b,a)}}var f=Ca||/\bEdge\//.test(d.navigator&&d.navigator.userAgent);return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){a&&c.apply(b, +arguments)}}()}}]}function Ig(a){return a+""}function Jg(a,b){return"undefined"!==typeof a?a:b}function Fd(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function Kg(a,b){switch(a.type){case r.MemberExpression:if(a.computed)return!1;break;case r.UnaryExpression:return 1;case r.BinaryExpression:return"+"!==a.operator?1:!1;case r.CallExpression:return!1}return void 0===b?Gd:b}function S(a,b,d){var c,e,f=a.isPure=Kg(a,d);switch(a.type){case r.Program:c=!0;q(a.body,function(a){S(a.expression, +b,f);c=c&&a.expression.constant});a.constant=c;break;case r.Literal:a.constant=!0;a.toWatch=[];break;case r.UnaryExpression:S(a.argument,b,f);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;break;case r.BinaryExpression:S(a.left,b,f);S(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.left.toWatch.concat(a.right.toWatch);break;case r.LogicalExpression:S(a.left,b,f);S(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case r.ConditionalExpression:S(a.test, +b,f);S(a.alternate,b,f);S(a.consequent,b,f);a.constant=a.test.constant&&a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case r.Identifier:a.constant=!1;a.toWatch=[a];break;case r.MemberExpression:S(a.object,b,f);a.computed&&S(a.property,b,f);a.constant=a.object.constant&&(!a.computed||a.property.constant);a.toWatch=a.constant?[]:[a];break;case r.CallExpression:c=d=a.filter?!b(a.callee.name).$stateful:!1;e=[];q(a.arguments,function(a){S(a,b,f);c=c&&a.constant;e.push.apply(e, +a.toWatch)});a.constant=c;a.toWatch=d?e:[a];break;case r.AssignmentExpression:S(a.left,b,f);S(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=[a];break;case r.ArrayExpression:c=!0;e=[];q(a.elements,function(a){S(a,b,f);c=c&&a.constant;e.push.apply(e,a.toWatch)});a.constant=c;a.toWatch=e;break;case r.ObjectExpression:c=!0;e=[];q(a.properties,function(a){S(a.value,b,f);c=c&&a.value.constant;e.push.apply(e,a.value.toWatch);a.computed&&(S(a.key,b,!1),c=c&&a.key.constant,e.push.apply(e, +a.key.toWatch))});a.constant=c;a.toWatch=e;break;case r.ThisExpression:a.constant=!1;a.toWatch=[];break;case r.LocalsExpression:a.constant=!1,a.toWatch=[]}}function Hd(a){if(1===a.length){a=a[0].expression;var b=a.toWatch;return 1!==b.length?b:b[0]!==a?b:void 0}}function Id(a){return a.type===r.Identifier||a.type===r.MemberExpression}function Jd(a){if(1===a.body.length&&Id(a.body[0].expression))return{type:r.AssignmentExpression,left:a.body[0].expression,right:{type:r.NGValueParameter},operator:"="}} +function Kd(a){this.$filter=a}function Ld(a){this.$filter=a}function Nb(a,b,d){this.ast=new r(a,d);this.astCompiler=d.csp?new Ld(b):new Kd(b)}function Bc(a){return z(a.valueOf)?a.valueOf():Lg.call(a)}function Rf(){var a=U(),b={"true":!0,"false":!1,"null":null,undefined:void 0},d,c;this.addLiteral=function(a,c){b[a]=c};this.setIdentifierFns=function(a,b){d=a;c=b;return this};this.$get=["$filter",function(e){function f(b,c){var d,f;switch(typeof b){case "string":return f=b=b.trim(),d=a[f],d||(d=new Ob(s), +d=(new Nb(d,e,s)).parse(b),a[f]=p(d)),t(d,c);case "function":return t(b,c);default:return t(x,c)}}function g(a,b,c){return null==a||null==b?a===b:"object"!==typeof a||(a=Bc(a),"object"!==typeof a||c)?a===b||a!==a&&b!==b:!1}function k(a,b,c,d,e){var f=d.inputs,h;if(1===f.length){var k=g,f=f[0];return a.$watch(function(a){var b=f(a);g(b,k,f.isPure)||(h=d(a,void 0,void 0,[b]),k=b&&Bc(b));return h},b,c,e)}for(var l=[],m=[],p=0,n=f.length;p=c.$$state.status&&e&&e.length&&a(function(){for(var a,c,f=0,g=e.length;fa)for(b in l++,f)sa.call(e,b)||(t--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$$pure=g(a).literal;c.$stateful=!c.$$pure;var d=this,e,f,h,k=1q&&(y=4-q,v[y]||(v[y]=[]),v[y].push({msg:z(a.exp)? +"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:g,oldVal:h}));else if(a===c){t=!1;break a}}catch(B){f(B)}if(!(n=!w.$$suspended&&w.$$watchersCount&&w.$$childHead||w!==A&&w.$$nextSibling))for(;w!==A&&!(n=w.$$nextSibling);)w=w.$parent}while(w=n);if((t||K.length)&&!q--)throw r.$$phase=null,d("infdig",b,v);}while(t||K.length);for(r.$$phase=null;ECa)throw pa("iequirks");var c=ja(da);c.isEnabled=function(){return a};c.trustAs=d.trustAs;c.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b}, +c.valueOf=Qa);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs,f=c.getTrusted,g=c.trustAs;q(da,function(a,b){var d=O(b);c[("parse_as_"+d).replace(Dc,yb)]=function(b){return e(a,b)};c[("get_trusted_"+d).replace(Dc,yb)]=function(b){return f(a,b)};c[("trust_as_"+d).replace(Dc,yb)]=function(b){return g(a,b)}});return c}]}function Xf(){this.$get=["$window","$document",function(a,b){var d={},c=!((!a.nw||!a.nw.process)&&a.chrome&& +(a.chrome.app&&a.chrome.app.runtime||!a.chrome.app&&a.chrome.runtime&&a.chrome.runtime.id))&&a.history&&a.history.pushState,e=ea((/android (\d+)/.exec(O((a.navigator||{}).userAgent))||[])[1]),f=/Boxee/i.test((a.navigator||{}).userAgent),g=b[0]||{},k=g.body&&g.body.style,h=!1,l=!1;k&&(h=!!("transition"in k||"webkitTransition"in k),l=!!("animation"in k||"webkitAnimation"in k));return{history:!(!c||4>e||f),hasEvent:function(a){if("input"===a&&Ca)return!1;if(v(d[a])){var b=g.createElement("div");d[a]= +"on"+a in b}return d[a]},csp:Ba(),transitions:h,animations:l,android:e}}]}function Zf(){var a;this.httpOptions=function(b){return b?(a=b,this):a};this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(b,d,c,e,f){function g(k,h){g.totalPendingRequests++;if(!B(k)||v(d.get(k)))k=f.getTrustedResourceUrl(k);var l=c.defaults&&c.defaults.transformResponse;F(l)?l=l.filter(function(a){return a!==vc}):l===vc&&(l=null);return c.get(k,P({cache:d,transformResponse:l},a)).finally(function(){g.totalPendingRequests--}).then(function(a){return d.put(k, +a.data)},function(a){h||(a=Ng("tpload",k,a.status,a.statusText),b(a));return e.reject(a)})}g.totalPendingRequests=0;return g}]}function $f(){this.$get=["$rootScope","$browser","$location",function(a,b,d){return{findBindings:function(a,b,d){a=a.getElementsByClassName("ng-binding");var g=[];q(a,function(a){var c=fa.element(a).data("$binding");c&&q(c,function(c){d?(new RegExp("(^|\\s)"+Nd(b)+"(\\s|\\||$)")).test(c)&&g.push(a):-1!==c.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,d){for(var g= +["ng-","data-ng-","ng\\:"],k=0;kc&&(c=e),c+=+a.slice(e+1),a=a.substring(0,e)):0>c&&(c=a.length);for(e=0;a.charAt(e)===Fc;e++);if(e===(g=a.length))d=[0],c=1;else{for(g--;a.charAt(g)===Fc;)g--;c-=e;d=[];for(f=0;e<=g;e++,f++)d[f]=+a.charAt(e)}c>Xd&&(d=d.splice(0,Xd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function Wg(a, +b,d,c){var e=a.d,f=e.length-a.i;b=v(b)?Math.min(Math.max(d,f),c):+b;d=b+a.i;c=e[d];if(0d-1){for(c=0;c>d;c--)e.unshift(0),a.i++;e.unshift(1);a.i++}else e[d-1]++;for(;fk;)h.unshift(0),k++;0=b.lgSize&&k.unshift(h.splice(-b.lgSize,h.length).join(""));h.length>b.gSize;)k.unshift(h.splice(-b.gSize,h.length).join(""));h.length&&k.unshift(h.join(""));h=k.join(d);f.length&&(h+=c+f.join(""));e&&(h+="e+"+e)}return 0>a&&!g?b.negPre+h+b.negSuf:b.posPre+ +h+b.posSuf}function Pb(a,b,d,c){var e="";if(0>a||c&&0>=a)c?a=-a+1:(a=-a,e="-");for(a=""+a;a.length-d)f+=d;0===f&&-12===d&&(f=12);return Pb(f,b,c,e)}}function mb(a,b,d){return function(c,e){var f=c["get"+a](),g=wb((d?"STANDALONE":"")+(b?"SHORT":"")+a);return e[g][f]}}function Yd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function Zd(a){return function(b){var d= +Yd(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Pb(b,a)}}function Gc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Sd(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0,k=b[8]?a.setUTCFullYear:a.setFullYear,h=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=ea(b[9]+b[10]),g=ea(b[9]+b[11]));k.call(a,ea(b[1]),ea(b[2])-1,ea(b[3]));f=ea(b[4]||0)-f;g=ea(b[5]||0)-g;k=ea(b[6]||0);b=Math.round(1E3*parseFloat("0."+ +(b[7]||0)));h.call(a,f,g,k,b)}return a}var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,d,f){var g="",k=[],h,l;d=d||"mediumDate";d=a.DATETIME_FORMATS[d]||d;B(c)&&(c=Xg.test(c)?ea(c):b(c));aa(c)&&(c=new Date(c));if(!$(c)||!isFinite(c.getTime()))return c;for(;d;)(l=Yg.exec(d))?(k=eb(k,l,1),d=k.pop()):(k.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=ec(f,m),c=fc(c,f,!0));q(k,function(b){h=Zg[b];g+=h?h(c,a.DATETIME_FORMATS, +m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Qg(){return function(a,b){v(b)&&(b=2);return fb(a,b)}}function Rg(){return function(a,b,d){b=Infinity===Math.abs(Number(b))?Number(b):ea(b);if(ha(b))return a;aa(a)&&(a=a.toString());if(!ra(a))return a;d=!d||isNaN(d)?0:ea(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?Hc(a,d,d+b):0===d?Hc(a,b,a.length):Hc(a,Math.max(0,d+b),d)}}function Hc(a,b,d){return B(a)?a.slice(b,d):ya.call(a,b,d)}function Ud(a){function b(b){return b.map(function(b){var c= +1,d=Qa;if(z(b))d=b;else if(B(b)){if("+"===b.charAt(0)||"-"===b.charAt(0))c="-"===b.charAt(0)?-1:1,b=b.substring(1);if(""!==b&&(d=a(b),d.constant))var e=d(),d=function(a){return a[e]}}return{get:d,descending:c}})}function d(a){switch(typeof a){case "number":case "boolean":case "string":return!0;default:return!1}}function c(a,b){var c=0,d=a.type,h=b.type;if(d===h){var h=a.value,l=b.value;"string"===d?(h=h.toLowerCase(),l=l.toLowerCase()):"object"===d&&(G(h)&&(h=a.index),G(l)&&(l=b.index));h!==l&&(c= +hb||37<=b&&40>=b|| +m(a,this,this.value)});if(e.hasEvent("paste"))b.on("paste cut drop",m)}b.on("change",l);if(de[g]&&c.$$hasNativeValidators&&g===d.type)b.on("keydown wheel mousedown",function(a){if(!h){var b=this.validity,c=b.badInput,d=b.typeMismatch;h=f.defer(function(){h=null;b.badInput===c&&b.typeMismatch===d||l(a)})}});c.$render=function(){var a=c.$isEmpty(c.$viewValue)?"":c.$viewValue;b.val()!==a&&b.val(a)}}function Rb(a,b){return function(d,c){var e,f;if($(d))return d;if(B(d)){'"'===d.charAt(0)&&'"'===d.charAt(d.length- +1)&&(d=d.substring(1,d.length-1));if($g.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(),ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},q(e,function(a,c){cf.yyyy&&e.setFullYear(f.yyyy),e}return NaN}}function pb(a,b,d,c){return function(e,f,g,k,h,l,m){function p(a){return a&& +!(a.getTime&&a.getTime()!==a.getTime())}function n(a){return u(a)&&!$(a)?t(a)||void 0:a}function t(a,b){var c=k.$options.getOption("timezone");q&&q!==c&&(b=Tc(b,ec(q)));var e=d(a,b);!isNaN(e)&&c&&(e=fc(e,c));return e}Jc(e,f,g,k,a);Xa(e,f,g,k,h,l);var s,q;k.$parsers.push(function(c){if(k.$isEmpty(c))return null;if(b.test(c))return t(c,s);k.$$parserName=a});k.$formatters.push(function(a){if(a&&!$(a))throw qb("datefmt",a);if(p(a)){s=a;var b=k.$options.getOption("timezone");b&&(q=b,s=fc(s,b,!0));return m("date")(a, +c,b)}q=s=null;return""});if(u(g.min)||g.ngMin){var w;k.$validators.min=function(a){return!p(a)||v(w)||d(a)>=w};g.$observe("min",function(a){w=n(a);k.$validate()})}if(u(g.max)||g.ngMax){var r;k.$validators.max=function(a){return!p(a)||v(r)||d(a)<=r};g.$observe("max",function(a){r=n(a);k.$validate()})}}}function Jc(a,b,d,c,e){(c.$$hasNativeValidators=G(b[0].validity))&&c.$parsers.push(function(a){var d=b.prop("validity")||{};if(d.badInput||d.typeMismatch)c.$$parserName=e;else return a})}function ee(a){a.$parsers.push(function(b){if(a.$isEmpty(b))return null; +if(ah.test(b))return parseFloat(b);a.$$parserName="number"});a.$formatters.push(function(b){if(!a.$isEmpty(b)){if(!aa(b))throw qb("numfmt",b);b=b.toString()}return b})}function Ya(a){u(a)&&!aa(a)&&(a=parseFloat(a));return ha(a)?void 0:a}function Kc(a){var b=a.toString(),d=b.indexOf(".");return-1===d?-1a&&(a=/e-(\d+)$/.exec(b))?Number(a[1]):0:b.length-d-1}function fe(a,b,d){a=Number(a);var c=(a|0)!==a,e=(b|0)!==b,f=(d|0)!==d;if(c||e||f){var g=c?Kc(a):0,k=e?Kc(b):0,h=f?Kc(d):0,g=Math.max(g,k, +h),g=Math.pow(10,g);a*=g;b*=g;d*=g;c&&(a=Math.round(a));e&&(b=Math.round(b));f&&(d=Math.round(d))}return 0===(a-b)%d}function ge(a,b,d,c,e){if(u(c)){a=a(c);if(!a.constant)throw qb("constexpr",d,c);return a(b)}return e}function Lc(a,b){function d(a,b){if(!a||!a.length)return[];if(!b||!b.length)return a;var c=[],d=0;a:for(;d(?:<\/\1>|)$/, +lc=/<|&#?\w+;/,hg=/<([\w:-]+)/,ig=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,na={option:[1,'"],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};na.optgroup=na.option;na.tbody=na.tfoot=na.colgroup=na.caption=na.thead;na.th=na.td;var pg=D.Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)& +16)},Sa=W.prototype={ready:gd,toString:function(){var a=[];q(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?y(this[a]):y(this[this.length+a])},length:0,push:dh,sort:[].sort,splice:[].splice},Ib={};q("multiple selected checked disabled readOnly required open".split(" "),function(a){Ib[O(a)]=a});var nd={};q("input select option textarea button form details".split(" "),function(a){nd[a]=!0});var ud={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max", +ngPattern:"pattern",ngStep:"step"};q({data:qc,removeData:pc,hasData:function(a){for(var b in Oa[a.ng339])return!0;return!1},cleanData:function(a){for(var b=0,d=a.length;b/,sg=/^[^(]*\(\s*([^)]*)\)/m,gh=/,/,hh=/^\s*(_?)(\S+?)\1\s*$/,qg=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ja=L("$injector");hb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw B(d)&&d||(d=a.name||tg(a)),Ja("strictdi",d);b=pd(a);q(b[1].split(gh),function(a){a.replace(hh,function(a,b,d){c.push(d)})})}a.$inject=c}}else F(a)?(b=a.length-1,ub(a[b],"fn"),c=a.slice(0,b)):ub(a,"fn", +!0);return c};var ie=L("$animate"),wf=function(){this.$get=x},xf=function(){var a=new Jb,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=B(b)?b.split(" "):F(b)?b:[],q(b,function(b){b&&(d=!0,a[b]=c)}));return d}function f(){q(b,function(b){var c=a.get(b);if(c){var d=ug(b.attr("class")),e="",f="";q(c,function(a,b){a!==!!d[b]&&(a?e+=(e.length?" ":"")+b:f+=(f.length?" ":"")+b)});q(b,function(a){e&&Fb(a,e);f&&Eb(a,f)});a.delete(b)}});b.length=0}return{enabled:x, +on:x,off:x,pin:x,push:function(g,k,h,l){l&&l();h=h||{};h.from&&g.css(h.from);h.to&&g.css(h.to);if(h.addClass||h.removeClass)if(k=h.addClass,l=h.removeClass,h=a.get(g)||{},k=e(h,k,!0),l=e(h,l,!1),k||l)a.set(g,h),b.push(g),1===b.length&&c.$$postDigest(f);g=new d;g.complete();return g}}}]},uf=["$provide",function(a){var b=this,d=null,c=null;this.$$registeredAnimations=Object.create(null);this.register=function(c,d){if(c&&"."!==c.charAt(0))throw ie("notcsel",c);var g=c+"-animation";b.$$registeredAnimations[c.substr(1)]= +g;a.factory(g,d)};this.customFilter=function(a){1===arguments.length&&(c=z(a)?a:null);return c};this.classNameFilter=function(a){if(1===arguments.length&&(d=a instanceof RegExp?a:null)&&/[(\s|\/)]ng-animate[(\s|\/)]/.test(d.toString()))throw d=null,ie("nongcls","ng-animate");return d};this.$get=["$$animateQueue",function(a){function b(a,c,d){if(d){var e;a:{for(e=0;e <= >= && || ! = |".split(" "),function(a){Ub[a]=!0});var kh={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Ob=function(a){this.options=a};Ob.prototype={constructor:Ob,lex:function(a){this.text=a;this.index=0;for(this.tokens=[];this.index=a&&"string"===typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdentifierStart:function(a){return this.options.isIdentifierStart?this.options.isIdentifierStart(a,this.codePointAt(a)):this.isValidIdentifierStart(a)},isValidIdentifierStart:function(a){return"a"<= +a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isIdentifierContinue:function(a){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(a,this.codePointAt(a)):this.isValidIdentifierContinue(a)},isValidIdentifierContinue:function(a,b){return this.isValidIdentifierStart(a,b)||this.isNumber(a)},codePointAt:function(a){return 1===a.length?a.charCodeAt(0):(a.charCodeAt(0)<<10)+a.charCodeAt(1)-56613888},peekMultichar:function(){var a=this.text.charAt(this.index),b=this.peek();if(!b)return a; +var d=a.charCodeAt(0),c=b.charCodeAt(0);return 55296<=d&&56319>=d&&56320<=c&&57343>=c?a+b:a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b=u(b)?"s "+b+"-"+this.index+" ["+this.text.substring(b,d)+"]":" "+d;throw Za("lexerr",a,b,this.text);},readNumber:function(){for(var a="",b=this.index;this.index","<=",">=");)a={type:r.BinaryExpression,operator:b.text,left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),b;b=this.expect("+","-");)a={type:r.BinaryExpression,operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(), +b;b=this.expect("*","/","%");)a={type:r.BinaryExpression,operator:b.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:r.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")):this.expect("[")?a=this.arrayDeclaration():this.expect("{")?a=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?a=za(this.selfReferential[this.consume().text]): +this.options.literals.hasOwnProperty(this.peek().text)?a={type:r.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError("not a primary expression",this.peek());for(var b;b=this.expect("(","[",".");)"("===b.text?(a={type:r.CallExpression,callee:a,arguments:this.parseArguments()},this.consume(")")):"["===b.text?(a={type:r.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")): +"."===b.text?a={type:r.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var b={type:r.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(":");)a.push(this.expression());return b},parseArguments:function(){var a=[];if(")"!==this.peekToken().text){do a.push(this.filterChain());while(this.expect(","))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier", +a);return{type:r.Identifier,name:a.text}},constant:function(){return{type:r.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]");return{type:r.ArrayExpression,elements:a}},object:function(){var a=[],b;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;b={type:r.Property,kind:"init"};this.peek().constant?(b.key=this.constant(),b.computed=!1,this.consume(":"), +b.value=this.expression()):this.peek().identifier?(b.key=this.identifier(),b.computed=!1,this.peek(":")?(this.consume(":"),b.value=this.expression()):b.value=b.key):this.peek("[")?(this.consume("["),b.key=this.expression(),this.consume("]"),b.computed=!0,this.consume(":"),b.value=this.expression()):this.throwError("invalid key",this.peek());a.push(b)}while(this.expect(","))}this.consume("}");return{type:r.ObjectExpression,properties:a}},throwError:function(a,b){throw Za("syntax",b.text,a,b.index+ +1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw Za("ueoe",this.text);var b=this.expect(a);b||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw Za("ueoe",this.text);return this.tokens[0]},peek:function(a,b,d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c,e){if(this.tokens.length>a){a=this.tokens[a];var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1}, +expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},selfReferential:{"this":{type:r.ThisExpression},$locals:{type:r.LocalsExpression}}};var Gd=2;Kd.prototype={compile:function(a){var b=this;this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]};S(a,b.$filter);var d="",c;this.stage="assign";if(c=Jd(a))this.state.computing="assign",d=this.nextId(),this.recurse(c,d),this.return_(d),d="fn.assign="+this.generateFunction("assign", +"s,v,l");c=Hd(a.body);b.stage="inputs";q(c,function(a,c){var d="fn"+c;b.state[d]={vars:[],body:[],own:{}};b.state.computing=d;var k=b.nextId();b.recurse(a,k);b.return_(k);b.state.inputs.push({name:d,isPure:a.isPure});a.watchId=c});this.state.computing="fn";this.stage="main";this.recurse(a);a='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+d+this.watchFns()+"return fn;";a=(new Function("$filter","getStringValue","ifDefined","plus",a))(this.$filter, +Ig,Jg,Fd);this.state=this.stage=void 0;return a},USE:"use",STRICT:"strict",watchFns:function(){var a=[],b=this.state.inputs,d=this;q(b,function(b){a.push("var "+b.name+"="+d.generateFunction(b.name,"s"));b.isPure&&a.push(b.name,".isPure="+JSON.stringify(b.isPure)+";")});b.length&&a.push("fn.inputs=["+b.map(function(a){return a.name}).join(",")+"];");return a.join("")},generateFunction:function(a,b){return"function("+b+"){"+this.varsPrefix(a)+this.body(a)+"};"},filterPrefix:function(){var a=[],b=this; +q(this.state.filters,function(d,c){a.push(d+"=$filter("+b.escape(c)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length?"var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")},recurse:function(a,b,d,c,e,f){var g,k,h=this,l,m,p;c=c||x;if(!f&&u(a.watchId))b=b||this.nextId(),this.if_("i",this.lazyAssign(b,this.computedMember("i",a.watchId)),this.lazyRecurse(a,b,d,c,e,!0));else switch(a.type){case r.Program:q(a.body, +function(b,c){h.recurse(b.expression,void 0,void 0,function(a){k=a});c!==a.body.length-1?h.current().body.push(k,";"):h.return_(k)});break;case r.Literal:m=this.escape(a.value);this.assign(b,m);c(b||m);break;case r.UnaryExpression:this.recurse(a.argument,void 0,void 0,function(a){k=a});m=a.operator+"("+this.ifDefined(k,0)+")";this.assign(b,m);c(m);break;case r.BinaryExpression:this.recurse(a.left,void 0,void 0,function(a){g=a});this.recurse(a.right,void 0,void 0,function(a){k=a});m="+"===a.operator? +this.plus(g,k):"-"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(k,0):"("+g+")"+a.operator+"("+k+")";this.assign(b,m);c(m);break;case r.LogicalExpression:b=b||this.nextId();h.recurse(a.left,b);h.if_("&&"===a.operator?b:h.not(b),h.lazyRecurse(a.right,b));c(b);break;case r.ConditionalExpression:b=b||this.nextId();h.recurse(a.test,b);h.if_(b,h.lazyRecurse(a.alternate,b),h.lazyRecurse(a.consequent,b));c(b);break;case r.Identifier:b=b||this.nextId();d&&(d.context="inputs"===h.stage?"s":this.assign(this.nextId(), +this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);h.if_("inputs"===h.stage||h.not(h.getHasOwnProperty("l",a.name)),function(){h.if_("inputs"===h.stage||"s",function(){e&&1!==e&&h.if_(h.isNull(h.nonComputedMember("s",a.name)),h.lazyAssign(h.nonComputedMember("s",a.name),"{}"));h.assign(b,h.nonComputedMember("s",a.name))})},b&&h.lazyAssign(b,h.nonComputedMember("l",a.name)));c(b);break;case r.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();h.recurse(a.object, +g,void 0,function(){h.if_(h.notNull(g),function(){a.computed?(k=h.nextId(),h.recurse(a.property,k),h.getStringValue(k),e&&1!==e&&h.if_(h.not(h.computedMember(g,k)),h.lazyAssign(h.computedMember(g,k),"{}")),m=h.computedMember(g,k),h.assign(b,m),d&&(d.computed=!0,d.name=k)):(e&&1!==e&&h.if_(h.isNull(h.nonComputedMember(g,a.property.name)),h.lazyAssign(h.nonComputedMember(g,a.property.name),"{}")),m=h.nonComputedMember(g,a.property.name),h.assign(b,m),d&&(d.computed=!1,d.name=a.property.name))},function(){h.assign(b, +"undefined")});c(b)},!!e);break;case r.CallExpression:b=b||this.nextId();a.filter?(k=h.filter(a.callee.name),l=[],q(a.arguments,function(a){var b=h.nextId();h.recurse(a,b);l.push(b)}),m=k+"("+l.join(",")+")",h.assign(b,m),c(b)):(k=h.nextId(),g={},l=[],h.recurse(a.callee,k,g,function(){h.if_(h.notNull(k),function(){q(a.arguments,function(b){h.recurse(b,a.constant?void 0:h.nextId(),void 0,function(a){l.push(a)})});m=g.name?h.member(g.context,g.name,g.computed)+"("+l.join(",")+")":k+"("+l.join(",")+ +")";h.assign(b,m)},function(){h.assign(b,"undefined")});c(b)}));break;case r.AssignmentExpression:k=this.nextId();g={};this.recurse(a.left,void 0,g,function(){h.if_(h.notNull(g.context),function(){h.recurse(a.right,k);m=h.member(g.context,g.name,g.computed)+a.operator+k;h.assign(b,m);c(b||m)})},1);break;case r.ArrayExpression:l=[];q(a.elements,function(b){h.recurse(b,a.constant?void 0:h.nextId(),void 0,function(a){l.push(a)})});m="["+l.join(",")+"]";this.assign(b,m);c(b||m);break;case r.ObjectExpression:l= +[];p=!1;q(a.properties,function(a){a.computed&&(p=!0)});p?(b=b||this.nextId(),this.assign(b,"{}"),q(a.properties,function(a){a.computed?(g=h.nextId(),h.recurse(a.key,g)):g=a.key.type===r.Identifier?a.key.name:""+a.key.value;k=h.nextId();h.recurse(a.value,k);h.assign(h.member(b,g,a.computed),k)})):(q(a.properties,function(b){h.recurse(b.value,a.constant?void 0:h.nextId(),void 0,function(a){l.push(h.escape(b.key.type===r.Identifier?b.key.name:""+b.key.value)+":"+a)})}),m="{"+l.join(",")+"}",this.assign(b, +m));c(b||m);break;case r.ThisExpression:this.assign(b,"s");c(b||"s");break;case r.LocalsExpression:this.assign(b,"l");c(b||"l");break;case r.NGValueParameter:this.assign(b,"v"),c(b||"v")}},getHasOwnProperty:function(a,b){var d=a+"."+b,c=this.current().own;c.hasOwnProperty(d)||(c[d]=this.nextId(!1,a+"&&("+this.escape(b)+" in "+a+")"));return c[d]},assign:function(a,b){if(a)return this.current().body.push(a,"=",b,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]= +this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return"ifDefined("+a+","+this.escape(b)+")"},plus:function(a,b){return"plus("+a+","+b+")"},return_:function(a){this.current().body.push("return ",a,";")},if_:function(a,b,d){if(!0===a)b();else{var c=this.current().body;c.push("if(",a,"){");b();c.push("}");d&&(c.push("else{"),d(),c.push("}"))}},not:function(a){return"!("+a+")"},isNull:function(a){return a+"==null"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a, +b){var d=/[^$_a-zA-Z0-9]/g;return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(b)?a+"."+b:a+'["'+b.replace(d,this.stringEscapeFn)+'"]'},computedMember:function(a,b){return a+"["+b+"]"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a,b)},getStringValue:function(a){this.assign(a,"getStringValue("+a+")")},lazyRecurse:function(a,b,d,c,e,f){var g=this;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g, +stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(B(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(aa(a))return a.toString();if(!0===a)return"true";if(!1===a)return"false";if(null===a)return"null";if("undefined"===typeof a)return"undefined";throw Za("esc");},nextId:function(a,b){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(b?"="+b:""));return d},current:function(){return this.state[this.state.computing]}}; +Ld.prototype={compile:function(a){var b=this;S(a,b.$filter);var d,c;if(d=Jd(a))c=this.recurse(d);d=Hd(a.body);var e;d&&(e=[],q(d,function(a,c){var d=b.recurse(a);d.isPure=a.isPure;a.input=d;e.push(d);a.watchId=c}));var f=[];q(a.body,function(a){f.push(b.recurse(a.expression))});a=0===a.body.length?x:1===a.body.length?f[0]:function(a,b){var c;q(f,function(d){c=d(a,b)});return c};c&&(a.assign=function(a,b,d){return c(a,d,b)});e&&(a.inputs=e);return a},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input, +a.watchId);switch(a.type){case r.Literal:return this.value(a.value,b);case r.UnaryExpression:return e=this.recurse(a.argument),this["unary"+a.operator](e,b);case r.BinaryExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case r.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case r.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent), +b);case r.Identifier:return f.identifier(a.name,b,d);case r.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(e=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c,e,b,d):this.nonComputedMember(c,e,b,d);case r.CallExpression:return g=[],q(a.arguments,function(a){g.push(f.recurse(a))}),a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter?function(a,c,d,f){for(var p=[],n=0;n":function(a,b,d){return function(c,e, +f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},"binary<=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<=b(c,e,f,g);return d?{value:c}:c}},"binary>=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},"binary&&":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},"binary||":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},"ternary?:":function(a,b,d,c){return function(e,f, +g,k){e=a(e,f,g,k)?b(e,f,g,k):d(e,f,g,k);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:void 0,name:void 0,value:a}:a}},identifier:function(a,b,d){return function(c,e,f,g){c=e&&a in e?e:c;d&&1!==d&&c&&null==c[a]&&(c[a]={});e=c?c[a]:void 0;return b?{context:c,name:a,value:e}:e}},computedMember:function(a,b,d,c){return function(e,f,g,k){var h=a(e,f,g,k),l,m;null!=h&&(l=b(e,f,g,k),l+="",c&&1!==c&&h&&!h[l]&&(h[l]={}),m=h[l]);return d?{context:h,name:l,value:m}:m}},nonComputedMember:function(a, +b,d,c){return function(e,f,g,k){e=a(e,f,g,k);c&&1!==c&&e&&null==e[b]&&(e[b]={});f=null!=e?e[b]:void 0;return d?{context:e,name:b,value:f}:f}},inputs:function(a,b){return function(d,c,e,f){return f?f[b]:a(d,c,e)}}};Nb.prototype={constructor:Nb,parse:function(a){a=this.getAst(a);var b=this.astCompiler.compile(a.ast),d=a.ast;b.literal=0===d.body.length||1===d.body.length&&(d.body[0].expression.type===r.Literal||d.body[0].expression.type===r.ArrayExpression||d.body[0].expression.type===r.ObjectExpression); +b.constant=a.ast.constant;b.oneTime=a.oneTime;return b},getAst:function(a){var b=!1;a=a.trim();":"===a.charAt(0)&&":"===a.charAt(1)&&(b=!0,a=a.substring(2));return{ast:this.ast.ast(a),oneTime:b}}};var pa=L("$sce"),da={HTML:"html",CSS:"css",MEDIA_URL:"mediaUrl",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Dc=/_([a-z])/g,Ng=L("$templateRequest"),Og=L("$timeout"),T=D.document.createElement("a"),Pd=oa(D.location.href),Va;Qd.$inject=["$document"];ed.$inject=["$provide"];var Xd=22,Wd=".",Fc="0";Rd.$inject= +["$locale"];Td.$inject=["$locale"];var Zg={yyyy:X("FullYear",4,0,!1,!0),yy:X("FullYear",2,0,!0,!0),y:X("FullYear",1,0,!1,!0),MMMM:mb("Month"),MMM:mb("Month",!0),MM:X("Month",2,1),M:X("Month",1,1),LLLL:mb("Month",!1,!0),dd:X("Date",2),d:X("Date",1),HH:X("Hours",2),H:X("Hours",1),hh:X("Hours",2,-12),h:X("Hours",1,-12),mm:X("Minutes",2),m:X("Minutes",1),ss:X("Seconds",2),s:X("Seconds",1),sss:X("Milliseconds",3),EEEE:mb("Day"),EEE:mb("Day",!0),a:function(a,b){return 12>a.getHours()?b.AMPMS[0]:b.AMPMS[1]}, +Z:function(a,b,d){a=-1*d;return a=(0<=a?"+":"")+(Pb(Math[0=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},Yg=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,Xg=/^-?\d+$/;Sd.$inject=["$locale"];var Sg=ia(O),Tg=ia(wb);Ud.$inject=["$parse"];var Ke=ia({restrict:"E",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a,b){if("a"===b[0].nodeName.toLowerCase()){var e= +"[object SVGAnimatedString]"===ga.call(b.prop("href"))?"xlink:href":"href";b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),xb={};q(Ib,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!==a){var c=wa("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!==e[c]&&d(a,b,e)});xb[c]=function(){return{restrict:"A",priority:100,link:e}}}});q(ud,function(a,b){xb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"===e.ngPattern.charAt(0)&& +(c=e.ngPattern.match(ch))){e.$set("ngPattern",new RegExp(c[1],c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});q(["src","srcset","href"],function(a){var b=wa("ng-"+a);xb[b]=function(){return{priority:99,link:function(d,c,e){var f=a,g=a;"href"===a&&"[object SVGAnimatedString]"===ga.call(c.prop("href"))&&(g="xlinkHref",e.$attr[g]="xlink:href",f=null);e.$observe(b,function(b){b?(e.$set(g,b),Ca&&f&&c.prop(f,e[g])):"href"===a&&e.$set(g,null)})}}}});var nb={$addControl:x,$$renameControl:function(a, +b){a.$name=b},$removeControl:x,$setValidity:x,$setDirty:x,$setPristine:x,$setSubmitted:x,$$setSubmitted:x};Qb.$inject=["$element","$attrs","$scope","$animate","$interpolate"];Qb.prototype={$rollbackViewValue:function(){q(this.$$controls,function(a){a.$rollbackViewValue()})},$commitViewValue:function(){q(this.$$controls,function(a){a.$commitViewValue()})},$addControl:function(a){Na(a.$name,"input");this.$$controls.push(a);a.$name&&(this[a.$name]=a);a.$$parentForm=this},$$renameControl:function(a,b){var d= +a.$name;this[d]===a&&delete this[d];this[b]=a;a.$name=b},$removeControl:function(a){a.$name&&this[a.$name]===a&&delete this[a.$name];q(this.$pending,function(b,d){this.$setValidity(d,null,a)},this);q(this.$error,function(b,d){this.$setValidity(d,null,a)},this);q(this.$$success,function(b,d){this.$setValidity(d,null,a)},this);db(this.$$controls,a);a.$$parentForm=nb},$setDirty:function(){this.$$animate.removeClass(this.$$element,$a);this.$$animate.addClass(this.$$element,Vb);this.$dirty=!0;this.$pristine= +!1;this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,$a,Vb+" ng-submitted");this.$dirty=!1;this.$pristine=!0;this.$submitted=!1;q(this.$$controls,function(a){a.$setPristine()})},$setUntouched:function(){q(this.$$controls,function(a){a.$setUntouched()})},$setSubmitted:function(){for(var a=this;a.$$parentForm&&a.$$parentForm!==nb;)a=a.$$parentForm;a.$$setSubmitted()},$$setSubmitted:function(){this.$$animate.addClass(this.$$element,"ng-submitted");this.$submitted= +!0;q(this.$$controls,function(a){a.$$setSubmitted&&a.$$setSubmitted()})}};be({clazz:Qb,set:function(a,b,d){var c=a[b];c?-1===c.indexOf(d)&&c.push(d):a[b]=[d]},unset:function(a,b,d){var c=a[b];c&&(db(c,d),0===c.length&&delete a[b])}});var je=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||x}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Qb,compile:function(d,f){d.addClass($a).addClass(ob);var g=f.name? +"name":a&&f.ngForm?"ngForm":!1;return{pre:function(a,d,e,f){var p=f[0];if(!("action"in e)){var n=function(b){a.$apply(function(){p.$commitViewValue();p.$setSubmitted()});b.preventDefault()};d[0].addEventListener("submit",n);d.on("$destroy",function(){b(function(){d[0].removeEventListener("submit",n)},0,!1)})}(f[1]||p.$$parentForm).$addControl(p);var t=g?c(p.$name):x;g&&(t(a,p),e.$observe(g,function(b){p.$name!==b&&(t(a,void 0),p.$$parentForm.$$renameControl(p,b),t=c(p.$name),t(a,p))}));d.on("$destroy", +function(){p.$$parentForm.$removeControl(p);t(a,void 0);P(p,nb)})}}}}}]},Le=je(),Xe=je(!0),$g=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,lh=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,mh=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,ah=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/, +ke=/^(\d{4,})-(\d{2})-(\d{2})$/,le=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Nc=/^(\d{4,})-W(\d\d)$/,me=/^(\d{4,})-(\d\d)$/,ne=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,de=U();q(["date","datetime-local","month","time","week"],function(a){de[a]=!0});var oe={text:function(a,b,d,c,e,f){Xa(a,b,d,c,e,f);Ic(c)},date:pb("date",ke,Rb(ke,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":pb("datetimelocal",le,Rb(le,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:pb("time", +ne,Rb(ne,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:pb("week",Nc,function(a,b){if($(a))return a;if(B(a)){Nc.lastIndex=0;var d=Nc.exec(a);if(d){var c=+d[1],e=+d[2],f=d=0,g=0,k=0,h=Yd(c),e=7*(e-1);b&&(d=b.getHours(),f=b.getMinutes(),g=b.getSeconds(),k=b.getMilliseconds());return new Date(c,0,h.getDate()+e,d,f,g,k)}}return NaN},"yyyy-Www"),month:pb("month",me,Rb(me,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f){Jc(a,b,d,c,"number");ee(c);Xa(a,b,d,c,e,f);var g,k;if(u(d.min)||d.ngMin)c.$validators.min= +function(a,b){return c.$isEmpty(b)||v(g)||b>=g},d.$observe("min",function(a){g=Ya(a);c.$validate()});if(u(d.max)||d.ngMax)c.$validators.max=function(a,b){return c.$isEmpty(b)||v(k)||b<=k},d.$observe("max",function(a){k=Ya(a);c.$validate()});if(u(d.step)||d.ngStep){var h;c.$validators.step=function(a,b){return c.$isEmpty(b)||v(h)||fe(b,g||0,h)};d.$observe("step",function(a){h=Ya(a);c.$validate()})}},url:function(a,b,d,c,e,f){Xa(a,b,d,c,e,f);Ic(c);c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)|| +lh.test(d)}},email:function(a,b,d,c,e,f){Xa(a,b,d,c,e,f);Ic(c);c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||mh.test(d)}},radio:function(a,b,d,c){var e=!d.ngTrim||"false"!==Q(d.ngTrim);v(d.name)&&b.attr("name",++rb);b.on("change",function(a){var g;b[0].checked&&(g=d.value,e&&(g=Q(g)),c.$setViewValue(g,a&&a.type))});c.$render=function(){var a=d.value;e&&(a=Q(a));b[0].checked=a===c.$viewValue};d.$observe("value",c.$render)},range:function(a,b,d,c,e,f){function g(a,c){b.attr(a,d[a]); +d.$observe(a,c)}function k(a){p=Ya(a);ha(c.$modelValue)||(m?(a=b.val(),p>a&&(a=p,b.val(a)),c.$setViewValue(a)):c.$validate())}function h(a){n=Ya(a);ha(c.$modelValue)||(m?(a=b.val(),n=p},g("min",k));e&&(c.$validators.max=m?function(){return!0}:function(a,b){return c.$isEmpty(b)||v(n)||b<=n},g("max",h));f&&(c.$validators.step=m?function(){return!s.stepMismatch}:function(a,b){return c.$isEmpty(b)||v(t)||fe(b,p||0,t)},g("step",l))},checkbox:function(a, +b,d,c,e,f,g,k){var h=ge(k,a,"ngTrueValue",d.ngTrueValue,!0),l=ge(k,a,"ngFalseValue",d.ngFalseValue,!1);b.on("change",function(a){c.$setViewValue(b[0].checked,a&&a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty=function(a){return!1===a};c.$formatters.push(function(a){return ua(a,h)});c.$parsers.push(function(a){return a?h:l})},hidden:x,button:x,submit:x,reset:x,file:x},Zc=["$browser","$sniffer","$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e, +f,g,k){k[0]&&(oe[O(g.type)]||oe.text)(e,f,g,k[0],b,a,d,c)}}}}],nh=/^(true|false|\d+)$/,qf=function(){function a(a,d,c){var e=u(c)?c:9===Ca?"":null;a.prop("value",e);d.$set("value",c)}return{restrict:"A",priority:100,compile:function(b,d){return nh.test(d.ngValue)?function(b,d,f){b=b.$eval(f.ngValue);a(d,f,b)}:function(b,d,f){b.$watch(f.ngValue,function(b){a(d,f,b)})}}}},Pe=["$compile",function(a){return{restrict:"AC",compile:function(b){a.$$addBindingClass(b);return function(b,c,e){a.$$addBindingInfo(c, +e.ngBind);c=c[0];b.$watch(e.ngBind,function(a){c.textContent=ic(a)})}}}}],Re=["$interpolate","$compile",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate));b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe("ngBindTemplate",function(a){d.textContent=v(a)?"":a})}}}}],Qe=["$sce","$parse","$compile",function(a,b,d){return{restrict:"A",compile:function(c,e){var f=b(e.ngBindHtml),g=b(e.ngBindHtml,function(b){return a.valueOf(b)}); +d.$$addBindingClass(c);return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml);b.$watch(g,function(){var d=f(b);c.html(a.getTrustedHtml(d)||"")})}}}}],pf=ia({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Se=Lc("",!0),Ue=Lc("Odd",0),Te=Lc("Even",1),Ve=Wa({compile:function(a,b){b.$set("ngCloak",void 0);a.removeClass("ng-cloak")}}),We=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],dd={},oh={blur:!0,focus:!0}; +q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var b=wa("ng-"+a);dd[b]=["$parse","$rootScope",function(d,c){return{restrict:"A",compile:function(e,f){var g=d(f[b]);return function(b,d){d.on(a,function(d){var e=function(){g(b,{$event:d})};oh[a]&&c.$$phase?b.$evalAsync(e):b.$apply(e)})}}}}]});var Ze=["$animate","$compile",function(a,b){return{multiElement:!0,transclude:"element",priority:600, +terminal:!0,restrict:"A",$$tlb:!0,link:function(d,c,e,f,g){var k,h,l;d.$watch(e.ngIf,function(d){d?h||g(function(d,f){h=f;d[d.length++]=b.$$createComment("end ngIf",e.ngIf);k={clone:d};a.enter(d,c.parent(),c)}):(l&&(l.remove(),l=null),h&&(h.$destroy(),h=null),k&&(l=vb(k.clone),a.leave(l).done(function(a){!1!==a&&(l=null)}),k=null))})}}}],$e=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:fa.noop,compile:function(c, +e){var f=e.ngInclude||e.src,g=e.onload||"",k=e.autoscroll;return function(c,e,m,p,n){var t=0,s,q,r,v=function(){q&&(q.remove(),q=null);s&&(s.$destroy(),s=null);r&&(d.leave(r).done(function(a){!1!==a&&(q=null)}),q=r,r=null)};c.$watch(f,function(f){var m=function(a){!1===a||!u(k)||k&&!c.$eval(k)||b()},q=++t;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&q===t){var b=c.$new();p.template=a;a=n(b,function(a){v();d.enter(a,null,e).done(m)});s=b;r=a;s.$emit("$includeContentLoaded",f);c.$eval(g)}},function(){c.$$destroyed|| +q!==t||(v(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(v(),p.template=null)})}}}}],sf=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(b,d,c,e){ga.call(d[0]).match(/SVG/)?(d.empty(),a(fd(e.template,D.document).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],af=Wa({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),of=function(){return{restrict:"A", +priority:100,require:"ngModel",link:function(a,b,d,c){var e=d.ngList||", ",f="false"!==d.ngTrim,g=f?Q(e):e;c.$parsers.push(function(a){if(!v(a)){var b=[];a&&q(a.split(g),function(a){a&&b.push(f?Q(a):a)});return b}});c.$formatters.push(function(a){if(F(a))return a.join(e)});c.$isEmpty=function(a){return!a||!a.length}}}},ob="ng-valid",ae="ng-invalid",$a="ng-pristine",Vb="ng-dirty",qb=L("ngModel");Sb.$inject="$scope $exceptionHandler $attrs $element $parse $animate $timeout $q $interpolate".split(" "); +Sb.prototype={$$initGetterSetters:function(){if(this.$options.getOption("getterSetter")){var a=this.$$parse(this.$$attr.ngModel+"()"),b=this.$$parse(this.$$attr.ngModel+"($$$p)");this.$$ngModelGet=function(b){var c=this.$$parsedNgModel(b);z(c)&&(c=a(b));return c};this.$$ngModelSet=function(a,c){z(this.$$parsedNgModel(a))?b(a,{$$$p:c}):this.$$parsedNgModelAssign(a,c)}}else if(!this.$$parsedNgModel.assign)throw qb("nonassign",this.$$attr.ngModel,Aa(this.$$element));},$render:x,$isEmpty:function(a){return v(a)|| +""===a||null===a||a!==a},$$updateEmptyClasses:function(a){this.$isEmpty(a)?(this.$$animate.removeClass(this.$$element,"ng-not-empty"),this.$$animate.addClass(this.$$element,"ng-empty")):(this.$$animate.removeClass(this.$$element,"ng-empty"),this.$$animate.addClass(this.$$element,"ng-not-empty"))},$setPristine:function(){this.$dirty=!1;this.$pristine=!0;this.$$animate.removeClass(this.$$element,Vb);this.$$animate.addClass(this.$$element,$a)},$setDirty:function(){this.$dirty=!0;this.$pristine=!1;this.$$animate.removeClass(this.$$element, +$a);this.$$animate.addClass(this.$$element,Vb);this.$$parentForm.$setDirty()},$setUntouched:function(){this.$touched=!1;this.$untouched=!0;this.$$animate.setClass(this.$$element,"ng-untouched","ng-touched")},$setTouched:function(){this.$touched=!0;this.$untouched=!1;this.$$animate.setClass(this.$$element,"ng-touched","ng-untouched")},$rollbackViewValue:function(){this.$$timeout.cancel(this.$$pendingDebounce);this.$viewValue=this.$$lastCommittedViewValue;this.$render()},$validate:function(){if(!ha(this.$modelValue)){var a= +this.$$lastCommittedViewValue,b=this.$$rawModelValue,d=this.$valid,c=this.$modelValue,e=this.$options.getOption("allowInvalid"),f=this;this.$$runValidators(b,a,function(a){e||d===a||(f.$modelValue=a?b:void 0,f.$modelValue!==c&&f.$$writeModelToScope())})}},$$runValidators:function(a,b,d){function c(){var c=!0;q(h.$validators,function(d,e){var g=Boolean(d(a,b));c=c&&g;f(e,g)});return c?!0:(q(h.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;q(h.$asyncValidators,function(e, +g){var h=e(a,b);if(!h||!z(h.then))throw qb("nopromise",h);f(g,void 0);c.push(h.then(function(){f(g,!0)},function(){d=!1;f(g,!1)}))});c.length?h.$$q.all(c).then(function(){g(d)},x):g(!0)}function f(a,b){k===h.$$currentValidationRunId&&h.$setValidity(a,b)}function g(a){k===h.$$currentValidationRunId&&d(a)}this.$$currentValidationRunId++;var k=this.$$currentValidationRunId,h=this;(function(){var a=h.$$parserName;if(v(h.$$parserValid))f(a,null);else return h.$$parserValid||(q(h.$validators,function(a, +b){f(b,null)}),q(h.$asyncValidators,function(a,b){f(b,null)})),f(a,h.$$parserValid),h.$$parserValid;return!0})()?c()?e():g(!1):g(!1)},$commitViewValue:function(){var a=this.$viewValue;this.$$timeout.cancel(this.$$pendingDebounce);if(this.$$lastCommittedViewValue!==a||""===a&&this.$$hasNativeValidators)this.$$updateEmptyClasses(a),this.$$lastCommittedViewValue=a,this.$pristine&&this.$setDirty(),this.$$parseAndValidate()},$$parseAndValidate:function(){var a=this.$$lastCommittedViewValue,b=this;this.$$parserValid= +v(a)?void 0:!0;this.$setValidity(this.$$parserName,null);this.$$parserName="parse";if(this.$$parserValid)for(var d=0;de||c.$isEmpty(b)||b.length<=e}}}}},bd=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=0;d.$observe("minlength",function(a){e=ea(a)||0;c.$validate()});c.$validators.minlength=function(a,b){return c.$isEmpty(b)||b.length>=e}}}}};D.angular.bootstrap?D.console&&console.log("WARNING: Tried to load AngularJS more than once."): +(De(),He(fa),fa.module("ngLocale",[],["$provide",function(a){function b(a){a+="";var b=a.indexOf(".");return-1==b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "), +STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2, +minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a,c){var e=a|0,f=c;void 0===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),y(function(){ye(D.document,Vc)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(''); //# sourceMappingURL=angular.min.js.map diff --git a/org.civicrm.reqangular/js/src/common/vendor/angular/rangy-core.js b/org.civicrm.reqangular/js/src/common/vendor/angular/rangy-core.js index a0f3ac4da33..745c0bed737 100755 --- a/org.civicrm.reqangular/js/src/common/vendor/angular/rangy-core.js +++ b/org.civicrm.reqangular/js/src/common/vendor/angular/rangy-core.js @@ -1,2478 +1,2454 @@ -/* - !CUSTOMIZED VENDOR FILE! - - Rangy is written to correctly work as an AMD module, but textAngular.js - (which is a shimmed, not-AMD "module") expects window.rangy to exist. - - The workaround consists of making sure a global variable is created before - defining the module - - - More details on dependencies for shimmed modules here: - http://requirejs.org/docs/api.html#config-shim - - > Only use other "shim" modules as dependencies for shimmed scripts, - or AMD libraries that have no dependencies and call define() after they - also create a global -*/ - /** * Rangy, a cross-browser JavaScript range and selection library * https://github.com/timdown/rangy * * Copyright 2015, Tim Down * Licensed under the MIT license. - * Version: 1.3.0 - * Build date: 10 May 2015 + * Version: 1.3.1-dev + * Build date: 20 May 2015 */ -(function(factory, root) { +(function (factory, root) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory); + } else if (typeof module !== 'undefined' && typeof exports === 'object') { + // Node/CommonJS style + module.exports = factory(); + } else { + // No AMD or CommonJS support so we place Rangy in (probably) the global variable root.rangy = factory(); + } +})(function () { + var OBJECT = 'object', FUNCTION = 'function', UNDEFINED = 'undefined'; - if (typeof define == "function" && define.amd) { - // AMD. Register as an anonymous module. - define(function () { return root.rangy; }); - } else if (typeof module != "undefined" && typeof exports == "object") { - // Node/CommonJS style - module.exports = root.rangy; - } -})(function() { - - var OBJECT = "object", FUNCTION = "function", UNDEFINED = "undefined"; - - // Minimal set of properties required for DOM Level 2 Range compliance. Comparison constants such as START_TO_START - // are omitted because ranges in KHTML do not have them but otherwise work perfectly well. See issue 113. - var domRangeProperties = ["startContainer", "startOffset", "endContainer", "endOffset", "collapsed", - "commonAncestorContainer"]; + // Minimal set of properties required for DOM Level 2 Range compliance. Comparison constants such as START_TO_START + // are omitted because ranges in KHTML do not have them but otherwise work perfectly well. See issue 113. + var domRangeProperties = ['startContainer', 'startOffset', 'endContainer', 'endOffset', 'collapsed', + 'commonAncestorContainer']; // Minimal set of methods required for DOM Level 2 Range compliance - var domRangeMethods = ["setStart", "setStartBefore", "setStartAfter", "setEnd", "setEndBefore", - "setEndAfter", "collapse", "selectNode", "selectNodeContents", "compareBoundaryPoints", "deleteContents", - "extractContents", "cloneContents", "insertNode", "surroundContents", "cloneRange", "toString", "detach"]; + var domRangeMethods = ['setStart', 'setStartBefore', 'setStartAfter', 'setEnd', 'setEndBefore', + 'setEndAfter', 'collapse', 'selectNode', 'selectNodeContents', 'compareBoundaryPoints', 'deleteContents', + 'extractContents', 'cloneContents', 'insertNode', 'surroundContents', 'cloneRange', 'toString', 'detach']; - var textRangeProperties = ["boundingHeight", "boundingLeft", "boundingTop", "boundingWidth", "htmlText", "text"]; + var textRangeProperties = ['boundingHeight', 'boundingLeft', 'boundingTop', 'boundingWidth', 'htmlText', 'text']; - // Subset of TextRange's full set of methods that we're interested in - var textRangeMethods = ["collapse", "compareEndPoints", "duplicate", "moveToElementText", "parentElement", "select", - "setEndPoint", "getBoundingClientRect"]; + // Subset of TextRange's full set of methods that we're interested in + var textRangeMethods = ['collapse', 'compareEndPoints', 'duplicate', 'moveToElementText', 'parentElement', 'select', + 'setEndPoint', 'getBoundingClientRect']; - /*----------------------------------------------------------------------------------------------------------------*/ + /* ---------------------------------------------------------------------------------------------------------------- */ // Trio of functions taken from Peter Michaux's article: // http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting - function isHostMethod(o, p) { - var t = typeof o[p]; - return t == FUNCTION || (!!(t == OBJECT && o[p])) || t == "unknown"; - } + function isHostMethod (o, p) { + var t = typeof o[p]; + return t == FUNCTION || (!!(t == OBJECT && o[p])) || t == 'unknown'; + } + + function isHostObject (o, p) { + return !!(typeof o[p] === OBJECT && o[p]); + } + + function isHostProperty (o, p) { + return typeof o[p] !== UNDEFINED; + } + + // Creates a convenience function to save verbose repeated calls to tests functions + function createMultiplePropertyTest (testFunc) { + return function (o, props) { + var i = props.length; + while (i--) { + if (!testFunc(o, props[i])) { + return false; + } + } + return true; + }; + } - function isHostObject(o, p) { - return !!(typeof o[p] == OBJECT && o[p]); - } + // Next trio of functions are a convenience to save verbose repeated calls to previous two functions + var areHostMethods = createMultiplePropertyTest(isHostMethod); + var areHostObjects = createMultiplePropertyTest(isHostObject); + var areHostProperties = createMultiplePropertyTest(isHostProperty); - function isHostProperty(o, p) { - return typeof o[p] != UNDEFINED; - } + function isTextRange (range) { + return range && areHostMethods(range, textRangeMethods) && areHostProperties(range, textRangeProperties); + } - // Creates a convenience function to save verbose repeated calls to tests functions - function createMultiplePropertyTest(testFunc) { - return function(o, props) { - var i = props.length; - while (i--) { - if (!testFunc(o, props[i])) { - return false; - } - } - return true; - }; + function getBody (doc) { + return isHostObject(doc, 'body') ? doc.body : doc.getElementsByTagName('body')[0]; + } + + var forEach = [].forEach + ? function (arr, func) { + arr.forEach(func); } + : function (arr, func) { + for (var i = 0, len = arr.length; i < len; ++i) { + func(arr[i], i); + } + }; - // Next trio of functions are a convenience to save verbose repeated calls to previous two functions - var areHostMethods = createMultiplePropertyTest(isHostMethod); - var areHostObjects = createMultiplePropertyTest(isHostObject); - var areHostProperties = createMultiplePropertyTest(isHostProperty); + var modules = {}; + + var isBrowser = (typeof window !== UNDEFINED && typeof document !== UNDEFINED); + + var util = { + isHostMethod: isHostMethod, + isHostObject: isHostObject, + isHostProperty: isHostProperty, + areHostMethods: areHostMethods, + areHostObjects: areHostObjects, + areHostProperties: areHostProperties, + isTextRange: isTextRange, + getBody: getBody, + forEach: forEach + }; + + var api = { + version: '1.3.1-dev', + initialized: false, + isBrowser: isBrowser, + supported: true, + util: util, + features: {}, + modules: modules, + config: { + alertOnFail: false, + alertOnWarn: false, + preferTextRange: false, + autoInitialize: (typeof rangyAutoInitialize === UNDEFINED) ? true : rangyAutoInitialize + } + }; - function isTextRange(range) { - return range && areHostMethods(range, textRangeMethods) && areHostProperties(range, textRangeProperties); + function consoleLog (msg) { + if (typeof console !== UNDEFINED && isHostMethod(console, 'log')) { + console.log(msg); } + } - function getBody(doc) { - return isHostObject(doc, "body") ? doc.body : doc.getElementsByTagName("body")[0]; + function alertOrLog (msg, shouldAlert) { + if (isBrowser && shouldAlert) { + alert(msg); + } else { + consoleLog(msg); } + } + + function fail (reason) { + api.initialized = true; + api.supported = false; + alertOrLog('Rangy is not supported in this environment. Reason: ' + reason, api.config.alertOnFail); + } + + api.fail = fail; + + function warn (msg) { + alertOrLog('Rangy warning: ' + msg, api.config.alertOnWarn); + } + + api.warn = warn; + + // Add utility extend() method + var extend; + if ({}.hasOwnProperty) { + util.extend = extend = function (obj, props, deep) { + var o, p; + for (var i in props) { + if (props.hasOwnProperty(i)) { + o = obj[i]; + p = props[i]; + if (deep && o !== null && typeof o === 'object' && p !== null && typeof p === 'object') { + extend(o, p, true); + } + obj[i] = p; + } + } + // Special case for toString, which does not show up in for...in loops in IE <= 8 + if (props.hasOwnProperty('toString')) { + obj.toString = props.toString; + } + return obj; + }; - var forEach = [].forEach ? - function(arr, func) { - arr.forEach(func); - } : - function(arr, func) { - for (var i = 0, len = arr.length; i < len; ++i) { - func(arr[i], i); - } - }; + util.createOptions = function (optionsParam, defaults) { + var options = {}; + extend(options, defaults); + if (optionsParam) { + extend(options, optionsParam); + } + return options; + }; + } else { + fail('hasOwnProperty not supported'); + } - var modules = {}; + // Test whether we're in a browser and bail out if not + if (!isBrowser) { + fail('Rangy can only run in a browser'); + } - var isBrowser = (typeof window != UNDEFINED && typeof document != UNDEFINED); + // Test whether Array.prototype.slice can be relied on for NodeLists and use an alternative toArray() if not + (function () { + var toArray; - var util = { - isHostMethod: isHostMethod, - isHostObject: isHostObject, - isHostProperty: isHostProperty, - areHostMethods: areHostMethods, - areHostObjects: areHostObjects, - areHostProperties: areHostProperties, - isTextRange: isTextRange, - getBody: getBody, - forEach: forEach - }; + if (isBrowser) { + var el = document.createElement('div'); + el.appendChild(document.createElement('span')); + var slice = [].slice; + try { + if (slice.call(el.childNodes, 0)[0].nodeType == 1) { + toArray = function (arrayLike) { + return slice.call(arrayLike, 0); + }; + } + } catch (e) {} + } - var api = { - version: "1.3.0", - initialized: false, - isBrowser: isBrowser, - supported: true, - util: util, - features: {}, - modules: modules, - config: { - alertOnFail: false, - alertOnWarn: false, - preferTextRange: false, - autoInitialize: (typeof rangyAutoInitialize == UNDEFINED) ? true : rangyAutoInitialize + if (!toArray) { + toArray = function (arrayLike) { + var arr = []; + for (var i = 0, len = arrayLike.length; i < len; ++i) { + arr[i] = arrayLike[i]; } - }; + return arr; + }; + } - function consoleLog(msg) { - if (typeof console != UNDEFINED && isHostMethod(console, "log")) { - console.log(msg); - } + util.toArray = toArray; + })(); + + // Very simple event handler wrapper function that doesn't attempt to solve issues such as "this" handling or + // normalization of event properties + var addListener; + if (isBrowser) { + if (isHostMethod(document, 'addEventListener')) { + addListener = function (obj, eventType, listener) { + obj.addEventListener(eventType, listener, false); + }; + } else if (isHostMethod(document, 'attachEvent')) { + addListener = function (obj, eventType, listener) { + obj.attachEvent('on' + eventType, listener); + }; + } else { + fail('Document does not have required addEventListener or attachEvent method'); } - function alertOrLog(msg, shouldAlert) { - if (isBrowser && shouldAlert) { - alert(msg); - } else { - consoleLog(msg); - } + util.addListener = addListener; + } + + var initListeners = []; + + function getErrorDesc (ex) { + return ex.message || ex.description || String(ex); + } + + // Initialization + function init () { + if (!isBrowser || api.initialized) { + return; } + var testRange; + var implementsDomRange = false, implementsTextRange = false; + + // First, perform basic feature tests - function fail(reason) { - api.initialized = true; - api.supported = false; - alertOrLog("Rangy is not supported in this environment. Reason: " + reason, api.config.alertOnFail); + if (isHostMethod(document, 'createRange')) { + testRange = document.createRange(); + if (areHostMethods(testRange, domRangeMethods) && areHostProperties(testRange, domRangeProperties)) { + implementsDomRange = true; + } } - api.fail = fail; + var body = getBody(document); + if (!body || body.nodeName.toLowerCase() != 'body') { + fail('No body element found'); + return; + } - function warn(msg) { - alertOrLog("Rangy warning: " + msg, api.config.alertOnWarn); + if (body && isHostMethod(body, 'createTextRange')) { + testRange = body.createTextRange(); + if (isTextRange(testRange)) { + implementsTextRange = true; + } } - api.warn = warn; + if (!implementsDomRange && !implementsTextRange) { + fail('Neither Range nor TextRange are available'); + return; + } - // Add utility extend() method - var extend; - if ({}.hasOwnProperty) { - util.extend = extend = function(obj, props, deep) { - var o, p; - for (var i in props) { - if (props.hasOwnProperty(i)) { - o = obj[i]; - p = props[i]; - if (deep && o !== null && typeof o == "object" && p !== null && typeof p == "object") { - extend(o, p, true); - } - obj[i] = p; - } - } - // Special case for toString, which does not show up in for...in loops in IE <= 8 - if (props.hasOwnProperty("toString")) { - obj.toString = props.toString; - } - return obj; - }; + api.initialized = true; + api.features = { + implementsDomRange: implementsDomRange, + implementsTextRange: implementsTextRange + }; - util.createOptions = function(optionsParam, defaults) { - var options = {}; - extend(options, defaults); - if (optionsParam) { - extend(options, optionsParam); - } - return options; - }; - } else { - fail("hasOwnProperty not supported"); + // Initialize modules + var module, errorMessage; + for (var moduleName in modules) { + if ((module = modules[moduleName]) instanceof Module) { + module.init(module, api); + } } - // Test whether we're in a browser and bail out if not - if (!isBrowser) { - fail("Rangy can only run in a browser"); + // Call init listeners + for (var i = 0, len = initListeners.length; i < len; ++i) { + try { + initListeners[i](api); + } catch (ex) { + errorMessage = 'Rangy init listener threw an exception. Continuing. Detail: ' + getErrorDesc(ex); + consoleLog(errorMessage); + } } + } - // Test whether Array.prototype.slice can be relied on for NodeLists and use an alternative toArray() if not - (function() { - var toArray; + function deprecationNotice (deprecated, replacement, module) { + if (module) { + deprecated += ' in module ' + module.name; + } + api.warn('DEPRECATED: ' + deprecated + ' is deprecated. Please use ' + + replacement + ' instead.'); + } + + function createAliasForDeprecatedMethod (owner, deprecated, replacement, module) { + owner[deprecated] = function () { + deprecationNotice(deprecated, replacement, module); + return owner[replacement].apply(owner, util.toArray(arguments)); + }; + } - if (isBrowser) { - var el = document.createElement("div"); - el.appendChild(document.createElement("span")); - var slice = [].slice; - try { - if (slice.call(el.childNodes, 0)[0].nodeType == 1) { - toArray = function(arrayLike) { - return slice.call(arrayLike, 0); - }; - } - } catch (e) {} - } + util.deprecationNotice = deprecationNotice; + util.createAliasForDeprecatedMethod = createAliasForDeprecatedMethod; - if (!toArray) { - toArray = function(arrayLike) { - var arr = []; - for (var i = 0, len = arrayLike.length; i < len; ++i) { - arr[i] = arrayLike[i]; - } - return arr; - }; - } + // Allow external scripts to initialize this library in case it's loaded after the document has loaded + api.init = init; - util.toArray = toArray; - })(); + // Execute listener immediately if already initialized + api.addInitListener = function (listener) { + if (api.initialized) { + listener(api); + } else { + initListeners.push(listener); + } + }; - // Very simple event handler wrapper function that doesn't attempt to solve issues such as "this" handling or - // normalization of event properties - var addListener; - if (isBrowser) { - if (isHostMethod(document, "addEventListener")) { - addListener = function(obj, eventType, listener) { - obj.addEventListener(eventType, listener, false); - }; - } else if (isHostMethod(document, "attachEvent")) { - addListener = function(obj, eventType, listener) { - obj.attachEvent("on" + eventType, listener); - }; - } else { - fail("Document does not have required addEventListener or attachEvent method"); - } + var shimListeners = []; - util.addListener = addListener; - } + api.addShimListener = function (listener) { + shimListeners.push(listener); + }; - var initListeners = []; + function shim (win) { + win = win || window; + init(); - function getErrorDesc(ex) { - return ex.message || ex.description || String(ex); + // Notify listeners + for (var i = 0, len = shimListeners.length; i < len; ++i) { + shimListeners[i](win); } + } - // Initialization - function init() { - if (!isBrowser || api.initialized) { - return; - } - var testRange; - var implementsDomRange = false, implementsTextRange = false; + if (isBrowser) { + api.shim = api.createMissingNativeApi = shim; + createAliasForDeprecatedMethod(api, 'createMissingNativeApi', 'shim'); + } - // First, perform basic feature tests + function Module (name, dependencies, initializer) { + this.name = name; + this.dependencies = dependencies; + this.initialized = false; + this.supported = false; + this.initializer = initializer; + } - if (isHostMethod(document, "createRange")) { - testRange = document.createRange(); - if (areHostMethods(testRange, domRangeMethods) && areHostProperties(testRange, domRangeProperties)) { - implementsDomRange = true; - } - } + Module.prototype = { + init: function () { + var requiredModuleNames = this.dependencies || []; + for (var i = 0, len = requiredModuleNames.length, requiredModule, moduleName; i < len; ++i) { + moduleName = requiredModuleNames[i]; - var body = getBody(document); - if (!body || body.nodeName.toLowerCase() != "body") { - fail("No body element found"); - return; + requiredModule = modules[moduleName]; + if (!requiredModule || !(requiredModule instanceof Module)) { + throw new Error("required module '" + moduleName + "' not found"); } - if (body && isHostMethod(body, "createTextRange")) { - testRange = body.createTextRange(); - if (isTextRange(testRange)) { - implementsTextRange = true; - } - } + requiredModule.init(); - if (!implementsDomRange && !implementsTextRange) { - fail("Neither Range nor TextRange are available"); - return; + if (!requiredModule.supported) { + throw new Error("required module '" + moduleName + "' not supported"); } + } - api.initialized = true; - api.features = { - implementsDomRange: implementsDomRange, - implementsTextRange: implementsTextRange - }; + // Now run initializer + this.initializer(this); + }, - // Initialize modules - var module, errorMessage; - for (var moduleName in modules) { - if ( (module = modules[moduleName]) instanceof Module ) { - module.init(module, api); - } - } + fail: function (reason) { + this.initialized = true; + this.supported = false; + throw new Error(reason); + }, - // Call init listeners - for (var i = 0, len = initListeners.length; i < len; ++i) { - try { - initListeners[i](api); - } catch (ex) { - errorMessage = "Rangy init listener threw an exception. Continuing. Detail: " + getErrorDesc(ex); - consoleLog(errorMessage); - } - } + warn: function (msg) { + api.warn('Module ' + this.name + ': ' + msg); + }, + + deprecationNotice: function (deprecated, replacement) { + api.warn('DEPRECATED: ' + deprecated + ' in module ' + this.name + ' is deprecated. Please use ' + + replacement + ' instead'); + }, + + createError: function (msg) { + return new Error('Error in Rangy ' + this.name + ' module: ' + msg); } + }; - function deprecationNotice(deprecated, replacement, module) { - if (module) { - deprecated += " in module " + module.name; - } - api.warn("DEPRECATED: " + deprecated + " is deprecated. Please use " + - replacement + " instead."); + function createModule (name, dependencies, initFunc) { + var newModule = new Module(name, dependencies, function (module) { + if (!module.initialized) { + module.initialized = true; + try { + initFunc(api, module); + module.supported = true; + } catch (ex) { + var errorMessage = "Module '" + name + "' failed to load: " + getErrorDesc(ex); + consoleLog(errorMessage); + if (ex.stack) { + consoleLog(ex.stack); + } + } + } + }); + modules[name] = newModule; + return newModule; + } + + api.createModule = function (name) { + // Allow 2 or 3 arguments (second argument is an optional array of dependencies) + var initFunc, dependencies; + if (arguments.length == 2) { + initFunc = arguments[1]; + dependencies = []; + } else { + initFunc = arguments[2]; + dependencies = arguments[1]; } - function createAliasForDeprecatedMethod(owner, deprecated, replacement, module) { - owner[deprecated] = function() { - deprecationNotice(deprecated, replacement, module); - return owner[replacement].apply(owner, util.toArray(arguments)); - }; + var module = createModule(name, dependencies, initFunc); + + // Initialize the module immediately if the core is already initialized + if (api.initialized && api.supported) { + module.init(); } + }; - util.deprecationNotice = deprecationNotice; - util.createAliasForDeprecatedMethod = createAliasForDeprecatedMethod; + api.createCoreModule = function (name, dependencies, initFunc) { + createModule(name, dependencies, initFunc); + }; - // Allow external scripts to initialize this library in case it's loaded after the document has loaded - api.init = init; + /* ---------------------------------------------------------------------------------------------------------------- */ - // Execute listener immediately if already initialized - api.addInitListener = function(listener) { - if (api.initialized) { - listener(api); - } else { - initListeners.push(listener); - } - }; + // Ensure rangy.rangePrototype and rangy.selectionPrototype are available immediately - var shimListeners = []; + function RangePrototype () {} + api.RangePrototype = RangePrototype; + api.rangePrototype = new RangePrototype(); - api.addShimListener = function(listener) { - shimListeners.push(listener); - }; + function SelectionPrototype () {} + api.selectionPrototype = new SelectionPrototype(); - function shim(win) { - win = win || window; - init(); + /* ---------------------------------------------------------------------------------------------------------------- */ - // Notify listeners - for (var i = 0, len = shimListeners.length; i < len; ++i) { - shimListeners[i](win); - } + // DOM utility methods used by Rangy + api.createCoreModule('DomUtil', [], function (api, module) { + var UNDEF = 'undefined'; + var util = api.util; + var getBody = util.getBody; + + // Perform feature tests + if (!util.areHostMethods(document, ['createDocumentFragment', 'createElement', 'createTextNode'])) { + module.fail('document missing a Node creation method'); } - if (isBrowser) { - api.shim = api.createMissingNativeApi = shim; - createAliasForDeprecatedMethod(api, "createMissingNativeApi", "shim"); + if (!util.isHostMethod(document, 'getElementsByTagName')) { + module.fail('document missing getElementsByTagName method'); } - function Module(name, dependencies, initializer) { - this.name = name; - this.dependencies = dependencies; - this.initialized = false; - this.supported = false; - this.initializer = initializer; + var el = document.createElement('div'); + if (!util.areHostMethods(el, ['insertBefore', 'appendChild', 'cloneNode'] || + !util.areHostObjects(el, ['previousSibling', 'nextSibling', 'childNodes', 'parentNode']))) { + module.fail('Incomplete Element implementation'); } - Module.prototype = { - init: function() { - var requiredModuleNames = this.dependencies || []; - for (var i = 0, len = requiredModuleNames.length, requiredModule, moduleName; i < len; ++i) { - moduleName = requiredModuleNames[i]; + // innerHTML is required for Range's createContextualFragment method + if (!util.isHostProperty(el, 'innerHTML')) { + module.fail('Element is missing innerHTML property'); + } - requiredModule = modules[moduleName]; - if (!requiredModule || !(requiredModule instanceof Module)) { - throw new Error("required module '" + moduleName + "' not found"); - } + var textNode = document.createTextNode('test'); + if (!util.areHostMethods(textNode, ['splitText', 'deleteData', 'insertData', 'appendData', 'cloneNode'] || + !util.areHostObjects(el, ['previousSibling', 'nextSibling', 'childNodes', 'parentNode']) || + !util.areHostProperties(textNode, ['data']))) { + module.fail('Incomplete Text Node implementation'); + } - requiredModule.init(); + /* ---------------------------------------------------------------------------------------------------------------- */ - if (!requiredModule.supported) { - throw new Error("required module '" + moduleName + "' not supported"); + // Removed use of indexOf because of a bizarre bug in Opera that is thrown in one of the Acid3 tests. I haven't been + // able to replicate it outside of the test. The bug is that indexOf returns -1 when called on an Array that + // contains just the document as a single element and the value searched for is the document. + var arrayContains = /* Array.prototype.indexOf ? + function(arr, val) { + return arr.indexOf(val) > -1; + }: */ + + function (arr, val) { + var i = arr.length; + while (i--) { + if (arr[i] === val) { + return true; } - } + } + return false; + }; - // Now run initializer - this.initializer(this); - }, + // Opera 11 puts HTML elements in the null namespace, it seems, and IE 7 has undefined namespaceURI + function isHtmlNamespace (node) { + var ns; + return typeof node.namespaceURI === UNDEF || ((ns = node.namespaceURI) === null || ns == 'http://www.w3.org/1999/xhtml'); + } - fail: function(reason) { - this.initialized = true; - this.supported = false; - throw new Error(reason); - }, + function parentElement (node) { + var parent = node.parentNode; + return (parent.nodeType == 1) ? parent : null; + } - warn: function(msg) { - api.warn("Module " + this.name + ": " + msg); - }, + function getNodeIndex (node) { + var i = 0; + while ((node = node.previousSibling)) { + ++i; + } + return i; + } - deprecationNotice: function(deprecated, replacement) { - api.warn("DEPRECATED: " + deprecated + " in module " + this.name + " is deprecated. Please use " + - replacement + " instead"); - }, + function getNodeLength (node) { + switch (node.nodeType) { + case 7: + case 10: + return 0; + case 3: + case 8: + return node.length; + default: + return node.childNodes.length; + } + } + + function getCommonAncestor (node1, node2) { + var ancestors = [], n; + for (n = node1; n; n = n.parentNode) { + ancestors.push(n); + } - createError: function(msg) { - return new Error("Error in Rangy " + this.name + " module: " + msg); + for (n = node2; n; n = n.parentNode) { + if (arrayContains(ancestors, n)) { + return n; } - }; + } - function createModule(name, dependencies, initFunc) { - var newModule = new Module(name, dependencies, function(module) { - if (!module.initialized) { - module.initialized = true; - try { - initFunc(api, module); - module.supported = true; - } catch (ex) { - var errorMessage = "Module '" + name + "' failed to load: " + getErrorDesc(ex); - consoleLog(errorMessage); - if (ex.stack) { - consoleLog(ex.stack); - } - } - } - }); - modules[name] = newModule; - return newModule; + return null; } - api.createModule = function(name) { - // Allow 2 or 3 arguments (second argument is an optional array of dependencies) - var initFunc, dependencies; - if (arguments.length == 2) { - initFunc = arguments[1]; - dependencies = []; + function isAncestorOf (ancestor, descendant, selfIsAncestor) { + var n = selfIsAncestor ? descendant : descendant.parentNode; + while (n) { + if (n === ancestor) { + return true; } else { - initFunc = arguments[2]; - dependencies = arguments[1]; + n = n.parentNode; } + } + return false; + } - var module = createModule(name, dependencies, initFunc); + function isOrIsAncestorOf (ancestor, descendant) { + return isAncestorOf(ancestor, descendant, true); + } - // Initialize the module immediately if the core is already initialized - if (api.initialized && api.supported) { - module.init(); + function getClosestAncestorIn (node, ancestor, selfIsAncestor) { + var p, n = selfIsAncestor ? node : node.parentNode; + while (n) { + p = n.parentNode; + if (p === ancestor) { + return n; } - }; - - api.createCoreModule = function(name, dependencies, initFunc) { - createModule(name, dependencies, initFunc); - }; + n = p; + } + return null; + } - /*----------------------------------------------------------------------------------------------------------------*/ + function isCharacterDataNode (node) { + var t = node.nodeType; + return t == 3 || t == 4 || t == 8; // Text, CDataSection or Comment + } - // Ensure rangy.rangePrototype and rangy.selectionPrototype are available immediately + function isTextOrCommentNode (node) { + if (!node) { + return false; + } + var t = node.nodeType; + return t == 3 || t == 8; // Text or Comment + } - function RangePrototype() {} - api.RangePrototype = RangePrototype; - api.rangePrototype = new RangePrototype(); + function insertAfter (node, precedingNode) { + var nextNode = precedingNode.nextSibling, parent = precedingNode.parentNode; + if (nextNode) { + parent.insertBefore(node, nextNode); + } else { + parent.appendChild(node); + } + return node; + } - function SelectionPrototype() {} - api.selectionPrototype = new SelectionPrototype(); + // Note that we cannot use splitText() because it is bugridden in IE 9. + function splitDataNode (node, index, positionsToPreserve) { + var newNode = node.cloneNode(false); + newNode.deleteData(0, index); + node.deleteData(index, node.length - index); + insertAfter(newNode, node); + + // Preserve positions + if (positionsToPreserve) { + for (var i = 0, position; position = positionsToPreserve[i++];) { + // Handle case where position was inside the portion of node after the split point + if (position.node == node && position.offset > index) { + position.node = newNode; + position.offset -= index; + } + // Handle the case where the position is a node offset within node's parent + else if (position.node == node.parentNode && position.offset > getNodeIndex(node)) { + ++position.offset; + } + } + } + return newNode; + } - /*----------------------------------------------------------------------------------------------------------------*/ + function getDocument (node) { + if (node.nodeType == 9) { + return node; + } else if (typeof node.ownerDocument !== UNDEF) { + return node.ownerDocument; + } else if (typeof node.document !== UNDEF) { + return node.document; + } else if (node.parentNode) { + return getDocument(node.parentNode); + } else { + throw module.createError('getDocument: no document found for node'); + } + } - // DOM utility methods used by Rangy - api.createCoreModule("DomUtil", [], function(api, module) { - var UNDEF = "undefined"; - var util = api.util; - var getBody = util.getBody; + function getWindow (node) { + var doc = getDocument(node); + if (typeof doc.defaultView !== UNDEF) { + return doc.defaultView; + } else if (typeof doc.parentWindow !== UNDEF) { + return doc.parentWindow; + } else { + throw module.createError('Cannot get a window object for node'); + } + } - // Perform feature tests - if (!util.areHostMethods(document, ["createDocumentFragment", "createElement", "createTextNode"])) { - module.fail("document missing a Node creation method"); - } + function getIframeDocument (iframeEl) { + if (typeof iframeEl.contentDocument !== UNDEF) { + return iframeEl.contentDocument; + } else if (typeof iframeEl.contentWindow !== UNDEF) { + return iframeEl.contentWindow.document; + } else { + throw module.createError('getIframeDocument: No Document object found for iframe element'); + } + } - if (!util.isHostMethod(document, "getElementsByTagName")) { - module.fail("document missing getElementsByTagName method"); - } + function getIframeWindow (iframeEl) { + if (typeof iframeEl.contentWindow !== UNDEF) { + return iframeEl.contentWindow; + } else if (typeof iframeEl.contentDocument !== UNDEF) { + return iframeEl.contentDocument.defaultView; + } else { + throw module.createError('getIframeWindow: No Window object found for iframe element'); + } + } - var el = document.createElement("div"); - if (!util.areHostMethods(el, ["insertBefore", "appendChild", "cloneNode"] || - !util.areHostObjects(el, ["previousSibling", "nextSibling", "childNodes", "parentNode"]))) { - module.fail("Incomplete Element implementation"); - } + // This looks bad. Is it worth it? + function isWindow (obj) { + return obj && util.isHostMethod(obj, 'setTimeout') && util.isHostObject(obj, 'document'); + } - // innerHTML is required for Range's createContextualFragment method - if (!util.isHostProperty(el, "innerHTML")) { - module.fail("Element is missing innerHTML property"); - } + function getContentDocument (obj, module, methodName) { + var doc; - var textNode = document.createTextNode("test"); - if (!util.areHostMethods(textNode, ["splitText", "deleteData", "insertData", "appendData", "cloneNode"] || - !util.areHostObjects(el, ["previousSibling", "nextSibling", "childNodes", "parentNode"]) || - !util.areHostProperties(textNode, ["data"]))) { - module.fail("Incomplete Text Node implementation"); - } + if (!obj) { + doc = document; + } - /*----------------------------------------------------------------------------------------------------------------*/ + // Test if a DOM node has been passed and obtain a document object for it if so + else if (util.isHostProperty(obj, 'nodeType')) { + doc = (obj.nodeType == 1 && obj.tagName.toLowerCase() == 'iframe') + ? getIframeDocument(obj) : getDocument(obj); + } - // Removed use of indexOf because of a bizarre bug in Opera that is thrown in one of the Acid3 tests. I haven't been - // able to replicate it outside of the test. The bug is that indexOf returns -1 when called on an Array that - // contains just the document as a single element and the value searched for is the document. - var arrayContains = /*Array.prototype.indexOf ? - function(arr, val) { - return arr.indexOf(val) > -1; - }:*/ + // Test if the doc parameter appears to be a Window object + else if (isWindow(obj)) { + doc = obj.document; + } - function(arr, val) { - var i = arr.length; - while (i--) { - if (arr[i] === val) { - return true; - } - } - return false; - }; + if (!doc) { + throw module.createError(methodName + '(): Parameter must be a Window object or DOM node'); + } - // Opera 11 puts HTML elements in the null namespace, it seems, and IE 7 has undefined namespaceURI - function isHtmlNamespace(node) { - var ns; - return typeof node.namespaceURI == UNDEF || ((ns = node.namespaceURI) === null || ns == "http://www.w3.org/1999/xhtml"); - } + return doc; + } - function parentElement(node) { - var parent = node.parentNode; - return (parent.nodeType == 1) ? parent : null; - } + function getRootContainer (node) { + var parent; + while ((parent = node.parentNode)) { + node = parent; + } + return node; + } - function getNodeIndex(node) { - var i = 0; - while( (node = node.previousSibling) ) { - ++i; - } - return i; - } - - function getNodeLength(node) { - switch (node.nodeType) { - case 7: - case 10: - return 0; - case 3: - case 8: - return node.length; - default: - return node.childNodes.length; + function comparePoints (nodeA, offsetA, nodeB, offsetB) { + // See http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Comparing + var nodeC, root, childA, childB, n; + if (nodeA == nodeB) { + // Case 1: nodes are the same + return offsetA === offsetB ? 0 : (offsetA < offsetB) ? -1 : 1; + } else if ((nodeC = getClosestAncestorIn(nodeB, nodeA, true))) { + // Case 2: node C (container B or an ancestor) is a child node of A + return offsetA <= getNodeIndex(nodeC) ? -1 : 1; + } else if ((nodeC = getClosestAncestorIn(nodeA, nodeB, true))) { + // Case 3: node C (container A or an ancestor) is a child node of B + return getNodeIndex(nodeC) < offsetB ? -1 : 1; + } else { + root = getCommonAncestor(nodeA, nodeB); + if (!root) { + throw new Error('comparePoints error: nodes have no common ancestor'); + } + + // Case 4: containers are siblings or descendants of siblings + childA = (nodeA === root) ? root : getClosestAncestorIn(nodeA, root, true); + childB = (nodeB === root) ? root : getClosestAncestorIn(nodeB, root, true); + + if (childA === childB) { + // This shouldn't be possible + throw module.createError('comparePoints got to case 4 and childA and childB are the same!'); + } else { + n = root.firstChild; + while (n) { + if (n === childA) { + return -1; + } else if (n === childB) { + return 1; } + n = n.nextSibling; + } } + } + } - function getCommonAncestor(node1, node2) { - var ancestors = [], n; - for (n = node1; n; n = n.parentNode) { - ancestors.push(n); - } + /* ---------------------------------------------------------------------------------------------------------------- */ - for (n = node2; n; n = n.parentNode) { - if (arrayContains(ancestors, n)) { - return n; - } - } + // Test for IE's crash (IE 6/7) or exception (IE >= 8) when a reference to garbage-collected text node is queried + var crashyTextNodes = false; - return null; - } + function isBrokenNode (node) { + var n; + try { + n = node.parentNode; + return false; + } catch (e) { + return true; + } + } - function isAncestorOf(ancestor, descendant, selfIsAncestor) { - var n = selfIsAncestor ? descendant : descendant.parentNode; - while (n) { - if (n === ancestor) { - return true; - } else { - n = n.parentNode; - } - } - return false; - } + (function () { + var el = document.createElement('b'); + el.innerHTML = '1'; + var textNode = el.firstChild; + el.innerHTML = '
    '; + crashyTextNodes = isBrokenNode(textNode); - function isOrIsAncestorOf(ancestor, descendant) { - return isAncestorOf(ancestor, descendant, true); - } + api.features.crashyTextNodes = crashyTextNodes; + })(); - function getClosestAncestorIn(node, ancestor, selfIsAncestor) { - var p, n = selfIsAncestor ? node : node.parentNode; - while (n) { - p = n.parentNode; - if (p === ancestor) { - return n; - } - n = p; - } - return null; - } + /* ---------------------------------------------------------------------------------------------------------------- */ + + function inspectNode (node) { + if (!node) { + return '[No node]'; + } + if (crashyTextNodes && isBrokenNode(node)) { + return '[Broken node]'; + } + if (isCharacterDataNode(node)) { + return '"' + node.data + '"'; + } + if (node.nodeType == 1) { + var idAttr = node.id ? ' id="' + node.id + '"' : ''; + return '<' + node.nodeName + idAttr + '>[index:' + getNodeIndex(node) + ',length:' + node.childNodes.length + '][' + (node.innerHTML || '[innerHTML not supported]').slice(0, 25) + ']'; + } + return node.nodeName; + } - function isCharacterDataNode(node) { - var t = node.nodeType; - return t == 3 || t == 4 || t == 8 ; // Text, CDataSection or Comment - } + function fragmentFromNodeChildren (node) { + var fragment = getDocument(node).createDocumentFragment(), child; + while ((child = node.firstChild)) { + fragment.appendChild(child); + } + return fragment; + } - function isTextOrCommentNode(node) { - if (!node) { - return false; - } - var t = node.nodeType; - return t == 3 || t == 8 ; // Text or Comment - } + var getComputedStyleProperty; + if (typeof window.getComputedStyle !== UNDEF) { + getComputedStyleProperty = function (el, propName) { + return getWindow(el).getComputedStyle(el, null)[propName]; + }; + } else if (typeof document.documentElement.currentStyle !== UNDEF) { + getComputedStyleProperty = function (el, propName) { + return el.currentStyle ? el.currentStyle[propName] : ''; + }; + } else { + module.fail('No means of obtaining computed style properties found'); + } - function insertAfter(node, precedingNode) { - var nextNode = precedingNode.nextSibling, parent = precedingNode.parentNode; - if (nextNode) { - parent.insertBefore(node, nextNode); - } else { - parent.appendChild(node); - } - return node; - } - - // Note that we cannot use splitText() because it is bugridden in IE 9. - function splitDataNode(node, index, positionsToPreserve) { - var newNode = node.cloneNode(false); - newNode.deleteData(0, index); - node.deleteData(index, node.length - index); - insertAfter(newNode, node); - - // Preserve positions - if (positionsToPreserve) { - for (var i = 0, position; position = positionsToPreserve[i++]; ) { - // Handle case where position was inside the portion of node after the split point - if (position.node == node && position.offset > index) { - position.node = newNode; - position.offset -= index; - } - // Handle the case where the position is a node offset within node's parent - else if (position.node == node.parentNode && position.offset > getNodeIndex(node)) { - ++position.offset; - } - } - } - return newNode; - } - - function getDocument(node) { - if (node.nodeType == 9) { - return node; - } else if (typeof node.ownerDocument != UNDEF) { - return node.ownerDocument; - } else if (typeof node.document != UNDEF) { - return node.document; - } else if (node.parentNode) { - return getDocument(node.parentNode); - } else { - throw module.createError("getDocument: no document found for node"); - } - } + function createTestElement (doc, html, contentEditable) { + var body = getBody(doc); + var el = doc.createElement('div'); + el.contentEditable = '' + !!contentEditable; + if (html) { + el.innerHTML = html; + } + + // Insert the test element at the start of the body to prevent scrolling to the bottom in iOS (issue #292) + var bodyFirstChild = body.firstChild; + if (bodyFirstChild) { + body.insertBefore(el, bodyFirstChild); + } else { + body.appendChild(el); + } + + return el; + } - function getWindow(node) { - var doc = getDocument(node); - if (typeof doc.defaultView != UNDEF) { - return doc.defaultView; - } else if (typeof doc.parentWindow != UNDEF) { - return doc.parentWindow; - } else { - throw module.createError("Cannot get a window object for node"); - } - } + function removeNode (node) { + return node.parentNode.removeChild(node); + } - function getIframeDocument(iframeEl) { - if (typeof iframeEl.contentDocument != UNDEF) { - return iframeEl.contentDocument; - } else if (typeof iframeEl.contentWindow != UNDEF) { - return iframeEl.contentWindow.document; - } else { - throw module.createError("getIframeDocument: No Document object found for iframe element"); - } - } + function NodeIterator (root) { + this.root = root; + this._next = root; + } - function getIframeWindow(iframeEl) { - if (typeof iframeEl.contentWindow != UNDEF) { - return iframeEl.contentWindow; - } else if (typeof iframeEl.contentDocument != UNDEF) { - return iframeEl.contentDocument.defaultView; - } else { - throw module.createError("getIframeWindow: No Window object found for iframe element"); - } - } + NodeIterator.prototype = { + _current: null, + + hasNext: function () { + return !!this._next; + }, + + next: function () { + var n = this._current = this._next; + var child, next; + if (this._current) { + child = n.firstChild; + if (child) { + this._next = child; + } else { + next = null; + while ((n !== this.root) && !(next = n.nextSibling)) { + n = n.parentNode; + } + this._next = next; + } + } + return this._current; + }, + + detach: function () { + this._current = this._next = this.root = null; + } + }; - // This looks bad. Is it worth it? - function isWindow(obj) { - return obj && util.isHostMethod(obj, "setTimeout") && util.isHostObject(obj, "document"); - } + function createIterator (root) { + return new NodeIterator(root); + } - function getContentDocument(obj, module, methodName) { - var doc; + function DomPosition (node, offset) { + this.node = node; + this.offset = offset; + } - if (!obj) { - doc = document; - } + DomPosition.prototype = { + equals: function (pos) { + return !!pos && this.node === pos.node && this.offset == pos.offset; + }, - // Test if a DOM node has been passed and obtain a document object for it if so - else if (util.isHostProperty(obj, "nodeType")) { - doc = (obj.nodeType == 1 && obj.tagName.toLowerCase() == "iframe") ? - getIframeDocument(obj) : getDocument(obj); - } + inspect: function () { + return '[DomPosition(' + inspectNode(this.node) + ':' + this.offset + ')]'; + }, - // Test if the doc parameter appears to be a Window object - else if (isWindow(obj)) { - doc = obj.document; - } + toString: function () { + return this.inspect(); + } + }; - if (!doc) { - throw module.createError(methodName + "(): Parameter must be a Window object or DOM node"); - } + function DOMException (codeName) { + this.code = this[codeName]; + this.codeName = codeName; + this.message = 'DOMException: ' + this.codeName; + } - return doc; - } + DOMException.prototype = { + INDEX_SIZE_ERR: 1, + HIERARCHY_REQUEST_ERR: 3, + WRONG_DOCUMENT_ERR: 4, + NO_MODIFICATION_ALLOWED_ERR: 7, + NOT_FOUND_ERR: 8, + NOT_SUPPORTED_ERR: 9, + INVALID_STATE_ERR: 11, + INVALID_NODE_TYPE_ERR: 24 + }; - function getRootContainer(node) { - var parent; - while ( (parent = node.parentNode) ) { - node = parent; - } - return node; - } - - function comparePoints(nodeA, offsetA, nodeB, offsetB) { - // See http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Comparing - var nodeC, root, childA, childB, n; - if (nodeA == nodeB) { - // Case 1: nodes are the same - return offsetA === offsetB ? 0 : (offsetA < offsetB) ? -1 : 1; - } else if ( (nodeC = getClosestAncestorIn(nodeB, nodeA, true)) ) { - // Case 2: node C (container B or an ancestor) is a child node of A - return offsetA <= getNodeIndex(nodeC) ? -1 : 1; - } else if ( (nodeC = getClosestAncestorIn(nodeA, nodeB, true)) ) { - // Case 3: node C (container A or an ancestor) is a child node of B - return getNodeIndex(nodeC) < offsetB ? -1 : 1; - } else { - root = getCommonAncestor(nodeA, nodeB); - if (!root) { - throw new Error("comparePoints error: nodes have no common ancestor"); - } + DOMException.prototype.toString = function () { + return this.message; + }; - // Case 4: containers are siblings or descendants of siblings - childA = (nodeA === root) ? root : getClosestAncestorIn(nodeA, root, true); - childB = (nodeB === root) ? root : getClosestAncestorIn(nodeB, root, true); - - if (childA === childB) { - // This shouldn't be possible - throw module.createError("comparePoints got to case 4 and childA and childB are the same!"); - } else { - n = root.firstChild; - while (n) { - if (n === childA) { - return -1; - } else if (n === childB) { - return 1; - } - n = n.nextSibling; - } - } - } - } + api.dom = { + arrayContains: arrayContains, + isHtmlNamespace: isHtmlNamespace, + parentElement: parentElement, + getNodeIndex: getNodeIndex, + getNodeLength: getNodeLength, + getCommonAncestor: getCommonAncestor, + isAncestorOf: isAncestorOf, + isOrIsAncestorOf: isOrIsAncestorOf, + getClosestAncestorIn: getClosestAncestorIn, + isCharacterDataNode: isCharacterDataNode, + isTextOrCommentNode: isTextOrCommentNode, + insertAfter: insertAfter, + splitDataNode: splitDataNode, + getDocument: getDocument, + getWindow: getWindow, + getIframeWindow: getIframeWindow, + getIframeDocument: getIframeDocument, + getBody: getBody, + isWindow: isWindow, + getContentDocument: getContentDocument, + getRootContainer: getRootContainer, + comparePoints: comparePoints, + isBrokenNode: isBrokenNode, + inspectNode: inspectNode, + getComputedStyleProperty: getComputedStyleProperty, + createTestElement: createTestElement, + removeNode: removeNode, + fragmentFromNodeChildren: fragmentFromNodeChildren, + createIterator: createIterator, + DomPosition: DomPosition + }; - /*----------------------------------------------------------------------------------------------------------------*/ + api.DOMException = DOMException; + }); - // Test for IE's crash (IE 6/7) or exception (IE >= 8) when a reference to garbage-collected text node is queried - var crashyTextNodes = false; + /* ---------------------------------------------------------------------------------------------------------------- */ - function isBrokenNode(node) { - var n; - try { - n = node.parentNode; - return false; - } catch (e) { - return true; - } - } + // Pure JavaScript implementation of DOM Range + api.createCoreModule('DomRange', ['DomUtil'], function (api, module) { + var dom = api.dom; + var util = api.util; + var DomPosition = dom.DomPosition; + var DOMException = api.DOMException; - (function() { - var el = document.createElement("b"); - el.innerHTML = "1"; - var textNode = el.firstChild; - el.innerHTML = "
    "; - crashyTextNodes = isBrokenNode(textNode); + var isCharacterDataNode = dom.isCharacterDataNode; + var getNodeIndex = dom.getNodeIndex; + var isOrIsAncestorOf = dom.isOrIsAncestorOf; + var getDocument = dom.getDocument; + var comparePoints = dom.comparePoints; + var splitDataNode = dom.splitDataNode; + var getClosestAncestorIn = dom.getClosestAncestorIn; + var getNodeLength = dom.getNodeLength; + var arrayContains = dom.arrayContains; + var getRootContainer = dom.getRootContainer; + var crashyTextNodes = api.features.crashyTextNodes; - api.features.crashyTextNodes = crashyTextNodes; - })(); + var removeNode = dom.removeNode; - /*----------------------------------------------------------------------------------------------------------------*/ + /* ---------------------------------------------------------------------------------------------------------------- */ - function inspectNode(node) { - if (!node) { - return "[No node]"; - } - if (crashyTextNodes && isBrokenNode(node)) { - return "[Broken node]"; - } - if (isCharacterDataNode(node)) { - return '"' + node.data + '"'; - } - if (node.nodeType == 1) { - var idAttr = node.id ? ' id="' + node.id + '"' : ""; - return "<" + node.nodeName + idAttr + ">[index:" + getNodeIndex(node) + ",length:" + node.childNodes.length + "][" + (node.innerHTML || "[innerHTML not supported]").slice(0, 25) + "]"; - } - return node.nodeName; - } + // Utility functions - function fragmentFromNodeChildren(node) { - var fragment = getDocument(node).createDocumentFragment(), child; - while ( (child = node.firstChild) ) { - fragment.appendChild(child); - } - return fragment; - } + function isNonTextPartiallySelected (node, range) { + return (node.nodeType != 3) && + (isOrIsAncestorOf(node, range.startContainer) || isOrIsAncestorOf(node, range.endContainer)); + } - var getComputedStyleProperty; - if (typeof window.getComputedStyle != UNDEF) { - getComputedStyleProperty = function(el, propName) { - return getWindow(el).getComputedStyle(el, null)[propName]; - }; - } else if (typeof document.documentElement.currentStyle != UNDEF) { - getComputedStyleProperty = function(el, propName) { - return el.currentStyle ? el.currentStyle[propName] : ""; - }; - } else { - module.fail("No means of obtaining computed style properties found"); - } + function getRangeDocument (range) { + return range.document || getDocument(range.startContainer); + } - function createTestElement(doc, html, contentEditable) { - var body = getBody(doc); - var el = doc.createElement("div"); - el.contentEditable = "" + !!contentEditable; - if (html) { - el.innerHTML = html; - } + function getRangeRoot (range) { + return getRootContainer(range.startContainer); + } - // Insert the test element at the start of the body to prevent scrolling to the bottom in iOS (issue #292) - var bodyFirstChild = body.firstChild; - if (bodyFirstChild) { - body.insertBefore(el, bodyFirstChild); - } else { - body.appendChild(el); - } + function getBoundaryBeforeNode (node) { + return new DomPosition(node.parentNode, getNodeIndex(node)); + } - return el; - } + function getBoundaryAfterNode (node) { + return new DomPosition(node.parentNode, getNodeIndex(node) + 1); + } - function removeNode(node) { - return node.parentNode.removeChild(node); - } + function insertNodeAtPosition (node, n, o) { + var firstNodeInserted = node.nodeType == 11 ? node.firstChild : node; + if (isCharacterDataNode(n)) { + if (o == n.length) { + dom.insertAfter(node, n); + } else { + n.parentNode.insertBefore(node, o == 0 ? n : splitDataNode(n, o)); + } + } else if (o >= n.childNodes.length) { + n.appendChild(node); + } else { + n.insertBefore(node, n.childNodes[o]); + } + return firstNodeInserted; + } - function NodeIterator(root) { - this.root = root; - this._next = root; - } + function rangesIntersect (rangeA, rangeB, touchingIsIntersecting) { + assertRangeValid(rangeA); + assertRangeValid(rangeB); - NodeIterator.prototype = { - _current: null, + if (getRangeDocument(rangeB) != getRangeDocument(rangeA)) { + throw new DOMException('WRONG_DOCUMENT_ERR'); + } - hasNext: function() { - return !!this._next; - }, + var startComparison = comparePoints(rangeA.startContainer, rangeA.startOffset, rangeB.endContainer, rangeB.endOffset), + endComparison = comparePoints(rangeA.endContainer, rangeA.endOffset, rangeB.startContainer, rangeB.startOffset); - next: function() { - var n = this._current = this._next; - var child, next; - if (this._current) { - child = n.firstChild; - if (child) { - this._next = child; - } else { - next = null; - while ((n !== this.root) && !(next = n.nextSibling)) { - n = n.parentNode; - } - this._next = next; - } - } - return this._current; - }, + return touchingIsIntersecting ? startComparison <= 0 && endComparison >= 0 : startComparison < 0 && endComparison > 0; + } - detach: function() { - this._current = this._next = this.root = null; - } - }; + function cloneSubtree (iterator) { + var partiallySelected; + for (var node, frag = getRangeDocument(iterator.range).createDocumentFragment(), subIterator; node = iterator.next();) { + partiallySelected = iterator.isPartiallySelectedSubtree(); + node = node.cloneNode(!partiallySelected); + if (partiallySelected) { + subIterator = iterator.getSubtreeIterator(); + node.appendChild(cloneSubtree(subIterator)); + subIterator.detach(); + } - function createIterator(root) { - return new NodeIterator(root); + if (node.nodeType == 10) { // DocumentType + throw new DOMException('HIERARCHY_REQUEST_ERR'); } + frag.appendChild(node); + } + return frag; + } - function DomPosition(node, offset) { - this.node = node; - this.offset = offset; + function iterateSubtree (rangeIterator, func, iteratorState) { + var it, n; + iteratorState = iteratorState || { stop: false }; + for (var node, subRangeIterator; node = rangeIterator.next();) { + if (rangeIterator.isPartiallySelectedSubtree()) { + if (func(node) === false) { + iteratorState.stop = true; + return; + } else { + // The node is partially selected by the Range, so we can use a new RangeIterator on the portion of + // the node selected by the Range. + subRangeIterator = rangeIterator.getSubtreeIterator(); + iterateSubtree(subRangeIterator, func, iteratorState); + subRangeIterator.detach(); + if (iteratorState.stop) { + return; + } + } + } else { + // The whole node is selected, so we can use efficient DOM iteration to iterate over the node and its + // descendants + it = dom.createIterator(node); + while ((n = it.next())) { + if (func(n) === false) { + iteratorState.stop = true; + return; + } + } } + } + } - DomPosition.prototype = { - equals: function(pos) { - return !!pos && this.node === pos.node && this.offset == pos.offset; - }, + function deleteSubtree (iterator) { + var subIterator; + while (iterator.next()) { + if (iterator.isPartiallySelectedSubtree()) { + subIterator = iterator.getSubtreeIterator(); + deleteSubtree(subIterator); + subIterator.detach(); + } else { + iterator.remove(); + } + } + } - inspect: function() { - return "[DomPosition(" + inspectNode(this.node) + ":" + this.offset + ")]"; - }, + function extractSubtree (iterator) { + for (var node, frag = getRangeDocument(iterator.range).createDocumentFragment(), subIterator; node = iterator.next();) { + if (iterator.isPartiallySelectedSubtree()) { + node = node.cloneNode(false); + subIterator = iterator.getSubtreeIterator(); + node.appendChild(extractSubtree(subIterator)); + subIterator.detach(); + } else { + iterator.remove(); + } + if (node.nodeType == 10) { // DocumentType + throw new DOMException('HIERARCHY_REQUEST_ERR'); + } + frag.appendChild(node); + } + return frag; + } - toString: function() { - return this.inspect(); - } - }; + function getNodesInRange (range, nodeTypes, filter) { + var filterNodeTypes = !!(nodeTypes && nodeTypes.length), regex; + var filterExists = !!filter; + if (filterNodeTypes) { + regex = new RegExp('^(' + nodeTypes.join('|') + ')$'); + } - function DOMException(codeName) { - this.code = this[codeName]; - this.codeName = codeName; - this.message = "DOMException: " + this.codeName; - } - - DOMException.prototype = { - INDEX_SIZE_ERR: 1, - HIERARCHY_REQUEST_ERR: 3, - WRONG_DOCUMENT_ERR: 4, - NO_MODIFICATION_ALLOWED_ERR: 7, - NOT_FOUND_ERR: 8, - NOT_SUPPORTED_ERR: 9, - INVALID_STATE_ERR: 11, - INVALID_NODE_TYPE_ERR: 24 - }; - - DOMException.prototype.toString = function() { - return this.message; - }; - - api.dom = { - arrayContains: arrayContains, - isHtmlNamespace: isHtmlNamespace, - parentElement: parentElement, - getNodeIndex: getNodeIndex, - getNodeLength: getNodeLength, - getCommonAncestor: getCommonAncestor, - isAncestorOf: isAncestorOf, - isOrIsAncestorOf: isOrIsAncestorOf, - getClosestAncestorIn: getClosestAncestorIn, - isCharacterDataNode: isCharacterDataNode, - isTextOrCommentNode: isTextOrCommentNode, - insertAfter: insertAfter, - splitDataNode: splitDataNode, - getDocument: getDocument, - getWindow: getWindow, - getIframeWindow: getIframeWindow, - getIframeDocument: getIframeDocument, - getBody: getBody, - isWindow: isWindow, - getContentDocument: getContentDocument, - getRootContainer: getRootContainer, - comparePoints: comparePoints, - isBrokenNode: isBrokenNode, - inspectNode: inspectNode, - getComputedStyleProperty: getComputedStyleProperty, - createTestElement: createTestElement, - removeNode: removeNode, - fragmentFromNodeChildren: fragmentFromNodeChildren, - createIterator: createIterator, - DomPosition: DomPosition - }; + var nodes = []; + iterateSubtree(new RangeIterator(range, false), function (node) { + if (filterNodeTypes && !regex.test(node.nodeType)) { + return; + } + if (filterExists && !filter(node)) { + return; + } + // Don't include a boundary container if it is a character data node and the range does not contain any + // of its character data. See issue 190. + var sc = range.startContainer; + if (node == sc && isCharacterDataNode(sc) && range.startOffset == sc.length) { + return; + } - api.DOMException = DOMException; - }); + var ec = range.endContainer; + if (node == ec && isCharacterDataNode(ec) && range.endOffset == 0) { + return; + } - /*----------------------------------------------------------------------------------------------------------------*/ + nodes.push(node); + }); + return nodes; + } - // Pure JavaScript implementation of DOM Range - api.createCoreModule("DomRange", ["DomUtil"], function(api, module) { - var dom = api.dom; - var util = api.util; - var DomPosition = dom.DomPosition; - var DOMException = api.DOMException; + function inspect (range) { + var name = (typeof range.getName === 'undefined') ? 'Range' : range.getName(); + return '[' + name + '(' + dom.inspectNode(range.startContainer) + ':' + range.startOffset + ', ' + + dom.inspectNode(range.endContainer) + ':' + range.endOffset + ')]'; + } - var isCharacterDataNode = dom.isCharacterDataNode; - var getNodeIndex = dom.getNodeIndex; - var isOrIsAncestorOf = dom.isOrIsAncestorOf; - var getDocument = dom.getDocument; - var comparePoints = dom.comparePoints; - var splitDataNode = dom.splitDataNode; - var getClosestAncestorIn = dom.getClosestAncestorIn; - var getNodeLength = dom.getNodeLength; - var arrayContains = dom.arrayContains; - var getRootContainer = dom.getRootContainer; - var crashyTextNodes = api.features.crashyTextNodes; + /* ---------------------------------------------------------------------------------------------------------------- */ - var removeNode = dom.removeNode; + // RangeIterator code partially borrows from IERange by Tim Ryan (http://github.com/timcameronryan/IERange) - /*----------------------------------------------------------------------------------------------------------------*/ + function RangeIterator (range, clonePartiallySelectedTextNodes) { + this.range = range; + this.clonePartiallySelectedTextNodes = clonePartiallySelectedTextNodes; - // Utility functions + if (!range.collapsed) { + this.sc = range.startContainer; + this.so = range.startOffset; + this.ec = range.endContainer; + this.eo = range.endOffset; + var root = range.commonAncestorContainer; - function isNonTextPartiallySelected(node, range) { - return (node.nodeType != 3) && - (isOrIsAncestorOf(node, range.startContainer) || isOrIsAncestorOf(node, range.endContainer)); + if (this.sc === this.ec && isCharacterDataNode(this.sc)) { + this.isSingleCharacterDataNode = true; + this._first = this._last = this._next = this.sc; + } else { + this._first = this._next = (this.sc === root && !isCharacterDataNode(this.sc)) + ? this.sc.childNodes[this.so] : getClosestAncestorIn(this.sc, root, true); + this._last = (this.ec === root && !isCharacterDataNode(this.ec)) + ? this.ec.childNodes[this.eo - 1] : getClosestAncestorIn(this.ec, root, true); } + } + } - function getRangeDocument(range) { - return range.document || getDocument(range.startContainer); - } + RangeIterator.prototype = { + _current: null, + _next: null, + _first: null, + _last: null, + isSingleCharacterDataNode: false, - function getRangeRoot(range) { - return getRootContainer(range.startContainer); - } + reset: function () { + this._current = null; + this._next = this._first; + }, - function getBoundaryBeforeNode(node) { - return new DomPosition(node.parentNode, getNodeIndex(node)); - } + hasNext: function () { + return !!this._next; + }, - function getBoundaryAfterNode(node) { - return new DomPosition(node.parentNode, getNodeIndex(node) + 1); - } + next: function () { + // Move to next node + var current = this._current = this._next; + if (current) { + this._next = (current !== this._last) ? current.nextSibling : null; - function insertNodeAtPosition(node, n, o) { - var firstNodeInserted = node.nodeType == 11 ? node.firstChild : node; - if (isCharacterDataNode(n)) { - if (o == n.length) { - dom.insertAfter(node, n); - } else { - n.parentNode.insertBefore(node, o == 0 ? n : splitDataNode(n, o)); - } - } else if (o >= n.childNodes.length) { - n.appendChild(node); - } else { - n.insertBefore(node, n.childNodes[o]); + // Check for partially selected text nodes + if (isCharacterDataNode(current) && this.clonePartiallySelectedTextNodes) { + if (current === this.ec) { + (current = current.cloneNode(true)).deleteData(this.eo, current.length - this.eo); + } + if (this._current === this.sc) { + (current = current.cloneNode(true)).deleteData(0, this.so); } - return firstNodeInserted; + } } - function rangesIntersect(rangeA, rangeB, touchingIsIntersecting) { - assertRangeValid(rangeA); - assertRangeValid(rangeB); + return current; + }, - if (getRangeDocument(rangeB) != getRangeDocument(rangeA)) { - throw new DOMException("WRONG_DOCUMENT_ERR"); - } + remove: function () { + var current = this._current, start, end; - var startComparison = comparePoints(rangeA.startContainer, rangeA.startOffset, rangeB.endContainer, rangeB.endOffset), - endComparison = comparePoints(rangeA.endContainer, rangeA.endOffset, rangeB.startContainer, rangeB.startOffset); + if (isCharacterDataNode(current) && (current === this.sc || current === this.ec)) { + start = (current === this.sc) ? this.so : 0; + end = (current === this.ec) ? this.eo : current.length; + if (start != end) { + current.deleteData(start, end - start); + } + } else { + if (current.parentNode) { + removeNode(current); + } else { + } + } + }, + + // Checks if the current node is partially selected + isPartiallySelectedSubtree: function () { + var current = this._current; + return isNonTextPartiallySelected(current, this.range); + }, + + getSubtreeIterator: function () { + var subRange; + if (this.isSingleCharacterDataNode) { + subRange = this.range.cloneRange(); + subRange.collapse(false); + } else { + subRange = new Range(getRangeDocument(this.range)); + var current = this._current; + var startContainer = current, startOffset = 0, endContainer = current, endOffset = getNodeLength(current); + + if (isOrIsAncestorOf(current, this.sc)) { + startContainer = this.sc; + startOffset = this.so; + } + if (isOrIsAncestorOf(current, this.ec)) { + endContainer = this.ec; + endOffset = this.eo; + } + + updateBoundaries(subRange, startContainer, startOffset, endContainer, endOffset); + } + return new RangeIterator(subRange, this.clonePartiallySelectedTextNodes); + }, + + detach: function () { + this.range = this._current = this._next = this._first = this._last = this.sc = this.so = this.ec = this.eo = null; + } + }; - return touchingIsIntersecting ? startComparison <= 0 && endComparison >= 0 : startComparison < 0 && endComparison > 0; - } + /* ---------------------------------------------------------------------------------------------------------------- */ + + var beforeAfterNodeTypes = [1, 3, 4, 5, 7, 8, 10]; + var rootContainerNodeTypes = [2, 9, 11]; + var readonlyNodeTypes = [5, 6, 10, 12]; + var insertableNodeTypes = [1, 3, 4, 5, 7, 8, 10, 11]; + var surroundNodeTypes = [1, 3, 4, 5, 7, 8]; + + function createAncestorFinder (nodeTypes) { + return function (node, selfIsAncestor) { + var t, n = selfIsAncestor ? node : node.parentNode; + while (n) { + t = n.nodeType; + if (arrayContains(nodeTypes, t)) { + return n; + } + n = n.parentNode; + } + return null; + }; + } - function cloneSubtree(iterator) { - var partiallySelected; - for (var node, frag = getRangeDocument(iterator.range).createDocumentFragment(), subIterator; node = iterator.next(); ) { - partiallySelected = iterator.isPartiallySelectedSubtree(); - node = node.cloneNode(!partiallySelected); - if (partiallySelected) { - subIterator = iterator.getSubtreeIterator(); - node.appendChild(cloneSubtree(subIterator)); - subIterator.detach(); - } + var getDocumentOrFragmentContainer = createAncestorFinder([9, 11]); + var getReadonlyAncestor = createAncestorFinder(readonlyNodeTypes); + var getDocTypeNotationEntityAncestor = createAncestorFinder([6, 10, 12]); - if (node.nodeType == 10) { // DocumentType - throw new DOMException("HIERARCHY_REQUEST_ERR"); - } - frag.appendChild(node); - } - return frag; - } + function assertNoDocTypeNotationEntityAncestor (node, allowSelf) { + if (getDocTypeNotationEntityAncestor(node, allowSelf)) { + throw new DOMException('INVALID_NODE_TYPE_ERR'); + } + } - function iterateSubtree(rangeIterator, func, iteratorState) { - var it, n; - iteratorState = iteratorState || { stop: false }; - for (var node, subRangeIterator; node = rangeIterator.next(); ) { - if (rangeIterator.isPartiallySelectedSubtree()) { - if (func(node) === false) { - iteratorState.stop = true; - return; - } else { - // The node is partially selected by the Range, so we can use a new RangeIterator on the portion of - // the node selected by the Range. - subRangeIterator = rangeIterator.getSubtreeIterator(); - iterateSubtree(subRangeIterator, func, iteratorState); - subRangeIterator.detach(); - if (iteratorState.stop) { - return; - } - } - } else { - // The whole node is selected, so we can use efficient DOM iteration to iterate over the node and its - // descendants - it = dom.createIterator(node); - while ( (n = it.next()) ) { - if (func(n) === false) { - iteratorState.stop = true; - return; - } - } - } - } - } + function assertValidNodeType (node, invalidTypes) { + if (!arrayContains(invalidTypes, node.nodeType)) { + throw new DOMException('INVALID_NODE_TYPE_ERR'); + } + } - function deleteSubtree(iterator) { - var subIterator; - while (iterator.next()) { - if (iterator.isPartiallySelectedSubtree()) { - subIterator = iterator.getSubtreeIterator(); - deleteSubtree(subIterator); - subIterator.detach(); - } else { - iterator.remove(); - } - } - } + function assertValidOffset (node, offset) { + if (offset < 0 || offset > (isCharacterDataNode(node) ? node.length : node.childNodes.length)) { + throw new DOMException('INDEX_SIZE_ERR'); + } + } - function extractSubtree(iterator) { - for (var node, frag = getRangeDocument(iterator.range).createDocumentFragment(), subIterator; node = iterator.next(); ) { + function assertSameDocumentOrFragment (node1, node2) { + if (getDocumentOrFragmentContainer(node1, true) !== getDocumentOrFragmentContainer(node2, true)) { + throw new DOMException('WRONG_DOCUMENT_ERR'); + } + } - if (iterator.isPartiallySelectedSubtree()) { - node = node.cloneNode(false); - subIterator = iterator.getSubtreeIterator(); - node.appendChild(extractSubtree(subIterator)); - subIterator.detach(); - } else { - iterator.remove(); - } - if (node.nodeType == 10) { // DocumentType - throw new DOMException("HIERARCHY_REQUEST_ERR"); - } - frag.appendChild(node); - } - return frag; - } + function assertNodeNotReadOnly (node) { + if (getReadonlyAncestor(node, true)) { + throw new DOMException('NO_MODIFICATION_ALLOWED_ERR'); + } + } - function getNodesInRange(range, nodeTypes, filter) { - var filterNodeTypes = !!(nodeTypes && nodeTypes.length), regex; - var filterExists = !!filter; - if (filterNodeTypes) { - regex = new RegExp("^(" + nodeTypes.join("|") + ")$"); - } + function assertNode (node, codeName) { + if (!node) { + throw new DOMException(codeName); + } + } - var nodes = []; - iterateSubtree(new RangeIterator(range, false), function(node) { - if (filterNodeTypes && !regex.test(node.nodeType)) { - return; - } - if (filterExists && !filter(node)) { - return; - } - // Don't include a boundary container if it is a character data node and the range does not contain any - // of its character data. See issue 190. - var sc = range.startContainer; - if (node == sc && isCharacterDataNode(sc) && range.startOffset == sc.length) { - return; - } + function isValidOffset (node, offset) { + return offset <= (isCharacterDataNode(node) ? node.length : node.childNodes.length); + } - var ec = range.endContainer; - if (node == ec && isCharacterDataNode(ec) && range.endOffset == 0) { - return; - } + function isRangeValid (range) { + return (!!range.startContainer && !!range.endContainer && + !(crashyTextNodes && (dom.isBrokenNode(range.startContainer) || dom.isBrokenNode(range.endContainer))) && + getRootContainer(range.startContainer) == getRootContainer(range.endContainer) && + isValidOffset(range.startContainer, range.startOffset) && + isValidOffset(range.endContainer, range.endOffset)); + } - nodes.push(node); - }); - return nodes; - } + function assertRangeValid (range) { + if (!isRangeValid(range)) { + throw new Error('Range error: Range is not valid. This usually happens after DOM mutation. Range: (' + range.inspect() + ')'); + } + } - function inspect(range) { - var name = (typeof range.getName == "undefined") ? "Range" : range.getName(); - return "[" + name + "(" + dom.inspectNode(range.startContainer) + ":" + range.startOffset + ", " + - dom.inspectNode(range.endContainer) + ":" + range.endOffset + ")]"; - } + /* ---------------------------------------------------------------------------------------------------------------- */ - /*----------------------------------------------------------------------------------------------------------------*/ + // Test the browser's innerHTML support to decide how to implement createContextualFragment + var styleEl = document.createElement('style'); + var htmlParsingConforms = false; + try { + styleEl.innerHTML = 'x'; + htmlParsingConforms = (styleEl.firstChild.nodeType == 3); // Opera incorrectly creates an element node + } catch (e) { + // IE 6 and 7 throw + } - // RangeIterator code partially borrows from IERange by Tim Ryan (http://github.com/timcameronryan/IERange) + api.features.htmlParsingConforms = htmlParsingConforms; - function RangeIterator(range, clonePartiallySelectedTextNodes) { - this.range = range; - this.clonePartiallySelectedTextNodes = clonePartiallySelectedTextNodes; + var createContextualFragment = htmlParsingConforms + // Implementation as per HTML parsing spec, trusting in the browser's implementation of innerHTML. See + // discussion and base code for this implementation at issue 67. + // Spec: http://html5.org/specs/dom-parsing.html#extensions-to-the-range-interface + // Thanks to Aleks Williams. + ? function (fragmentStr) { + // "Let node the context object's start's node." + var node = this.startContainer; + var doc = getDocument(node); - if (!range.collapsed) { - this.sc = range.startContainer; - this.so = range.startOffset; - this.ec = range.endContainer; - this.eo = range.endOffset; - var root = range.commonAncestorContainer; + // "If the context object's start's node is null, raise an INVALID_STATE_ERR + // exception and abort these steps." + if (!node) { + throw new DOMException('INVALID_STATE_ERR'); + } - if (this.sc === this.ec && isCharacterDataNode(this.sc)) { - this.isSingleCharacterDataNode = true; - this._first = this._last = this._next = this.sc; - } else { - this._first = this._next = (this.sc === root && !isCharacterDataNode(this.sc)) ? - this.sc.childNodes[this.so] : getClosestAncestorIn(this.sc, root, true); - this._last = (this.ec === root && !isCharacterDataNode(this.ec)) ? - this.ec.childNodes[this.eo - 1] : getClosestAncestorIn(this.ec, root, true); - } - } + // "Let element be as follows, depending on node's interface:" + // Document, Document Fragment: null + var el = null; + + // "Element: node" + if (node.nodeType == 1) { + el = node; + + // "Text, Comment: node's parentElement" + } else if (isCharacterDataNode(node)) { + el = dom.parentElement(node); } - RangeIterator.prototype = { - _current: null, - _next: null, - _first: null, - _last: null, - isSingleCharacterDataNode: false, - - reset: function() { - this._current = null; - this._next = this._first; - }, - - hasNext: function() { - return !!this._next; - }, - - next: function() { - // Move to next node - var current = this._current = this._next; - if (current) { - this._next = (current !== this._last) ? current.nextSibling : null; - - // Check for partially selected text nodes - if (isCharacterDataNode(current) && this.clonePartiallySelectedTextNodes) { - if (current === this.ec) { - (current = current.cloneNode(true)).deleteData(this.eo, current.length - this.eo); - } - if (this._current === this.sc) { - (current = current.cloneNode(true)).deleteData(0, this.so); - } - } - } + // "If either element is null or element's ownerDocument is an HTML document + // and element's local name is "html" and element's namespace is the HTML + // namespace" + if (el === null || ( + el.nodeName == 'HTML' && + dom.isHtmlNamespace(getDocument(el).documentElement) && + dom.isHtmlNamespace(el) + )) { + // "let element be a new Element with "body" as its local name and the HTML + // namespace as its namespace."" + el = doc.createElement('body'); + } else { + el = el.cloneNode(false); + } + + // "If the node's document is an HTML document: Invoke the HTML fragment parsing algorithm." + // "If the node's document is an XML document: Invoke the XML fragment parsing algorithm." + // "In either case, the algorithm must be invoked with fragment as the input + // and element as the context element." + el.innerHTML = fragmentStr; + + // "If this raises an exception, then abort these steps. Otherwise, let new + // children be the nodes returned." + + // "Let fragment be a new DocumentFragment." + // "Append all new children to fragment." + // "Return fragment." + return dom.fragmentFromNodeChildren(el); + } + + // In this case, innerHTML cannot be trusted, so fall back to a simpler, non-conformant implementation that + // previous versions of Rangy used (with the exception of using a body element rather than a div) + : function (fragmentStr) { + var doc = getRangeDocument(this); + var el = doc.createElement('body'); + el.innerHTML = fragmentStr; + + return dom.fragmentFromNodeChildren(el); + }; + + function splitRangeBoundaries (range, positionsToPreserve) { + assertRangeValid(range); + + var sc = range.startContainer, so = range.startOffset, ec = range.endContainer, eo = range.endOffset; + var startEndSame = (sc === ec); + + if (isCharacterDataNode(ec) && eo > 0 && eo < ec.length) { + splitDataNode(ec, eo, positionsToPreserve); + } + + if (isCharacterDataNode(sc) && so > 0 && so < sc.length) { + sc = splitDataNode(sc, so, positionsToPreserve); + if (startEndSame) { + eo -= so; + ec = sc; + } else if (ec == sc.parentNode && eo >= getNodeIndex(sc)) { + eo++; + } + so = 0; + } + range.setStartAndEnd(sc, so, ec, eo); + } - return current; - }, - - remove: function() { - var current = this._current, start, end; - - if (isCharacterDataNode(current) && (current === this.sc || current === this.ec)) { - start = (current === this.sc) ? this.so : 0; - end = (current === this.ec) ? this.eo : current.length; - if (start != end) { - current.deleteData(start, end - start); - } - } else { - if (current.parentNode) { - removeNode(current); - } else { - } - } - }, - - // Checks if the current node is partially selected - isPartiallySelectedSubtree: function() { - var current = this._current; - return isNonTextPartiallySelected(current, this.range); - }, - - getSubtreeIterator: function() { - var subRange; - if (this.isSingleCharacterDataNode) { - subRange = this.range.cloneRange(); - subRange.collapse(false); - } else { - subRange = new Range(getRangeDocument(this.range)); - var current = this._current; - var startContainer = current, startOffset = 0, endContainer = current, endOffset = getNodeLength(current); - - if (isOrIsAncestorOf(current, this.sc)) { - startContainer = this.sc; - startOffset = this.so; - } - if (isOrIsAncestorOf(current, this.ec)) { - endContainer = this.ec; - endOffset = this.eo; - } - - updateBoundaries(subRange, startContainer, startOffset, endContainer, endOffset); - } - return new RangeIterator(subRange, this.clonePartiallySelectedTextNodes); - }, + function rangeToHtml (range) { + assertRangeValid(range); + var container = range.commonAncestorContainer.parentNode.cloneNode(false); + container.appendChild(range.cloneContents()); + return container.innerHTML; + } - detach: function() { - this.range = this._current = this._next = this._first = this._last = this.sc = this.so = this.ec = this.eo = null; - } - }; + /* ---------------------------------------------------------------------------------------------------------------- */ - /*----------------------------------------------------------------------------------------------------------------*/ - - var beforeAfterNodeTypes = [1, 3, 4, 5, 7, 8, 10]; - var rootContainerNodeTypes = [2, 9, 11]; - var readonlyNodeTypes = [5, 6, 10, 12]; - var insertableNodeTypes = [1, 3, 4, 5, 7, 8, 10, 11]; - var surroundNodeTypes = [1, 3, 4, 5, 7, 8]; - - function createAncestorFinder(nodeTypes) { - return function(node, selfIsAncestor) { - var t, n = selfIsAncestor ? node : node.parentNode; - while (n) { - t = n.nodeType; - if (arrayContains(nodeTypes, t)) { - return n; - } - n = n.parentNode; - } - return null; - }; - } + var rangeProperties = ['startContainer', 'startOffset', 'endContainer', 'endOffset', 'collapsed', + 'commonAncestorContainer']; - var getDocumentOrFragmentContainer = createAncestorFinder( [9, 11] ); - var getReadonlyAncestor = createAncestorFinder(readonlyNodeTypes); - var getDocTypeNotationEntityAncestor = createAncestorFinder( [6, 10, 12] ); + var s2s = 0, s2e = 1, e2e = 2, e2s = 3; + var n_b = 0, n_a = 1, n_b_a = 2, n_i = 3; - function assertNoDocTypeNotationEntityAncestor(node, allowSelf) { - if (getDocTypeNotationEntityAncestor(node, allowSelf)) { - throw new DOMException("INVALID_NODE_TYPE_ERR"); - } - } + util.extend(api.rangePrototype, { + compareBoundaryPoints: function (how, range) { + assertRangeValid(this); + assertSameDocumentOrFragment(this.startContainer, range.startContainer); - function assertValidNodeType(node, invalidTypes) { - if (!arrayContains(invalidTypes, node.nodeType)) { - throw new DOMException("INVALID_NODE_TYPE_ERR"); - } - } + var nodeA, offsetA, nodeB, offsetB; + var prefixA = (how == e2s || how == s2s) ? 'start' : 'end'; + var prefixB = (how == s2e || how == s2s) ? 'start' : 'end'; + nodeA = this[prefixA + 'Container']; + offsetA = this[prefixA + 'Offset']; + nodeB = range[prefixB + 'Container']; + offsetB = range[prefixB + 'Offset']; + return comparePoints(nodeA, offsetA, nodeB, offsetB); + }, - function assertValidOffset(node, offset) { - if (offset < 0 || offset > (isCharacterDataNode(node) ? node.length : node.childNodes.length)) { - throw new DOMException("INDEX_SIZE_ERR"); - } - } + insertNode: function (node) { + assertRangeValid(this); + assertValidNodeType(node, insertableNodeTypes); + assertNodeNotReadOnly(this.startContainer); - function assertSameDocumentOrFragment(node1, node2) { - if (getDocumentOrFragmentContainer(node1, true) !== getDocumentOrFragmentContainer(node2, true)) { - throw new DOMException("WRONG_DOCUMENT_ERR"); - } + if (isOrIsAncestorOf(node, this.startContainer)) { + throw new DOMException('HIERARCHY_REQUEST_ERR'); } - function assertNodeNotReadOnly(node) { - if (getReadonlyAncestor(node, true)) { - throw new DOMException("NO_MODIFICATION_ALLOWED_ERR"); - } - } + // No check for whether the container of the start of the Range is of a type that does not allow + // children of the type of node: the browser's DOM implementation should do this for us when we attempt + // to add the node - function assertNode(node, codeName) { - if (!node) { - throw new DOMException(codeName); - } - } + var firstNodeInserted = insertNodeAtPosition(node, this.startContainer, this.startOffset); + this.setStartBefore(firstNodeInserted); + }, - function isValidOffset(node, offset) { - return offset <= (isCharacterDataNode(node) ? node.length : node.childNodes.length); - } + cloneContents: function () { + assertRangeValid(this); - function isRangeValid(range) { - return (!!range.startContainer && !!range.endContainer && - !(crashyTextNodes && (dom.isBrokenNode(range.startContainer) || dom.isBrokenNode(range.endContainer))) && - getRootContainer(range.startContainer) == getRootContainer(range.endContainer) && - isValidOffset(range.startContainer, range.startOffset) && - isValidOffset(range.endContainer, range.endOffset)); - } + var clone, frag; + if (this.collapsed) { + return getRangeDocument(this).createDocumentFragment(); + } else { + if (this.startContainer === this.endContainer && isCharacterDataNode(this.startContainer)) { + clone = this.startContainer.cloneNode(true); + clone.data = clone.data.slice(this.startOffset, this.endOffset); + frag = getRangeDocument(this).createDocumentFragment(); + frag.appendChild(clone); + return frag; + } else { + var iterator = new RangeIterator(this, true); + clone = cloneSubtree(iterator); + iterator.detach(); + } + return clone; + } + }, + + canSurroundContents: function () { + assertRangeValid(this); + assertNodeNotReadOnly(this.startContainer); + assertNodeNotReadOnly(this.endContainer); + + // Check if the contents can be surrounded. Specifically, this means whether the range partially selects + // no non-text nodes. + var iterator = new RangeIterator(this, true); + var boundariesInvalid = (iterator._first && (isNonTextPartiallySelected(iterator._first, this)) || + (iterator._last && isNonTextPartiallySelected(iterator._last, this))); + iterator.detach(); + return !boundariesInvalid; + }, - function assertRangeValid(range) { - if (!isRangeValid(range)) { - throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: (" + range.inspect() + ")"); - } + surroundContents: function (node) { + assertValidNodeType(node, surroundNodeTypes); + + if (!this.canSurroundContents()) { + throw new DOMException('INVALID_STATE_ERR'); } - /*----------------------------------------------------------------------------------------------------------------*/ + // Extract the contents + var content = this.extractContents(); - // Test the browser's innerHTML support to decide how to implement createContextualFragment - var styleEl = document.createElement("style"); - var htmlParsingConforms = false; - try { - styleEl.innerHTML = "x"; - htmlParsingConforms = (styleEl.firstChild.nodeType == 3); // Opera incorrectly creates an element node - } catch (e) { - // IE 6 and 7 throw + // Clear the children of the node + if (node.hasChildNodes()) { + while (node.lastChild) { + node.removeChild(node.lastChild); + } } - api.features.htmlParsingConforms = htmlParsingConforms; + // Insert the new node and add the extracted contents + insertNodeAtPosition(node, this.startContainer, this.startOffset); + node.appendChild(content); - var createContextualFragment = htmlParsingConforms ? + this.selectNode(node); + }, - // Implementation as per HTML parsing spec, trusting in the browser's implementation of innerHTML. See - // discussion and base code for this implementation at issue 67. - // Spec: http://html5.org/specs/dom-parsing.html#extensions-to-the-range-interface - // Thanks to Aleks Williams. - function(fragmentStr) { - // "Let node the context object's start's node." - var node = this.startContainer; - var doc = getDocument(node); + cloneRange: function () { + assertRangeValid(this); + var range = new Range(getRangeDocument(this)); + var i = rangeProperties.length, prop; + while (i--) { + prop = rangeProperties[i]; + range[prop] = this[prop]; + } + return range; + }, - // "If the context object's start's node is null, raise an INVALID_STATE_ERR - // exception and abort these steps." - if (!node) { - throw new DOMException("INVALID_STATE_ERR"); - } + toString: function () { + assertRangeValid(this); + var sc = this.startContainer; + if (sc === this.endContainer && isCharacterDataNode(sc)) { + return (sc.nodeType == 3 || sc.nodeType == 4) ? sc.data.slice(this.startOffset, this.endOffset) : ''; + } else { + var textParts = [], iterator = new RangeIterator(this, true); + iterateSubtree(iterator, function (node) { + // Accept only text or CDATA nodes, not comments + if (node.nodeType == 3 || node.nodeType == 4) { + textParts.push(node.data); + } + }); + iterator.detach(); + return textParts.join(''); + } + }, - // "Let element be as follows, depending on node's interface:" - // Document, Document Fragment: null - var el = null; + // The methods below are all non-standard. The following batch were introduced by Mozilla but have since + // been removed from Mozilla. - // "Element: node" - if (node.nodeType == 1) { - el = node; + compareNode: function (node) { + assertRangeValid(this); - // "Text, Comment: node's parentElement" - } else if (isCharacterDataNode(node)) { - el = dom.parentElement(node); - } + var parent = node.parentNode; + var nodeIndex = getNodeIndex(node); - // "If either element is null or element's ownerDocument is an HTML document - // and element's local name is "html" and element's namespace is the HTML - // namespace" - if (el === null || ( - el.nodeName == "HTML" && - dom.isHtmlNamespace(getDocument(el).documentElement) && - dom.isHtmlNamespace(el) - )) { + if (!parent) { + throw new DOMException('NOT_FOUND_ERR'); + } - // "let element be a new Element with "body" as its local name and the HTML - // namespace as its namespace."" - el = doc.createElement("body"); - } else { - el = el.cloneNode(false); - } + var startComparison = this.comparePoint(parent, nodeIndex), + endComparison = this.comparePoint(parent, nodeIndex + 1); - // "If the node's document is an HTML document: Invoke the HTML fragment parsing algorithm." - // "If the node's document is an XML document: Invoke the XML fragment parsing algorithm." - // "In either case, the algorithm must be invoked with fragment as the input - // and element as the context element." - el.innerHTML = fragmentStr; - - // "If this raises an exception, then abort these steps. Otherwise, let new - // children be the nodes returned." - - // "Let fragment be a new DocumentFragment." - // "Append all new children to fragment." - // "Return fragment." - return dom.fragmentFromNodeChildren(el); - } : - - // In this case, innerHTML cannot be trusted, so fall back to a simpler, non-conformant implementation that - // previous versions of Rangy used (with the exception of using a body element rather than a div) - function(fragmentStr) { - var doc = getRangeDocument(this); - var el = doc.createElement("body"); - el.innerHTML = fragmentStr; - - return dom.fragmentFromNodeChildren(el); - }; + if (startComparison < 0) { // Node starts before + return (endComparison > 0) ? n_b_a : n_b; + } else { + return (endComparison > 0) ? n_a : n_i; + } + }, + + comparePoint: function (node, offset) { + assertRangeValid(this); + assertNode(node, 'HIERARCHY_REQUEST_ERR'); + assertSameDocumentOrFragment(node, this.startContainer); - function splitRangeBoundaries(range, positionsToPreserve) { - assertRangeValid(range); + if (comparePoints(node, offset, this.startContainer, this.startOffset) < 0) { + return -1; + } else if (comparePoints(node, offset, this.endContainer, this.endOffset) > 0) { + return 1; + } + return 0; + }, - var sc = range.startContainer, so = range.startOffset, ec = range.endContainer, eo = range.endOffset; - var startEndSame = (sc === ec); + createContextualFragment: createContextualFragment, - if (isCharacterDataNode(ec) && eo > 0 && eo < ec.length) { - splitDataNode(ec, eo, positionsToPreserve); - } + toHtml: function () { + return rangeToHtml(this); + }, - if (isCharacterDataNode(sc) && so > 0 && so < sc.length) { - sc = splitDataNode(sc, so, positionsToPreserve); - if (startEndSame) { - eo -= so; - ec = sc; - } else if (ec == sc.parentNode && eo >= getNodeIndex(sc)) { - eo++; - } - so = 0; - } - range.setStartAndEnd(sc, so, ec, eo); + // touchingIsIntersecting determines whether this method considers a node that borders a range intersects + // with it (as in WebKit) or not (as in Gecko pre-1.9, and the default) + intersectsNode: function (node, touchingIsIntersecting) { + assertRangeValid(this); + if (getRootContainer(node) != getRangeRoot(this)) { + return false; } - function rangeToHtml(range) { - assertRangeValid(range); - var container = range.commonAncestorContainer.parentNode.cloneNode(false); - container.appendChild( range.cloneContents() ); - return container.innerHTML; + var parent = node.parentNode, offset = getNodeIndex(node); + if (!parent) { + return true; } - /*----------------------------------------------------------------------------------------------------------------*/ + var startComparison = comparePoints(parent, offset, this.endContainer, this.endOffset), + endComparison = comparePoints(parent, offset + 1, this.startContainer, this.startOffset); - var rangeProperties = ["startContainer", "startOffset", "endContainer", "endOffset", "collapsed", - "commonAncestorContainer"]; + return touchingIsIntersecting ? startComparison <= 0 && endComparison >= 0 : startComparison < 0 && endComparison > 0; + }, - var s2s = 0, s2e = 1, e2e = 2, e2s = 3; - var n_b = 0, n_a = 1, n_b_a = 2, n_i = 3; + isPointInRange: function (node, offset) { + assertRangeValid(this); + assertNode(node, 'HIERARCHY_REQUEST_ERR'); + assertSameDocumentOrFragment(node, this.startContainer); - util.extend(api.rangePrototype, { - compareBoundaryPoints: function(how, range) { - assertRangeValid(this); - assertSameDocumentOrFragment(this.startContainer, range.startContainer); + return (comparePoints(node, offset, this.startContainer, this.startOffset) >= 0) && + (comparePoints(node, offset, this.endContainer, this.endOffset) <= 0); + }, + + // The methods below are non-standard and invented by me. + + // Sharing a boundary start-to-end or end-to-start does not count as intersection. + intersectsRange: function (range) { + return rangesIntersect(this, range, false); + }, + + // Sharing a boundary start-to-end or end-to-start does count as intersection. + intersectsOrTouchesRange: function (range) { + return rangesIntersect(this, range, true); + }, + + intersection: function (range) { + if (this.intersectsRange(range)) { + var startComparison = comparePoints(this.startContainer, this.startOffset, range.startContainer, range.startOffset), + endComparison = comparePoints(this.endContainer, this.endOffset, range.endContainer, range.endOffset); + + var intersectionRange = this.cloneRange(); + if (startComparison == -1) { + intersectionRange.setStart(range.startContainer, range.startOffset); + } + if (endComparison == 1) { + intersectionRange.setEnd(range.endContainer, range.endOffset); + } + return intersectionRange; + } + return null; + }, + + union: function (range) { + if (this.intersectsOrTouchesRange(range)) { + var unionRange = this.cloneRange(); + if (comparePoints(range.startContainer, range.startOffset, this.startContainer, this.startOffset) == -1) { + unionRange.setStart(range.startContainer, range.startOffset); + } + if (comparePoints(range.endContainer, range.endOffset, this.endContainer, this.endOffset) == 1) { + unionRange.setEnd(range.endContainer, range.endOffset); + } + return unionRange; + } else { + throw new DOMException('Ranges do not intersect'); + } + }, - var nodeA, offsetA, nodeB, offsetB; - var prefixA = (how == e2s || how == s2s) ? "start" : "end"; - var prefixB = (how == s2e || how == s2s) ? "start" : "end"; - nodeA = this[prefixA + "Container"]; - offsetA = this[prefixA + "Offset"]; - nodeB = range[prefixB + "Container"]; - offsetB = range[prefixB + "Offset"]; - return comparePoints(nodeA, offsetA, nodeB, offsetB); - }, + containsNode: function (node, allowPartial) { + if (allowPartial) { + return this.intersectsNode(node, false); + } else { + return this.compareNode(node) == n_i; + } + }, + + containsNodeContents: function (node) { + return this.comparePoint(node, 0) >= 0 && this.comparePoint(node, getNodeLength(node)) <= 0; + }, + + containsRange: function (range) { + var intersection = this.intersection(range); + return intersection !== null && range.equals(intersection); + }, + + containsNodeText: function (node) { + var nodeRange = this.cloneRange(); + nodeRange.selectNode(node); + var textNodes = nodeRange.getNodes([3]); + if (textNodes.length > 0) { + nodeRange.setStart(textNodes[0], 0); + var lastTextNode = textNodes.pop(); + nodeRange.setEnd(lastTextNode, lastTextNode.length); + return this.containsRange(nodeRange); + } else { + return this.containsNodeContents(node); + } + }, + + getNodes: function (nodeTypes, filter) { + assertRangeValid(this); + return getNodesInRange(this, nodeTypes, filter); + }, + + getDocument: function () { + return getRangeDocument(this); + }, + + collapseBefore: function (node) { + this.setEndBefore(node); + this.collapse(false); + }, + + collapseAfter: function (node) { + this.setStartAfter(node); + this.collapse(true); + }, + + getBookmark: function (containerNode) { + var doc = getRangeDocument(this); + var preSelectionRange = api.createRange(doc); + containerNode = containerNode || dom.getBody(doc); + preSelectionRange.selectNodeContents(containerNode); + var range = this.intersection(preSelectionRange); + var start = 0, end = 0; + if (range) { + preSelectionRange.setEnd(range.startContainer, range.startOffset); + start = preSelectionRange.toString().length; + end = start + range.toString().length; + } + + return { + start: start, + end: end, + containerNode: containerNode + }; + }, + + moveToBookmark: function (bookmark) { + var containerNode = bookmark.containerNode; + var charIndex = 0; + this.setStart(containerNode, 0); + this.collapse(true); + var nodeStack = [containerNode], node, foundStart = false, stop = false; + var nextCharIndex, i, childNodes; + + while (!stop && (node = nodeStack.pop())) { + if (node.nodeType == 3) { + nextCharIndex = charIndex + node.length; + if (!foundStart && bookmark.start >= charIndex && bookmark.start <= nextCharIndex) { + this.setStart(node, bookmark.start - charIndex); + foundStart = true; + } + if (foundStart && bookmark.end >= charIndex && bookmark.end <= nextCharIndex) { + this.setEnd(node, bookmark.end - charIndex); + stop = true; + } + charIndex = nextCharIndex; + } else { + childNodes = node.childNodes; + i = childNodes.length; + while (i--) { + nodeStack.push(childNodes[i]); + } + } + } + }, - insertNode: function(node) { - assertRangeValid(this); - assertValidNodeType(node, insertableNodeTypes); - assertNodeNotReadOnly(this.startContainer); + getName: function () { + return 'DomRange'; + }, - if (isOrIsAncestorOf(node, this.startContainer)) { - throw new DOMException("HIERARCHY_REQUEST_ERR"); - } + equals: function (range) { + return Range.rangesEqual(this, range); + }, - // No check for whether the container of the start of the Range is of a type that does not allow - // children of the type of node: the browser's DOM implementation should do this for us when we attempt - // to add the node - - var firstNodeInserted = insertNodeAtPosition(node, this.startContainer, this.startOffset); - this.setStartBefore(firstNodeInserted); - }, - - cloneContents: function() { - assertRangeValid(this); - - var clone, frag; - if (this.collapsed) { - return getRangeDocument(this).createDocumentFragment(); - } else { - if (this.startContainer === this.endContainer && isCharacterDataNode(this.startContainer)) { - clone = this.startContainer.cloneNode(true); - clone.data = clone.data.slice(this.startOffset, this.endOffset); - frag = getRangeDocument(this).createDocumentFragment(); - frag.appendChild(clone); - return frag; - } else { - var iterator = new RangeIterator(this, true); - clone = cloneSubtree(iterator); - iterator.detach(); - } - return clone; - } - }, + isValid: function () { + return isRangeValid(this); + }, - canSurroundContents: function() { - assertRangeValid(this); - assertNodeNotReadOnly(this.startContainer); - assertNodeNotReadOnly(this.endContainer); + inspect: function () { + return inspect(this); + }, - // Check if the contents can be surrounded. Specifically, this means whether the range partially selects - // no non-text nodes. - var iterator = new RangeIterator(this, true); - var boundariesInvalid = (iterator._first && (isNonTextPartiallySelected(iterator._first, this)) || - (iterator._last && isNonTextPartiallySelected(iterator._last, this))); - iterator.detach(); - return !boundariesInvalid; - }, + detach: function () { + // In DOM4, detach() is now a no-op. + } + }); - surroundContents: function(node) { - assertValidNodeType(node, surroundNodeTypes); + function copyComparisonConstantsToObject (obj) { + obj.START_TO_START = s2s; + obj.START_TO_END = s2e; + obj.END_TO_END = e2e; + obj.END_TO_START = e2s; - if (!this.canSurroundContents()) { - throw new DOMException("INVALID_STATE_ERR"); - } + obj.NODE_BEFORE = n_b; + obj.NODE_AFTER = n_a; + obj.NODE_BEFORE_AND_AFTER = n_b_a; + obj.NODE_INSIDE = n_i; + } - // Extract the contents - var content = this.extractContents(); + function copyComparisonConstants (constructor) { + copyComparisonConstantsToObject(constructor); + copyComparisonConstantsToObject(constructor.prototype); + } - // Clear the children of the node - if (node.hasChildNodes()) { - while (node.lastChild) { - node.removeChild(node.lastChild); - } - } + function createRangeContentRemover (remover, boundaryUpdater) { + return function () { + assertRangeValid(this); - // Insert the new node and add the extracted contents - insertNodeAtPosition(node, this.startContainer, this.startOffset); - node.appendChild(content); + var sc = this.startContainer, so = this.startOffset, root = this.commonAncestorContainer; - this.selectNode(node); - }, + var iterator = new RangeIterator(this, true); - cloneRange: function() { - assertRangeValid(this); - var range = new Range(getRangeDocument(this)); - var i = rangeProperties.length, prop; - while (i--) { - prop = rangeProperties[i]; - range[prop] = this[prop]; - } - return range; - }, - - toString: function() { - assertRangeValid(this); - var sc = this.startContainer; - if (sc === this.endContainer && isCharacterDataNode(sc)) { - return (sc.nodeType == 3 || sc.nodeType == 4) ? sc.data.slice(this.startOffset, this.endOffset) : ""; - } else { - var textParts = [], iterator = new RangeIterator(this, true); - iterateSubtree(iterator, function(node) { - // Accept only text or CDATA nodes, not comments - if (node.nodeType == 3 || node.nodeType == 4) { - textParts.push(node.data); - } - }); - iterator.detach(); - return textParts.join(""); - } - }, + // Work out where to position the range after content removal + var node, boundary; + if (sc !== root) { + node = getClosestAncestorIn(sc, root, true); + boundary = getBoundaryAfterNode(node); + sc = boundary.node; + so = boundary.offset; + } - // The methods below are all non-standard. The following batch were introduced by Mozilla but have since - // been removed from Mozilla. + // Check none of the range is read-only + iterateSubtree(iterator, assertNodeNotReadOnly); - compareNode: function(node) { - assertRangeValid(this); + iterator.reset(); - var parent = node.parentNode; - var nodeIndex = getNodeIndex(node); + // Remove the content + var returnValue = remover(iterator); + iterator.detach(); - if (!parent) { - throw new DOMException("NOT_FOUND_ERR"); - } + // Move to the new position + boundaryUpdater(this, sc, so, sc, so); - var startComparison = this.comparePoint(parent, nodeIndex), - endComparison = this.comparePoint(parent, nodeIndex + 1); + return returnValue; + }; + } - if (startComparison < 0) { // Node starts before - return (endComparison > 0) ? n_b_a : n_b; - } else { - return (endComparison > 0) ? n_a : n_i; - } - }, + function createPrototypeRange (constructor, boundaryUpdater) { + function createBeforeAfterNodeSetter (isBefore, isStart) { + return function (node) { + assertValidNodeType(node, beforeAfterNodeTypes); + assertValidNodeType(getRootContainer(node), rootContainerNodeTypes); - comparePoint: function(node, offset) { - assertRangeValid(this); - assertNode(node, "HIERARCHY_REQUEST_ERR"); - assertSameDocumentOrFragment(node, this.startContainer); + var boundary = (isBefore ? getBoundaryBeforeNode : getBoundaryAfterNode)(node); + (isStart ? setRangeStart : setRangeEnd)(this, boundary.node, boundary.offset); + }; + } + + function setRangeStart (range, node, offset) { + var ec = range.endContainer, eo = range.endOffset; + if (node !== range.startContainer || offset !== range.startOffset) { + // Check the root containers of the range and the new boundary, and also check whether the new boundary + // is after the current end. In either case, collapse the range to the new position + if (getRootContainer(node) != getRootContainer(ec) || comparePoints(node, offset, ec, eo) == 1) { + ec = node; + eo = offset; + } + boundaryUpdater(range, node, offset, ec, eo); + } + } + + function setRangeEnd (range, node, offset) { + var sc = range.startContainer, so = range.startOffset; + if (node !== range.endContainer || offset !== range.endOffset) { + // Check the root containers of the range and the new boundary, and also check whether the new boundary + // is after the current end. In either case, collapse the range to the new position + if (getRootContainer(node) != getRootContainer(sc) || comparePoints(node, offset, sc, so) == -1) { + sc = node; + so = offset; + } + boundaryUpdater(range, sc, so, node, offset); + } + } + + // Set up inheritance + var F = function () {}; + F.prototype = api.rangePrototype; + constructor.prototype = new F(); + + util.extend(constructor.prototype, { + setStart: function (node, offset) { + assertNoDocTypeNotationEntityAncestor(node, true); + assertValidOffset(node, offset); + + setRangeStart(this, node, offset); + }, - if (comparePoints(node, offset, this.startContainer, this.startOffset) < 0) { - return -1; - } else if (comparePoints(node, offset, this.endContainer, this.endOffset) > 0) { - return 1; - } - return 0; - }, + setEnd: function (node, offset) { + assertNoDocTypeNotationEntityAncestor(node, true); + assertValidOffset(node, offset); - createContextualFragment: createContextualFragment, + setRangeEnd(this, node, offset); + }, - toHtml: function() { - return rangeToHtml(this); - }, + /** + * Convenience method to set a range's start and end boundaries. Overloaded as follows: + * - Two parameters (node, offset) creates a collapsed range at that position + * - Three parameters (node, startOffset, endOffset) creates a range contained with node starting at + * startOffset and ending at endOffset + * - Four parameters (startNode, startOffset, endNode, endOffset) creates a range starting at startOffset in + * startNode and ending at endOffset in endNode + */ + setStartAndEnd: function () { + var args = arguments; + var sc = args[0], so = args[1], ec = sc, eo = so; + + switch (args.length) { + case 3: + eo = args[2]; + break; + case 4: + ec = args[2]; + eo = args[3]; + break; + } + + boundaryUpdater(this, sc, so, ec, eo); + }, - // touchingIsIntersecting determines whether this method considers a node that borders a range intersects - // with it (as in WebKit) or not (as in Gecko pre-1.9, and the default) - intersectsNode: function(node, touchingIsIntersecting) { - assertRangeValid(this); - if (getRootContainer(node) != getRangeRoot(this)) { - return false; - } + setBoundary: function (node, offset, isStart) { + this['set' + (isStart ? 'Start' : 'End')](node, offset); + }, - var parent = node.parentNode, offset = getNodeIndex(node); - if (!parent) { - return true; - } + setStartBefore: createBeforeAfterNodeSetter(true, true), + setStartAfter: createBeforeAfterNodeSetter(false, true), + setEndBefore: createBeforeAfterNodeSetter(true, false), + setEndAfter: createBeforeAfterNodeSetter(false, false), + + collapse: function (isStart) { + assertRangeValid(this); + if (isStart) { + boundaryUpdater(this, this.startContainer, this.startOffset, this.startContainer, this.startOffset); + } else { + boundaryUpdater(this, this.endContainer, this.endOffset, this.endContainer, this.endOffset); + } + }, - var startComparison = comparePoints(parent, offset, this.endContainer, this.endOffset), - endComparison = comparePoints(parent, offset + 1, this.startContainer, this.startOffset); + selectNodeContents: function (node) { + assertNoDocTypeNotationEntityAncestor(node, true); - return touchingIsIntersecting ? startComparison <= 0 && endComparison >= 0 : startComparison < 0 && endComparison > 0; - }, + boundaryUpdater(this, node, 0, node, getNodeLength(node)); + }, - isPointInRange: function(node, offset) { - assertRangeValid(this); - assertNode(node, "HIERARCHY_REQUEST_ERR"); - assertSameDocumentOrFragment(node, this.startContainer); + selectNode: function (node) { + assertNoDocTypeNotationEntityAncestor(node, false); + assertValidNodeType(node, beforeAfterNodeTypes); - return (comparePoints(node, offset, this.startContainer, this.startOffset) >= 0) && - (comparePoints(node, offset, this.endContainer, this.endOffset) <= 0); - }, - - // The methods below are non-standard and invented by me. - - // Sharing a boundary start-to-end or end-to-start does not count as intersection. - intersectsRange: function(range) { - return rangesIntersect(this, range, false); - }, - - // Sharing a boundary start-to-end or end-to-start does count as intersection. - intersectsOrTouchesRange: function(range) { - return rangesIntersect(this, range, true); - }, - - intersection: function(range) { - if (this.intersectsRange(range)) { - var startComparison = comparePoints(this.startContainer, this.startOffset, range.startContainer, range.startOffset), - endComparison = comparePoints(this.endContainer, this.endOffset, range.endContainer, range.endOffset); - - var intersectionRange = this.cloneRange(); - if (startComparison == -1) { - intersectionRange.setStart(range.startContainer, range.startOffset); - } - if (endComparison == 1) { - intersectionRange.setEnd(range.endContainer, range.endOffset); - } - return intersectionRange; - } - return null; - }, - - union: function(range) { - if (this.intersectsOrTouchesRange(range)) { - var unionRange = this.cloneRange(); - if (comparePoints(range.startContainer, range.startOffset, this.startContainer, this.startOffset) == -1) { - unionRange.setStart(range.startContainer, range.startOffset); - } - if (comparePoints(range.endContainer, range.endOffset, this.endContainer, this.endOffset) == 1) { - unionRange.setEnd(range.endContainer, range.endOffset); - } - return unionRange; - } else { - throw new DOMException("Ranges do not intersect"); - } - }, + var start = getBoundaryBeforeNode(node), end = getBoundaryAfterNode(node); + boundaryUpdater(this, start.node, start.offset, end.node, end.offset); + }, - containsNode: function(node, allowPartial) { - if (allowPartial) { - return this.intersectsNode(node, false); - } else { - return this.compareNode(node) == n_i; - } - }, - - containsNodeContents: function(node) { - return this.comparePoint(node, 0) >= 0 && this.comparePoint(node, getNodeLength(node)) <= 0; - }, - - containsRange: function(range) { - var intersection = this.intersection(range); - return intersection !== null && range.equals(intersection); - }, - - containsNodeText: function(node) { - var nodeRange = this.cloneRange(); - nodeRange.selectNode(node); - var textNodes = nodeRange.getNodes([3]); - if (textNodes.length > 0) { - nodeRange.setStart(textNodes[0], 0); - var lastTextNode = textNodes.pop(); - nodeRange.setEnd(lastTextNode, lastTextNode.length); - return this.containsRange(nodeRange); - } else { - return this.containsNodeContents(node); - } - }, - - getNodes: function(nodeTypes, filter) { - assertRangeValid(this); - return getNodesInRange(this, nodeTypes, filter); - }, - - getDocument: function() { - return getRangeDocument(this); - }, - - collapseBefore: function(node) { - this.setEndBefore(node); - this.collapse(false); - }, - - collapseAfter: function(node) { - this.setStartAfter(node); - this.collapse(true); - }, - - getBookmark: function(containerNode) { - var doc = getRangeDocument(this); - var preSelectionRange = api.createRange(doc); - containerNode = containerNode || dom.getBody(doc); - preSelectionRange.selectNodeContents(containerNode); - var range = this.intersection(preSelectionRange); - var start = 0, end = 0; - if (range) { - preSelectionRange.setEnd(range.startContainer, range.startOffset); - start = preSelectionRange.toString().length; - end = start + range.toString().length; - } + extractContents: createRangeContentRemover(extractSubtree, boundaryUpdater), - return { - start: start, - end: end, - containerNode: containerNode - }; - }, - - moveToBookmark: function(bookmark) { - var containerNode = bookmark.containerNode; - var charIndex = 0; - this.setStart(containerNode, 0); - this.collapse(true); - var nodeStack = [containerNode], node, foundStart = false, stop = false; - var nextCharIndex, i, childNodes; - - while (!stop && (node = nodeStack.pop())) { - if (node.nodeType == 3) { - nextCharIndex = charIndex + node.length; - if (!foundStart && bookmark.start >= charIndex && bookmark.start <= nextCharIndex) { - this.setStart(node, bookmark.start - charIndex); - foundStart = true; - } - if (foundStart && bookmark.end >= charIndex && bookmark.end <= nextCharIndex) { - this.setEnd(node, bookmark.end - charIndex); - stop = true; - } - charIndex = nextCharIndex; - } else { - childNodes = node.childNodes; - i = childNodes.length; - while (i--) { - nodeStack.push(childNodes[i]); - } - } - } - }, + deleteContents: createRangeContentRemover(deleteSubtree, boundaryUpdater), - getName: function() { - return "DomRange"; - }, + canSurroundContents: function () { + assertRangeValid(this); + assertNodeNotReadOnly(this.startContainer); + assertNodeNotReadOnly(this.endContainer); - equals: function(range) { - return Range.rangesEqual(this, range); - }, + // Check if the contents can be surrounded. Specifically, this means whether the range partially selects + // no non-text nodes. + var iterator = new RangeIterator(this, true); + var boundariesInvalid = (iterator._first && isNonTextPartiallySelected(iterator._first, this) || + (iterator._last && isNonTextPartiallySelected(iterator._last, this))); + iterator.detach(); + return !boundariesInvalid; + }, - isValid: function() { - return isRangeValid(this); - }, + splitBoundaries: function () { + splitRangeBoundaries(this); + }, - inspect: function() { - return inspect(this); - }, + splitBoundariesPreservingPositions: function (positionsToPreserve) { + splitRangeBoundaries(this, positionsToPreserve); + }, - detach: function() { - // In DOM4, detach() is now a no-op. + normalizeBoundaries: function () { + assertRangeValid(this); + + var sc = this.startContainer, so = this.startOffset, ec = this.endContainer, eo = this.endOffset; + + var mergeForward = function (node) { + var sibling = node.nextSibling; + if (sibling && sibling.nodeType == node.nodeType) { + ec = node; + eo = node.length; + node.appendData(sibling.data); + removeNode(sibling); + } + }; + + var mergeBackward = function (node) { + var sibling = node.previousSibling; + if (sibling && sibling.nodeType == node.nodeType) { + sc = node; + var nodeLength = node.length; + so = sibling.length; + node.insertData(0, sibling.data); + removeNode(sibling); + if (sc == ec) { + eo += so; + ec = sc; + } else if (ec == node.parentNode) { + var nodeIndex = getNodeIndex(node); + if (eo == nodeIndex) { + ec = node; + eo = nodeLength; + } else if (eo > nodeIndex) { + eo--; + } + } + } + }; + + var normalizeStart = true; + var sibling; + + if (isCharacterDataNode(ec)) { + if (eo == ec.length) { + mergeForward(ec); + } else if (eo == 0) { + sibling = ec.previousSibling; + if (sibling && sibling.nodeType == ec.nodeType) { + eo = sibling.length; + if (sc == ec) { + normalizeStart = false; + } + sibling.appendData(ec.data); + removeNode(ec); + ec = sibling; + } + } + } else { + if (eo > 0) { + var endNode = ec.childNodes[eo - 1]; + if (endNode && isCharacterDataNode(endNode)) { + mergeForward(endNode); + } + } + normalizeStart = !this.collapsed; + } + + if (normalizeStart) { + if (isCharacterDataNode(sc)) { + if (so == 0) { + mergeBackward(sc); + } else if (so == sc.length) { + sibling = sc.nextSibling; + if (sibling && sibling.nodeType == sc.nodeType) { + if (ec == sibling) { + ec = sc; + eo += sc.length; + } + sc.appendData(sibling.data); + removeNode(sibling); + } + } + } else { + if (so < sc.childNodes.length) { + var startNode = sc.childNodes[so]; + if (startNode && isCharacterDataNode(startNode)) { + mergeBackward(startNode); + } + } } - }); + } else { + sc = ec; + so = eo; + } - function copyComparisonConstantsToObject(obj) { - obj.START_TO_START = s2s; - obj.START_TO_END = s2e; - obj.END_TO_END = e2e; - obj.END_TO_START = e2s; + boundaryUpdater(this, sc, so, ec, eo); + }, - obj.NODE_BEFORE = n_b; - obj.NODE_AFTER = n_a; - obj.NODE_BEFORE_AND_AFTER = n_b_a; - obj.NODE_INSIDE = n_i; + collapseToPoint: function (node, offset) { + assertNoDocTypeNotationEntityAncestor(node, true); + assertValidOffset(node, offset); + this.setStartAndEnd(node, offset); } + }); - function copyComparisonConstants(constructor) { - copyComparisonConstantsToObject(constructor); - copyComparisonConstantsToObject(constructor.prototype); - } + copyComparisonConstants(constructor); + } - function createRangeContentRemover(remover, boundaryUpdater) { - return function() { - assertRangeValid(this); + /* ---------------------------------------------------------------------------------------------------------------- */ - var sc = this.startContainer, so = this.startOffset, root = this.commonAncestorContainer; + // Updates commonAncestorContainer and collapsed after boundary change + function updateCollapsedAndCommonAncestor (range) { + range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset); + range.commonAncestorContainer = range.collapsed + ? range.startContainer : dom.getCommonAncestor(range.startContainer, range.endContainer); + } - var iterator = new RangeIterator(this, true); + function updateBoundaries (range, startContainer, startOffset, endContainer, endOffset) { + range.startContainer = startContainer; + range.startOffset = startOffset; + range.endContainer = endContainer; + range.endOffset = endOffset; + range.document = dom.getDocument(startContainer); - // Work out where to position the range after content removal - var node, boundary; - if (sc !== root) { - node = getClosestAncestorIn(sc, root, true); - boundary = getBoundaryAfterNode(node); - sc = boundary.node; - so = boundary.offset; - } + updateCollapsedAndCommonAncestor(range); + } - // Check none of the range is read-only - iterateSubtree(iterator, assertNodeNotReadOnly); + function Range (doc) { + this.startContainer = doc; + this.startOffset = 0; + this.endContainer = doc; + this.endOffset = 0; + this.document = doc; + updateCollapsedAndCommonAncestor(this); + } - iterator.reset(); + createPrototypeRange(Range, updateBoundaries); + + util.extend(Range, { + rangeProperties: rangeProperties, + RangeIterator: RangeIterator, + copyComparisonConstants: copyComparisonConstants, + createPrototypeRange: createPrototypeRange, + inspect: inspect, + toHtml: rangeToHtml, + getRangeDocument: getRangeDocument, + rangesEqual: function (r1, r2) { + return r1.startContainer === r2.startContainer && + r1.startOffset === r2.startOffset && + r1.endContainer === r2.endContainer && + r1.endOffset === r2.endOffset; + } + }); - // Remove the content - var returnValue = remover(iterator); - iterator.detach(); + api.DomRange = Range; + }); + + /* ---------------------------------------------------------------------------------------------------------------- */ + + // Wrappers for the browser's native DOM Range and/or TextRange implementation + api.createCoreModule('WrappedRange', ['DomRange'], function (api, module) { + var WrappedRange, WrappedTextRange; + var dom = api.dom; + var util = api.util; + var DomPosition = dom.DomPosition; + var DomRange = api.DomRange; + var getBody = dom.getBody; + var getContentDocument = dom.getContentDocument; + var isCharacterDataNode = dom.isCharacterDataNode; + + /* ---------------------------------------------------------------------------------------------------------------- */ + + if (api.features.implementsDomRange) { + // This is a wrapper around the browser's native DOM Range. It has two aims: + // - Provide workarounds for specific browser bugs + // - provide convenient extensions, which are inherited from Rangy's DomRange + + (function () { + var rangeProto; + var rangeProperties = DomRange.rangeProperties; + + function updateRangeProperties (range) { + var i = rangeProperties.length, prop; + while (i--) { + prop = rangeProperties[i]; + range[prop] = range.nativeRange[prop]; + } + // Fix for broken collapsed property in IE 9. + range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset); + } + + function updateNativeRange (range, startContainer, startOffset, endContainer, endOffset) { + var startMoved = (range.startContainer !== startContainer || range.startOffset != startOffset); + var endMoved = (range.endContainer !== endContainer || range.endOffset != endOffset); + var nativeRangeDifferent = !range.equals(range.nativeRange); + + // Always set both boundaries for the benefit of IE9 (see issue 35) + if (startMoved || endMoved || nativeRangeDifferent) { + range.setEnd(endContainer, endOffset); + range.setStart(startContainer, startOffset); + } + } + + var createBeforeAfterNodeSetter; + + WrappedRange = function (range) { + if (!range) { + throw module.createError('WrappedRange: Range must be specified'); + } + this.nativeRange = range; + updateRangeProperties(this); + }; - // Move to the new position - boundaryUpdater(this, sc, so, sc, so); + DomRange.createPrototypeRange(WrappedRange, updateNativeRange); - return returnValue; - }; - } + rangeProto = WrappedRange.prototype; - function createPrototypeRange(constructor, boundaryUpdater) { - function createBeforeAfterNodeSetter(isBefore, isStart) { - return function(node) { - assertValidNodeType(node, beforeAfterNodeTypes); - assertValidNodeType(getRootContainer(node), rootContainerNodeTypes); + rangeProto.selectNode = function (node) { + this.nativeRange.selectNode(node); + updateRangeProperties(this); + }; - var boundary = (isBefore ? getBoundaryBeforeNode : getBoundaryAfterNode)(node); - (isStart ? setRangeStart : setRangeEnd)(this, boundary.node, boundary.offset); - }; - } + rangeProto.cloneContents = function () { + return this.nativeRange.cloneContents(); + }; - function setRangeStart(range, node, offset) { - var ec = range.endContainer, eo = range.endOffset; - if (node !== range.startContainer || offset !== range.startOffset) { - // Check the root containers of the range and the new boundary, and also check whether the new boundary - // is after the current end. In either case, collapse the range to the new position - if (getRootContainer(node) != getRootContainer(ec) || comparePoints(node, offset, ec, eo) == 1) { - ec = node; - eo = offset; - } - boundaryUpdater(range, node, offset, ec, eo); - } - } + // Due to a long-standing Firefox bug that I have not been able to find a reliable way to detect, + // insertNode() is never delegated to the native range. - function setRangeEnd(range, node, offset) { - var sc = range.startContainer, so = range.startOffset; - if (node !== range.endContainer || offset !== range.endOffset) { - // Check the root containers of the range and the new boundary, and also check whether the new boundary - // is after the current end. In either case, collapse the range to the new position - if (getRootContainer(node) != getRootContainer(sc) || comparePoints(node, offset, sc, so) == -1) { - sc = node; - so = offset; - } - boundaryUpdater(range, sc, so, node, offset); - } - } + rangeProto.surroundContents = function (node) { + this.nativeRange.surroundContents(node); + updateRangeProperties(this); + }; - // Set up inheritance - var F = function() {}; - F.prototype = api.rangePrototype; - constructor.prototype = new F(); + rangeProto.collapse = function (isStart) { + this.nativeRange.collapse(isStart); + updateRangeProperties(this); + }; - util.extend(constructor.prototype, { - setStart: function(node, offset) { - assertNoDocTypeNotationEntityAncestor(node, true); - assertValidOffset(node, offset); + rangeProto.cloneRange = function () { + return new WrappedRange(this.nativeRange.cloneRange()); + }; - setRangeStart(this, node, offset); - }, + rangeProto.refresh = function () { + updateRangeProperties(this); + }; - setEnd: function(node, offset) { - assertNoDocTypeNotationEntityAncestor(node, true); - assertValidOffset(node, offset); + rangeProto.toString = function () { + return this.nativeRange.toString(); + }; - setRangeEnd(this, node, offset); - }, + // Create test range and node for feature detection - /** - * Convenience method to set a range's start and end boundaries. Overloaded as follows: - * - Two parameters (node, offset) creates a collapsed range at that position - * - Three parameters (node, startOffset, endOffset) creates a range contained with node starting at - * startOffset and ending at endOffset - * - Four parameters (startNode, startOffset, endNode, endOffset) creates a range starting at startOffset in - * startNode and ending at endOffset in endNode - */ - setStartAndEnd: function() { - var args = arguments; - var sc = args[0], so = args[1], ec = sc, eo = so; - - switch (args.length) { - case 3: - eo = args[2]; - break; - case 4: - ec = args[2]; - eo = args[3]; - break; - } - - boundaryUpdater(this, sc, so, ec, eo); - }, - - setBoundary: function(node, offset, isStart) { - this["set" + (isStart ? "Start" : "End")](node, offset); - }, - - setStartBefore: createBeforeAfterNodeSetter(true, true), - setStartAfter: createBeforeAfterNodeSetter(false, true), - setEndBefore: createBeforeAfterNodeSetter(true, false), - setEndAfter: createBeforeAfterNodeSetter(false, false), - - collapse: function(isStart) { - assertRangeValid(this); - if (isStart) { - boundaryUpdater(this, this.startContainer, this.startOffset, this.startContainer, this.startOffset); - } else { - boundaryUpdater(this, this.endContainer, this.endOffset, this.endContainer, this.endOffset); - } - }, - - selectNodeContents: function(node) { - assertNoDocTypeNotationEntityAncestor(node, true); - - boundaryUpdater(this, node, 0, node, getNodeLength(node)); - }, - - selectNode: function(node) { - assertNoDocTypeNotationEntityAncestor(node, false); - assertValidNodeType(node, beforeAfterNodeTypes); - - var start = getBoundaryBeforeNode(node), end = getBoundaryAfterNode(node); - boundaryUpdater(this, start.node, start.offset, end.node, end.offset); - }, - - extractContents: createRangeContentRemover(extractSubtree, boundaryUpdater), - - deleteContents: createRangeContentRemover(deleteSubtree, boundaryUpdater), - - canSurroundContents: function() { - assertRangeValid(this); - assertNodeNotReadOnly(this.startContainer); - assertNodeNotReadOnly(this.endContainer); - - // Check if the contents can be surrounded. Specifically, this means whether the range partially selects - // no non-text nodes. - var iterator = new RangeIterator(this, true); - var boundariesInvalid = (iterator._first && isNonTextPartiallySelected(iterator._first, this) || - (iterator._last && isNonTextPartiallySelected(iterator._last, this))); - iterator.detach(); - return !boundariesInvalid; - }, - - splitBoundaries: function() { - splitRangeBoundaries(this); - }, - - splitBoundariesPreservingPositions: function(positionsToPreserve) { - splitRangeBoundaries(this, positionsToPreserve); - }, - - normalizeBoundaries: function() { - assertRangeValid(this); - - var sc = this.startContainer, so = this.startOffset, ec = this.endContainer, eo = this.endOffset; - - var mergeForward = function(node) { - var sibling = node.nextSibling; - if (sibling && sibling.nodeType == node.nodeType) { - ec = node; - eo = node.length; - node.appendData(sibling.data); - removeNode(sibling); - } - }; - - var mergeBackward = function(node) { - var sibling = node.previousSibling; - if (sibling && sibling.nodeType == node.nodeType) { - sc = node; - var nodeLength = node.length; - so = sibling.length; - node.insertData(0, sibling.data); - removeNode(sibling); - if (sc == ec) { - eo += so; - ec = sc; - } else if (ec == node.parentNode) { - var nodeIndex = getNodeIndex(node); - if (eo == nodeIndex) { - ec = node; - eo = nodeLength; - } else if (eo > nodeIndex) { - eo--; - } - } - } - }; - - var normalizeStart = true; - var sibling; - - if (isCharacterDataNode(ec)) { - if (eo == ec.length) { - mergeForward(ec); - } else if (eo == 0) { - sibling = ec.previousSibling; - if (sibling && sibling.nodeType == ec.nodeType) { - eo = sibling.length; - if (sc == ec) { - normalizeStart = false; - } - sibling.appendData(ec.data); - removeNode(ec); - ec = sibling; - } - } - } else { - if (eo > 0) { - var endNode = ec.childNodes[eo - 1]; - if (endNode && isCharacterDataNode(endNode)) { - mergeForward(endNode); - } - } - normalizeStart = !this.collapsed; - } - - if (normalizeStart) { - if (isCharacterDataNode(sc)) { - if (so == 0) { - mergeBackward(sc); - } else if (so == sc.length) { - sibling = sc.nextSibling; - if (sibling && sibling.nodeType == sc.nodeType) { - if (ec == sibling) { - ec = sc; - eo += sc.length; - } - sc.appendData(sibling.data); - removeNode(sibling); - } - } - } else { - if (so < sc.childNodes.length) { - var startNode = sc.childNodes[so]; - if (startNode && isCharacterDataNode(startNode)) { - mergeBackward(startNode); - } - } - } - } else { - sc = ec; - so = eo; - } - - boundaryUpdater(this, sc, so, ec, eo); - }, - - collapseToPoint: function(node, offset) { - assertNoDocTypeNotationEntityAncestor(node, true); - assertValidOffset(node, offset); - this.setStartAndEnd(node, offset); - } - }); + var testTextNode = document.createTextNode('test'); + getBody(document).appendChild(testTextNode); + var range = document.createRange(); - copyComparisonConstants(constructor); - } + /* -------------------------------------------------------------------------------------------------------- */ - /*----------------------------------------------------------------------------------------------------------------*/ + // Test for Firefox 2 bug that prevents moving the start of a Range to a point after its current end and + // correct for it - // Updates commonAncestorContainer and collapsed after boundary change - function updateCollapsedAndCommonAncestor(range) { - range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset); - range.commonAncestorContainer = range.collapsed ? - range.startContainer : dom.getCommonAncestor(range.startContainer, range.endContainer); - } + range.setStart(testTextNode, 0); + range.setEnd(testTextNode, 0); - function updateBoundaries(range, startContainer, startOffset, endContainer, endOffset) { - range.startContainer = startContainer; - range.startOffset = startOffset; - range.endContainer = endContainer; - range.endOffset = endOffset; - range.document = dom.getDocument(startContainer); + try { + range.setStart(testTextNode, 1); + + rangeProto.setStart = function (node, offset) { + this.nativeRange.setStart(node, offset); + updateRangeProperties(this); + }; + + rangeProto.setEnd = function (node, offset) { + this.nativeRange.setEnd(node, offset); + updateRangeProperties(this); + }; + + createBeforeAfterNodeSetter = function (name) { + return function (node) { + this.nativeRange[name](node); + updateRangeProperties(this); + }; + }; + } catch (ex) { + rangeProto.setStart = function (node, offset) { + try { + this.nativeRange.setStart(node, offset); + } catch (ex) { + this.nativeRange.setEnd(node, offset); + this.nativeRange.setStart(node, offset); + } + updateRangeProperties(this); + }; - updateCollapsedAndCommonAncestor(range); + rangeProto.setEnd = function (node, offset) { + try { + this.nativeRange.setEnd(node, offset); + } catch (ex) { + this.nativeRange.setStart(node, offset); + this.nativeRange.setEnd(node, offset); + } + updateRangeProperties(this); + }; + + createBeforeAfterNodeSetter = function (name, oppositeName) { + return function (node) { + try { + this.nativeRange[name](node); + } catch (ex) { + this.nativeRange[oppositeName](node); + this.nativeRange[name](node); + } + updateRangeProperties(this); + }; + }; } - function Range(doc) { - this.startContainer = doc; - this.startOffset = 0; - this.endContainer = doc; - this.endOffset = 0; - this.document = doc; - updateCollapsedAndCommonAncestor(this); - } + rangeProto.setStartBefore = createBeforeAfterNodeSetter('setStartBefore', 'setEndBefore'); + rangeProto.setStartAfter = createBeforeAfterNodeSetter('setStartAfter', 'setEndAfter'); + rangeProto.setEndBefore = createBeforeAfterNodeSetter('setEndBefore', 'setStartBefore'); + rangeProto.setEndAfter = createBeforeAfterNodeSetter('setEndAfter', 'setStartAfter'); - createPrototypeRange(Range, updateBoundaries); + /* -------------------------------------------------------------------------------------------------------- */ - util.extend(Range, { - rangeProperties: rangeProperties, - RangeIterator: RangeIterator, - copyComparisonConstants: copyComparisonConstants, - createPrototypeRange: createPrototypeRange, - inspect: inspect, - toHtml: rangeToHtml, - getRangeDocument: getRangeDocument, - rangesEqual: function(r1, r2) { - return r1.startContainer === r2.startContainer && - r1.startOffset === r2.startOffset && - r1.endContainer === r2.endContainer && - r1.endOffset === r2.endOffset; - } - }); + // Always use DOM4-compliant selectNodeContents implementation: it's simpler and less code than testing + // whether the native implementation can be trusted + rangeProto.selectNodeContents = function (node) { + this.setStartAndEnd(node, 0, dom.getNodeLength(node)); + }; - api.DomRange = Range; - }); + /* -------------------------------------------------------------------------------------------------------- */ - /*----------------------------------------------------------------------------------------------------------------*/ - - // Wrappers for the browser's native DOM Range and/or TextRange implementation - api.createCoreModule("WrappedRange", ["DomRange"], function(api, module) { - var WrappedRange, WrappedTextRange; - var dom = api.dom; - var util = api.util; - var DomPosition = dom.DomPosition; - var DomRange = api.DomRange; - var getBody = dom.getBody; - var getContentDocument = dom.getContentDocument; - var isCharacterDataNode = dom.isCharacterDataNode; - - - /*----------------------------------------------------------------------------------------------------------------*/ - - if (api.features.implementsDomRange) { - // This is a wrapper around the browser's native DOM Range. It has two aims: - // - Provide workarounds for specific browser bugs - // - provide convenient extensions, which are inherited from Rangy's DomRange - - (function() { - var rangeProto; - var rangeProperties = DomRange.rangeProperties; - - function updateRangeProperties(range) { - var i = rangeProperties.length, prop; - while (i--) { - prop = rangeProperties[i]; - range[prop] = range.nativeRange[prop]; - } - // Fix for broken collapsed property in IE 9. - range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset); - } + // Test for and correct WebKit bug that has the behaviour of compareBoundaryPoints round the wrong way for + // constants START_TO_END and END_TO_START: https://bugs.webkit.org/show_bug.cgi?id=20738 - function updateNativeRange(range, startContainer, startOffset, endContainer, endOffset) { - var startMoved = (range.startContainer !== startContainer || range.startOffset != startOffset); - var endMoved = (range.endContainer !== endContainer || range.endOffset != endOffset); - var nativeRangeDifferent = !range.equals(range.nativeRange); + range.selectNodeContents(testTextNode); + range.setEnd(testTextNode, 3); - // Always set both boundaries for the benefit of IE9 (see issue 35) - if (startMoved || endMoved || nativeRangeDifferent) { - range.setEnd(endContainer, endOffset); - range.setStart(startContainer, startOffset); - } - } + var range2 = document.createRange(); + range2.selectNodeContents(testTextNode); + range2.setEnd(testTextNode, 4); + range2.setStart(testTextNode, 2); - var createBeforeAfterNodeSetter; - - WrappedRange = function(range) { - if (!range) { - throw module.createError("WrappedRange: Range must be specified"); - } - this.nativeRange = range; - updateRangeProperties(this); - }; - - DomRange.createPrototypeRange(WrappedRange, updateNativeRange); - - rangeProto = WrappedRange.prototype; - - rangeProto.selectNode = function(node) { - this.nativeRange.selectNode(node); - updateRangeProperties(this); - }; - - rangeProto.cloneContents = function() { - return this.nativeRange.cloneContents(); - }; - - // Due to a long-standing Firefox bug that I have not been able to find a reliable way to detect, - // insertNode() is never delegated to the native range. - - rangeProto.surroundContents = function(node) { - this.nativeRange.surroundContents(node); - updateRangeProperties(this); - }; - - rangeProto.collapse = function(isStart) { - this.nativeRange.collapse(isStart); - updateRangeProperties(this); - }; - - rangeProto.cloneRange = function() { - return new WrappedRange(this.nativeRange.cloneRange()); - }; - - rangeProto.refresh = function() { - updateRangeProperties(this); - }; - - rangeProto.toString = function() { - return this.nativeRange.toString(); - }; - - // Create test range and node for feature detection - - var testTextNode = document.createTextNode("test"); - getBody(document).appendChild(testTextNode); - var range = document.createRange(); - - /*--------------------------------------------------------------------------------------------------------*/ - - // Test for Firefox 2 bug that prevents moving the start of a Range to a point after its current end and - // correct for it - - range.setStart(testTextNode, 0); - range.setEnd(testTextNode, 0); - - try { - range.setStart(testTextNode, 1); - - rangeProto.setStart = function(node, offset) { - this.nativeRange.setStart(node, offset); - updateRangeProperties(this); - }; - - rangeProto.setEnd = function(node, offset) { - this.nativeRange.setEnd(node, offset); - updateRangeProperties(this); - }; - - createBeforeAfterNodeSetter = function(name) { - return function(node) { - this.nativeRange[name](node); - updateRangeProperties(this); - }; - }; - - } catch(ex) { - - rangeProto.setStart = function(node, offset) { - try { - this.nativeRange.setStart(node, offset); - } catch (ex) { - this.nativeRange.setEnd(node, offset); - this.nativeRange.setStart(node, offset); - } - updateRangeProperties(this); - }; - - rangeProto.setEnd = function(node, offset) { - try { - this.nativeRange.setEnd(node, offset); - } catch (ex) { - this.nativeRange.setStart(node, offset); - this.nativeRange.setEnd(node, offset); - } - updateRangeProperties(this); - }; - - createBeforeAfterNodeSetter = function(name, oppositeName) { - return function(node) { - try { - this.nativeRange[name](node); - } catch (ex) { - this.nativeRange[oppositeName](node); - this.nativeRange[name](node); - } - updateRangeProperties(this); - }; - }; - } + if (range.compareBoundaryPoints(range.START_TO_END, range2) == -1 && + range.compareBoundaryPoints(range.END_TO_START, range2) == 1) { + // This is the wrong way round, so correct for it - rangeProto.setStartBefore = createBeforeAfterNodeSetter("setStartBefore", "setEndBefore"); - rangeProto.setStartAfter = createBeforeAfterNodeSetter("setStartAfter", "setEndAfter"); - rangeProto.setEndBefore = createBeforeAfterNodeSetter("setEndBefore", "setStartBefore"); - rangeProto.setEndAfter = createBeforeAfterNodeSetter("setEndAfter", "setStartAfter"); + rangeProto.compareBoundaryPoints = function (type, range) { + range = range.nativeRange || range; + if (type == range.START_TO_END) { + type = range.END_TO_START; + } else if (type == range.END_TO_START) { + type = range.START_TO_END; + } + return this.nativeRange.compareBoundaryPoints(type, range); + }; + } else { + rangeProto.compareBoundaryPoints = function (type, range) { + return this.nativeRange.compareBoundaryPoints(type, range.nativeRange || range); + }; + } - /*--------------------------------------------------------------------------------------------------------*/ + /* -------------------------------------------------------------------------------------------------------- */ - // Always use DOM4-compliant selectNodeContents implementation: it's simpler and less code than testing - // whether the native implementation can be trusted - rangeProto.selectNodeContents = function(node) { - this.setStartAndEnd(node, 0, dom.getNodeLength(node)); - }; + // Test for IE deleteContents() and extractContents() bug and correct it. See issue 107. - /*--------------------------------------------------------------------------------------------------------*/ + var el = document.createElement('div'); + el.innerHTML = '123'; + var textNode = el.firstChild; + var body = getBody(document); + body.appendChild(el); + + range.setStart(textNode, 1); + range.setEnd(textNode, 2); + range.deleteContents(); + + if (textNode.data == '13') { + // Behaviour is correct per DOM4 Range so wrap the browser's implementation of deleteContents() and + // extractContents() + rangeProto.deleteContents = function () { + this.nativeRange.deleteContents(); + updateRangeProperties(this); + }; + + rangeProto.extractContents = function () { + var frag = this.nativeRange.extractContents(); + updateRangeProperties(this); + return frag; + }; + } else { + } - // Test for and correct WebKit bug that has the behaviour of compareBoundaryPoints round the wrong way for - // constants START_TO_END and END_TO_START: https://bugs.webkit.org/show_bug.cgi?id=20738 + body.removeChild(el); + body = null; - range.selectNodeContents(testTextNode); - range.setEnd(testTextNode, 3); + /* -------------------------------------------------------------------------------------------------------- */ - var range2 = document.createRange(); - range2.selectNodeContents(testTextNode); - range2.setEnd(testTextNode, 4); - range2.setStart(testTextNode, 2); + // Test for existence of createContextualFragment and delegate to it if it exists + if (util.isHostMethod(range, 'createContextualFragment')) { + rangeProto.createContextualFragment = function (fragmentStr) { + return this.nativeRange.createContextualFragment(fragmentStr); + }; + } - if (range.compareBoundaryPoints(range.START_TO_END, range2) == -1 && - range.compareBoundaryPoints(range.END_TO_START, range2) == 1) { - // This is the wrong way round, so correct for it - - rangeProto.compareBoundaryPoints = function(type, range) { - range = range.nativeRange || range; - if (type == range.START_TO_END) { - type = range.END_TO_START; - } else if (type == range.END_TO_START) { - type = range.START_TO_END; - } - return this.nativeRange.compareBoundaryPoints(type, range); - }; - } else { - rangeProto.compareBoundaryPoints = function(type, range) { - return this.nativeRange.compareBoundaryPoints(type, range.nativeRange || range); - }; - } + /* -------------------------------------------------------------------------------------------------------- */ - /*--------------------------------------------------------------------------------------------------------*/ - - // Test for IE deleteContents() and extractContents() bug and correct it. See issue 107. - - var el = document.createElement("div"); - el.innerHTML = "123"; - var textNode = el.firstChild; - var body = getBody(document); - body.appendChild(el); - - range.setStart(textNode, 1); - range.setEnd(textNode, 2); - range.deleteContents(); - - if (textNode.data == "13") { - // Behaviour is correct per DOM4 Range so wrap the browser's implementation of deleteContents() and - // extractContents() - rangeProto.deleteContents = function() { - this.nativeRange.deleteContents(); - updateRangeProperties(this); - }; - - rangeProto.extractContents = function() { - var frag = this.nativeRange.extractContents(); - updateRangeProperties(this); - return frag; - }; - } else { - } + // Clean up + getBody(document).removeChild(testTextNode); - body.removeChild(el); - body = null; + rangeProto.getName = function () { + return 'WrappedRange'; + }; - /*--------------------------------------------------------------------------------------------------------*/ + api.WrappedRange = WrappedRange; - // Test for existence of createContextualFragment and delegate to it if it exists - if (util.isHostMethod(range, "createContextualFragment")) { - rangeProto.createContextualFragment = function(fragmentStr) { - return this.nativeRange.createContextualFragment(fragmentStr); - }; - } + api.createNativeRange = function (doc) { + doc = getContentDocument(doc, module, 'createNativeRange'); + return doc.createRange(); + }; + })(); + } - /*--------------------------------------------------------------------------------------------------------*/ - - // Clean up - getBody(document).removeChild(testTextNode); - - rangeProto.getName = function() { - return "WrappedRange"; - }; - - api.WrappedRange = WrappedRange; - - api.createNativeRange = function(doc) { - doc = getContentDocument(doc, module, "createNativeRange"); - return doc.createRange(); - }; - })(); - } - - if (api.features.implementsTextRange) { - /* - This is a workaround for a bug where IE returns the wrong container element from the TextRange's parentElement() - method. For example, in the following (where pipes denote the selection boundaries): + if (api.features.implementsTextRange) { + /* + This is a workaround for a bug where IE returns the wrong container element from the TextRange's parentElement() + method. For example, in the following (where pipes denote the selection boundaries):
    • | a
    • b |
    @@ -2484,109 +2460,107 @@ - the parentElement() of the textRange after calling collapse(true) - the parentElement() of the textRange after calling collapse(false) */ - var getTextRangeContainerElement = function(textRange) { - var parentEl = textRange.parentElement(); - var range = textRange.duplicate(); - range.collapse(true); - var startEl = range.parentElement(); - range = textRange.duplicate(); - range.collapse(false); - var endEl = range.parentElement(); - var startEndContainer = (startEl == endEl) ? startEl : dom.getCommonAncestor(startEl, endEl); - - return startEndContainer == parentEl ? startEndContainer : dom.getCommonAncestor(parentEl, startEndContainer); - }; - - var textRangeIsCollapsed = function(textRange) { - return textRange.compareEndPoints("StartToEnd", textRange) == 0; - }; - - // Gets the boundary of a TextRange expressed as a node and an offset within that node. This function started - // out as an improved version of code found in Tim Cameron Ryan's IERange (http://code.google.com/p/ierange/) - // but has grown, fixing problems with line breaks in preformatted text, adding workaround for IE TextRange - // bugs, handling for inputs and images, plus optimizations. - var getTextRangeBoundaryPosition = function(textRange, wholeRangeContainerElement, isStart, isCollapsed, startInfo) { - var workingRange = textRange.duplicate(); - workingRange.collapse(isStart); - var containerElement = workingRange.parentElement(); - - // Sometimes collapsing a TextRange that's at the start of a text node can move it into the previous node, so - // check for that - if (!dom.isOrIsAncestorOf(wholeRangeContainerElement, containerElement)) { - containerElement = wholeRangeContainerElement; - } - - - // Deal with nodes that cannot "contain rich HTML markup". In practice, this means form inputs, images and - // similar. See http://msdn.microsoft.com/en-us/library/aa703950%28VS.85%29.aspx - if (!containerElement.canHaveHTML) { - var pos = new DomPosition(containerElement.parentNode, dom.getNodeIndex(containerElement)); - return { - boundaryPosition: pos, - nodeInfo: { - nodeIndex: pos.offset, - containerElement: pos.node - } - }; - } - - var workingNode = dom.getDocument(containerElement).createElement("span"); - - // Workaround for HTML5 Shiv's insane violation of document.createElement(). See Rangy issue 104 and HTML5 - // Shiv issue 64: https://github.com/aFarkas/html5shiv/issues/64 - if (workingNode.parentNode) { - dom.removeNode(workingNode); - } - - var comparison, workingComparisonType = isStart ? "StartToStart" : "StartToEnd"; - var previousNode, nextNode, boundaryPosition, boundaryNode; - var start = (startInfo && startInfo.containerElement == containerElement) ? startInfo.nodeIndex : 0; - var childNodeCount = containerElement.childNodes.length; - var end = childNodeCount; - - // Check end first. Code within the loop assumes that the endth child node of the container is definitely - // after the range boundary. - var nodeIndex = end; - - while (true) { - if (nodeIndex == childNodeCount) { - containerElement.appendChild(workingNode); - } else { - containerElement.insertBefore(workingNode, containerElement.childNodes[nodeIndex]); - } - workingRange.moveToElementText(workingNode); - comparison = workingRange.compareEndPoints(workingComparisonType, textRange); - if (comparison == 0 || start == end) { - break; - } else if (comparison == -1) { - if (end == start + 1) { - // We know the endth child node is after the range boundary, so we must be done. - break; - } else { - start = nodeIndex; - } - } else { - end = (end == start + 1) ? start : nodeIndex; - } - nodeIndex = Math.floor((start + end) / 2); - containerElement.removeChild(workingNode); - } - + var getTextRangeContainerElement = function (textRange) { + var parentEl = textRange.parentElement(); + var range = textRange.duplicate(); + range.collapse(true); + var startEl = range.parentElement(); + range = textRange.duplicate(); + range.collapse(false); + var endEl = range.parentElement(); + var startEndContainer = (startEl == endEl) ? startEl : dom.getCommonAncestor(startEl, endEl); + + return startEndContainer == parentEl ? startEndContainer : dom.getCommonAncestor(parentEl, startEndContainer); + }; + + var textRangeIsCollapsed = function (textRange) { + return textRange.compareEndPoints('StartToEnd', textRange) == 0; + }; + + // Gets the boundary of a TextRange expressed as a node and an offset within that node. This function started + // out as an improved version of code found in Tim Cameron Ryan's IERange (http://code.google.com/p/ierange/) + // but has grown, fixing problems with line breaks in preformatted text, adding workaround for IE TextRange + // bugs, handling for inputs and images, plus optimizations. + var getTextRangeBoundaryPosition = function (textRange, wholeRangeContainerElement, isStart, isCollapsed, startInfo) { + var workingRange = textRange.duplicate(); + workingRange.collapse(isStart); + var containerElement = workingRange.parentElement(); + + // Sometimes collapsing a TextRange that's at the start of a text node can move it into the previous node, so + // check for that + if (!dom.isOrIsAncestorOf(wholeRangeContainerElement, containerElement)) { + containerElement = wholeRangeContainerElement; + } + + // Deal with nodes that cannot "contain rich HTML markup". In practice, this means form inputs, images and + // similar. See http://msdn.microsoft.com/en-us/library/aa703950%28VS.85%29.aspx + if (!containerElement.canHaveHTML) { + var pos = new DomPosition(containerElement.parentNode, dom.getNodeIndex(containerElement)); + return { + boundaryPosition: pos, + nodeInfo: { + nodeIndex: pos.offset, + containerElement: pos.node + } + }; + } + + var workingNode = dom.getDocument(containerElement).createElement('span'); + + // Workaround for HTML5 Shiv's insane violation of document.createElement(). See Rangy issue 104 and HTML5 + // Shiv issue 64: https://github.com/aFarkas/html5shiv/issues/64 + if (workingNode.parentNode) { + dom.removeNode(workingNode); + } + + var comparison, workingComparisonType = isStart ? 'StartToStart' : 'StartToEnd'; + var previousNode, nextNode, boundaryPosition, boundaryNode; + var start = (startInfo && startInfo.containerElement == containerElement) ? startInfo.nodeIndex : 0; + var childNodeCount = containerElement.childNodes.length; + var end = childNodeCount; + + // Check end first. Code within the loop assumes that the endth child node of the container is definitely + // after the range boundary. + var nodeIndex = end; + + while (true) { + if (nodeIndex == childNodeCount) { + containerElement.appendChild(workingNode); + } else { + containerElement.insertBefore(workingNode, containerElement.childNodes[nodeIndex]); + } + workingRange.moveToElementText(workingNode); + comparison = workingRange.compareEndPoints(workingComparisonType, textRange); + if (comparison == 0 || start == end) { + break; + } else if (comparison == -1) { + if (end == start + 1) { + // We know the endth child node is after the range boundary, so we must be done. + break; + } else { + start = nodeIndex; + } + } else { + end = (end == start + 1) ? start : nodeIndex; + } + nodeIndex = Math.floor((start + end) / 2); + containerElement.removeChild(workingNode); + } - // We've now reached or gone past the boundary of the text range we're interested in - // so have identified the node we want - boundaryNode = workingNode.nextSibling; + // We've now reached or gone past the boundary of the text range we're interested in + // so have identified the node we want + boundaryNode = workingNode.nextSibling; - if (comparison == -1 && boundaryNode && isCharacterDataNode(boundaryNode)) { - // This is a character data node (text, comment, cdata). The working range is collapsed at the start of - // the node containing the text range's boundary, so we move the end of the working range to the - // boundary point and measure the length of its text to get the boundary's offset within the node. - workingRange.setEndPoint(isStart ? "EndToStart" : "EndToEnd", textRange); + if (comparison == -1 && boundaryNode && isCharacterDataNode(boundaryNode)) { + // This is a character data node (text, comment, cdata). The working range is collapsed at the start of + // the node containing the text range's boundary, so we move the end of the working range to the + // boundary point and measure the length of its text to get the boundary's offset within the node. + workingRange.setEndPoint(isStart ? 'EndToStart' : 'EndToEnd', textRange); - var offset; + var offset; - if (/[\r\n]/.test(boundaryNode.data)) { - /* + if (/[\r\n]/.test(boundaryNode.data)) { + /* For the particular case of a boundary within a text node containing rendered line breaks (within a
     element, for example), we need a slightly complicated approach to get the boundary's offset in
                             IE. The facts:
    @@ -2616,1247 +2590,1242 @@
                             and then a character at a time to make up for any trailing line breaks not contained in the 'text'
                             property. This has good performance in most situations compared to the previous two methods.
                             */
    -                        var tempRange = workingRange.duplicate();
    -                        var rangeLength = tempRange.text.replace(/\r\n/g, "\r").length;
    -
    -                        offset = tempRange.moveStart("character", rangeLength);
    -                        while ( (comparison = tempRange.compareEndPoints("StartToEnd", tempRange)) == -1) {
    -                            offset++;
    -                            tempRange.moveStart("character", 1);
    -                        }
    -                    } else {
    -                        offset = workingRange.text.length;
    -                    }
    -                    boundaryPosition = new DomPosition(boundaryNode, offset);
    -                } else {
    -
    -                    // If the boundary immediately follows a character data node and this is the end boundary, we should favour
    -                    // a position within that, and likewise for a start boundary preceding a character data node
    -                    previousNode = (isCollapsed || !isStart) && workingNode.previousSibling;
    -                    nextNode = (isCollapsed || isStart) && workingNode.nextSibling;
    -                    if (nextNode && isCharacterDataNode(nextNode)) {
    -                        boundaryPosition = new DomPosition(nextNode, 0);
    -                    } else if (previousNode && isCharacterDataNode(previousNode)) {
    -                        boundaryPosition = new DomPosition(previousNode, previousNode.data.length);
    -                    } else {
    -                        boundaryPosition = new DomPosition(containerElement, dom.getNodeIndex(workingNode));
    -                    }
    -                }
    -
    -                // Clean up
    -                dom.removeNode(workingNode);
    -
    -                return {
    -                    boundaryPosition: boundaryPosition,
    -                    nodeInfo: {
    -                        nodeIndex: nodeIndex,
    -                        containerElement: containerElement
    -                    }
    -                };
    -            };
    -
    -            // Returns a TextRange representing the boundary of a TextRange expressed as a node and an offset within that
    -            // node. This function started out as an optimized version of code found in Tim Cameron Ryan's IERange
    -            // (http://code.google.com/p/ierange/)
    -            var createBoundaryTextRange = function(boundaryPosition, isStart) {
    -                var boundaryNode, boundaryParent, boundaryOffset = boundaryPosition.offset;
    -                var doc = dom.getDocument(boundaryPosition.node);
    -                var workingNode, childNodes, workingRange = getBody(doc).createTextRange();
    -                var nodeIsDataNode = isCharacterDataNode(boundaryPosition.node);
    -
    -                if (nodeIsDataNode) {
    -                    boundaryNode = boundaryPosition.node;
    -                    boundaryParent = boundaryNode.parentNode;
    -                } else {
    -                    childNodes = boundaryPosition.node.childNodes;
    -                    boundaryNode = (boundaryOffset < childNodes.length) ? childNodes[boundaryOffset] : null;
    -                    boundaryParent = boundaryPosition.node;
    -                }
    -
    -                // Position the range immediately before the node containing the boundary
    -                workingNode = doc.createElement("span");
    +            var tempRange = workingRange.duplicate();
    +            var rangeLength = tempRange.text.replace(/\r\n/g, '\r').length;
    +
    +            offset = tempRange.moveStart('character', rangeLength);
    +            while ((comparison = tempRange.compareEndPoints('StartToEnd', tempRange)) == -1) {
    +              offset++;
    +              tempRange.moveStart('character', 1);
    +            }
    +          } else {
    +            offset = workingRange.text.length;
    +          }
    +          boundaryPosition = new DomPosition(boundaryNode, offset);
    +        } else {
    +          // If the boundary immediately follows a character data node and this is the end boundary, we should favour
    +          // a position within that, and likewise for a start boundary preceding a character data node
    +          previousNode = (isCollapsed || !isStart) && workingNode.previousSibling;
    +          nextNode = (isCollapsed || isStart) && workingNode.nextSibling;
    +          if (nextNode && isCharacterDataNode(nextNode)) {
    +            boundaryPosition = new DomPosition(nextNode, 0);
    +          } else if (previousNode && isCharacterDataNode(previousNode)) {
    +            boundaryPosition = new DomPosition(previousNode, previousNode.data.length);
    +          } else {
    +            boundaryPosition = new DomPosition(containerElement, dom.getNodeIndex(workingNode));
    +          }
    +        }
    +
    +        // Clean up
    +        dom.removeNode(workingNode);
    +
    +        return {
    +          boundaryPosition: boundaryPosition,
    +          nodeInfo: {
    +            nodeIndex: nodeIndex,
    +            containerElement: containerElement
    +          }
    +        };
    +      };
    +
    +      // Returns a TextRange representing the boundary of a TextRange expressed as a node and an offset within that
    +      // node. This function started out as an optimized version of code found in Tim Cameron Ryan's IERange
    +      // (http://code.google.com/p/ierange/)
    +      var createBoundaryTextRange = function (boundaryPosition, isStart) {
    +        var boundaryNode, boundaryParent, boundaryOffset = boundaryPosition.offset;
    +        var doc = dom.getDocument(boundaryPosition.node);
    +        var workingNode, childNodes, workingRange = getBody(doc).createTextRange();
    +        var nodeIsDataNode = isCharacterDataNode(boundaryPosition.node);
    +
    +        if (nodeIsDataNode) {
    +          boundaryNode = boundaryPosition.node;
    +          boundaryParent = boundaryNode.parentNode;
    +        } else {
    +          childNodes = boundaryPosition.node.childNodes;
    +          boundaryNode = (boundaryOffset < childNodes.length) ? childNodes[boundaryOffset] : null;
    +          boundaryParent = boundaryPosition.node;
    +        }
     
    -                // Making the working element non-empty element persuades IE to consider the TextRange boundary to be within
    -                // the element rather than immediately before or after it
    -                workingNode.innerHTML = "&#feff;";
    +        // Position the range immediately before the node containing the boundary
    +        workingNode = doc.createElement('span');
     
    -                // insertBefore is supposed to work like appendChild if the second parameter is null. However, a bug report
    -                // for IERange suggests that it can crash the browser: http://code.google.com/p/ierange/issues/detail?id=12
    -                if (boundaryNode) {
    -                    boundaryParent.insertBefore(workingNode, boundaryNode);
    -                } else {
    -                    boundaryParent.appendChild(workingNode);
    -                }
    +        // Making the working element non-empty element persuades IE to consider the TextRange boundary to be within
    +        // the element rather than immediately before or after it
    +        workingNode.innerHTML = '&#feff;';
     
    -                workingRange.moveToElementText(workingNode);
    -                workingRange.collapse(!isStart);
    +        // insertBefore is supposed to work like appendChild if the second parameter is null. However, a bug report
    +        // for IERange suggests that it can crash the browser: http://code.google.com/p/ierange/issues/detail?id=12
    +        if (boundaryNode) {
    +          boundaryParent.insertBefore(workingNode, boundaryNode);
    +        } else {
    +          boundaryParent.appendChild(workingNode);
    +        }
     
    -                // Clean up
    -                boundaryParent.removeChild(workingNode);
    +        workingRange.moveToElementText(workingNode);
    +        workingRange.collapse(!isStart);
     
    -                // Move the working range to the text offset, if required
    -                if (nodeIsDataNode) {
    -                    workingRange[isStart ? "moveStart" : "moveEnd"]("character", boundaryOffset);
    -                }
    +        // Clean up
    +        boundaryParent.removeChild(workingNode);
     
    -                return workingRange;
    -            };
    +        // Move the working range to the text offset, if required
    +        if (nodeIsDataNode) {
    +          workingRange[isStart ? 'moveStart' : 'moveEnd']('character', boundaryOffset);
    +        }
     
    -            /*------------------------------------------------------------------------------------------------------------*/
    +        return workingRange;
    +      };
     
    -            // This is a wrapper around a TextRange, providing full DOM Range functionality using rangy's DomRange as a
    -            // prototype
    +      /* ------------------------------------------------------------------------------------------------------------ */
     
    -            WrappedTextRange = function(textRange) {
    -                this.textRange = textRange;
    -                this.refresh();
    -            };
    +      // This is a wrapper around a TextRange, providing full DOM Range functionality using rangy's DomRange as a
    +      // prototype
     
    -            WrappedTextRange.prototype = new DomRange(document);
    +      WrappedTextRange = function (textRange) {
    +        this.textRange = textRange;
    +        this.refresh();
    +      };
     
    -            WrappedTextRange.prototype.refresh = function() {
    -                var start, end, startBoundary;
    +      WrappedTextRange.prototype = new DomRange(document);
     
    -                // TextRange's parentElement() method cannot be trusted. getTextRangeContainerElement() works around that.
    -                var rangeContainerElement = getTextRangeContainerElement(this.textRange);
    +      WrappedTextRange.prototype.refresh = function () {
    +        var start, end, startBoundary;
     
    -                if (textRangeIsCollapsed(this.textRange)) {
    -                    end = start = getTextRangeBoundaryPosition(this.textRange, rangeContainerElement, true,
    -                        true).boundaryPosition;
    -                } else {
    -                    startBoundary = getTextRangeBoundaryPosition(this.textRange, rangeContainerElement, true, false);
    -                    start = startBoundary.boundaryPosition;
    +        // TextRange's parentElement() method cannot be trusted. getTextRangeContainerElement() works around that.
    +        var rangeContainerElement = getTextRangeContainerElement(this.textRange);
     
    -                    // An optimization used here is that if the start and end boundaries have the same parent element, the
    -                    // search scope for the end boundary can be limited to exclude the portion of the element that precedes
    -                    // the start boundary
    -                    end = getTextRangeBoundaryPosition(this.textRange, rangeContainerElement, false, false,
    -                        startBoundary.nodeInfo).boundaryPosition;
    -                }
    +        if (textRangeIsCollapsed(this.textRange)) {
    +          end = start = getTextRangeBoundaryPosition(this.textRange, rangeContainerElement, true,
    +            true).boundaryPosition;
    +        } else {
    +          startBoundary = getTextRangeBoundaryPosition(this.textRange, rangeContainerElement, true, false);
    +          start = startBoundary.boundaryPosition;
     
    -                this.setStart(start.node, start.offset);
    -                this.setEnd(end.node, end.offset);
    -            };
    +          // An optimization used here is that if the start and end boundaries have the same parent element, the
    +          // search scope for the end boundary can be limited to exclude the portion of the element that precedes
    +          // the start boundary
    +          end = getTextRangeBoundaryPosition(this.textRange, rangeContainerElement, false, false,
    +            startBoundary.nodeInfo).boundaryPosition;
    +        }
     
    -            WrappedTextRange.prototype.getName = function() {
    -                return "WrappedTextRange";
    -            };
    +        this.setStart(start.node, start.offset);
    +        this.setEnd(end.node, end.offset);
    +      };
     
    -            DomRange.copyComparisonConstants(WrappedTextRange);
    -
    -            var rangeToTextRange = function(range) {
    -                if (range.collapsed) {
    -                    return createBoundaryTextRange(new DomPosition(range.startContainer, range.startOffset), true);
    -                } else {
    -                    var startRange = createBoundaryTextRange(new DomPosition(range.startContainer, range.startOffset), true);
    -                    var endRange = createBoundaryTextRange(new DomPosition(range.endContainer, range.endOffset), false);
    -                    var textRange = getBody( DomRange.getRangeDocument(range) ).createTextRange();
    -                    textRange.setEndPoint("StartToStart", startRange);
    -                    textRange.setEndPoint("EndToEnd", endRange);
    -                    return textRange;
    -                }
    -            };
    +      WrappedTextRange.prototype.getName = function () {
    +        return 'WrappedTextRange';
    +      };
     
    -            WrappedTextRange.rangeToTextRange = rangeToTextRange;
    +      DomRange.copyComparisonConstants(WrappedTextRange);
     
    -            WrappedTextRange.prototype.toTextRange = function() {
    -                return rangeToTextRange(this);
    -            };
    +      var rangeToTextRange = function (range) {
    +        if (range.collapsed) {
    +          return createBoundaryTextRange(new DomPosition(range.startContainer, range.startOffset), true);
    +        } else {
    +          var startRange = createBoundaryTextRange(new DomPosition(range.startContainer, range.startOffset), true);
    +          var endRange = createBoundaryTextRange(new DomPosition(range.endContainer, range.endOffset), false);
    +          var textRange = getBody(DomRange.getRangeDocument(range)).createTextRange();
    +          textRange.setEndPoint('StartToStart', startRange);
    +          textRange.setEndPoint('EndToEnd', endRange);
    +          return textRange;
    +        }
    +      };
     
    -            api.WrappedTextRange = WrappedTextRange;
    +      WrappedTextRange.rangeToTextRange = rangeToTextRange;
     
    -            // IE 9 and above have both implementations and Rangy makes both available. The next few lines sets which
    -            // implementation to use by default.
    -            if (!api.features.implementsDomRange || api.config.preferTextRange) {
    -                // Add WrappedTextRange as the Range property of the global object to allow expression like Range.END_TO_END to work
    -                var globalObj = (function(f) { return f("return this;")(); })(Function);
    -                if (typeof globalObj.Range == "undefined") {
    -                    globalObj.Range = WrappedTextRange;
    -                }
    +      WrappedTextRange.prototype.toTextRange = function () {
    +        return rangeToTextRange(this);
    +      };
     
    -                api.createNativeRange = function(doc) {
    -                    doc = getContentDocument(doc, module, "createNativeRange");
    -                    return getBody(doc).createTextRange();
    -                };
    +      api.WrappedTextRange = WrappedTextRange;
     
    -                api.WrappedRange = WrappedTextRange;
    -            }
    +      // IE 9 and above have both implementations and Rangy makes both available. The next few lines sets which
    +      // implementation to use by default.
    +      if (!api.features.implementsDomRange || api.config.preferTextRange) {
    +        // Add WrappedTextRange as the Range property of the global object to allow expression like Range.END_TO_END to work
    +        var globalObj = (function (f) { return f('return this;')(); })(Function);
    +        if (typeof globalObj.Range === 'undefined') {
    +          globalObj.Range = WrappedTextRange;
             }
     
    -        api.createRange = function(doc) {
    -            doc = getContentDocument(doc, module, "createRange");
    -            return new api.WrappedRange(api.createNativeRange(doc));
    -        };
    -
    -        api.createRangyRange = function(doc) {
    -            doc = getContentDocument(doc, module, "createRangyRange");
    -            return new DomRange(doc);
    +        api.createNativeRange = function (doc) {
    +          doc = getContentDocument(doc, module, 'createNativeRange');
    +          return getBody(doc).createTextRange();
             };
     
    -        util.createAliasForDeprecatedMethod(api, "createIframeRange", "createRange");
    -        util.createAliasForDeprecatedMethod(api, "createIframeRangyRange", "createRangyRange");
    -
    -        api.addShimListener(function(win) {
    -            var doc = win.document;
    -            if (typeof doc.createRange == "undefined") {
    -                doc.createRange = function() {
    -                    return api.createRange(doc);
    -                };
    -            }
    -            doc = win = null;
    -        });
    -    });
    -
    -    /*----------------------------------------------------------------------------------------------------------------*/
    -
    -    // This module creates a selection object wrapper that conforms as closely as possible to the Selection specification
    -    // in the HTML Editing spec (http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections)
    -    api.createCoreModule("WrappedSelection", ["DomRange", "WrappedRange"], function(api, module) {
    -        api.config.checkSelectionRanges = true;
    -
    -        var BOOLEAN = "boolean";
    -        var NUMBER = "number";
    -        var dom = api.dom;
    -        var util = api.util;
    -        var isHostMethod = util.isHostMethod;
    -        var DomRange = api.DomRange;
    -        var WrappedRange = api.WrappedRange;
    -        var DOMException = api.DOMException;
    -        var DomPosition = dom.DomPosition;
    -        var getNativeSelection;
    -        var selectionIsCollapsed;
    -        var features = api.features;
    -        var CONTROL = "Control";
    -        var getDocument = dom.getDocument;
    -        var getBody = dom.getBody;
    -        var rangesEqual = DomRange.rangesEqual;
    -
    -
    -        // Utility function to support direction parameters in the API that may be a string ("backward", "backwards",
    -        // "forward" or "forwards") or a Boolean (true for backwards).
    -        function isDirectionBackward(dir) {
    -            return (typeof dir == "string") ? /^backward(s)?$/i.test(dir) : !!dir;
    -        }
    -
    -        function getWindow(win, methodName) {
    -            if (!win) {
    -                return window;
    -            } else if (dom.isWindow(win)) {
    -                return win;
    -            } else if (win instanceof WrappedSelection) {
    -                return win.win;
    -            } else {
    -                var doc = dom.getContentDocument(win, module, methodName);
    -                return dom.getWindow(doc);
    -            }
    -        }
    +        api.WrappedRange = WrappedTextRange;
    +      }
    +    }
     
    -        function getWinSelection(winParam) {
    -            return getWindow(winParam, "getWinSelection").getSelection();
    -        }
    +    api.createRange = function (doc) {
    +      doc = getContentDocument(doc, module, 'createRange');
    +      return new api.WrappedRange(api.createNativeRange(doc));
    +    };
     
    -        function getDocSelection(winParam) {
    -            return getWindow(winParam, "getDocSelection").document.selection;
    -        }
    +    api.createRangyRange = function (doc) {
    +      doc = getContentDocument(doc, module, 'createRangyRange');
    +      return new DomRange(doc);
    +    };
     
    -        function winSelectionIsBackward(sel) {
    -            var backward = false;
    -            if (sel.anchorNode) {
    -                backward = (dom.comparePoints(sel.anchorNode, sel.anchorOffset, sel.focusNode, sel.focusOffset) == 1);
    -            }
    -            return backward;
    -        }
    +    util.createAliasForDeprecatedMethod(api, 'createIframeRange', 'createRange');
    +    util.createAliasForDeprecatedMethod(api, 'createIframeRangyRange', 'createRangyRange');
     
    -        // Test for the Range/TextRange and Selection features required
    -        // Test for ability to retrieve selection
    -        var implementsWinGetSelection = isHostMethod(window, "getSelection"),
    -            implementsDocSelection = util.isHostObject(document, "selection");
    +    api.addShimListener(function (win) {
    +      var doc = win.document;
    +      if (typeof doc.createRange === 'undefined') {
    +        doc.createRange = function () {
    +          return api.createRange(doc);
    +        };
    +      }
    +      doc = win = null;
    +    });
    +  });
    +
    +  /* ---------------------------------------------------------------------------------------------------------------- */
    +
    +  // This module creates a selection object wrapper that conforms as closely as possible to the Selection specification
    +  // in the HTML Editing spec (http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections)
    +  api.createCoreModule('WrappedSelection', ['DomRange', 'WrappedRange'], function (api, module) {
    +    api.config.checkSelectionRanges = true;
    +
    +    var BOOLEAN = 'boolean';
    +    var NUMBER = 'number';
    +    var dom = api.dom;
    +    var util = api.util;
    +    var isHostMethod = util.isHostMethod;
    +    var DomRange = api.DomRange;
    +    var WrappedRange = api.WrappedRange;
    +    var DOMException = api.DOMException;
    +    var DomPosition = dom.DomPosition;
    +    var getNativeSelection;
    +    var selectionIsCollapsed;
    +    var features = api.features;
    +    var CONTROL = 'Control';
    +    var getDocument = dom.getDocument;
    +    var getBody = dom.getBody;
    +    var rangesEqual = DomRange.rangesEqual;
    +
    +    // Utility function to support direction parameters in the API that may be a string ("backward", "backwards",
    +    // "forward" or "forwards") or a Boolean (true for backwards).
    +    function isDirectionBackward (dir) {
    +      return (typeof dir === 'string') ? /^backward(s)?$/i.test(dir) : !!dir;
    +    }
     
    -        features.implementsWinGetSelection = implementsWinGetSelection;
    -        features.implementsDocSelection = implementsDocSelection;
    +    function getWindow (win, methodName) {
    +      if (!win) {
    +        return window;
    +      } else if (dom.isWindow(win)) {
    +        return win;
    +      } else if (win instanceof WrappedSelection) {
    +        return win.win;
    +      } else {
    +        var doc = dom.getContentDocument(win, module, methodName);
    +        return dom.getWindow(doc);
    +      }
    +    }
     
    -        var useDocumentSelection = implementsDocSelection && (!implementsWinGetSelection || api.config.preferTextRange);
    +    function getWinSelection (winParam) {
    +      return getWindow(winParam, 'getWinSelection').getSelection();
    +    }
     
    -        if (useDocumentSelection) {
    -            getNativeSelection = getDocSelection;
    -            api.isSelectionValid = function(winParam) {
    -                var doc = getWindow(winParam, "isSelectionValid").document, nativeSel = doc.selection;
    +    function getDocSelection (winParam) {
    +      return getWindow(winParam, 'getDocSelection').document.selection;
    +    }
     
    -                // Check whether the selection TextRange is actually contained within the correct document
    -                return (nativeSel.type != "None" || getDocument(nativeSel.createRange().parentElement()) == doc);
    -            };
    -        } else if (implementsWinGetSelection) {
    -            getNativeSelection = getWinSelection;
    -            api.isSelectionValid = function() {
    -                return true;
    -            };
    -        } else {
    -            module.fail("Neither document.selection or window.getSelection() detected.");
    -            return false;
    -        }
    +    function winSelectionIsBackward (sel) {
    +      var backward = false;
    +      if (sel.anchorNode) {
    +        backward = (dom.comparePoints(sel.anchorNode, sel.anchorOffset, sel.focusNode, sel.focusOffset) == 1);
    +      }
    +      return backward;
    +    }
     
    -        api.getNativeSelection = getNativeSelection;
    +    // Test for the Range/TextRange and Selection features required
    +    // Test for ability to retrieve selection
    +    var implementsWinGetSelection = isHostMethod(window, 'getSelection'),
    +      implementsDocSelection = util.isHostObject(document, 'selection');
    +
    +    features.implementsWinGetSelection = implementsWinGetSelection;
    +    features.implementsDocSelection = implementsDocSelection;
    +
    +    var useDocumentSelection = implementsDocSelection && (!implementsWinGetSelection || api.config.preferTextRange);
    +
    +    if (useDocumentSelection) {
    +      getNativeSelection = getDocSelection;
    +      api.isSelectionValid = function (winParam) {
    +        var doc = getWindow(winParam, 'isSelectionValid').document, nativeSel = doc.selection;
    +
    +        // Check whether the selection TextRange is actually contained within the correct document
    +        return (nativeSel.type != 'None' || getDocument(nativeSel.createRange().parentElement()) == doc);
    +      };
    +    } else if (implementsWinGetSelection) {
    +      getNativeSelection = getWinSelection;
    +      api.isSelectionValid = function () {
    +        return true;
    +      };
    +    } else {
    +      module.fail('Neither document.selection or window.getSelection() detected.');
    +      return false;
    +    }
     
    -        var testSelection = getNativeSelection();
    +    api.getNativeSelection = getNativeSelection;
     
    -        // In Firefox, the selection is null in an iframe with display: none. See issue #138.
    -        if (!testSelection) {
    -            module.fail("Native selection was null (possibly issue 138?)");
    -            return false;
    -        }
    +    var testSelection = getNativeSelection();
     
    -        var testRange = api.createNativeRange(document);
    -        var body = getBody(document);
    +    // In Firefox, the selection is null in an iframe with display: none. See issue #138.
    +    if (!testSelection) {
    +      module.fail('Native selection was null (possibly issue 138?)');
    +      return false;
    +    }
     
    -        // Obtaining a range from a selection
    -        var selectionHasAnchorAndFocus = util.areHostProperties(testSelection,
    -            ["anchorNode", "focusNode", "anchorOffset", "focusOffset"]);
    -
    -        features.selectionHasAnchorAndFocus = selectionHasAnchorAndFocus;
    -
    -        // Test for existence of native selection extend() method
    -        var selectionHasExtend = isHostMethod(testSelection, "extend");
    -        features.selectionHasExtend = selectionHasExtend;
    -
    -        // Test if rangeCount exists
    -        var selectionHasRangeCount = (typeof testSelection.rangeCount == NUMBER);
    -        features.selectionHasRangeCount = selectionHasRangeCount;
    -
    -        var selectionSupportsMultipleRanges = false;
    -        var collapsedNonEditableSelectionsSupported = true;
    -
    -        var addRangeBackwardToNative = selectionHasExtend ?
    -            function(nativeSelection, range) {
    -                var doc = DomRange.getRangeDocument(range);
    -                var endRange = api.createRange(doc);
    -                endRange.collapseToPoint(range.endContainer, range.endOffset);
    -                nativeSelection.addRange(getNativeRange(endRange));
    -                nativeSelection.extend(range.startContainer, range.startOffset);
    -            } : null;
    -
    -        if (util.areHostMethods(testSelection, ["addRange", "getRangeAt", "removeAllRanges"]) &&
    -                typeof testSelection.rangeCount == NUMBER && features.implementsDomRange) {
    -
    -            (function() {
    -                // Previously an iframe was used but this caused problems in some circumstances in IE, so tests are
    -                // performed on the current document's selection. See issue 109.
    -
    -                // Note also that if a selection previously existed, it is wiped and later restored by these tests. This
    -                // will result in the selection direction begin reversed if the original selection was backwards and the
    -                // browser does not support setting backwards selections (Internet Explorer, I'm looking at you).
    -                var sel = window.getSelection();
    -                if (sel) {
    -                    // Store the current selection
    -                    var originalSelectionRangeCount = sel.rangeCount;
    -                    var selectionHasMultipleRanges = (originalSelectionRangeCount > 1);
    -                    var originalSelectionRanges = [];
    -                    var originalSelectionBackward = winSelectionIsBackward(sel);
    -                    for (var i = 0; i < originalSelectionRangeCount; ++i) {
    -                        originalSelectionRanges[i] = sel.getRangeAt(i);
    -                    }
    -
    -                    // Create some test elements
    -                    var testEl = dom.createTestElement(document, "", false);
    -                    var textNode = testEl.appendChild( document.createTextNode("\u00a0\u00a0\u00a0") );
    -
    -                    // Test whether the native selection will allow a collapsed selection within a non-editable element
    -                    var r1 = document.createRange();
    -
    -                    r1.setStart(textNode, 1);
    -                    r1.collapse(true);
    -                    sel.removeAllRanges();
    -                    sel.addRange(r1);
    -                    collapsedNonEditableSelectionsSupported = (sel.rangeCount == 1);
    -                    sel.removeAllRanges();
    -
    -                    // Test whether the native selection is capable of supporting multiple ranges.
    -                    if (!selectionHasMultipleRanges) {
    -                        // Doing the original feature test here in Chrome 36 (and presumably later versions) prints a
    -                        // console error of "Discontiguous selection is not supported." that cannot be suppressed. There's
    -                        // nothing we can do about this while retaining the feature test so we have to resort to a browser
    -                        // sniff. I'm not happy about it. See
    -                        // https://code.google.com/p/chromium/issues/detail?id=399791
    -                        var chromeMatch = window.navigator.appVersion.match(/Chrome\/(.*?) /);
    -                        if (chromeMatch && parseInt(chromeMatch[1]) >= 36) {
    -                            selectionSupportsMultipleRanges = false;
    -                        } else {
    -                            var r2 = r1.cloneRange();
    -                            r1.setStart(textNode, 0);
    -                            r2.setEnd(textNode, 3);
    -                            r2.setStart(textNode, 2);
    -                            sel.addRange(r1);
    -                            sel.addRange(r2);
    -                            selectionSupportsMultipleRanges = (sel.rangeCount == 2);
    -                        }
    -                    }
    -
    -                    // Clean up
    -                    dom.removeNode(testEl);
    -                    sel.removeAllRanges();
    -
    -                    for (i = 0; i < originalSelectionRangeCount; ++i) {
    -                        if (i == 0 && originalSelectionBackward) {
    -                            if (addRangeBackwardToNative) {
    -                                addRangeBackwardToNative(sel, originalSelectionRanges[i]);
    -                            } else {
    -                                api.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend");
    -                                sel.addRange(originalSelectionRanges[i]);
    -                            }
    -                        } else {
    -                            sel.addRange(originalSelectionRanges[i]);
    -                        }
    -                    }
    -                }
    -            })();
    +    var testRange = api.createNativeRange(document);
    +    var body = getBody(document);
    +
    +    // Obtaining a range from a selection
    +    var selectionHasAnchorAndFocus = util.areHostProperties(testSelection,
    +      ['anchorNode', 'focusNode', 'anchorOffset', 'focusOffset']);
    +
    +    features.selectionHasAnchorAndFocus = selectionHasAnchorAndFocus;
    +
    +    // Test for existence of native selection extend() method
    +    var selectionHasExtend = isHostMethod(testSelection, 'extend');
    +    features.selectionHasExtend = selectionHasExtend;
    +
    +    // Test if rangeCount exists
    +    var selectionHasRangeCount = (typeof testSelection.rangeCount === NUMBER);
    +    features.selectionHasRangeCount = selectionHasRangeCount;
    +
    +    var selectionSupportsMultipleRanges = false;
    +    var collapsedNonEditableSelectionsSupported = true;
    +
    +    var addRangeBackwardToNative = selectionHasExtend
    +      ? function (nativeSelection, range) {
    +        var doc = DomRange.getRangeDocument(range);
    +        var endRange = api.createRange(doc);
    +        endRange.collapseToPoint(range.endContainer, range.endOffset);
    +        nativeSelection.addRange(getNativeRange(endRange));
    +        nativeSelection.extend(range.startContainer, range.startOffset);
    +      } : null;
    +
    +    if (util.areHostMethods(testSelection, ['addRange', 'getRangeAt', 'removeAllRanges']) &&
    +                typeof testSelection.rangeCount === NUMBER && features.implementsDomRange) {
    +      (function () {
    +        // Previously an iframe was used but this caused problems in some circumstances in IE, so tests are
    +        // performed on the current document's selection. See issue 109.
    +
    +        // Note also that if a selection previously existed, it is wiped and later restored by these tests. This
    +        // will result in the selection direction begin reversed if the original selection was backwards and the
    +        // browser does not support setting backwards selections (Internet Explorer, I'm looking at you).
    +        var sel = window.getSelection();
    +        if (sel) {
    +          // Store the current selection
    +          var originalSelectionRangeCount = sel.rangeCount;
    +          var selectionHasMultipleRanges = (originalSelectionRangeCount > 1);
    +          var originalSelectionRanges = [];
    +          var originalSelectionBackward = winSelectionIsBackward(sel);
    +          for (var i = 0; i < originalSelectionRangeCount; ++i) {
    +            originalSelectionRanges[i] = sel.getRangeAt(i);
    +          }
    +
    +          // Create some test elements
    +          var testEl = dom.createTestElement(document, '', false);
    +          var textNode = testEl.appendChild(document.createTextNode('\u00a0\u00a0\u00a0'));
    +
    +          // Test whether the native selection will allow a collapsed selection within a non-editable element
    +          var r1 = document.createRange();
    +
    +          r1.setStart(textNode, 1);
    +          r1.collapse(true);
    +          sel.removeAllRanges();
    +          sel.addRange(r1);
    +          collapsedNonEditableSelectionsSupported = (sel.rangeCount == 1);
    +          sel.removeAllRanges();
    +
    +          // Test whether the native selection is capable of supporting multiple ranges.
    +          if (!selectionHasMultipleRanges) {
    +            // Doing the original feature test here in Chrome 36 (and presumably later versions) prints a
    +            // console error of "Discontiguous selection is not supported." that cannot be suppressed. There's
    +            // nothing we can do about this while retaining the feature test so we have to resort to a browser
    +            // sniff. I'm not happy about it. See
    +            // https://code.google.com/p/chromium/issues/detail?id=399791
    +            var chromeMatch = window.navigator.appVersion.match(/Chrome\/(.*?) /);
    +            if (chromeMatch && parseInt(chromeMatch[1]) >= 36) {
    +              selectionSupportsMultipleRanges = false;
    +            } else {
    +              var r2 = r1.cloneRange();
    +              r1.setStart(textNode, 0);
    +              r2.setEnd(textNode, 3);
    +              r2.setStart(textNode, 2);
    +              sel.addRange(r1);
    +              sel.addRange(r2);
    +              selectionSupportsMultipleRanges = (sel.rangeCount == 2);
    +            }
    +          }
    +
    +          // Clean up
    +          dom.removeNode(testEl);
    +          sel.removeAllRanges();
    +
    +          for (i = 0; i < originalSelectionRangeCount; ++i) {
    +            if (i == 0 && originalSelectionBackward) {
    +              if (addRangeBackwardToNative) {
    +                addRangeBackwardToNative(sel, originalSelectionRanges[i]);
    +              } else {
    +                api.warn('Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend');
    +                sel.addRange(originalSelectionRanges[i]);
    +              }
    +            } else {
    +              sel.addRange(originalSelectionRanges[i]);
    +            }
    +          }
             }
    +      })();
    +    }
     
    -        features.selectionSupportsMultipleRanges = selectionSupportsMultipleRanges;
    -        features.collapsedNonEditableSelectionsSupported = collapsedNonEditableSelectionsSupported;
    -
    -        // ControlRanges
    -        var implementsControlRange = false, testControlRange;
    +    features.selectionSupportsMultipleRanges = selectionSupportsMultipleRanges;
    +    features.collapsedNonEditableSelectionsSupported = collapsedNonEditableSelectionsSupported;
     
    -        if (body && isHostMethod(body, "createControlRange")) {
    -            testControlRange = body.createControlRange();
    -            if (util.areHostProperties(testControlRange, ["item", "add"])) {
    -                implementsControlRange = true;
    -            }
    -        }
    -        features.implementsControlRange = implementsControlRange;
    +    // ControlRanges
    +    var implementsControlRange = false, testControlRange;
     
    -        // Selection collapsedness
    -        if (selectionHasAnchorAndFocus) {
    -            selectionIsCollapsed = function(sel) {
    -                return sel.anchorNode === sel.focusNode && sel.anchorOffset === sel.focusOffset;
    -            };
    -        } else {
    -            selectionIsCollapsed = function(sel) {
    -                return sel.rangeCount ? sel.getRangeAt(sel.rangeCount - 1).collapsed : false;
    -            };
    -        }
    +    if (body && isHostMethod(body, 'createControlRange')) {
    +      testControlRange = body.createControlRange();
    +      if (util.areHostProperties(testControlRange, ['item', 'add'])) {
    +        implementsControlRange = true;
    +      }
    +    }
    +    features.implementsControlRange = implementsControlRange;
     
    -        function updateAnchorAndFocusFromRange(sel, range, backward) {
    -            var anchorPrefix = backward ? "end" : "start", focusPrefix = backward ? "start" : "end";
    -            sel.anchorNode = range[anchorPrefix + "Container"];
    -            sel.anchorOffset = range[anchorPrefix + "Offset"];
    -            sel.focusNode = range[focusPrefix + "Container"];
    -            sel.focusOffset = range[focusPrefix + "Offset"];
    -        }
    -
    -        function updateAnchorAndFocusFromNativeSelection(sel) {
    -            var nativeSel = sel.nativeSelection;
    -            sel.anchorNode = nativeSel.anchorNode;
    -            sel.anchorOffset = nativeSel.anchorOffset;
    -            sel.focusNode = nativeSel.focusNode;
    -            sel.focusOffset = nativeSel.focusOffset;
    -        }
    -
    -        function updateEmptySelection(sel) {
    -            sel.anchorNode = sel.focusNode = null;
    -            sel.anchorOffset = sel.focusOffset = 0;
    -            sel.rangeCount = 0;
    -            sel.isCollapsed = true;
    -            sel._ranges.length = 0;
    -        }
    -
    -        function getNativeRange(range) {
    -            var nativeRange;
    -            if (range instanceof DomRange) {
    -                nativeRange = api.createNativeRange(range.getDocument());
    -                nativeRange.setEnd(range.endContainer, range.endOffset);
    -                nativeRange.setStart(range.startContainer, range.startOffset);
    -            } else if (range instanceof WrappedRange) {
    -                nativeRange = range.nativeRange;
    -            } else if (features.implementsDomRange && (range instanceof dom.getWindow(range.startContainer).Range)) {
    -                nativeRange = range;
    -            }
    -            return nativeRange;
    -        }
    +    // Selection collapsedness
    +    if (selectionHasAnchorAndFocus) {
    +      selectionIsCollapsed = function (sel) {
    +        return sel.anchorNode === sel.focusNode && sel.anchorOffset === sel.focusOffset;
    +      };
    +    } else {
    +      selectionIsCollapsed = function (sel) {
    +        return sel.rangeCount ? sel.getRangeAt(sel.rangeCount - 1).collapsed : false;
    +      };
    +    }
     
    -        function rangeContainsSingleElement(rangeNodes) {
    -            if (!rangeNodes.length || rangeNodes[0].nodeType != 1) {
    -                return false;
    -            }
    -            for (var i = 1, len = rangeNodes.length; i < len; ++i) {
    -                if (!dom.isAncestorOf(rangeNodes[0], rangeNodes[i])) {
    -                    return false;
    -                }
    -            }
    -            return true;
    -        }
    +    function updateAnchorAndFocusFromRange (sel, range, backward) {
    +      var anchorPrefix = backward ? 'end' : 'start', focusPrefix = backward ? 'start' : 'end';
    +      sel.anchorNode = range[anchorPrefix + 'Container'];
    +      sel.anchorOffset = range[anchorPrefix + 'Offset'];
    +      sel.focusNode = range[focusPrefix + 'Container'];
    +      sel.focusOffset = range[focusPrefix + 'Offset'];
    +    }
     
    -        function getSingleElementFromRange(range) {
    -            var nodes = range.getNodes();
    -            if (!rangeContainsSingleElement(nodes)) {
    -                throw module.createError("getSingleElementFromRange: range " + range.inspect() + " did not consist of a single element");
    -            }
    -            return nodes[0];
    -        }
    +    function updateAnchorAndFocusFromNativeSelection (sel) {
    +      var nativeSel = sel.nativeSelection;
    +      sel.anchorNode = nativeSel.anchorNode;
    +      sel.anchorOffset = nativeSel.anchorOffset;
    +      sel.focusNode = nativeSel.focusNode;
    +      sel.focusOffset = nativeSel.focusOffset;
    +    }
     
    -        // Simple, quick test which only needs to distinguish between a TextRange and a ControlRange
    -        function isTextRange(range) {
    -            return !!range && typeof range.text != "undefined";
    -        }
    +    function updateEmptySelection (sel) {
    +      sel.anchorNode = sel.focusNode = null;
    +      sel.anchorOffset = sel.focusOffset = 0;
    +      sel.rangeCount = 0;
    +      sel.isCollapsed = true;
    +      sel._ranges.length = 0;
    +    }
     
    -        function updateFromTextRange(sel, range) {
    -            // Create a Range from the selected TextRange
    -            var wrappedRange = new WrappedRange(range);
    -            sel._ranges = [wrappedRange];
    +    function getNativeRange (range) {
    +      var nativeRange;
    +      if (range instanceof DomRange) {
    +        nativeRange = api.createNativeRange(range.getDocument());
    +        nativeRange.setEnd(range.endContainer, range.endOffset);
    +        nativeRange.setStart(range.startContainer, range.startOffset);
    +      } else if (range instanceof WrappedRange) {
    +        nativeRange = range.nativeRange;
    +      } else if (features.implementsDomRange && (range instanceof dom.getWindow(range.startContainer).Range)) {
    +        nativeRange = range;
    +      }
    +      return nativeRange;
    +    }
     
    -            updateAnchorAndFocusFromRange(sel, wrappedRange, false);
    -            sel.rangeCount = 1;
    -            sel.isCollapsed = wrappedRange.collapsed;
    +    function rangeContainsSingleElement (rangeNodes) {
    +      if (!rangeNodes.length || rangeNodes[0].nodeType != 1) {
    +        return false;
    +      }
    +      for (var i = 1, len = rangeNodes.length; i < len; ++i) {
    +        if (!dom.isAncestorOf(rangeNodes[0], rangeNodes[i])) {
    +          return false;
             }
    +      }
    +      return true;
    +    }
     
    -        function updateControlSelection(sel) {
    -            // Update the wrapped selection based on what's now in the native selection
    -            sel._ranges.length = 0;
    -            if (sel.docSelection.type == "None") {
    -                updateEmptySelection(sel);
    -            } else {
    -                var controlRange = sel.docSelection.createRange();
    -                if (isTextRange(controlRange)) {
    -                    // This case (where the selection type is "Control" and calling createRange() on the selection returns
    -                    // a TextRange) can happen in IE 9. It happens, for example, when all elements in the selected
    -                    // ControlRange have been removed from the ControlRange and removed from the document.
    -                    updateFromTextRange(sel, controlRange);
    -                } else {
    -                    sel.rangeCount = controlRange.length;
    -                    var range, doc = getDocument(controlRange.item(0));
    -                    for (var i = 0; i < sel.rangeCount; ++i) {
    -                        range = api.createRange(doc);
    -                        range.selectNode(controlRange.item(i));
    -                        sel._ranges.push(range);
    -                    }
    -                    sel.isCollapsed = sel.rangeCount == 1 && sel._ranges[0].collapsed;
    -                    updateAnchorAndFocusFromRange(sel, sel._ranges[sel.rangeCount - 1], false);
    -                }
    -            }
    -        }
    +    function getSingleElementFromRange (range) {
    +      var nodes = range.getNodes();
    +      if (!rangeContainsSingleElement(nodes)) {
    +        throw module.createError('getSingleElementFromRange: range ' + range.inspect() + ' did not consist of a single element');
    +      }
    +      return nodes[0];
    +    }
     
    -        function addRangeToControlSelection(sel, range) {
    -            var controlRange = sel.docSelection.createRange();
    -            var rangeElement = getSingleElementFromRange(range);
    +    // Simple, quick test which only needs to distinguish between a TextRange and a ControlRange
    +    function isTextRange (range) {
    +      return !!range && typeof range.text !== 'undefined';
    +    }
     
    -            // Create a new ControlRange containing all the elements in the selected ControlRange plus the element
    -            // contained by the supplied range
    -            var doc = getDocument(controlRange.item(0));
    -            var newControlRange = getBody(doc).createControlRange();
    -            for (var i = 0, len = controlRange.length; i < len; ++i) {
    -                newControlRange.add(controlRange.item(i));
    -            }
    -            try {
    -                newControlRange.add(rangeElement);
    -            } catch (ex) {
    -                throw module.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");
    -            }
    -            newControlRange.select();
    +    function updateFromTextRange (sel, range) {
    +      // Create a Range from the selected TextRange
    +      var wrappedRange = new WrappedRange(range);
    +      sel._ranges = [wrappedRange];
     
    -            // Update the wrapped selection based on what's now in the native selection
    -            updateControlSelection(sel);
    -        }
    +      updateAnchorAndFocusFromRange(sel, wrappedRange, false);
    +      sel.rangeCount = 1;
    +      sel.isCollapsed = wrappedRange.collapsed;
    +    }
     
    -        var getSelectionRangeAt;
    +    function updateControlSelection (sel) {
    +      // Update the wrapped selection based on what's now in the native selection
    +      sel._ranges.length = 0;
    +      if (sel.docSelection.type == 'None') {
    +        updateEmptySelection(sel);
    +      } else {
    +        var controlRange = sel.docSelection.createRange();
    +        if (isTextRange(controlRange)) {
    +          // This case (where the selection type is "Control" and calling createRange() on the selection returns
    +          // a TextRange) can happen in IE 9. It happens, for example, when all elements in the selected
    +          // ControlRange have been removed from the ControlRange and removed from the document.
    +          updateFromTextRange(sel, controlRange);
    +        } else {
    +          sel.rangeCount = controlRange.length;
    +          var range, doc = getDocument(controlRange.item(0));
    +          for (var i = 0; i < sel.rangeCount; ++i) {
    +            range = api.createRange(doc);
    +            range.selectNode(controlRange.item(i));
    +            sel._ranges.push(range);
    +          }
    +          sel.isCollapsed = sel.rangeCount == 1 && sel._ranges[0].collapsed;
    +          updateAnchorAndFocusFromRange(sel, sel._ranges[sel.rangeCount - 1], false);
    +        }
    +      }
    +    }
     
    -        if (isHostMethod(testSelection, "getRangeAt")) {
    -            // try/catch is present because getRangeAt() must have thrown an error in some browser and some situation.
    -            // Unfortunately, I didn't write a comment about the specifics and am now scared to take it out. Let that be a
    -            // lesson to us all, especially me.
    -            getSelectionRangeAt = function(sel, index) {
    -                try {
    -                    return sel.getRangeAt(index);
    -                } catch (ex) {
    -                    return null;
    -                }
    -            };
    -        } else if (selectionHasAnchorAndFocus) {
    -            getSelectionRangeAt = function(sel) {
    -                var doc = getDocument(sel.anchorNode);
    -                var range = api.createRange(doc);
    -                range.setStartAndEnd(sel.anchorNode, sel.anchorOffset, sel.focusNode, sel.focusOffset);
    -
    -                // Handle the case when the selection was selected backwards (from the end to the start in the
    -                // document)
    -                if (range.collapsed !== this.isCollapsed) {
    -                    range.setStartAndEnd(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset);
    -                }
    +    function addRangeToControlSelection (sel, range) {
    +      var controlRange = sel.docSelection.createRange();
    +      var rangeElement = getSingleElementFromRange(range);
    +
    +      // Create a new ControlRange containing all the elements in the selected ControlRange plus the element
    +      // contained by the supplied range
    +      var doc = getDocument(controlRange.item(0));
    +      var newControlRange = getBody(doc).createControlRange();
    +      for (var i = 0, len = controlRange.length; i < len; ++i) {
    +        newControlRange.add(controlRange.item(i));
    +      }
    +      try {
    +        newControlRange.add(rangeElement);
    +      } catch (ex) {
    +        throw module.createError('addRange(): Element within the specified Range could not be added to control selection (does it have layout?)');
    +      }
    +      newControlRange.select();
    +
    +      // Update the wrapped selection based on what's now in the native selection
    +      updateControlSelection(sel);
    +    }
     
    -                return range;
    -            };
    -        }
    +    var getSelectionRangeAt;
     
    -        function WrappedSelection(selection, docSelection, win) {
    -            this.nativeSelection = selection;
    -            this.docSelection = docSelection;
    -            this._ranges = [];
    -            this.win = win;
    -            this.refresh();
    +    if (isHostMethod(testSelection, 'getRangeAt')) {
    +      // try/catch is present because getRangeAt() must have thrown an error in some browser and some situation.
    +      // Unfortunately, I didn't write a comment about the specifics and am now scared to take it out. Let that be a
    +      // lesson to us all, especially me.
    +      getSelectionRangeAt = function (sel, index) {
    +        try {
    +          return sel.getRangeAt(index);
    +        } catch (ex) {
    +          return null;
             }
    +      };
    +    } else if (selectionHasAnchorAndFocus) {
    +      getSelectionRangeAt = function (sel) {
    +        var doc = getDocument(sel.anchorNode);
    +        var range = api.createRange(doc);
    +        range.setStartAndEnd(sel.anchorNode, sel.anchorOffset, sel.focusNode, sel.focusOffset);
     
    -        WrappedSelection.prototype = api.selectionPrototype;
    -
    -        function deleteProperties(sel) {
    -            sel.win = sel.anchorNode = sel.focusNode = sel._ranges = null;
    -            sel.rangeCount = sel.anchorOffset = sel.focusOffset = 0;
    -            sel.detached = true;
    +        // Handle the case when the selection was selected backwards (from the end to the start in the
    +        // document)
    +        if (range.collapsed !== this.isCollapsed) {
    +          range.setStartAndEnd(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset);
             }
     
    -        var cachedRangySelections = [];
    +        return range;
    +      };
    +    }
     
    -        function actOnCachedSelection(win, action) {
    -            var i = cachedRangySelections.length, cached, sel;
    -            while (i--) {
    -                cached = cachedRangySelections[i];
    -                sel = cached.selection;
    -                if (action == "deleteAll") {
    -                    deleteProperties(sel);
    -                } else if (cached.win == win) {
    -                    if (action == "delete") {
    -                        cachedRangySelections.splice(i, 1);
    -                        return true;
    -                    } else {
    -                        return sel;
    -                    }
    -                }
    -            }
    -            if (action == "deleteAll") {
    -                cachedRangySelections.length = 0;
    -            }
    -            return null;
    -        }
    +    function WrappedSelection (selection, docSelection, win) {
    +      this.nativeSelection = selection;
    +      this.docSelection = docSelection;
    +      this._ranges = [];
    +      this.win = win;
    +      this.refresh();
    +    }
     
    -        var getSelection = function(win) {
    -            // Check if the parameter is a Rangy Selection object
    -            if (win && win instanceof WrappedSelection) {
    -                win.refresh();
    -                return win;
    -            }
    +    WrappedSelection.prototype = api.selectionPrototype;
     
    -            win = getWindow(win, "getNativeSelection");
    +    function deleteProperties (sel) {
    +      sel.win = sel.anchorNode = sel.focusNode = sel._ranges = null;
    +      sel.rangeCount = sel.anchorOffset = sel.focusOffset = 0;
    +      sel.detached = true;
    +    }
     
    -            var sel = actOnCachedSelection(win);
    -            var nativeSel = getNativeSelection(win), docSel = implementsDocSelection ? getDocSelection(win) : null;
    -            if (sel) {
    -                sel.nativeSelection = nativeSel;
    -                sel.docSelection = docSel;
    -                sel.refresh();
    -            } else {
    -                sel = new WrappedSelection(nativeSel, docSel, win);
    -                cachedRangySelections.push( { win: win, selection: sel } );
    -            }
    +    var cachedRangySelections = [];
    +
    +    function actOnCachedSelection (win, action) {
    +      var i = cachedRangySelections.length, cached, sel;
    +      while (i--) {
    +        cached = cachedRangySelections[i];
    +        sel = cached.selection;
    +        if (action == 'deleteAll') {
    +          deleteProperties(sel);
    +        } else if (cached.win == win) {
    +          if (action == 'delete') {
    +            cachedRangySelections.splice(i, 1);
    +            return true;
    +          } else {
                 return sel;
    -        };
    +          }
    +        }
    +      }
    +      if (action == 'deleteAll') {
    +        cachedRangySelections.length = 0;
    +      }
    +      return null;
    +    }
     
    -        api.getSelection = getSelection;
    +    var getSelection = function (win) {
    +      // Check if the parameter is a Rangy Selection object
    +      if (win && win instanceof WrappedSelection) {
    +        win.refresh();
    +        return win;
    +      }
    +
    +      win = getWindow(win, 'getNativeSelection');
    +
    +      var sel = actOnCachedSelection(win);
    +      var nativeSel = getNativeSelection(win), docSel = implementsDocSelection ? getDocSelection(win) : null;
    +      if (sel) {
    +        sel.nativeSelection = nativeSel;
    +        sel.docSelection = docSel;
    +        sel.refresh();
    +      } else {
    +        sel = new WrappedSelection(nativeSel, docSel, win);
    +        cachedRangySelections.push({ win: win, selection: sel });
    +      }
    +      return sel;
    +    };
     
    -        util.createAliasForDeprecatedMethod(api, "getIframeSelection", "getSelection");
    +    api.getSelection = getSelection;
     
    -        var selProto = WrappedSelection.prototype;
    +    util.createAliasForDeprecatedMethod(api, 'getIframeSelection', 'getSelection');
     
    -        function createControlSelection(sel, ranges) {
    -            // Ensure that the selection becomes of type "Control"
    -            var doc = getDocument(ranges[0].startContainer);
    -            var controlRange = getBody(doc).createControlRange();
    -            for (var i = 0, el, len = ranges.length; i < len; ++i) {
    -                el = getSingleElementFromRange(ranges[i]);
    -                try {
    -                    controlRange.add(el);
    -                } catch (ex) {
    -                    throw module.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)");
    -                }
    -            }
    -            controlRange.select();
    +    var selProto = WrappedSelection.prototype;
     
    -            // Update the wrapped selection based on what's now in the native selection
    -            updateControlSelection(sel);
    +    function createControlSelection (sel, ranges) {
    +      // Ensure that the selection becomes of type "Control"
    +      var doc = getDocument(ranges[0].startContainer);
    +      var controlRange = getBody(doc).createControlRange();
    +      for (var i = 0, el, len = ranges.length; i < len; ++i) {
    +        el = getSingleElementFromRange(ranges[i]);
    +        try {
    +          controlRange.add(el);
    +        } catch (ex) {
    +          throw module.createError('setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)');
             }
    +      }
    +      controlRange.select();
     
    -        // Selecting a range
    -        if (!useDocumentSelection && selectionHasAnchorAndFocus && util.areHostMethods(testSelection, ["removeAllRanges", "addRange"])) {
    -            selProto.removeAllRanges = function() {
    -                this.nativeSelection.removeAllRanges();
    -                updateEmptySelection(this);
    -            };
    -
    -            var addRangeBackward = function(sel, range) {
    -                addRangeBackwardToNative(sel.nativeSelection, range);
    -                sel.refresh();
    -            };
    +      // Update the wrapped selection based on what's now in the native selection
    +      updateControlSelection(sel);
    +    }
     
    -            if (selectionHasRangeCount) {
    -                selProto.addRange = function(range, direction) {
    -                    if (implementsControlRange && implementsDocSelection && this.docSelection.type == CONTROL) {
    -                        addRangeToControlSelection(this, range);
    -                    } else {
    -                        if (isDirectionBackward(direction) && selectionHasExtend) {
    -                            addRangeBackward(this, range);
    -                        } else {
    -                            var previousRangeCount;
    -                            if (selectionSupportsMultipleRanges) {
    -                                previousRangeCount = this.rangeCount;
    -                            } else {
    -                                this.removeAllRanges();
    -                                previousRangeCount = 0;
    -                            }
    -                            // Clone the native range so that changing the selected range does not affect the selection.
    -                            // This is contrary to the spec but is the only way to achieve consistency between browsers. See
    -                            // issue 80.
    -                            var clonedNativeRange = getNativeRange(range).cloneRange();
    -                            try {
    -                                this.nativeSelection.addRange(clonedNativeRange);
    -                            } catch (ex) {
    -                            }
    -
    -                            // Check whether adding the range was successful
    -                            this.rangeCount = this.nativeSelection.rangeCount;
    -
    -                            if (this.rangeCount == previousRangeCount + 1) {
    -                                // The range was added successfully
    -
    -                                // Check whether the range that we added to the selection is reflected in the last range extracted from
    -                                // the selection
    -                                if (api.config.checkSelectionRanges) {
    -                                    var nativeRange = getSelectionRangeAt(this.nativeSelection, this.rangeCount - 1);
    -                                    if (nativeRange && !rangesEqual(nativeRange, range)) {
    -                                        // Happens in WebKit with, for example, a selection placed at the start of a text node
    -                                        range = new WrappedRange(nativeRange);
    -                                    }
    -                                }
    -                                this._ranges[this.rangeCount - 1] = range;
    -                                updateAnchorAndFocusFromRange(this, range, selectionIsBackward(this.nativeSelection));
    -                                this.isCollapsed = selectionIsCollapsed(this);
    -                            } else {
    -                                // The range was not added successfully. The simplest thing is to refresh
    -                                this.refresh();
    -                            }
    -                        }
    -                    }
    -                };
    +    // Selecting a range
    +    if (!useDocumentSelection && selectionHasAnchorAndFocus && util.areHostMethods(testSelection, ['removeAllRanges', 'addRange'])) {
    +      selProto.removeAllRanges = function () {
    +        this.nativeSelection.removeAllRanges();
    +        updateEmptySelection(this);
    +      };
    +
    +      var addRangeBackward = function (sel, range) {
    +        addRangeBackwardToNative(sel.nativeSelection, range);
    +        sel.refresh();
    +      };
    +
    +      if (selectionHasRangeCount) {
    +        selProto.addRange = function (range, direction) {
    +          if (implementsControlRange && implementsDocSelection && this.docSelection.type == CONTROL) {
    +            addRangeToControlSelection(this, range);
    +          } else {
    +            if (isDirectionBackward(direction) && selectionHasExtend) {
    +              addRangeBackward(this, range);
                 } else {
    -                selProto.addRange = function(range, direction) {
    -                    if (isDirectionBackward(direction) && selectionHasExtend) {
    -                        addRangeBackward(this, range);
    -                    } else {
    -                        this.nativeSelection.addRange(getNativeRange(range));
    -                        this.refresh();
    -                    }
    -                };
    +              var previousRangeCount;
    +              if (selectionSupportsMultipleRanges) {
    +                previousRangeCount = this.rangeCount;
    +              } else {
    +                this.removeAllRanges();
    +                previousRangeCount = 0;
    +              }
    +              // Clone the native range so that changing the selected range does not affect the selection.
    +              // This is contrary to the spec but is the only way to achieve consistency between browsers. See
    +              // issue 80.
    +              var clonedNativeRange = getNativeRange(range).cloneRange();
    +              try {
    +                this.nativeSelection.addRange(clonedNativeRange);
    +              } catch (ex) {
    +              }
    +
    +              // Check whether adding the range was successful
    +              this.rangeCount = this.nativeSelection.rangeCount;
    +
    +              if (this.rangeCount == previousRangeCount + 1) {
    +                // The range was added successfully
    +
    +                // Check whether the range that we added to the selection is reflected in the last range extracted from
    +                // the selection
    +                if (api.config.checkSelectionRanges) {
    +                  var nativeRange = getSelectionRangeAt(this.nativeSelection, this.rangeCount - 1);
    +                  if (nativeRange && !rangesEqual(nativeRange, range)) {
    +                    // Happens in WebKit with, for example, a selection placed at the start of a text node
    +                    range = new WrappedRange(nativeRange);
    +                  }
    +                }
    +                this._ranges[this.rangeCount - 1] = range;
    +                updateAnchorAndFocusFromRange(this, range, selectionIsBackward(this.nativeSelection));
    +                this.isCollapsed = selectionIsCollapsed(this);
    +              } else {
    +                // The range was not added successfully. The simplest thing is to refresh
    +                this.refresh();
    +              }
                 }
    +          }
    +        };
    +      } else {
    +        selProto.addRange = function (range, direction) {
    +          if (isDirectionBackward(direction) && selectionHasExtend) {
    +            addRangeBackward(this, range);
    +          } else {
    +            this.nativeSelection.addRange(getNativeRange(range));
    +            this.refresh();
    +          }
    +        };
    +      }
     
    -            selProto.setRanges = function(ranges) {
    -                if (implementsControlRange && implementsDocSelection && ranges.length > 1) {
    -                    createControlSelection(this, ranges);
    -                } else {
    -                    this.removeAllRanges();
    -                    for (var i = 0, len = ranges.length; i < len; ++i) {
    -                        this.addRange(ranges[i]);
    -                    }
    -                }
    -            };
    -        } else if (isHostMethod(testSelection, "empty") && isHostMethod(testRange, "select") &&
    -                   implementsControlRange && useDocumentSelection) {
    -
    -            selProto.removeAllRanges = function() {
    -                // Added try/catch as fix for issue #21
    -                try {
    -                    this.docSelection.empty();
    -
    -                    // Check for empty() not working (issue #24)
    -                    if (this.docSelection.type != "None") {
    -                        // Work around failure to empty a control selection by instead selecting a TextRange and then
    -                        // calling empty()
    -                        var doc;
    -                        if (this.anchorNode) {
    -                            doc = getDocument(this.anchorNode);
    -                        } else if (this.docSelection.type == CONTROL) {
    -                            var controlRange = this.docSelection.createRange();
    -                            if (controlRange.length) {
    -                                doc = getDocument( controlRange.item(0) );
    -                            }
    -                        }
    -                        if (doc) {
    -                            var textRange = getBody(doc).createTextRange();
    -                            textRange.select();
    -                            this.docSelection.empty();
    -                        }
    -                    }
    -                } catch(ex) {}
    -                updateEmptySelection(this);
    -            };
    -
    -            selProto.addRange = function(range) {
    -                if (this.docSelection.type == CONTROL) {
    -                    addRangeToControlSelection(this, range);
    -                } else {
    -                    api.WrappedTextRange.rangeToTextRange(range).select();
    -                    this._ranges[0] = range;
    -                    this.rangeCount = 1;
    -                    this.isCollapsed = this._ranges[0].collapsed;
    -                    updateAnchorAndFocusFromRange(this, range, false);
    -                }
    -            };
    -
    -            selProto.setRanges = function(ranges) {
    -                this.removeAllRanges();
    -                var rangeCount = ranges.length;
    -                if (rangeCount > 1) {
    -                    createControlSelection(this, ranges);
    -                } else if (rangeCount) {
    -                    this.addRange(ranges[0]);
    -                }
    -            };
    +      selProto.setRanges = function (ranges) {
    +        if (implementsControlRange && implementsDocSelection && ranges.length > 1) {
    +          createControlSelection(this, ranges);
             } else {
    -            module.fail("No means of selecting a Range or TextRange was found");
    -            return false;
    +          this.removeAllRanges();
    +          for (var i = 0, len = ranges.length; i < len; ++i) {
    +            this.addRange(ranges[i]);
    +          }
             }
    +      };
    +    } else if (isHostMethod(testSelection, 'empty') && isHostMethod(testRange, 'select') &&
    +                   implementsControlRange && useDocumentSelection) {
    +      selProto.removeAllRanges = function () {
    +        // Added try/catch as fix for issue #21
    +        try {
    +          this.docSelection.empty();
     
    -        selProto.getRangeAt = function(index) {
    -            if (index < 0 || index >= this.rangeCount) {
    -                throw new DOMException("INDEX_SIZE_ERR");
    -            } else {
    -                // Clone the range to preserve selection-range independence. See issue 80.
    -                return this._ranges[index].cloneRange();
    -            }
    -        };
    +          // Check for empty() not working (issue #24)
    +          if (this.docSelection.type != 'None') {
    +            // Work around failure to empty a control selection by instead selecting a TextRange and then
    +            // calling empty()
    +            var doc;
    +            if (this.anchorNode) {
    +              doc = getDocument(this.anchorNode);
    +            } else if (this.docSelection.type == CONTROL) {
    +              var controlRange = this.docSelection.createRange();
    +              if (controlRange.length) {
    +                doc = getDocument(controlRange.item(0));
    +              }
    +            }
    +            if (doc) {
    +              var textRange = getBody(doc).createTextRange();
    +              textRange.select();
    +              this.docSelection.empty();
    +            }
    +          }
    +        } catch (ex) {}
    +        updateEmptySelection(this);
    +      };
    +
    +      selProto.addRange = function (range) {
    +        if (this.docSelection.type == CONTROL) {
    +          addRangeToControlSelection(this, range);
    +        } else {
    +          api.WrappedTextRange.rangeToTextRange(range).select();
    +          this._ranges[0] = range;
    +          this.rangeCount = 1;
    +          this.isCollapsed = this._ranges[0].collapsed;
    +          updateAnchorAndFocusFromRange(this, range, false);
    +        }
    +      };
    +
    +      selProto.setRanges = function (ranges) {
    +        this.removeAllRanges();
    +        var rangeCount = ranges.length;
    +        if (rangeCount > 1) {
    +          createControlSelection(this, ranges);
    +        } else if (rangeCount) {
    +          this.addRange(ranges[0]);
    +        }
    +      };
    +    } else {
    +      module.fail('No means of selecting a Range or TextRange was found');
    +      return false;
    +    }
     
    -        var refreshSelection;
    +    selProto.getRangeAt = function (index) {
    +      if (index < 0 || index >= this.rangeCount) {
    +        throw new DOMException('INDEX_SIZE_ERR');
    +      } else {
    +        // Clone the range to preserve selection-range independence. See issue 80.
    +        return this._ranges[index].cloneRange();
    +      }
    +    };
     
    -        if (useDocumentSelection) {
    -            refreshSelection = function(sel) {
    -                var range;
    -                if (api.isSelectionValid(sel.win)) {
    -                    range = sel.docSelection.createRange();
    -                } else {
    -                    range = getBody(sel.win.document).createTextRange();
    -                    range.collapse(true);
    -                }
    +    var refreshSelection;
     
    -                if (sel.docSelection.type == CONTROL) {
    -                    updateControlSelection(sel);
    -                } else if (isTextRange(range)) {
    -                    updateFromTextRange(sel, range);
    -                } else {
    -                    updateEmptySelection(sel);
    -                }
    -            };
    -        } else if (isHostMethod(testSelection, "getRangeAt") && typeof testSelection.rangeCount == NUMBER) {
    -            refreshSelection = function(sel) {
    -                if (implementsControlRange && implementsDocSelection && sel.docSelection.type == CONTROL) {
    -                    updateControlSelection(sel);
    -                } else {
    -                    sel._ranges.length = sel.rangeCount = sel.nativeSelection.rangeCount;
    -                    if (sel.rangeCount) {
    -                        for (var i = 0, len = sel.rangeCount; i < len; ++i) {
    -                            sel._ranges[i] = new api.WrappedRange(sel.nativeSelection.getRangeAt(i));
    -                        }
    -                        updateAnchorAndFocusFromRange(sel, sel._ranges[sel.rangeCount - 1], selectionIsBackward(sel.nativeSelection));
    -                        sel.isCollapsed = selectionIsCollapsed(sel);
    -                    } else {
    -                        updateEmptySelection(sel);
    -                    }
    -                }
    -            };
    -        } else if (selectionHasAnchorAndFocus && typeof testSelection.isCollapsed == BOOLEAN && typeof testRange.collapsed == BOOLEAN && features.implementsDomRange) {
    -            refreshSelection = function(sel) {
    -                var range, nativeSel = sel.nativeSelection;
    -                if (nativeSel.anchorNode) {
    -                    range = getSelectionRangeAt(nativeSel, 0);
    -                    sel._ranges = [range];
    -                    sel.rangeCount = 1;
    -                    updateAnchorAndFocusFromNativeSelection(sel);
    -                    sel.isCollapsed = selectionIsCollapsed(sel);
    -                } else {
    -                    updateEmptySelection(sel);
    -                }
    -            };
    +    if (useDocumentSelection) {
    +      refreshSelection = function (sel) {
    +        var range;
    +        if (api.isSelectionValid(sel.win)) {
    +          range = sel.docSelection.createRange();
             } else {
    -            module.fail("No means of obtaining a Range or TextRange from the user's selection was found");
    -            return false;
    +          range = getBody(sel.win.document).createTextRange();
    +          range.collapse(true);
             }
     
    -        selProto.refresh = function(checkForChanges) {
    -            var oldRanges = checkForChanges ? this._ranges.slice(0) : null;
    -            var oldAnchorNode = this.anchorNode, oldAnchorOffset = this.anchorOffset;
    -
    -            refreshSelection(this);
    -            if (checkForChanges) {
    -                // Check the range count first
    -                var i = oldRanges.length;
    -                if (i != this._ranges.length) {
    -                    return true;
    -                }
    -
    -                // Now check the direction. Checking the anchor position is the same is enough since we're checking all the
    -                // ranges after this
    -                if (this.anchorNode != oldAnchorNode || this.anchorOffset != oldAnchorOffset) {
    -                    return true;
    -                }
    -
    -                // Finally, compare each range in turn
    -                while (i--) {
    -                    if (!rangesEqual(oldRanges[i], this._ranges[i])) {
    -                        return true;
    -                    }
    -                }
    -                return false;
    -            }
    -        };
    +        if (sel.docSelection.type == CONTROL) {
    +          updateControlSelection(sel);
    +        } else if (isTextRange(range)) {
    +          updateFromTextRange(sel, range);
    +        } else {
    +          updateEmptySelection(sel);
    +        }
    +      };
    +    } else if (isHostMethod(testSelection, 'getRangeAt') && typeof testSelection.rangeCount === NUMBER) {
    +      refreshSelection = function (sel) {
    +        if (implementsControlRange && implementsDocSelection && sel.docSelection.type == CONTROL) {
    +          updateControlSelection(sel);
    +        } else {
    +          sel._ranges.length = sel.rangeCount = sel.nativeSelection.rangeCount;
    +          if (sel.rangeCount) {
    +            for (var i = 0, len = sel.rangeCount; i < len; ++i) {
    +              sel._ranges[i] = new api.WrappedRange(sel.nativeSelection.getRangeAt(i));
    +            }
    +            updateAnchorAndFocusFromRange(sel, sel._ranges[sel.rangeCount - 1], selectionIsBackward(sel.nativeSelection));
    +            sel.isCollapsed = selectionIsCollapsed(sel);
    +          } else {
    +            updateEmptySelection(sel);
    +          }
    +        }
    +      };
    +    } else if (selectionHasAnchorAndFocus && typeof testSelection.isCollapsed === BOOLEAN && typeof testRange.collapsed === BOOLEAN && features.implementsDomRange) {
    +      refreshSelection = function (sel) {
    +        var range, nativeSel = sel.nativeSelection;
    +        if (nativeSel.anchorNode) {
    +          range = getSelectionRangeAt(nativeSel, 0);
    +          sel._ranges = [range];
    +          sel.rangeCount = 1;
    +          updateAnchorAndFocusFromNativeSelection(sel);
    +          sel.isCollapsed = selectionIsCollapsed(sel);
    +        } else {
    +          updateEmptySelection(sel);
    +        }
    +      };
    +    } else {
    +      module.fail("No means of obtaining a Range or TextRange from the user's selection was found");
    +      return false;
    +    }
     
    -        // Removal of a single range
    -        var removeRangeManually = function(sel, range) {
    -            var ranges = sel.getAllRanges();
    -            sel.removeAllRanges();
    -            for (var i = 0, len = ranges.length; i < len; ++i) {
    -                if (!rangesEqual(range, ranges[i])) {
    -                    sel.addRange(ranges[i]);
    -                }
    -            }
    -            if (!sel.rangeCount) {
    -                updateEmptySelection(sel);
    -            }
    -        };
    +    selProto.refresh = function (checkForChanges) {
    +      var oldRanges = checkForChanges ? this._ranges.slice(0) : null;
    +      var oldAnchorNode = this.anchorNode, oldAnchorOffset = this.anchorOffset;
     
    -        if (implementsControlRange && implementsDocSelection) {
    -            selProto.removeRange = function(range) {
    -                if (this.docSelection.type == CONTROL) {
    -                    var controlRange = this.docSelection.createRange();
    -                    var rangeElement = getSingleElementFromRange(range);
    -
    -                    // Create a new ControlRange containing all the elements in the selected ControlRange minus the
    -                    // element contained by the supplied range
    -                    var doc = getDocument(controlRange.item(0));
    -                    var newControlRange = getBody(doc).createControlRange();
    -                    var el, removed = false;
    -                    for (var i = 0, len = controlRange.length; i < len; ++i) {
    -                        el = controlRange.item(i);
    -                        if (el !== rangeElement || removed) {
    -                            newControlRange.add(controlRange.item(i));
    -                        } else {
    -                            removed = true;
    -                        }
    -                    }
    -                    newControlRange.select();
    -
    -                    // Update the wrapped selection based on what's now in the native selection
    -                    updateControlSelection(this);
    -                } else {
    -                    removeRangeManually(this, range);
    -                }
    -            };
    -        } else {
    -            selProto.removeRange = function(range) {
    -                removeRangeManually(this, range);
    -            };
    +      refreshSelection(this);
    +      if (checkForChanges) {
    +        // Check the range count first
    +        var i = oldRanges.length;
    +        if (i != this._ranges.length) {
    +          return true;
             }
     
    -        // Detecting if a selection is backward
    -        var selectionIsBackward;
    -        if (!useDocumentSelection && selectionHasAnchorAndFocus && features.implementsDomRange) {
    -            selectionIsBackward = winSelectionIsBackward;
    +        // Now check the direction. Checking the anchor position is the same is enough since we're checking all the
    +        // ranges after this
    +        if (this.anchorNode != oldAnchorNode || this.anchorOffset != oldAnchorOffset) {
    +          return true;
    +        }
     
    -            selProto.isBackward = function() {
    -                return selectionIsBackward(this);
    -            };
    -        } else {
    -            selectionIsBackward = selProto.isBackward = function() {
    -                return false;
    -            };
    +        // Finally, compare each range in turn
    +        while (i--) {
    +          if (!rangesEqual(oldRanges[i], this._ranges[i])) {
    +            return true;
    +          }
             }
    +        return false;
    +      }
    +    };
     
    -        // Create an alias for backwards compatibility. From 1.3, everything is "backward" rather than "backwards"
    -        selProto.isBackwards = selProto.isBackward;
    +    // Removal of a single range
    +    var removeRangeManually = function (sel, range) {
    +      var ranges = sel.getAllRanges();
    +      sel.removeAllRanges();
    +      for (var i = 0, len = ranges.length; i < len; ++i) {
    +        if (!rangesEqual(range, ranges[i])) {
    +          sel.addRange(ranges[i]);
    +        }
    +      }
    +      if (!sel.rangeCount) {
    +        updateEmptySelection(sel);
    +      }
    +    };
     
    -        // Selection stringifier
    -        // This is conformant to the old HTML5 selections draft spec but differs from WebKit and Mozilla's implementation.
    -        // The current spec does not yet define this method.
    -        selProto.toString = function() {
    -            var rangeTexts = [];
    -            for (var i = 0, len = this.rangeCount; i < len; ++i) {
    -                rangeTexts[i] = "" + this._ranges[i];
    +    if (implementsControlRange && implementsDocSelection) {
    +      selProto.removeRange = function (range) {
    +        if (this.docSelection.type == CONTROL) {
    +          var controlRange = this.docSelection.createRange();
    +          var rangeElement = getSingleElementFromRange(range);
    +
    +          // Create a new ControlRange containing all the elements in the selected ControlRange minus the
    +          // element contained by the supplied range
    +          var doc = getDocument(controlRange.item(0));
    +          var newControlRange = getBody(doc).createControlRange();
    +          var el, removed = false;
    +          for (var i = 0, len = controlRange.length; i < len; ++i) {
    +            el = controlRange.item(i);
    +            if (el !== rangeElement || removed) {
    +              newControlRange.add(controlRange.item(i));
    +            } else {
    +              removed = true;
                 }
    -            return rangeTexts.join("");
    -        };
    +          }
    +          newControlRange.select();
     
    -        function assertNodeInSameDocument(sel, node) {
    -            if (sel.win.document != getDocument(node)) {
    -                throw new DOMException("WRONG_DOCUMENT_ERR");
    -            }
    +          // Update the wrapped selection based on what's now in the native selection
    +          updateControlSelection(this);
    +        } else {
    +          removeRangeManually(this, range);
             }
    +      };
    +    } else {
    +      selProto.removeRange = function (range) {
    +        removeRangeManually(this, range);
    +      };
    +    }
     
    -        // No current browser conforms fully to the spec for this method, so Rangy's own method is always used
    -        selProto.collapse = function(node, offset) {
    -            assertNodeInSameDocument(this, node);
    -            var range = api.createRange(node);
    -            range.collapseToPoint(node, offset);
    -            this.setSingleRange(range);
    -            this.isCollapsed = true;
    -        };
    +    // Detecting if a selection is backward
    +    var selectionIsBackward;
    +    if (!useDocumentSelection && selectionHasAnchorAndFocus && features.implementsDomRange) {
    +      selectionIsBackward = winSelectionIsBackward;
     
    -        selProto.collapseToStart = function() {
    -            if (this.rangeCount) {
    -                var range = this._ranges[0];
    -                this.collapse(range.startContainer, range.startOffset);
    -            } else {
    -                throw new DOMException("INVALID_STATE_ERR");
    -            }
    -        };
    +      selProto.isBackward = function () {
    +        return selectionIsBackward(this);
    +      };
    +    } else {
    +      selectionIsBackward = selProto.isBackward = function () {
    +        return false;
    +      };
    +    }
     
    -        selProto.collapseToEnd = function() {
    -            if (this.rangeCount) {
    -                var range = this._ranges[this.rangeCount - 1];
    -                this.collapse(range.endContainer, range.endOffset);
    -            } else {
    -                throw new DOMException("INVALID_STATE_ERR");
    -            }
    -        };
    +    // Create an alias for backwards compatibility. From 1.3, everything is "backward" rather than "backwards"
    +    selProto.isBackwards = selProto.isBackward;
    +
    +    // Selection stringifier
    +    // This is conformant to the old HTML5 selections draft spec but differs from WebKit and Mozilla's implementation.
    +    // The current spec does not yet define this method.
    +    selProto.toString = function () {
    +      var rangeTexts = [];
    +      for (var i = 0, len = this.rangeCount; i < len; ++i) {
    +        rangeTexts[i] = '' + this._ranges[i];
    +      }
    +      return rangeTexts.join('');
    +    };
     
    -        // The spec is very specific on how selectAllChildren should be implemented and not all browsers implement it as
    -        // specified so the native implementation is never used by Rangy.
    -        selProto.selectAllChildren = function(node) {
    -            assertNodeInSameDocument(this, node);
    -            var range = api.createRange(node);
    -            range.selectNodeContents(node);
    -            this.setSingleRange(range);
    -        };
    +    function assertNodeInSameDocument (sel, node) {
    +      if (sel.win.document != getDocument(node)) {
    +        throw new DOMException('WRONG_DOCUMENT_ERR');
    +      }
    +    }
     
    -        selProto.deleteFromDocument = function() {
    -            // Sepcial behaviour required for IE's control selections
    -            if (implementsControlRange && implementsDocSelection && this.docSelection.type == CONTROL) {
    -                var controlRange = this.docSelection.createRange();
    -                var element;
    -                while (controlRange.length) {
    -                    element = controlRange.item(0);
    -                    controlRange.remove(element);
    -                    dom.removeNode(element);
    -                }
    -                this.refresh();
    -            } else if (this.rangeCount) {
    -                var ranges = this.getAllRanges();
    -                if (ranges.length) {
    -                    this.removeAllRanges();
    -                    for (var i = 0, len = ranges.length; i < len; ++i) {
    -                        ranges[i].deleteContents();
    -                    }
    -                    // The spec says nothing about what the selection should contain after calling deleteContents on each
    -                    // range. Firefox moves the selection to where the final selected range was, so we emulate that
    -                    this.addRange(ranges[len - 1]);
    -                }
    -            }
    -        };
    +    // No current browser conforms fully to the spec for this method, so Rangy's own method is always used
    +    selProto.collapse = function (node, offset) {
    +      assertNodeInSameDocument(this, node);
    +      var range = api.createRange(node);
    +      range.collapseToPoint(node, offset);
    +      this.setSingleRange(range);
    +      this.isCollapsed = true;
    +    };
     
    -        // The following are non-standard extensions
    -        selProto.eachRange = function(func, returnValue) {
    -            for (var i = 0, len = this._ranges.length; i < len; ++i) {
    -                if ( func( this.getRangeAt(i) ) ) {
    -                    return returnValue;
    -                }
    -            }
    -        };
    +    selProto.collapseToStart = function () {
    +      if (this.rangeCount) {
    +        var range = this._ranges[0];
    +        this.collapse(range.startContainer, range.startOffset);
    +      } else {
    +        throw new DOMException('INVALID_STATE_ERR');
    +      }
    +    };
     
    -        selProto.getAllRanges = function() {
    -            var ranges = [];
    -            this.eachRange(function(range) {
    -                ranges.push(range);
    -            });
    -            return ranges;
    -        };
    +    selProto.collapseToEnd = function () {
    +      if (this.rangeCount) {
    +        var range = this._ranges[this.rangeCount - 1];
    +        this.collapse(range.endContainer, range.endOffset);
    +      } else {
    +        throw new DOMException('INVALID_STATE_ERR');
    +      }
    +    };
     
    -        selProto.setSingleRange = function(range, direction) {
    -            this.removeAllRanges();
    -            this.addRange(range, direction);
    -        };
    +    // The spec is very specific on how selectAllChildren should be implemented and not all browsers implement it as
    +    // specified so the native implementation is never used by Rangy.
    +    selProto.selectAllChildren = function (node) {
    +      assertNodeInSameDocument(this, node);
    +      var range = api.createRange(node);
    +      range.selectNodeContents(node);
    +      this.setSingleRange(range);
    +    };
     
    -        selProto.callMethodOnEachRange = function(methodName, params) {
    -            var results = [];
    -            this.eachRange( function(range) {
    -                results.push( range[methodName].apply(range, params || []) );
    -            } );
    -            return results;
    -        };
    +    selProto.deleteFromDocument = function () {
    +      // Sepcial behaviour required for IE's control selections
    +      if (implementsControlRange && implementsDocSelection && this.docSelection.type == CONTROL) {
    +        var controlRange = this.docSelection.createRange();
    +        var element;
    +        while (controlRange.length) {
    +          element = controlRange.item(0);
    +          controlRange.remove(element);
    +          dom.removeNode(element);
    +        }
    +        this.refresh();
    +      } else if (this.rangeCount) {
    +        var ranges = this.getAllRanges();
    +        if (ranges.length) {
    +          this.removeAllRanges();
    +          for (var i = 0, len = ranges.length; i < len; ++i) {
    +            ranges[i].deleteContents();
    +          }
    +          // The spec says nothing about what the selection should contain after calling deleteContents on each
    +          // range. Firefox moves the selection to where the final selected range was, so we emulate that
    +          this.addRange(ranges[len - 1]);
    +        }
    +      }
    +    };
     
    -        function createStartOrEndSetter(isStart) {
    -            return function(node, offset) {
    -                var range;
    -                if (this.rangeCount) {
    -                    range = this.getRangeAt(0);
    -                    range["set" + (isStart ? "Start" : "End")](node, offset);
    -                } else {
    -                    range = api.createRange(this.win.document);
    -                    range.setStartAndEnd(node, offset);
    -                }
    -                this.setSingleRange(range, this.isBackward());
    -            };
    +    // The following are non-standard extensions
    +    selProto.eachRange = function (func, returnValue) {
    +      for (var i = 0, len = this._ranges.length; i < len; ++i) {
    +        if (func(this.getRangeAt(i))) {
    +          return returnValue;
             }
    +      }
    +    };
     
    -        selProto.setStart = createStartOrEndSetter(true);
    -        selProto.setEnd = createStartOrEndSetter(false);
    +    selProto.getAllRanges = function () {
    +      var ranges = [];
    +      this.eachRange(function (range) {
    +        ranges.push(range);
    +      });
    +      return ranges;
    +    };
     
    -        // Add select() method to Range prototype. Any existing selection will be removed.
    -        api.rangePrototype.select = function(direction) {
    -            getSelection( this.getDocument() ).setSingleRange(this, direction);
    -        };
    +    selProto.setSingleRange = function (range, direction) {
    +      this.removeAllRanges();
    +      this.addRange(range, direction);
    +    };
     
    -        selProto.changeEachRange = function(func) {
    -            var ranges = [];
    -            var backward = this.isBackward();
    +    selProto.callMethodOnEachRange = function (methodName, params) {
    +      var results = [];
    +      this.eachRange(function (range) {
    +        results.push(range[methodName].apply(range, params || []));
    +      });
    +      return results;
    +    };
     
    -            this.eachRange(function(range) {
    -                func(range);
    -                ranges.push(range);
    -            });
    +    function createStartOrEndSetter (isStart) {
    +      return function (node, offset) {
    +        var range;
    +        if (this.rangeCount) {
    +          range = this.getRangeAt(0);
    +          range['set' + (isStart ? 'Start' : 'End')](node, offset);
    +        } else {
    +          range = api.createRange(this.win.document);
    +          range.setStartAndEnd(node, offset);
    +        }
    +        this.setSingleRange(range, this.isBackward());
    +      };
    +    }
     
    -            this.removeAllRanges();
    -            if (backward && ranges.length == 1) {
    -                this.addRange(ranges[0], "backward");
    -            } else {
    -                this.setRanges(ranges);
    -            }
    -        };
    +    selProto.setStart = createStartOrEndSetter(true);
    +    selProto.setEnd = createStartOrEndSetter(false);
     
    -        selProto.containsNode = function(node, allowPartial) {
    -            return this.eachRange( function(range) {
    -                return range.containsNode(node, allowPartial);
    -            }, true ) || false;
    -        };
    +    // Add select() method to Range prototype. Any existing selection will be removed.
    +    api.rangePrototype.select = function (direction) {
    +      getSelection(this.getDocument()).setSingleRange(this, direction);
    +    };
     
    -        selProto.getBookmark = function(containerNode) {
    -            return {
    -                backward: this.isBackward(),
    -                rangeBookmarks: this.callMethodOnEachRange("getBookmark", [containerNode])
    -            };
    -        };
    +    selProto.changeEachRange = function (func) {
    +      var ranges = [];
    +      var backward = this.isBackward();
    +
    +      this.eachRange(function (range) {
    +        func(range);
    +        ranges.push(range);
    +      });
    +
    +      this.removeAllRanges();
    +      if (backward && ranges.length == 1) {
    +        this.addRange(ranges[0], 'backward');
    +      } else {
    +        this.setRanges(ranges);
    +      }
    +    };
     
    -        selProto.moveToBookmark = function(bookmark) {
    -            var selRanges = [];
    -            for (var i = 0, rangeBookmark, range; rangeBookmark = bookmark.rangeBookmarks[i++]; ) {
    -                range = api.createRange(this.win);
    -                range.moveToBookmark(rangeBookmark);
    -                selRanges.push(range);
    -            }
    -            if (bookmark.backward) {
    -                this.setSingleRange(selRanges[0], "backward");
    -            } else {
    -                this.setRanges(selRanges);
    -            }
    -        };
    +    selProto.containsNode = function (node, allowPartial) {
    +      return this.eachRange(function (range) {
    +        return range.containsNode(node, allowPartial);
    +      }, true) || false;
    +    };
     
    -        selProto.saveRanges = function() {
    -            return {
    -                backward: this.isBackward(),
    -                ranges: this.callMethodOnEachRange("cloneRange")
    -            };
    -        };
    +    selProto.getBookmark = function (containerNode) {
    +      return {
    +        backward: this.isBackward(),
    +        rangeBookmarks: this.callMethodOnEachRange('getBookmark', [containerNode])
    +      };
    +    };
     
    -        selProto.restoreRanges = function(selRanges) {
    -            this.removeAllRanges();
    -            for (var i = 0, range; range = selRanges.ranges[i]; ++i) {
    -                this.addRange(range, (selRanges.backward && i == 0));
    -            }
    -        };
    +    selProto.moveToBookmark = function (bookmark) {
    +      var selRanges = [];
    +      for (var i = 0, rangeBookmark, range; rangeBookmark = bookmark.rangeBookmarks[i++];) {
    +        range = api.createRange(this.win);
    +        range.moveToBookmark(rangeBookmark);
    +        selRanges.push(range);
    +      }
    +      if (bookmark.backward) {
    +        this.setSingleRange(selRanges[0], 'backward');
    +      } else {
    +        this.setRanges(selRanges);
    +      }
    +    };
     
    -        selProto.toHtml = function() {
    -            var rangeHtmls = [];
    -            this.eachRange(function(range) {
    -                rangeHtmls.push( DomRange.toHtml(range) );
    -            });
    -            return rangeHtmls.join("");
    -        };
    +    selProto.saveRanges = function () {
    +      return {
    +        backward: this.isBackward(),
    +        ranges: this.callMethodOnEachRange('cloneRange')
    +      };
    +    };
     
    -        if (features.implementsTextRange) {
    -            selProto.getNativeTextRange = function() {
    -                var sel, textRange;
    -                if ( (sel = this.docSelection) ) {
    -                    var range = sel.createRange();
    -                    if (isTextRange(range)) {
    -                        return range;
    -                    } else {
    -                        throw module.createError("getNativeTextRange: selection is a control selection");
    -                    }
    -                } else if (this.rangeCount > 0) {
    -                    return api.WrappedTextRange.rangeToTextRange( this.getRangeAt(0) );
    -                } else {
    -                    throw module.createError("getNativeTextRange: selection contains no range");
    -                }
    -            };
    +    selProto.restoreRanges = function (selRanges) {
    +      this.removeAllRanges();
    +      for (var i = 0, range; range = selRanges.ranges[i]; ++i) {
    +        this.addRange(range, (selRanges.backward && i == 0));
    +      }
    +    };
    +
    +    selProto.toHtml = function () {
    +      var rangeHtmls = [];
    +      this.eachRange(function (range) {
    +        rangeHtmls.push(DomRange.toHtml(range));
    +      });
    +      return rangeHtmls.join('');
    +    };
    +
    +    if (features.implementsTextRange) {
    +      selProto.getNativeTextRange = function () {
    +        var sel, textRange;
    +        if ((sel = this.docSelection)) {
    +          var range = sel.createRange();
    +          if (isTextRange(range)) {
    +            return range;
    +          } else {
    +            throw module.createError('getNativeTextRange: selection is a control selection');
    +          }
    +        } else if (this.rangeCount > 0) {
    +          return api.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));
    +        } else {
    +          throw module.createError('getNativeTextRange: selection contains no range');
             }
    +      };
    +    }
     
    -        function inspect(sel) {
    -            var rangeInspects = [];
    -            var anchor = new DomPosition(sel.anchorNode, sel.anchorOffset);
    -            var focus = new DomPosition(sel.focusNode, sel.focusOffset);
    -            var name = (typeof sel.getName == "function") ? sel.getName() : "Selection";
    +    function inspect (sel) {
    +      var rangeInspects = [];
    +      var anchor = new DomPosition(sel.anchorNode, sel.anchorOffset);
    +      var focus = new DomPosition(sel.focusNode, sel.focusOffset);
    +      var name = (typeof sel.getName === 'function') ? sel.getName() : 'Selection';
     
    -            if (typeof sel.rangeCount != "undefined") {
    -                for (var i = 0, len = sel.rangeCount; i < len; ++i) {
    -                    rangeInspects[i] = DomRange.inspect(sel.getRangeAt(i));
    -                }
    -            }
    -            return "[" + name + "(Ranges: " + rangeInspects.join(", ") +
    -                    ")(anchor: " + anchor.inspect() + ", focus: " + focus.inspect() + "]";
    +      if (typeof sel.rangeCount !== 'undefined') {
    +        for (var i = 0, len = sel.rangeCount; i < len; ++i) {
    +          rangeInspects[i] = DomRange.inspect(sel.getRangeAt(i));
             }
    +      }
    +      return '[' + name + '(Ranges: ' + rangeInspects.join(', ') +
    +                    ')(anchor: ' + anchor.inspect() + ', focus: ' + focus.inspect() + ']';
    +    }
     
    -        selProto.getName = function() {
    -            return "WrappedSelection";
    -        };
    +    selProto.getName = function () {
    +      return 'WrappedSelection';
    +    };
     
    -        selProto.inspect = function() {
    -            return inspect(this);
    -        };
    +    selProto.inspect = function () {
    +      return inspect(this);
    +    };
     
    -        selProto.detach = function() {
    -            actOnCachedSelection(this.win, "delete");
    -            deleteProperties(this);
    -        };
    +    selProto.detach = function () {
    +      actOnCachedSelection(this.win, 'delete');
    +      deleteProperties(this);
    +    };
     
    -        WrappedSelection.detachAll = function() {
    -            actOnCachedSelection(null, "deleteAll");
    -        };
    +    WrappedSelection.detachAll = function () {
    +      actOnCachedSelection(null, 'deleteAll');
    +    };
     
    -        WrappedSelection.inspect = inspect;
    -        WrappedSelection.isDirectionBackward = isDirectionBackward;
    +    WrappedSelection.inspect = inspect;
    +    WrappedSelection.isDirectionBackward = isDirectionBackward;
     
    -        api.Selection = WrappedSelection;
    +    api.Selection = WrappedSelection;
     
    -        api.selectionPrototype = selProto;
    +    api.selectionPrototype = selProto;
     
    -        api.addShimListener(function(win) {
    -            if (typeof win.getSelection == "undefined") {
    -                win.getSelection = function() {
    -                    return getSelection(win);
    -                };
    -            }
    -            win = null;
    -        });
    +    api.addShimListener(function (win) {
    +      if (typeof win.getSelection === 'undefined') {
    +        win.getSelection = function () {
    +          return getSelection(win);
    +        };
    +      }
    +      win = null;
         });
    -    
    +  });
     
    -    /*----------------------------------------------------------------------------------------------------------------*/
    +  /* ---------------------------------------------------------------------------------------------------------------- */
     
    -    // Wait for document to load before initializing
    -    var docReady = false;
    +  // Wait for document to load before initializing
    +  var docReady = false;
     
    -    var loadHandler = function(e) {
    -        if (!docReady) {
    -            docReady = true;
    -            if (!api.initialized && api.config.autoInitialize) {
    -                init();
    -            }
    -        }
    -    };
    +  var loadHandler = function (e) {
    +    if (!docReady) {
    +      docReady = true;
    +      if (!api.initialized && api.config.autoInitialize) {
    +        init();
    +      }
    +    }
    +  };
     
    -    if (isBrowser) {
    -        // Test whether the document has already been loaded and initialize immediately if so
    -        if (document.readyState == "complete") {
    -            loadHandler();
    -        } else {
    -            if (isHostMethod(document, "addEventListener")) {
    -                document.addEventListener("DOMContentLoaded", loadHandler, false);
    -            }
    +  if (isBrowser) {
    +    // Test whether the document has already been loaded and initialize immediately if so
    +    if (document.readyState == 'complete') {
    +      loadHandler();
    +    } else {
    +      if (isHostMethod(document, 'addEventListener')) {
    +        document.addEventListener('DOMContentLoaded', loadHandler, false);
    +      }
     
    -            // Add a fallback in case the DOMContentLoaded event isn't supported
    -            addListener(window, "load", loadHandler);
    -        }
    +      // Add a fallback in case the DOMContentLoaded event isn't supported
    +      addListener(window, 'load', loadHandler);
         }
    +  }
     
    -    return api;
    +  return api;
     }, this);
    diff --git a/org.civicrm.reqangular/js/src/common/vendor/angular/rangy-selectionsaverestore.js b/org.civicrm.reqangular/js/src/common/vendor/angular/rangy-selectionsaverestore.js
    index c8d3f9408b7..a963ee43e2e 100755
    --- a/org.civicrm.reqangular/js/src/common/vendor/angular/rangy-selectionsaverestore.js
    +++ b/org.civicrm.reqangular/js/src/common/vendor/angular/rangy-selectionsaverestore.js
    @@ -1,21 +1,3 @@
    -/*
    -    !CUSTOMIZED VENDOR FILE!
    -
    -    Rangy is written to correctly work as an AMD module, but textAngular.js
    -    (which is a shimmed, not-AMD "module") expects window.rangy to exist.
    -
    -    The workaround consists of making sure a global variable is created before
    -    defining the module
    -
    -
    -    More details on dependencies for shimmed modules here:
    -    http://requirejs.org/docs/api.html#config-shim
    -
    -    > Only use other "shim" modules as dependencies for shimmed scripts,
    -    or AMD libraries that have no dependencies and call define() after they
    -    also create a global
    -*/
    -
     /**
      * Selection save and restore module for Rangy.
      * Saves and restores user selections using marker invisible elements in the DOM.
    @@ -27,243 +9,244 @@
      *
      * Copyright 2015, Tim Down
      * Licensed under the MIT license.
    - * Version: 1.3.0
    - * Build date: 10 May 2015
    + * Version: 1.3.1-dev
    + * Build date: 20 May 2015
      */
    -(function(factory, root) {
    +(function (factory, root) {
    +  if (typeof define === 'function' && define.amd) {
    +    // AMD. Register as an anonymous module with a dependency on Rangy.
    +    define(['./rangy-core'], factory);
    +  } else if (typeof module !== 'undefined' && typeof exports === 'object') {
    +    // Node/CommonJS style
    +    module.exports = factory(require('rangy'));
    +  } else {
    +    // No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
         factory(root.rangy);
    +  }
    +})(function (rangy) {
    +  rangy.createModule('SaveRestore', ['WrappedRange'], function (api, module) {
    +    var dom = api.dom;
    +    var removeNode = dom.removeNode;
    +    var isDirectionBackward = api.Selection.isDirectionBackward;
    +    var markerTextChar = '\ufeff';
    +
    +    function gEBI (id, doc) {
    +      return (doc || document).getElementById(id);
    +    }
     
    -    if (typeof define == "function" && define.amd) {
    -        // AMD. Register as an anonymous module with a dependency on Rangy.
    -        define(["./rangy-core"], factory);
    -    } else if (typeof module != "undefined" && typeof exports == "object") {
    -        // Node/CommonJS style
    -        module.exports = factory( require("rangy") );
    +    function insertRangeBoundaryMarker (range, atStart) {
    +      var markerId = 'selectionBoundary_' + (+new Date()) + '_' + ('' + Math.random()).slice(2);
    +      var markerEl;
    +      var doc = dom.getDocument(range.startContainer);
    +
    +      // Clone the Range and collapse to the appropriate boundary point
    +      var boundaryRange = range.cloneRange();
    +      boundaryRange.collapse(atStart);
    +
    +      // Create the marker element containing a single invisible character using DOM methods and insert it
    +      markerEl = doc.createElement('span');
    +      markerEl.id = markerId;
    +      markerEl.style.lineHeight = '0';
    +      markerEl.style.display = 'none';
    +      markerEl.className = 'rangySelectionBoundary';
    +      markerEl.appendChild(doc.createTextNode(markerTextChar));
    +
    +      boundaryRange.insertNode(markerEl);
    +      return markerEl;
         }
    -})(function(rangy) {
    -    rangy.createModule("SaveRestore", ["WrappedRange"], function(api, module) {
    -        var dom = api.dom;
    -        var removeNode = dom.removeNode;
    -        var isDirectionBackward = api.Selection.isDirectionBackward;
    -        var markerTextChar = "\ufeff";
    -
    -        function gEBI(id, doc) {
    -            return (doc || document).getElementById(id);
    -        }
     
    -        function insertRangeBoundaryMarker(range, atStart) {
    -            var markerId = "selectionBoundary_" + (+new Date()) + "_" + ("" + Math.random()).slice(2);
    -            var markerEl;
    -            var doc = dom.getDocument(range.startContainer);
    -
    -            // Clone the Range and collapse to the appropriate boundary point
    -            var boundaryRange = range.cloneRange();
    -            boundaryRange.collapse(atStart);
    -
    -            // Create the marker element containing a single invisible character using DOM methods and insert it
    -            markerEl = doc.createElement("span");
    -            markerEl.id = markerId;
    -            markerEl.style.lineHeight = "0";
    -            markerEl.style.display = "none";
    -            markerEl.className = "rangySelectionBoundary";
    -            markerEl.appendChild(doc.createTextNode(markerTextChar));
    -
    -            boundaryRange.insertNode(markerEl);
    -            return markerEl;
    -        }
    +    function setRangeBoundary (doc, range, markerId, atStart) {
    +      var markerEl = gEBI(markerId, doc);
    +      if (markerEl) {
    +        range[atStart ? 'setStartBefore' : 'setEndBefore'](markerEl);
    +        removeNode(markerEl);
    +      } else {
    +        module.warn('Marker element has been removed. Cannot restore selection.');
    +      }
    +    }
     
    -        function setRangeBoundary(doc, range, markerId, atStart) {
    -            var markerEl = gEBI(markerId, doc);
    -            if (markerEl) {
    -                range[atStart ? "setStartBefore" : "setEndBefore"](markerEl);
    -                removeNode(markerEl);
    -            } else {
    -                module.warn("Marker element has been removed. Cannot restore selection.");
    -            }
    -        }
    +    function compareRanges (r1, r2) {
    +      return r2.compareBoundaryPoints(r1.START_TO_START, r1);
    +    }
     
    -        function compareRanges(r1, r2) {
    -            return r2.compareBoundaryPoints(r1.START_TO_START, r1);
    -        }
    +    function saveRange (range, direction) {
    +      var startEl, endEl, doc = api.DomRange.getRangeDocument(range), text = range.toString();
    +      var backward = isDirectionBackward(direction);
    +
    +      if (range.collapsed) {
    +        endEl = insertRangeBoundaryMarker(range, false);
    +        return {
    +          document: doc,
    +          markerId: endEl.id,
    +          collapsed: true
    +        };
    +      } else {
    +        endEl = insertRangeBoundaryMarker(range, false);
    +        startEl = insertRangeBoundaryMarker(range, true);
    +
    +        return {
    +          document: doc,
    +          startMarkerId: startEl.id,
    +          endMarkerId: endEl.id,
    +          collapsed: false,
    +          backward: backward,
    +          toString: function () {
    +            return "original text: '" + text + "', new text: '" + range.toString() + "'";
    +          }
    +        };
    +      }
    +    }
     
    -        function saveRange(range, direction) {
    -            var startEl, endEl, doc = api.DomRange.getRangeDocument(range), text = range.toString();
    -            var backward = isDirectionBackward(direction);
    -
    -            if (range.collapsed) {
    -                endEl = insertRangeBoundaryMarker(range, false);
    -                return {
    -                    document: doc,
    -                    markerId: endEl.id,
    -                    collapsed: true
    -                };
    -            } else {
    -                endEl = insertRangeBoundaryMarker(range, false);
    -                startEl = insertRangeBoundaryMarker(range, true);
    -
    -                return {
    -                    document: doc,
    -                    startMarkerId: startEl.id,
    -                    endMarkerId: endEl.id,
    -                    collapsed: false,
    -                    backward: backward,
    -                    toString: function() {
    -                        return "original text: '" + text + "', new text: '" + range.toString() + "'";
    -                    }
    -                };
    -            }
    +    function restoreRange (rangeInfo, normalize) {
    +      var doc = rangeInfo.document;
    +      if (typeof normalize === 'undefined') {
    +        normalize = true;
    +      }
    +      var range = api.createRange(doc);
    +      if (rangeInfo.collapsed) {
    +        var markerEl = gEBI(rangeInfo.markerId, doc);
    +        if (markerEl) {
    +          markerEl.style.display = 'inline';
    +          var previousNode = markerEl.previousSibling;
    +
    +          // Workaround for issue 17
    +          if (previousNode && previousNode.nodeType == 3) {
    +            removeNode(markerEl);
    +            range.collapseToPoint(previousNode, previousNode.length);
    +          } else {
    +            range.collapseBefore(markerEl);
    +            removeNode(markerEl);
    +          }
    +        } else {
    +          module.warn('Marker element has been removed. Cannot restore selection.');
             }
    +      } else {
    +        setRangeBoundary(doc, range, rangeInfo.startMarkerId, true);
    +        setRangeBoundary(doc, range, rangeInfo.endMarkerId, false);
    +      }
     
    -        function restoreRange(rangeInfo, normalize) {
    -            var doc = rangeInfo.document;
    -            if (typeof normalize == "undefined") {
    -                normalize = true;
    -            }
    -            var range = api.createRange(doc);
    -            if (rangeInfo.collapsed) {
    -                var markerEl = gEBI(rangeInfo.markerId, doc);
    -                if (markerEl) {
    -                    markerEl.style.display = "inline";
    -                    var previousNode = markerEl.previousSibling;
    -
    -                    // Workaround for issue 17
    -                    if (previousNode && previousNode.nodeType == 3) {
    -                        removeNode(markerEl);
    -                        range.collapseToPoint(previousNode, previousNode.length);
    -                    } else {
    -                        range.collapseBefore(markerEl);
    -                        removeNode(markerEl);
    -                    }
    -                } else {
    -                    module.warn("Marker element has been removed. Cannot restore selection.");
    -                }
    -            } else {
    -                setRangeBoundary(doc, range, rangeInfo.startMarkerId, true);
    -                setRangeBoundary(doc, range, rangeInfo.endMarkerId, false);
    -            }
    -
    -            if (normalize) {
    -                range.normalizeBoundaries();
    -            }
    -
    -            return range;
    -        }
    +      if (normalize) {
    +        range.normalizeBoundaries();
    +      }
     
    -        function saveRanges(ranges, direction) {
    -            var rangeInfos = [], range, doc;
    -            var backward = isDirectionBackward(direction);
    -
    -            // Order the ranges by position within the DOM, latest first, cloning the array to leave the original untouched
    -            ranges = ranges.slice(0);
    -            ranges.sort(compareRanges);
    -
    -            for (var i = 0, len = ranges.length; i < len; ++i) {
    -                rangeInfos[i] = saveRange(ranges[i], backward);
    -            }
    -
    -            // Now that all the markers are in place and DOM manipulation over, adjust each range's boundaries to lie
    -            // between its markers
    -            for (i = len - 1; i >= 0; --i) {
    -                range = ranges[i];
    -                doc = api.DomRange.getRangeDocument(range);
    -                if (range.collapsed) {
    -                    range.collapseAfter(gEBI(rangeInfos[i].markerId, doc));
    -                } else {
    -                    range.setEndBefore(gEBI(rangeInfos[i].endMarkerId, doc));
    -                    range.setStartAfter(gEBI(rangeInfos[i].startMarkerId, doc));
    -                }
    -            }
    -
    -            return rangeInfos;
    -        }
    +      return range;
    +    }
     
    -        function saveSelection(win) {
    -            if (!api.isSelectionValid(win)) {
    -                module.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus.");
    -                return null;
    -            }
    -            var sel = api.getSelection(win);
    -            var ranges = sel.getAllRanges();
    -            var backward = (ranges.length == 1 && sel.isBackward());
    -
    -            var rangeInfos = saveRanges(ranges, backward);
    -
    -            // Ensure current selection is unaffected
    -            if (backward) {
    -                sel.setSingleRange(ranges[0], backward);
    -            } else {
    -                sel.setRanges(ranges);
    -            }
    -
    -            return {
    -                win: win,
    -                rangeInfos: rangeInfos,
    -                restored: false
    -            };
    +    function saveRanges (ranges, direction) {
    +      var rangeInfos = [], range, doc;
    +      var backward = isDirectionBackward(direction);
    +
    +      // Order the ranges by position within the DOM, latest first, cloning the array to leave the original untouched
    +      ranges = ranges.slice(0);
    +      ranges.sort(compareRanges);
    +
    +      for (var i = 0, len = ranges.length; i < len; ++i) {
    +        rangeInfos[i] = saveRange(ranges[i], backward);
    +      }
    +
    +      // Now that all the markers are in place and DOM manipulation over, adjust each range's boundaries to lie
    +      // between its markers
    +      for (i = len - 1; i >= 0; --i) {
    +        range = ranges[i];
    +        doc = api.DomRange.getRangeDocument(range);
    +        if (range.collapsed) {
    +          range.collapseAfter(gEBI(rangeInfos[i].markerId, doc));
    +        } else {
    +          range.setEndBefore(gEBI(rangeInfos[i].endMarkerId, doc));
    +          range.setStartAfter(gEBI(rangeInfos[i].startMarkerId, doc));
             }
    +      }
     
    -        function restoreRanges(rangeInfos) {
    -            var ranges = [];
    +      return rangeInfos;
    +    }
     
    -            // Ranges are in reverse order of appearance in the DOM. We want to restore earliest first to avoid
    -            // normalization affecting previously restored ranges.
    -            var rangeCount = rangeInfos.length;
    +    function saveSelection (win) {
    +      if (!api.isSelectionValid(win)) {
    +        module.warn('Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus.');
    +        return null;
    +      }
    +      var sel = api.getSelection(win);
    +      var ranges = sel.getAllRanges();
    +      var backward = (ranges.length == 1 && sel.isBackward());
    +
    +      var rangeInfos = saveRanges(ranges, backward);
    +
    +      // Ensure current selection is unaffected
    +      if (backward) {
    +        sel.setSingleRange(ranges[0], backward);
    +      } else {
    +        sel.setRanges(ranges);
    +      }
    +
    +      return {
    +        win: win,
    +        rangeInfos: rangeInfos,
    +        restored: false
    +      };
    +    }
     
    -            for (var i = rangeCount - 1; i >= 0; i--) {
    -                ranges[i] = restoreRange(rangeInfos[i], true);
    -            }
    +    function restoreRanges (rangeInfos) {
    +      var ranges = [];
     
    -            return ranges;
    -        }
    +      // Ranges are in reverse order of appearance in the DOM. We want to restore earliest first to avoid
    +      // normalization affecting previously restored ranges.
    +      var rangeCount = rangeInfos.length;
     
    -        function restoreSelection(savedSelection, preserveDirection) {
    -            if (!savedSelection.restored) {
    -                var rangeInfos = savedSelection.rangeInfos;
    -                var sel = api.getSelection(savedSelection.win);
    -                var ranges = restoreRanges(rangeInfos), rangeCount = rangeInfos.length;
    -
    -                if (rangeCount == 1 && preserveDirection && api.features.selectionHasExtend && rangeInfos[0].backward) {
    -                    sel.removeAllRanges();
    -                    sel.addRange(ranges[0], true);
    -                } else {
    -                    sel.setRanges(ranges);
    -                }
    -
    -                savedSelection.restored = true;
    -            }
    -        }
    +      for (var i = rangeCount - 1; i >= 0; i--) {
    +        ranges[i] = restoreRange(rangeInfos[i], true);
    +      }
    +
    +      return ranges;
    +    }
     
    -        function removeMarkerElement(doc, markerId) {
    -            var markerEl = gEBI(markerId, doc);
    -            if (markerEl) {
    -                removeNode(markerEl);
    -            }
    +    function restoreSelection (savedSelection, preserveDirection) {
    +      if (!savedSelection.restored) {
    +        var rangeInfos = savedSelection.rangeInfos;
    +        var sel = api.getSelection(savedSelection.win);
    +        var ranges = restoreRanges(rangeInfos), rangeCount = rangeInfos.length;
    +
    +        if (rangeCount == 1 && preserveDirection && api.features.selectionHasExtend && rangeInfos[0].backward) {
    +          sel.removeAllRanges();
    +          sel.addRange(ranges[0], true);
    +        } else {
    +          sel.setRanges(ranges);
             }
     
    -        function removeMarkers(savedSelection) {
    -            var rangeInfos = savedSelection.rangeInfos;
    -            for (var i = 0, len = rangeInfos.length, rangeInfo; i < len; ++i) {
    -                rangeInfo = rangeInfos[i];
    -                if (rangeInfo.collapsed) {
    -                    removeMarkerElement(savedSelection.doc, rangeInfo.markerId);
    -                } else {
    -                    removeMarkerElement(savedSelection.doc, rangeInfo.startMarkerId);
    -                    removeMarkerElement(savedSelection.doc, rangeInfo.endMarkerId);
    -                }
    -            }
    +        savedSelection.restored = true;
    +      }
    +    }
    +
    +    function removeMarkerElement (doc, markerId) {
    +      var markerEl = gEBI(markerId, doc);
    +      if (markerEl) {
    +        removeNode(markerEl);
    +      }
    +    }
    +
    +    function removeMarkers (savedSelection) {
    +      var rangeInfos = savedSelection.rangeInfos;
    +      for (var i = 0, len = rangeInfos.length, rangeInfo; i < len; ++i) {
    +        rangeInfo = rangeInfos[i];
    +        if (rangeInfo.collapsed) {
    +          removeMarkerElement(savedSelection.doc, rangeInfo.markerId);
    +        } else {
    +          removeMarkerElement(savedSelection.doc, rangeInfo.startMarkerId);
    +          removeMarkerElement(savedSelection.doc, rangeInfo.endMarkerId);
             }
    +      }
    +    }
     
    -        api.util.extend(api, {
    -            saveRange: saveRange,
    -            restoreRange: restoreRange,
    -            saveRanges: saveRanges,
    -            restoreRanges: restoreRanges,
    -            saveSelection: saveSelection,
    -            restoreSelection: restoreSelection,
    -            removeMarkerElement: removeMarkerElement,
    -            removeMarkers: removeMarkers
    -        });
    +    api.util.extend(api, {
    +      saveRange: saveRange,
    +      restoreRange: restoreRange,
    +      saveRanges: saveRanges,
    +      restoreRanges: restoreRanges,
    +      saveSelection: saveSelection,
    +      restoreSelection: restoreSelection,
    +      removeMarkerElement: removeMarkerElement,
    +      removeMarkers: removeMarkers
         });
    -    
    -    return rangy;
    +  });
    +
    +  return rangy;
     }, this);
    diff --git a/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular-sanitize.js b/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular-sanitize.js
    new file mode 100755
    index 00000000000..050662860ec
    --- /dev/null
    +++ b/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular-sanitize.js
    @@ -0,0 +1,805 @@
    +/**
    + * @license AngularJS v1.3.10
    + * (c) 2010-2014 Google, Inc. http://angularjs.org
    + * License: MIT
    + */
    +(function (window, angular, undefined) {
    +  'use strict';
    +
    +  var $sanitizeMinErr = angular.$$minErr('$sanitize');
    +
    +  /**
    + * @ngdoc module
    + * @name ngSanitize
    + * @description
    + *
    + * # ngSanitize
    + *
    + * The `ngSanitize` module provides functionality to sanitize HTML.
    + *
    + *
    + * 
    + * + * See {@link ngSanitize.$sanitize `$sanitize`} for usage. + */ + + /* + * HTML Parser By Misko Hevery (misko@hevery.com) + * based on: HTML Parser By John Resig (ejohn.org) + * Original code by Erik Arvidsson, Mozilla Public License + * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js + * + * // Use like so: + * htmlParser(htmlString, { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * }); + * + */ + + /** + * @ngdoc service + * @name $sanitize + * @kind function + * + * @description + * The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are + * then serialized back to properly escaped html string. This means that no unsafe input can make + * it into the returned string, however, since our parser is more strict than a typical browser + * parser, it's possible that some obscure input, which would be recognized as valid HTML by a + * browser, won't make it through the sanitizer. The input may also contain SVG markup. + * The whitelist is configured using the functions `aHrefSanitizationWhitelist` and + * `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}. + * + * @param {string} html HTML input. + * @returns {string} Sanitized HTML. + * + * @example + + + +
    + Snippet: + + + + + + + + + + + + + + + + + + + + + + + + + +
    DirectiveHowSourceRendered
    ng-bind-htmlAutomatically uses $sanitize
    <div ng-bind-html="snippet">
    </div>
    ng-bind-htmlBypass $sanitize by explicitly trusting the dangerous value +
    <div ng-bind-html="deliberatelyTrustDangerousSnippet()">
    +</div>
    +
    ng-bindAutomatically escapes
    <div ng-bind="snippet">
    </div>
    +
    +
    + + it('should sanitize the html snippet by default', function() { + expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()). + toBe('

    an html\nclick here\nsnippet

    '); + }); + + it('should inline raw snippet if bound to a trusted value', function() { + expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()). + toBe("

    an html\n" + + "click here\n" + + "snippet

    "); + }); + + it('should escape snippet without any filter', function() { + expect(element(by.css('#bind-default div')).getInnerHtml()). + toBe("<p style=\"color:blue\">an html\n" + + "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + + "snippet</p>"); + }); + + it('should update', function() { + element(by.model('snippet')).clear(); + element(by.model('snippet')).sendKeys('new text'); + expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()). + toBe('new text'); + expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe( + 'new text'); + expect(element(by.css('#bind-default div')).getInnerHtml()).toBe( + "new <b onclick=\"alert(1)\">text</b>"); + }); +
    +
    + */ + function $SanitizeProvider () { + this.$get = ['$$sanitizeUri', function ($$sanitizeUri) { + return function (html) { + if (typeof arguments[1] !== 'undefined') { + arguments[1].version = 'taSanitize'; + } + var buf = []; + htmlParser(html, htmlSanitizeWriter(buf, function (uri, isImage) { + return !/^unsafe/.test($$sanitizeUri(uri, isImage)); + })); + return buf.join(''); + }; + }]; + } + + function sanitizeText (chars) { + var buf = []; + var writer = htmlSanitizeWriter(buf, angular.noop); + writer.chars(chars); + return buf.join(''); + } + + // Regular Expressions for parsing tags and attributes + var START_TAG_REGEXP = + /^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/, + END_TAG_REGEXP = /^<\/\s*([\w:-]+)[^>]*>/, + ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, + BEGIN_TAG_REGEXP = /^/g, + SINGLE_COMMENT_REGEXP = /(^)/, + DOCTYPE_REGEXP = /]*?)>/i, + CDATA_REGEXP = //g, + SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + // Match everything outside of normal chars and " (quote character) + NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g, + WHITE_SPACE_REGEXP = /^(\s+)/; + + // Good source of info about elements and attributes + // http://dev.w3.org/html5/spec/Overview.html#semantics + // http://simon.html5.org/html-elements + + // Safe Void Elements - HTML5 + // http://dev.w3.org/html5/spec/Overview.html#void-elements + var voidElements = makeMap('area,br,col,hr,img,wbr,input'); + + // Elements that you can, intentionally, leave open (and which close themselves) + // http://dev.w3.org/html5/spec/Overview.html#optional-tags + var optionalEndTagBlockElements = makeMap('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'), + optionalEndTagInlineElements = makeMap('rp,rt'), + optionalEndTagElements = angular.extend({}, + optionalEndTagInlineElements, + optionalEndTagBlockElements); + + // Safe Block Elements - HTML5 + var blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap('address,article,' + + 'aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' + + 'h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul')); + + // Inline Elements - HTML5 + var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap('a,abbr,acronym,b,' + + 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,' + + 'samp,small,span,strike,strong,sub,sup,time,tt,u,var')); + + // SVG Elements + // https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements + var svgElements = makeMap('animate,animateColor,animateMotion,animateTransform,circle,defs,' + + 'desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,' + + 'line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,set,' + + 'stop,svg,switch,text,title,tspan,use'); + + // Special Elements (can contain anything) + var specialElements = makeMap('script,style'); + + var validElements = angular.extend({}, + voidElements, + blockElements, + inlineElements, + optionalEndTagElements, + svgElements); + + // Attributes that have href and hence need to be sanitized + var uriAttrs = makeMap('background,cite,href,longdesc,src,usemap,xlink:href'); + + var htmlAttrs = makeMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' + + 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' + + 'id,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' + + 'scope,scrolling,shape,size,span,start,summary,target,title,type,' + + 'valign,value,vspace,width'); + + // SVG attributes (without "id" and "name" attributes) + // https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes + var svgAttrs = makeMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' + + 'attributeName,attributeType,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,' + + 'color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,' + + 'font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,' + + 'gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,' + + 'keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,' + + 'markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,' + + 'overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,' + + 'repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,' + + 'stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,' + + 'stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,' + + 'stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,' + + 'underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,' + + 'viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,' + + 'xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,' + + 'zoomAndPan'); + + var validAttrs = angular.extend({}, + uriAttrs, + svgAttrs, + htmlAttrs); + + function makeMap (str) { + var obj = {}, items = str.split(','), i; + for (i = 0; i < items.length; i++) obj[items[i]] = true; + return obj; + } + + /** + * @example + * htmlParser(htmlString, { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * }); + * + * @param {string} html string + * @param {object} handler + */ + function htmlParser (html, handler) { + if (typeof html !== 'string') { + if (html === null || typeof html === 'undefined') { + html = ''; + } else { + html = '' + html; + } + } + var index, chars, match, stack = [], last = html, text; + stack.last = function () { return stack[ stack.length - 1 ]; }; + + while (html) { + text = ''; + chars = true; + + // Make sure we're not in a script or style element + if (!stack.last() || !specialElements[ stack.last() ]) { + // White space + if (WHITE_SPACE_REGEXP.test(html)) { + match = html.match(WHITE_SPACE_REGEXP); + + if (match) { + var mat = match[0]; + if (handler.whitespace) handler.whitespace(match[0]); + html = html.replace(match[0], ''); + chars = false; + } + // Comment + } else if (SINGLE_COMMENT_REGEXP.test(html)) { + match = html.match(SINGLE_COMMENT_REGEXP); + + if (match) { + if (handler.comment) handler.comment(match[1]); + html = html.replace(match[0], ''); + chars = false; + } + // DOCTYPE + } else if (DOCTYPE_REGEXP.test(html)) { + match = html.match(DOCTYPE_REGEXP); + + if (match) { + html = html.replace(match[0], ''); + chars = false; + } + // end tag + } else if (BEGING_END_TAGE_REGEXP.test(html)) { + match = html.match(END_TAG_REGEXP); + + if (match) { + html = html.substring(match[0].length); + match[0].replace(END_TAG_REGEXP, parseEndTag); + chars = false; + } + + // start tag + } else if (BEGIN_TAG_REGEXP.test(html)) { + match = html.match(START_TAG_REGEXP); + + if (match) { + // We only have a valid start-tag if there is a '>'. + if (match[4]) { + html = html.substring(match[0].length); + match[0].replace(START_TAG_REGEXP, parseStartTag); + } + chars = false; + } else { + // no ending tag found --- this piece should be encoded as an entity. + text += '<'; + html = html.substring(1); + } + } + + if (chars) { + index = html.indexOf('<'); + + text += index < 0 ? html : html.substring(0, index); + html = index < 0 ? '' : html.substring(index); + + if (handler.chars) handler.chars(decodeEntities(text)); + } + } else { + html = html.replace(new RegExp('([^]*)<\\s*\\/\\s*' + stack.last() + '[^>]*>', 'i'), + function (all, text) { + text = text.replace(COMMENT_REGEXP, '$1').replace(CDATA_REGEXP, '$1'); + + if (handler.chars) handler.chars(decodeEntities(text)); + + return ''; + }); + + parseEndTag('', stack.last()); + } + + if (html == last) { + throw $sanitizeMinErr('badparse', 'The sanitizer was unable to parse the following block ' + + 'of html: {0}', html); + } + last = html; + } + + // Clean up any remaining tags + parseEndTag(); + + function parseStartTag (tag, tagName, rest, unary) { + tagName = angular.isString(tagName) ? tagName.toLowerCase() : tagName; + if (blockElements[ tagName ]) { + while (stack.last() && inlineElements[ stack.last() ]) { + parseEndTag('', stack.last()); + } + } + + if (optionalEndTagElements[ tagName ] && stack.last() == tagName) { + parseEndTag('', tagName); + } + + unary = voidElements[ tagName ] || !!unary; + + if (!unary) { stack.push(tagName); } + + var attrs = {}; + + rest.replace(ATTR_REGEXP, + function (match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) { + var value = doubleQuotedValue || + singleQuotedValue || + unquotedValue || + ''; + + attrs[name] = decodeEntities(value); + }); + if (handler.start) handler.start(tagName, attrs, unary); + } + + function parseEndTag (tag, tagName) { + var pos = 0, i; + tagName = angular.isString(tagName) ? tagName.toLowerCase() : tagName; + if (tagName) + // Find the closest opened tag of the same type + { + for (pos = stack.length - 1; pos >= 0; pos--) { + if (stack[ pos ] == tagName) { break; } + } + } + + if (pos >= 0) { + // Close all the open elements, up the stack + for (i = stack.length - 1; i >= pos; i--) { if (handler.end) handler.end(stack[ i ]); } + + // Remove the open elements from the stack + stack.length = pos; + } + } + } + + var hiddenPre = document.createElement('pre'); + var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/; + /** + * decodes all entities into regular string + * @param value + * @returns {string} A string with decoded entities. + */ + function decodeEntities (value) { + if (!value) { return ''; } + + // Note: IE8 does not preserve spaces at the start/end of innerHTML + // so we must capture them and reattach them afterward + var parts = spaceRe.exec(value); + var spaceBefore = parts[1]; + var spaceAfter = parts[3]; + var content = parts[2]; + if (content) { + hiddenPre.innerHTML = content.replace(/= 1536 && c <= 1540) || + c == 1807 || + c == 6068 || + c == 6069 || + (c >= 8204 && c <= 8207) || + (c >= 8232 && c <= 8239) || + (c >= 8288 && c <= 8303) || + c == 65279 || + (c >= 65520 && c <= 65535)) return '&#' + c + ';'; + return value; // avoids multilingual issues + }) + .replace(//g, '>'); + } + + var trim = (function () { + // native trim is way faster: http://jsperf.com/angular-trim-test + // but IE doesn't have it... :-( + // TODO: we should move this into IE/ES5 polyfill + if (!String.prototype.trim) { + return function (value) { + return angular.isString(value) ? value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') : value; + }; + } + return function (value) { + return angular.isString(value) ? value.trim() : value; + }; + })(); + + // Custom logic for accepting certain style options only - textAngular + // Currently allows only the color, background-color, text-align, float, width and height attributes + // all other attributes should be easily done through classes. + function validStyles (styleAttr) { + var result = ''; + var styleArray = styleAttr.split(';'); + angular.forEach(styleArray, function (value) { + var v = value.split(':'); + if (v.length == 2) { + var key = trim(angular.isString(v[0]) ? v[0].toLowerCase() : v[0]); + var value = trim(angular.isString(v[1]) ? v[1].toLowerCase() : v[1]); + if ( + (key === 'color' || key === 'background-color') && ( + value.match(/^rgb\([0-9%,\. ]*\)$/i) || + value.match(/^rgba\([0-9%,\. ]*\)$/i) || + value.match(/^hsl\([0-9%,\. ]*\)$/i) || + value.match(/^hsla\([0-9%,\. ]*\)$/i) || + value.match(/^#[0-9a-f]{3,6}$/i) || + value.match(/^[a-z]*$/i) + ) || + key === 'text-align' && ( + value === 'left' || + value === 'right' || + value === 'center' || + value === 'justify' + ) || + key === 'text-decoration' && ( + value === 'underline' || + value === 'line-through' + ) || + key === 'font-weight' && ( + value === 'bold' + ) || + key === 'font-style' && ( + value === 'italic' + ) || + key === 'float' && ( + value === 'left' || + value === 'right' || + value === 'none' + ) || + key === 'vertical-align' && ( + value === 'baseline' || + value === 'sub' || + value === 'super' || + value === 'test-top' || + value === 'text-bottom' || + value === 'middle' || + value === 'top' || + value === 'bottom' || + value.match(/[0-9]*(px|em)/) || + value.match(/[0-9]+?%/) + ) || + key === 'font-size' && ( + value === 'xx-small' || + value === 'x-small' || + value === 'small' || + value === 'medium' || + value === 'large' || + value === 'x-large' || + value === 'xx-large' || + value === 'larger' || + value === 'smaller' || + value.match(/[0-9]*\.?[0-9]*(px|em|rem|mm|q|cm|in|pt|pc|%)/) + ) || + (key === 'width' || key === 'height') && ( + value.match(/[0-9\.]*(px|em|rem|%)/) + ) || // Reference #520 + (key === 'direction' && value.match(/^ltr|rtl|initial|inherit$/)) + ) result += key + ': ' + value + ';'; + } + }); + return result; + } + + // this function is used to manually allow specific attributes on specific tags with certain prerequisites + function validCustomTag (tag, attrs, lkey, value) { + // catch the div placeholder for the iframe replacement + if (tag === 'img' && attrs['ta-insert-video']) { + if (lkey === 'ta-insert-video' || lkey === 'allowfullscreen' || lkey === 'frameborder' || (lkey === 'contenteditable' && value === 'false')) return true; + } + return false; + } + + /** + * create an HTML/XML writer which writes to buffer + * @param {Array} buf use buf.jain('') to get out sanitized html string + * @returns {object} in the form of { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * } + */ + function htmlSanitizeWriter (buf, uriValidator) { + var ignore = false; + var out = angular.bind(buf, buf.push); + return { + start: function (tag, attrs, unary) { + tag = angular.isString(tag) ? tag.toLowerCase() : tag; + if (!ignore && specialElements[tag]) { + ignore = tag; + } + if (!ignore && validElements[tag] === true) { + out('<'); + out(tag); + angular.forEach(attrs, function (value, key) { + var lkey = angular.isString(key) ? key.toLowerCase() : key; + var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background'); + if ((lkey === 'style' && (value = validStyles(value)) !== '') || validCustomTag(tag, attrs, lkey, value) || validAttrs[lkey] === true && + (uriAttrs[lkey] !== true || uriValidator(value, isImage))) { + out(' '); + out(key); + out('="'); + out(encodeEntities(value)); + out('"'); + } + }); + out(unary ? '/>' : '>'); + } + }, + comment: function (com) { + out(com); + }, + whitespace: function (ws) { + out(encodeEntities(ws)); + }, + end: function (tag) { + tag = angular.isString(tag) ? tag.toLowerCase() : tag; + if (!ignore && validElements[tag] === true) { + out(''); + } + if (tag == ignore) { + ignore = false; + } + }, + chars: function (chars) { + if (!ignore) { + out(encodeEntities(chars)); + } + } + }; + } + + // define ngSanitize module and register $sanitize service + angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider); + + /* global sanitizeText: false */ + + /** + * @ngdoc filter + * @name linky + * @kind function + * + * @description + * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and + * plain email address links. + * + * Requires the {@link ngSanitize `ngSanitize`} module to be installed. + * + * @param {string} text Input text. + * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in. + * @returns {string} Html-linkified text. + * + * @usage + + * + * @example + + + +
    + Snippet: + + + + + + + + + + + + + + + + + + + + + +
    FilterSourceRendered
    linky filter +
    <div ng-bind-html="snippet | linky">
    </div>
    +
    +
    +
    linky target +
    <div ng-bind-html="snippetWithTarget | linky:'_blank'">
    </div>
    +
    +
    +
    no filter
    <div ng-bind="snippet">
    </div>
    + + + 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("snippetWithTarget | linky:'_blank'")).getText()). + toBe('http://angularjs.org/'); + expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank'); + }); + + + */ + angular.module('ngSanitize').filter('linky', ['$sanitize', function ($sanitize) { + var LINKY_URL_REGEXP = + /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/, + MAILTO_REGEXP = /^mailto:/; + + return function (text, target) { + if (!text) return text; + 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) { + html.push('
    '); + addText(text); + html.push(''); + } + }; + }]); +})(window, window.angular); diff --git a/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular-sanitize.min.js b/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular-sanitize.min.js deleted file mode 100755 index ec0517fd1e5..00000000000 --- a/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular-sanitize.min.js +++ /dev/null @@ -1,6 +0,0 @@ -!function(a,b){b["true"]=a,/** - * @license AngularJS v1.3.10 - * (c) 2010-2014 Google, Inc. http://angularjs.org - * License: MIT - */ -function(a,b,c){"use strict";function d(){this.$get=["$$sanitizeUri",function(a){return function(b){"undefined"!=typeof arguments[1]&&(arguments[1].version="taSanitize");var c=[];return g(b,l(c,function(b,c){return!/^unsafe/.test(a(b,c))})),c.join("")}}]}function e(a){var c=[],d=l(c,b.noop);return d.chars(a),c.join("")}function f(a){var b,c={},d=a.split(",");for(b=0;b=0&&k[f]!=d;f--);if(f>=0){for(e=k.length-1;e>=f;e--)c.end&&c.end(k[e]);k.length=f}}"string"!=typeof a&&(a=null===a||"undefined"==typeof a?"":""+a);var f,g,i,j,k=[],l=a;for(k.last=function(){return k[k.length-1]};a;){if(j="",g=!0,k.last()&&G[k.last()])a=a.replace(new RegExp("([^]*)<\\s*\\/\\s*"+k.last()+"[^>]*>","i"),function(a,b){return b=b.replace(s,"$1").replace(v,"$1"),c.chars&&c.chars(h(b)),""}),e("",k.last());else{if(y.test(a)){if(i=a.match(y)){i[0];c.whitespace&&c.whitespace(i[0]),a=a.replace(i[0],""),g=!1}}else t.test(a)?(i=a.match(t),i&&(c.comment&&c.comment(i[1]),a=a.replace(i[0],""),g=!1)):u.test(a)?(i=a.match(u),i&&(a=a.replace(i[0],""),g=!1)):r.test(a)?(i=a.match(o),i&&(a=a.substring(i[0].length),i[0].replace(o,e),g=!1)):q.test(a)&&(i=a.match(n),i?(i[4]&&(a=a.substring(i[0].length),i[0].replace(n,d)),g=!1):(j+="<",a=a.substring(1)));g&&(f=a.indexOf("<"),j+=0>f?a:a.substring(0,f),a=0>f?"":a.substring(f),c.chars&&c.chars(h(j)))}if(a==l)throw m("badparse","The sanitizer was unable to parse the following block of html: {0}",a);l=a}e()}function h(a){if(!a)return"";var b=N.exec(a),c=b[1],d=b[3],e=b[2];return e&&(M.innerHTML=e.replace(/=b||173==b||b>=1536&&1540>=b||1807==b||6068==b||6069==b||b>=8204&&8207>=b||b>=8232&&8239>=b||b>=8288&&8303>=b||65279==b||b>=65520&&65535>=b?"&#"+b+";":a}).replace(//g,">")}function j(a){var c="",d=a.split(";");return b.forEach(d,function(a){var d=a.split(":");if(2==d.length){var e=O(b.lowercase(d[0])),a=O(b.lowercase(d[1]));(("color"===e||"background-color"===e)&&(a.match(/^rgb\([0-9%,\. ]*\)$/i)||a.match(/^rgba\([0-9%,\. ]*\)$/i)||a.match(/^hsl\([0-9%,\. ]*\)$/i)||a.match(/^hsla\([0-9%,\. ]*\)$/i)||a.match(/^#[0-9a-f]{3,6}$/i)||a.match(/^[a-z]*$/i))||"text-align"===e&&("left"===a||"right"===a||"center"===a||"justify"===a)||"text-decoration"===e&&("underline"===a||"line-through"===a)||"font-weight"===e&&"bold"===a||"float"===e&&("left"===a||"right"===a||"none"===a)||("width"===e||"height"===e)&&a.match(/[0-9\.]*(px|em|rem|%)/)||"direction"===e&&a.match(/^ltr|rtl|initial|inherit$/))&&(c+=e+": "+a+";")}}),c}function k(a,b,c,d){return"img"===a&&b["ta-insert-video"]&&("ta-insert-video"===c||"allowfullscreen"===c||"frameborder"===c||"contenteditable"===c&&"false"===d)?!0:!1}function l(a,c){var d=!1,e=b.bind(a,a.push);return{start:function(a,f,g){a=b.lowercase(a),!d&&G[a]&&(d=a),d||H[a]!==!0||(e("<"),e(a),b.forEach(f,function(d,g){var h=b.lowercase(g),l="img"===a&&"src"===h||"background"===h;("style"===h&&""!==(d=j(d))||k(a,f,h,d)||L[h]===!0&&(I[h]!==!0||c(d,l)))&&(e(" "),e(g),e('="'),e(i(d)),e('"'))}),e(g?"/>":">"))},comment:function(a){e(a)},whitespace:function(a){e(i(a))},end:function(a){a=b.lowercase(a),d||H[a]!==!0||(e("")),a==d&&(d=!1)},chars:function(a){d||e(i(a))}}}var m=b.$$minErr("$sanitize"),n=/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,o=/^<\/\s*([\w:-]+)[^>]*>/,p=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,q=/^/g,t=/(^)/,u=/]*?)>/i,v=//g,w=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,x=/([^\#-~| |!])/g,y=/^(\s+)/,z=f("area,br,col,hr,img,wbr,input"),A=f("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),B=f("rp,rt"),C=b.extend({},B,A),D=b.extend({},A,f("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")),E=b.extend({},B,f("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),F=f("animate,animateColor,animateMotion,animateTransform,circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,set,stop,svg,switch,text,title,tspan,use"),G=f("script,style"),H=b.extend({},z,D,E,C,F),I=f("background,cite,href,longdesc,src,usemap,xlink:href"),J=f("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,id,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width"),K=f("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,attributeName,attributeType,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan"),L=b.extend({},I,K,J),M=document.createElement("pre"),N=/^(\s*)([\s\S]*?)(\s*)$/,O=function(){return String.prototype.trim?function(a){return b.isString(a)?a.trim():a}:function(a){return b.isString(a)?a.replace(/^\s\s*/,"").replace(/\s\s*$/,""):a}}();b.module("ngSanitize",[]).provider("$sanitize",d),b.module("ngSanitize").filter("linky",["$sanitize",function(a){var c=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/,d=/^mailto:/;return function(f,g){function h(a){a&&n.push(e(a))}function i(a,c){n.push("'),h(c),n.push("")}if(!f)return f;for(var j,k,l,m=f,n=[];j=m.match(c);)k=j[0],j[2]||j[4]||(k=(j[3]?"http://":"mailto:")+k),l=j.index,h(m.substr(0,l)),i(k,j[0].replace(d,"")),m=m.substring(l+j[0].length);return h(m),a(n.join(""))}}])}(window,window.angular)}({},function(){return this}()); \ No newline at end of file diff --git a/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular.js b/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular.js index 182896c255c..6950c28aeca 100755 --- a/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular.js +++ b/org.civicrm.reqangular/js/src/common/vendor/angular/textAngular.js @@ -1,18 +1,8 @@ -/* - !CUSTOMIZED VENDOR FILE! - - Contains workaround for these issues: - * https://github.com/fraywing/textAngular/issues/892 - * https://github.com/fraywing/textAngular/issues/1016 - - Removed the require() calls in the .run() block -*/ - /* @license textAngular Author : Austin Anderson License : 2013 MIT -Version 1.5.0 +Version 2.0.0 See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use. */ @@ -21,11 +11,9 @@ See README.md or https://github.com/fraywing/textAngular/wiki for requirements a Commonjs package manager support (eg componentjs). */ -/* istanbul ignore next: */ -'undefined'!=typeof module&&'undefined'!=typeof exports&&module.exports===exports&&(module.exports='textAngular'); +'use strict';// NOTE: textAngularVersion must match the Gruntfile.js 'setVersion' task.... and have format v/d+./d+./d+ +var textAngularVersion = 'v1.5.16'; // This is automatically updated during the build process to the current release! -(function(){ // encapsulate all variables so they don't become global vars -"use strict"; // IE version detection - http://stackoverflow.com/questions/4169160/javascript-ie-detection-why-not-use-simple-conditional-comments // We need this as IE sometimes plays funny tricks with the contenteditable. // ---------------------------------------------------------- @@ -42,3052 +30,4230 @@ Commonjs package manager support (eg componentjs). // ---------------------------------------------------------- /* istanbul ignore next: untestable browser check */ var _browserDetect = { - ie: (function(){ - var undef, - v = 3, - div = document.createElement('div'), - all = div.getElementsByTagName('i'); - - while ( - div.innerHTML = '', - all[0] - ); - - return v > 4 ? v : undef; - }()), - webkit: /AppleWebKit\/([\d.]+)/i.test(navigator.userAgent) + ie: (function () { + var undef, + v = 3, + div = document.createElement('div'), + all = div.getElementsByTagName('i'); + + while ( + div.innerHTML = '', + all[0] + ); + + return v > 4 ? v : undef; + }()), + webkit: /AppleWebKit\/([\d.]+)/i.test(navigator.userAgent), + isFirefox: navigator.userAgent.toLowerCase().indexOf('firefox') > -1 }; -// fix a webkit bug, see: https://gist.github.com/shimondoodkin/1081133 -// this is set true when a blur occurs as the blur of the ta-bind triggers before the click -var globalContentEditableBlur = false; -/* istanbul ignore next: Browser Un-Focus fix for webkit */ -if(_browserDetect.webkit) { - document.addEventListener("mousedown", function(_event){ - var e = _event || window.event; - var curelement = e.target; - if(globalContentEditableBlur && curelement !== null){ - var isEditable = false; - var tempEl = curelement; - while(tempEl !== null && tempEl.tagName.toLowerCase() !== 'html' && !isEditable){ - isEditable = tempEl.contentEditable === 'true'; - tempEl = tempEl.parentNode; - } - if(!isEditable){ - document.getElementById('textAngular-editableFix-010203040506070809').setSelectionRange(0, 0); // set caret focus to an element that handles caret focus correctly. - curelement.focus(); // focus the wanted element. - if (curelement.select) { - curelement.select(); // use select to place cursor for input elements. - } - } - } - globalContentEditableBlur = false; - }, false); // add global click handler - angular.element(document).ready(function () { - angular.element(document.body).append(angular.element('')); - }); +// Global to textAngular to measure performance where needed +/* istanbul ignore next: untestable browser check */ +var performance = performance || {}; +/* istanbul ignore next: untestable browser check */ +performance.now = (function () { + return performance.now || + performance.mozNow || + performance.msNow || + performance.oNow || + performance.webkitNow || + function () { return new Date().getTime(); }; +})(); +// usage is: +// var t0 = performance.now(); +// doSomething(); +// var t1 = performance.now(); +// console.log('Took', (t1 - t0).toFixed(4), 'milliseconds to do something!'); +// + +// turn html into pure text that shows visiblity +function stripHtmlToText (html) { + var tmp = document.createElement('DIV'); + tmp.innerHTML = html; + var res = tmp.textContent || tmp.innerText || ''; + res.replace('\u200B', ''); // zero width space + res = res.trim(); + return res; +} +// get html +function getDomFromHtml (html) { + var tmp = document.createElement('DIV'); + tmp.innerHTML = html; + return tmp; } -// Gloabl to textAngular REGEXP vars for block and list elements. +// Global to textAngular REGEXP vars for block and list elements. -var BLOCKELEMENTS = /^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i; +var BLOCKELEMENTS = /^(address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i; var LISTELEMENTS = /^(ul|li|ol)$/i; -var VALIDELEMENTS = /^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i; +// updated VALIDELEMENTS to include #text and span so that we can use nodeName instead of tagName +var VALIDELEMENTS = /^(#text|span|address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Compatibility /* istanbul ignore next: trim shim for older browsers */ if (!String.prototype.trim) { - String.prototype.trim = function () { - return this.replace(/^\s+|\s+$/g, ''); - }; + String.prototype.trim = function () { + return this.replace(/^\s+|\s+$/g, ''); + }; } /* - Custom stylesheet for the placeholders rules. - Credit to: http://davidwalsh.name/add-rules-stylesheets + Custom stylesheet for the placeholders rules. + Credit to: http://davidwalsh.name/add-rules-stylesheets */ var sheet, addCSSRule, removeCSSRule, _addCSSRule, _removeCSSRule, _getRuleIndex; -/* istanbul ignore else: IE <8 test*/ -if(_browserDetect.ie > 8 || _browserDetect.ie === undefined){ - var _sheets = document.styleSheets; - /* istanbul ignore next: preference for stylesheet loaded externally */ - for(var i = 0; i < _sheets.length; i++){ - if(_sheets[i].media.length === 0 || _sheets[i].media.mediaText.match(/(all|screen)/ig)){ - if(_sheets[i].href){ - if(_sheets[i].href.match(/textangular\.(min\.|)css/ig)){ - sheet = _sheets[i]; - break; - } - } - } - } - /* istanbul ignore next: preference for stylesheet loaded externally */ - if(!sheet){ - // this sheet is used for the placeholders later on. - sheet = (function() { - // Create the + 1 + + + 11 + 1 + civicrm_value_extended_demographics_8 + 0 + 0 + 1 + + + + + Nationality + + Country + Select Country + 0 + 0 + 0 + 1 + 1 + 0 + 255 + 60 + 4 + nationality_44 + Extended_Demographics + + + Marital_Status + + String + Select + Not Applicable + 0 + 1 + 0 + 6 + 1 + 0 + 255 + 60 + 4 + marital_status_58 + marital_status_20130913084916 + Extended_Demographics + + + Is_Visa_Required + + Boolean + Radio + 0 + 0 + 0 + 2 + 1 + 0 + 255 + 60 + 4 + is_visa_required_64 + is_visa_required_20130702051150 + Extended_Demographics + + + + + marital_status_20130913084916 + Marital Status + 1 + 1 + + + is_visa_required_20130702051150 + Is Visa Required + 1 + 1 + + + + + + Single + Single + 0 + 1 + 0 + 0 + 1 + marital_status_20130913084916 + + + + Married + Married + 0 + 2 + 0 + 0 + 1 + marital_status_20130913084916 + + + + Divorced + Divorced + 0 + 3 + 0 + 0 + 1 + marital_status_20130913084916 + + + + Widowed + Widowed + 0 + 4 + 0 + 0 + 1 + marital_status_20130913084916 + + + + Prefer Not to Say + Prefer_Not_to_Say + 0 + 5 + 0 + 0 + 1 + marital_status_20130913084916 + + + + Not Applicable + Not_Applicable + 0 + 6 + 0 + 0 + 1 + marital_status_20130913084916 + + + + 1 + is_visa_required + 0 + 1 + 0 + 0 + 1 + is_visa_required_20130702051150 + + + diff --git a/uk.co.compucorp.civicrm.hremails/email-templates/package-lock.json b/uk.co.compucorp.civicrm.hremails/email-templates/package-lock.json index 81f6c2fa113..f81ee559e9a 100644 --- a/uk.co.compucorp.civicrm.hremails/email-templates/package-lock.json +++ b/uk.co.compucorp.civicrm.hremails/email-templates/package-lock.json @@ -44,12 +44,12 @@ "dev": true }, "accepts": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", - "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", "dev": true, "requires": { - "mime-types": "~2.1.16", + "mime-types": "~2.1.18", "negotiator": "0.6.1" } }, @@ -91,13 +91,15 @@ "dev": true }, "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "align-text": { @@ -481,9 +483,9 @@ "dev": true }, "atob": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", - "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", + "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", "dev": true }, "aws-sdk": { @@ -529,6 +531,36 @@ "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", "dev": true }, + "axios": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.17.1.tgz", + "integrity": "sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=", + "dev": true, + "requires": { + "follow-redirects": "^1.2.5", + "is-buffer": "^1.1.5" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.5.tgz", + "integrity": "sha512-GHjtHDlY/ehslqv0Gr5N0PUJppgg/q0rOBvX0na1s7y1A3LWxPqCYU76s3Z1bM4+UZB4QF0usaXLT5wFpof5PA==", + "dev": true, + "requires": { + "debug": "^3.1.0" + } + } + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -1157,9 +1189,9 @@ "dev": true }, "batch": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.5.3.tgz", - "integrity": "sha1-PzQU84AyF0O/wQQvmoP/HVgk1GQ=", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", "dev": true }, "bcrypt-pbkdf": { @@ -1377,37 +1409,37 @@ } }, "browser-sync": { - "version": "2.23.6", - "resolved": "https://registry.npmjs.org/browser-sync/-/browser-sync-2.23.6.tgz", - "integrity": "sha512-loCO5NQKZXfBJrEvmLwF1TPSECCsPopNd29qduoysLmpw8op2lgolGMjz3oI/MjG4duzB9TfDs7k58djRSwPwg==", + "version": "2.24.6", + "resolved": "https://registry.npmjs.org/browser-sync/-/browser-sync-2.24.6.tgz", + "integrity": "sha512-3cVW8Ft3sPQ1t9gqZXBDZhTyRce8NW4wf5KzpCYcg6fWjPbyt+vZLvEo+sTq7c7eNQhi8lInQWbjIFEpoM2f7Q==", "dev": true, "requires": { "browser-sync-ui": "v1.0.1", "bs-recipes": "1.3.4", "chokidar": "1.7.0", - "connect": "3.5.0", + "connect": "3.6.6", "connect-history-api-fallback": "^1.5.0", "dev-ip": "^1.0.1", "easy-extender": "2.3.2", "eazy-logger": "3.0.2", - "emitter-steward": "^1.0.0", "etag": "^1.8.1", "fresh": "^0.5.2", "fs-extra": "3.0.1", "http-proxy": "1.15.2", "immutable": "3.8.2", - "localtunnel": "1.8.3", + "localtunnel": "1.9.0", "micromatch": "2.3.11", "opn": "4.0.2", "portscanner": "2.1.1", - "qs": "6.2.1", + "qs": "6.2.3", + "raw-body": "^2.3.2", "resp-modifier": "6.0.2", "rx": "4.1.0", - "serve-index": "1.8.0", - "serve-static": "1.12.2", + "serve-index": "1.9.1", + "serve-static": "1.13.2", "server-destroy": "1.0.1", - "socket.io": "2.0.4", - "ua-parser-js": "0.7.12", + "socket.io": "2.1.1", + "ua-parser-js": "0.7.17", "yargs": "6.4.0" }, "dependencies": { @@ -1418,9 +1450,9 @@ "dev": true }, "qs": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.1.tgz", - "integrity": "sha1-zgPF/wk1vB2daanxTL0Y5WjWdiU=", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.3.tgz", + "integrity": "sha1-HPyyXBCpsrSDBT/zn138kjOQjP4=", "dev": true }, "window-size": { @@ -1621,6 +1653,12 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -2212,32 +2250,15 @@ } }, "connect": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/connect/-/connect-3.5.0.tgz", - "integrity": "sha1-s1dSWgtMH1BZnNmD4dnv7qlncZg=", + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.6.6.tgz", + "integrity": "sha1-Ce/2xVr3I24TcTWnJXSFi2eG9SQ=", "dev": true, "requires": { - "debug": "~2.2.0", - "finalhandler": "0.5.0", - "parseurl": "~1.3.1", - "utils-merge": "1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "dev": true, - "requires": { - "ms": "0.7.1" - } - }, - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", - "dev": true - } + "debug": "2.6.9", + "finalhandler": "1.1.0", + "parseurl": "~1.3.2", + "utils-merge": "1.0.1" } }, "connect-history-api-fallback": { @@ -2344,23 +2365,17 @@ } }, "css": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css/-/css-2.2.1.tgz", - "integrity": "sha1-c6TIHehdtmTU7mdPfUcIXjstVdw=", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/css/-/css-2.2.3.tgz", + "integrity": "sha512-0W171WccAjQGGTKLhw4m2nnl0zPHUlTO/I8td4XzJgIB8Hg3ZZx71qT4G4eX8OVsSiaAKiUMy73E3nsbPlg2DQ==", "dev": true, "requires": { "inherits": "^2.0.1", "source-map": "^0.1.38", - "source-map-resolve": "^0.3.0", + "source-map-resolve": "^0.5.1", "urix": "^0.1.0" }, "dependencies": { - "atob": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-1.1.3.tgz", - "integrity": "sha1-lfE2KbEsOlGl0hWr3OKqnzL4B3M=", - "dev": true - }, "source-map": { "version": "0.1.43", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", @@ -2369,24 +2384,6 @@ "requires": { "amdefine": ">=0.0.4" } - }, - "source-map-resolve": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.3.1.tgz", - "integrity": "sha1-YQ9hIqRFuN1RU1oqcbeD38Ekh2E=", - "dev": true, - "requires": { - "atob": "~1.1.0", - "resolve-url": "~0.2.1", - "source-map-url": "~0.3.0", - "urix": "~0.1.0" - } - }, - "source-map-url": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.3.0.tgz", - "integrity": "sha1-fsrxO1e80J2opAxdJp2zN5nUqvk=", - "dev": true } } }, @@ -3568,12 +3565,6 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "dev": true }, - "emitter-steward": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/emitter-steward/-/emitter-steward-1.0.0.tgz", - "integrity": "sha1-80Ea3pdYp1Zd+Eiy2gy70bRsvWQ=", - "dev": true - }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -3599,9 +3590,9 @@ } }, "engine.io": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.1.5.tgz", - "integrity": "sha512-D06ivJkYxyRrcEe0bTpNnBQNgP9d3xog+qZlLbui8EsMr/DouQpf5o9FzJnWYHEYE0YsFHllUv2R1dkgYZXHcA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.2.0.tgz", + "integrity": "sha512-mRbgmAtQ4GAlKwuPnnAvXXwdPhEx+jkc0OBCLrXuD/CRvwNK3AxRSnqK4FSqmAMRRHryVJP8TopOvmEaA64fKw==", "dev": true, "requires": { "accepts": "~1.3.4", @@ -3609,7 +3600,6 @@ "cookie": "0.3.1", "debug": "~3.1.0", "engine.io-parser": "~2.1.0", - "uws": "~9.14.0", "ws": "~3.3.1" }, "dependencies": { @@ -3625,9 +3615,9 @@ } }, "engine.io-client": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.1.5.tgz", - "integrity": "sha512-Rv9vgb83zrNVhRircUXHi4mtbJhgy2oWtJOCZEbCLFs2HiDSWmh/aOEj8TwoKsn8zXGqTuQuPSoU4v3E10bR6A==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.1.6.tgz", + "integrity": "sha512-hnuHsFluXnsKOndS4Hv6SvUrgdYx1pk2NqfaDMW+GWdgfU3+/V25Cj7I8a0x92idSpa5PIhJRKxPvp9mnoLsfg==", "dev": true, "requires": { "component-emitter": "1.2.1", @@ -3937,22 +3927,132 @@ } }, "extract-css": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/extract-css/-/extract-css-1.0.4.tgz", - "integrity": "sha512-JY1GTiGqKRE8uzVRNK2v0A/a7jfcVP56e7Z4marbDAGrfgx0RsuyL0XuenXtaB54Tr80gAMfYGBKPyNbLkA40g==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/extract-css/-/extract-css-1.2.0.tgz", + "integrity": "sha1-vlOQ9AnIWwy18buQKZx35RaIqN4=", "dev": true, "requires": { "batch": "^0.6.1", - "href-content": "^1.0.0", - "list-stylesheets": "^1.1.0", - "style-data": "^1.1.0" + "href-content": "^1.0.2", + "list-stylesheets": "^1.2.1", + "style-data": "^1.3.0" }, "dependencies": { - "batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", + "cheerio": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "dev": true, + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + } + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", + "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", + "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "dev": true + }, + "htmlparser2": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", + "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", + "dev": true, + "requires": { + "domelementtype": "^1.3.0", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true + }, + "list-stylesheets": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/list-stylesheets/-/list-stylesheets-1.2.1.tgz", + "integrity": "sha1-eX82xaRU8xE2kZc970Lk8Mxm3+s=", + "dev": true, + "requires": { + "cheerio": "^0.22.0", + "extend": "^3.0.1", + "object.pick": "^1.3.0" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "style-data": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/style-data/-/style-data-1.3.0.tgz", + "integrity": "sha1-tZcW3LCMQEY5Bv5V8E5HWOyRup0=", + "dev": true, + "requires": { + "cheerio": "^0.22.0", + "extend": "^3.0.1", + "mediaquery-text": "^1.0.5", + "object.pick": "^1.3.0" + } } } }, @@ -4089,46 +4189,31 @@ } }, "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", "dev": true, "requires": { "is-number": "^2.1.0", "isobject": "^2.0.0", - "randomatic": "^1.1.3", + "randomatic": "^3.0.0", "repeat-element": "^1.1.2", "repeat-string": "^1.5.2" } }, "finalhandler": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-0.5.0.tgz", - "integrity": "sha1-6VCKvs6bbbqHGmlCodeRG5GRGsc=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", "dev": true, "requires": { - "debug": "~2.2.0", + "debug": "2.6.9", + "encodeurl": "~1.0.1", "escape-html": "~1.0.3", "on-finished": "~2.3.0", - "statuses": "~1.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", "unpipe": "~1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "dev": true, - "requires": { - "ms": "0.7.1" - } - }, - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", - "dev": true - } } }, "find-up": { @@ -4179,18 +4264,16 @@ "dev": true }, "braces": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.1.tgz", - "integrity": "sha512-SO5lYHA3vO6gz66erVvedSCkp7AKWdv6VcQ2N4ysXfPxdAlxAMMAdwegGGcv1Bqwm7naF1hNdk5d6AAIEHV2nQ==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "dev": true, "requires": { "arr-flatten": "^1.1.0", "array-unique": "^0.3.2", - "define-property": "^1.0.0", "extend-shallow": "^2.0.1", "fill-range": "^4.0.0", "isobject": "^3.0.1", - "kind-of": "^6.0.2", "repeat-element": "^1.1.2", "snapdragon": "^0.8.1", "snapdragon-node": "^2.0.1", @@ -4198,15 +4281,6 @@ "to-regex": "^3.0.1" }, "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", @@ -4417,9 +4491,9 @@ "dev": true }, "micromatch": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.6.tgz", - "integrity": "sha512-6hezhKgmSIRZeSCiVB84GOmH1Ajvo8XgnaEq/uPQ/wv0g+MQlaVonSEru7VMDZXzRWFoclakpADfInbg/5FGjw==", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "dev": true, "requires": { "arr-diff": "^4.0.0", @@ -4434,7 +4508,33 @@ "object.pick": "^1.3.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "to-regex": "^3.0.2" + }, + "dependencies": { + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "dependencies": { + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + } + } + } } } } @@ -4562,17 +4662,6 @@ "integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA=", "dev": true }, - "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" - } - }, "formidable": { "version": "1.0.17", "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.0.17.tgz", @@ -4666,39 +4755,29 @@ "dev": true }, "fsevents": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", - "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", "dev": true, "optional": true, "requires": { - "nan": "^2.3.0", - "node-pre-gyp": "^0.6.39" + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" }, "dependencies": { "abbrev": { - "version": "1.1.0", + "version": "1.1.1", "bundled": true, "dev": true, "optional": true }, - "ajv": { - "version": "4.11.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, "ansi-regex": { "version": "2.1.1", "bundled": true, "dev": true }, "aproba": { - "version": "1.1.1", + "version": "1.2.0", "bundled": true, "dev": true, "optional": true @@ -4713,147 +4792,49 @@ "readable-stream": "^2.0.6" } }, - "asn1": { - "version": "0.2.3", + "balanced-match": { + "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, - "assert-plus": { - "version": "0.2.0", + "brace-expansion": { + "version": "1.1.11", "bundled": true, "dev": true, - "optional": true + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } }, - "asynckit": { - "version": "0.4.0", + "chownr": { + "version": "1.0.1", "bundled": true, "dev": true, "optional": true }, - "aws-sign2": { - "version": "0.6.0", + "code-point-at": { + "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, - "aws4": { - "version": "1.6.0", + "concat-map": { + "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, - "balanced-match": { - "version": "0.4.2", + "console-control-strings": { + "version": "1.1.0", "bundled": true, "dev": true }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "block-stream": { - "version": "0.0.9", - "bundled": true, - "dev": true, - "requires": { - "inherits": "~2.0.0" - } - }, - "boom": { - "version": "2.10.1", - "bundled": true, - "dev": true, - "requires": { - "hoek": "2.x.x" - } - }, - "brace-expansion": { - "version": "1.1.7", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "^0.4.1", - "concat-map": "0.0.1" - } - }, - "buffer-shims": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "caseless": { - "version": "0.12.0", - "bundled": true, - "dev": true, - "optional": true - }, - "co": { - "version": "4.6.0", + "core-util-is": { + "version": "1.0.2", "bundled": true, "dev": true, "optional": true }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "combined-stream": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "cryptiles": { - "version": "2.0.5", - "bundled": true, - "dev": true, - "requires": { - "boom": "2.x.x" - } - }, - "dashdash": { - "version": "1.14.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, "debug": { - "version": "2.6.8", + "version": "2.6.9", "bundled": true, "dev": true, "optional": true, @@ -4862,16 +4843,11 @@ } }, "deep-extend": { - "version": "0.4.2", + "version": "0.5.1", "bundled": true, "dev": true, "optional": true }, - "delayed-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, "delegates": { "version": "1.0.0", "bundled": true, @@ -4879,74 +4855,25 @@ "optional": true }, "detect-libc": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "ecc-jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "extend": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "extsprintf": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "forever-agent": { - "version": "0.6.1", + "version": "1.0.3", "bundled": true, "dev": true, "optional": true }, - "form-data": { - "version": "2.1.4", + "fs-minipass": { + "version": "1.2.5", "bundled": true, "dev": true, "optional": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" + "minipass": "^2.2.1" } }, "fs.realpath": { "version": "1.0.0", "bundled": true, - "dev": true - }, - "fstream": { - "version": "1.0.11", - "bundled": true, "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - } - }, - "fstream-ignore": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fstream": "^1.0.0", - "inherits": "2", - "minimatch": "^3.0.0" - } + "optional": true }, "gauge": { "version": "2.7.4", @@ -4964,27 +4891,11 @@ "wide-align": "^1.1.0" } }, - "getpass": { - "version": "0.1.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, "glob": { "version": "7.1.2", "bundled": true, "dev": true, + "optional": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -4994,64 +4905,35 @@ "path-is-absolute": "^1.0.0" } }, - "graceful-fs": { - "version": "4.1.11", - "bundled": true, - "dev": true - }, - "har-schema": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true - }, - "har-validator": { - "version": "4.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - } - }, "has-unicode": { "version": "2.0.1", "bundled": true, "dev": true, "optional": true }, - "hawk": { - "version": "3.1.3", + "iconv-lite": { + "version": "0.4.21", "bundled": true, "dev": true, + "optional": true, "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" + "safer-buffer": "^2.1.0" } }, - "hoek": { - "version": "2.16.3", - "bundled": true, - "dev": true - }, - "http-signature": { - "version": "1.1.1", + "ignore-walk": { + "version": "3.0.1", "bundled": true, "dev": true, "optional": true, "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "minimatch": "^3.0.4" } }, "inflight": { "version": "1.0.6", "bundled": true, "dev": true, + "optional": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -5063,7 +4945,7 @@ "dev": true }, "ini": { - "version": "1.3.4", + "version": "1.3.5", "bundled": true, "dev": true, "optional": true @@ -5076,111 +4958,43 @@ "number-is-nan": "^1.0.0" } }, - "is-typedarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, "isarray": { "version": "1.0.0", "bundled": true, - "dev": true - }, - "isstream": { - "version": "0.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "jodid25519": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "optional": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsonify": "~0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "jsonify": { - "version": "0.0.0", - "bundled": true, "dev": true, "optional": true }, - "jsprim": { - "version": "1.4.0", + "minimatch": { + "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } + "brace-expansion": "^1.1.7" } }, - "mime-db": { - "version": "1.27.0", + "minimist": { + "version": "0.0.8", "bundled": true, "dev": true }, - "mime-types": { - "version": "2.1.15", + "minipass": { + "version": "2.2.4", "bundled": true, "dev": true, "requires": { - "mime-db": "~1.27.0" + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" } }, - "minimatch": { - "version": "3.0.4", + "minizlib": { + "version": "1.1.0", "bundled": true, "dev": true, + "optional": true, "requires": { - "brace-expansion": "^1.1.7" + "minipass": "^2.2.1" } }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, "mkdirp": { "version": "0.5.1", "bundled": true, @@ -5195,23 +5009,40 @@ "dev": true, "optional": true }, + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, "node-pre-gyp": { - "version": "0.6.39", + "version": "0.10.0", "bundled": true, "dev": true, "optional": true, "requires": { "detect-libc": "^1.0.2", - "hawk": "3.1.3", "mkdirp": "^0.5.1", + "needle": "^2.2.0", "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", "npmlog": "^4.0.2", "rc": "^1.1.7", - "request": "2.81.0", "rimraf": "^2.6.1", "semver": "^5.3.0", - "tar": "^2.2.1", - "tar-pack": "^3.4.0" + "tar": "^4" } }, "nopt": { @@ -5224,8 +5055,24 @@ "osenv": "^0.1.4" } }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, "npmlog": { - "version": "4.1.0", + "version": "4.1.2", "bundled": true, "dev": true, "optional": true, @@ -5241,12 +5088,6 @@ "bundled": true, "dev": true }, - "oauth-sign": { - "version": "0.8.2", - "bundled": true, - "dev": true, - "optional": true - }, "object-assign": { "version": "4.1.1", "bundled": true, @@ -5274,7 +5115,7 @@ "optional": true }, "osenv": { - "version": "0.1.4", + "version": "0.1.5", "bundled": true, "dev": true, "optional": true, @@ -5286,38 +5127,22 @@ "path-is-absolute": { "version": "1.0.1", "bundled": true, - "dev": true - }, - "performance-now": { - "version": "0.2.0", - "bundled": true, "dev": true, "optional": true }, "process-nextick-args": { - "version": "1.0.7", - "bundled": true, - "dev": true - }, - "punycode": { - "version": "1.4.1", - "bundled": true, - "dev": true, - "optional": true - }, - "qs": { - "version": "6.4.0", + "version": "2.0.0", "bundled": true, "dev": true, "optional": true }, "rc": { - "version": "1.2.1", + "version": "1.2.7", "bundled": true, "dev": true, "optional": true, "requires": { - "deep-extend": "~0.4.0", + "deep-extend": "^0.5.1", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" @@ -5332,112 +5157,63 @@ } }, "readable-stream": { - "version": "2.2.9", + "version": "2.3.6", "bundled": true, "dev": true, + "optional": true, "requires": { - "buffer-shims": "~1.0.0", "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "inherits": "~2.0.3", "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, - "request": { - "version": "2.81.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "performance-now": "^0.2.0", - "qs": "~6.4.0", - "safe-buffer": "^5.0.1", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.0.0" - } - }, "rimraf": { - "version": "2.6.1", + "version": "2.6.2", "bundled": true, "dev": true, + "optional": true, "requires": { "glob": "^7.0.5" } }, "safe-buffer": { - "version": "5.0.1", + "version": "5.1.1", "bundled": true, "dev": true }, - "semver": { - "version": "5.3.0", + "safer-buffer": { + "version": "2.1.2", "bundled": true, "dev": true, "optional": true }, - "set-blocking": { - "version": "2.0.0", + "sax": { + "version": "1.2.4", "bundled": true, "dev": true, "optional": true }, - "signal-exit": { - "version": "3.0.2", + "semver": { + "version": "5.5.0", "bundled": true, "dev": true, "optional": true }, - "sntp": { - "version": "1.0.9", + "set-blocking": { + "version": "2.0.0", "bundled": true, "dev": true, - "requires": { - "hoek": "2.x.x" - } + "optional": true }, - "sshpk": { - "version": "1.13.0", + "signal-exit": { + "version": "3.0.2", "bundled": true, "dev": true, - "optional": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jodid25519": "^1.0.0", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } + "optional": true }, "string-width": { "version": "1.0.2", @@ -5450,19 +5226,14 @@ } }, "string_decoder": { - "version": "1.0.1", + "version": "1.1.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "safe-buffer": "^5.0.1" + "safe-buffer": "~5.1.0" } }, - "stringstream": { - "version": "0.0.5", - "bundled": true, - "dev": true, - "optional": true - }, "strip-ansi": { "version": "3.0.1", "bundled": true, @@ -5478,81 +5249,26 @@ "optional": true }, "tar": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" - } - }, - "tar-pack": { - "version": "3.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^2.2.0", - "fstream": "^1.0.10", - "fstream-ignore": "^1.0.5", - "once": "^1.3.3", - "readable-stream": "^2.1.4", - "rimraf": "^2.5.1", - "tar": "^2.2.1", - "uid-number": "^0.0.6" - } - }, - "tough-cookie": { - "version": "2.3.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "punycode": "^1.4.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", + "version": "4.4.1", "bundled": true, "dev": true, "optional": true, "requires": { - "safe-buffer": "^5.0.1" + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" } }, - "tweetnacl": { - "version": "0.14.5", - "bundled": true, - "dev": true, - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "bundled": true, - "dev": true, - "optional": true - }, "util-deprecate": { "version": "1.0.2", "bundled": true, - "dev": true - }, - "uuid": { - "version": "3.0.1", - "bundled": true, "dev": true, "optional": true }, - "verror": { - "version": "1.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "extsprintf": "1.0.2" - } - }, "wide-align": { "version": "1.1.2", "bundled": true, @@ -5566,6 +5282,11 @@ "version": "1.0.2", "bundled": true, "dev": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true, + "dev": true } } }, @@ -6923,12 +6644,13 @@ } }, "gulp-mail": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/gulp-mail/-/gulp-mail-0.1.2.tgz", - "integrity": "sha1-VpzvNTXcvI7b90GvsswHS11xWC8=", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/gulp-mail/-/gulp-mail-0.3.0.tgz", + "integrity": "sha512-/8cXwnUxVy1R0ODhYJEzmgx06lRFZikod/21wbssf9uxwb+UKI2BWywSPgnQxJxnwQDKvzEB10H+k9n2CDiw0A==", "dev": true, "requires": { - "gulp-util": "^3.0.1", + "ansi-colors": "^1.1.0", + "fancy-log": "^1.3.2", "nodemailer": "^0.7.1", "through2": "^0.6.1", "underscore": "^1.7.0" @@ -6957,9 +6679,9 @@ } }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==", "dev": true } } @@ -7162,9 +6884,9 @@ } }, "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", "dev": true }, "har-validator": { @@ -7189,9 +6911,9 @@ } }, "has-binary2": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.2.tgz", - "integrity": "sha1-6D26SfC5vk0CbSc2U1DZ8D9Uvpg=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", "dev": true, "requires": { "isarray": "2.0.1" @@ -7472,14 +7194,23 @@ } }, "http-errors": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.5.1.tgz", - "integrity": "sha1-eIwNLB3iyBuebowBhDtrl+uSB1A=", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "dev": true, "requires": { + "depd": "~1.1.2", "inherits": "2.0.3", - "setprototypeof": "1.0.2", - "statuses": ">= 1.3.1 < 2" + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "dependencies": { + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true + } } }, "http-proxy": { @@ -9112,9 +8843,9 @@ } }, "limiter": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.2.tgz", - "integrity": "sha512-JIKZ0xb6fZZYa3deZ0BgXCgX6HgV8Nx3mFGeFHmFWW8Fb2c08e0CyE+G3nalpD0xGvGssjGb1UdFr+PprxZEbw==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.3.tgz", + "integrity": "sha512-zrycnIMsLw/3ZxTbW7HCez56rcFGecWTx5OZNplzcXUUmJLmoYArC6qdJzmAN5BWiNXGcpjhF9RQ1HSv5zebEw==", "dev": true }, "linerstream": { @@ -9123,102 +8854,6 @@ "integrity": "sha1-Xee/afqisPnYXoMyCZtw5BmoRdU=", "dev": true }, - "list-stylesheets": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/list-stylesheets/-/list-stylesheets-1.1.0.tgz", - "integrity": "sha1-8N/w+xh6ov7KmZgEWZQUHMKdvzE=", - "dev": true, - "requires": { - "cheerio": "^0.19.0", - "extend": "^3.0.0", - "object.pick": "^1.1.1" - }, - "dependencies": { - "cheerio": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.19.0.tgz", - "integrity": "sha1-dy5wFfLuKZZQltcepBdbdas1SSU=", - "dev": true, - "requires": { - "css-select": "~1.0.0", - "dom-serializer": "~0.1.0", - "entities": "~1.1.1", - "htmlparser2": "~3.8.1", - "lodash": "^3.2.0" - } - }, - "css-select": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.0.0.tgz", - "integrity": "sha1-sRIcpRhI3SZOIkTQWM7iVN7rRLA=", - "dev": true, - "requires": { - "boolbase": "~1.0.0", - "css-what": "1.0", - "domutils": "1.4", - "nth-check": "~1.0.0" - } - }, - "css-what": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-1.0.0.tgz", - "integrity": "sha1-18wt9FGAZm+Z0rFEYmOUaeAPc2w=", - "dev": true - }, - "domhandler": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", - "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", - "dev": true - }, - "htmlparser2": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", - "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", - "dev": true, - "requires": { - "domelementtype": "1", - "domhandler": "2.3", - "domutils": "1.5", - "entities": "1.0", - "readable-stream": "1.1" - }, - "dependencies": { - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "entities": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", - "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", - "dev": true - } - } - }, - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - } - } - }, "litmus-api": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/litmus-api/-/litmus-api-0.3.2.tgz", @@ -9413,27 +9048,21 @@ } }, "localtunnel": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/localtunnel/-/localtunnel-1.8.3.tgz", - "integrity": "sha1-3MWSL9hWUQN9S94k/ZMkjQsk6wU=", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/localtunnel/-/localtunnel-1.9.0.tgz", + "integrity": "sha512-wCIiIHJ8kKIcWkTQE3m1VRABvsH2ZuOkiOpZUofUCf6Q42v3VIZ+Q0YfX1Z4sYDRj0muiKL1bLvz1FeoxsPO0w==", "dev": true, "requires": { + "axios": "0.17.1", "debug": "2.6.8", "openurl": "1.1.1", - "request": "2.81.0", - "yargs": "3.29.0" + "yargs": "6.6.0" }, "dependencies": { "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", "dev": true }, "debug": { @@ -9445,73 +9074,34 @@ "ms": "2.0.0" } }, - "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", - "dev": true, - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - } - }, - "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", - "dev": true - }, - "request": { - "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", - "dev": true, - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "performance-now": "^0.2.0", - "qs": "~6.4.0", - "safe-buffer": "^5.0.1", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.0.0" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "yargs": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz", + "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", "dev": true, "requires": { - "safe-buffer": "^5.0.1" + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^4.2.0" } }, - "yargs": { - "version": "3.29.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.29.0.tgz", - "integrity": "sha1-GquWYOrnnYuPZ1vK7qtu40ws9pw=", + "yargs-parser": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz", + "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", "dev": true, "requires": { - "camelcase": "^1.2.1", - "cliui": "^3.0.3", - "decamelize": "^1.0.0", - "os-locale": "^1.4.0", - "window-size": "^0.1.2", - "y18n": "^3.2.0" + "camelcase": "^3.0.0" } } } @@ -10295,6 +9885,12 @@ } } }, + "math-random": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", + "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", + "dev": true + }, "mediaquery-text": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/mediaquery-text/-/mediaquery-text-1.0.5.tgz", @@ -10399,9 +9995,9 @@ } }, "mime": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", - "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, "mime-db": { @@ -10504,9 +10100,9 @@ "dev": true }, "nan": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", - "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", "dev": true }, "nanomatch": { @@ -10573,39 +10169,10 @@ "lower-case": "^1.1.1" } }, - "node-gyp": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.6.2.tgz", - "integrity": "sha1-m/vlRWIoYoSDjnUOrAUpWFP6HGA=", - "dev": true, - "requires": { - "fstream": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "minimatch": "^3.0.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "osenv": "0", - "request": "2", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^2.0.0", - "which": "1" - }, - "dependencies": { - "semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", - "dev": true - } - } - }, "node-sass": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.7.2.tgz", - "integrity": "sha512-CaV+wLqZ7//Jdom5aUFCpGNoECd7BbNhjuwdsX/LkXBrHl8eb1Wjw4HvWqcFvhr5KuNgAk8i/myf/MQ1YYeroA==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.9.3.tgz", + "integrity": "sha512-XzXyGjO+84wxyH7fV6IwBOTrEBe2f0a6SBze9QWWYR/cL74AcQUks2AsqcCZenl/Fp/JVbuEaLpgrLtocwBUww==", "dev": true, "requires": { "async-foreach": "^0.1.3", @@ -10620,13 +10187,134 @@ "lodash.mergewith": "^4.6.0", "meow": "^3.7.0", "mkdirp": "^0.5.1", - "nan": "^2.3.2", - "node-gyp": "^3.3.1", + "nan": "^2.10.0", + "node-gyp": "^3.8.0", "npmlog": "^4.0.0", - "request": "~2.79.0", + "request": "2.87.0", "sass-graph": "^2.2.4", "stdout-stream": "^1.4.0", "true-case-path": "^1.0.2" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "dev": true, + "requires": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "node-gyp": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", + "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", + "dev": true, + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + } + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "request": { + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + } } }, "node-status-codes": { @@ -11603,9 +11291,9 @@ "dev": true }, "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, "phantomjs-prebuilt": { @@ -11625,18 +11313,6 @@ "which": "^1.2.10" }, "dependencies": { - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "dev": true, - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", @@ -11649,41 +11325,12 @@ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", "dev": true }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "dev": true, - "requires": { - "hoek": "4.x.x" - } - }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "dev": true, - "requires": { - "boom": "5.x.x" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "dev": true, - "requires": { - "hoek": "4.x.x" - } - } - } - }, "form-data": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", @@ -11706,40 +11353,16 @@ "klaw": "^1.0.0" } }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", "dev": true, "requires": { - "ajv": "^5.1.0", + "ajv": "^5.3.0", "har-schema": "^2.0.0" } }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "dev": true, - "requires": { - "boom": "4.x.x", - "cryptiles": "3.x.x", - "hoek": "4.x.x", - "sntp": "2.x.x" - } - }, - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", - "dev": true - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -11760,55 +11383,95 @@ "graceful-fs": "^4.1.6" } }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", "dev": true }, "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, "request": { - "version": "2.83.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "dev": true, "requires": { "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", + "aws4": "^1.8.0", "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", - "hawk": "~6.0.2", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "stringstream": "~0.0.5", - "tough-cookie": "~2.3.3", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" - } - }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "dev": true, - "requires": { - "hoek": "4.x.x" + "uuid": "^3.3.2" + }, + "dependencies": { + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "dev": true, + "requires": { + "mime-db": "~1.35.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + } } }, "tunnel-agent": { @@ -12025,6 +11688,12 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, "public-address": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/public-address/-/public-address-0.1.2.tgz", @@ -12064,12 +11733,6 @@ "integrity": "sha1-EYcq7t7okmgRCxCnGESP+xARKhQ=", "dev": true }, - "qs": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", - "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", - "dev": true - }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -12083,43 +11746,27 @@ "dev": true }, "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", + "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", "dev": true, "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" }, "dependencies": { "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true }, "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true } } }, @@ -12129,6 +11776,29 @@ "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", "dev": true }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "dev": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, "rc": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.5.tgz", @@ -12468,66 +12138,202 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "readable-stream": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.4.tgz", + "integrity": "sha512-vuYxeWYM+fde14+rajzqgeohAI7YoJcHE7kXDAc4Nk0EbuKnJfqtY9YtRkLo/tqkuF7MsBQRhPnPeyjYITp3ZQ==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "optional": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true, + "optional": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true, + "optional": true + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true, + "optional": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true, + "optional": true + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true, + "optional": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "optional": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "dev": true, + "optional": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "optional": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "dev": true, + "requires": { + "mime-db": "~1.35.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true, + "optional": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true, + "optional": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "readable-stream": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.4.tgz", - "integrity": "sha512-vuYxeWYM+fde14+rajzqgeohAI7YoJcHE7kXDAc4Nk0EbuKnJfqtY9YtRkLo/tqkuF7MsBQRhPnPeyjYITp3ZQ==", + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, + "optional": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" + "psl": "^1.1.24", + "punycode": "^1.4.1" } }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, + "optional": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "^5.0.1" } + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true, + "optional": true } } }, - "request": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", - "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", - "dev": true, - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.11.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~2.0.6", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "qs": "~6.3.0", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "~0.4.1", - "uuid": "^3.0.0" - } - }, "request-progress": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", @@ -12644,6 +12450,12 @@ "ret": "~0.1.10" } }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "sass-graph": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz", @@ -12754,79 +12566,36 @@ } }, "send": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.15.2.tgz", - "integrity": "sha1-+R+rRAO8+H5xb3DOtdsvV4vcF9Y=", + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", "dev": true, "requires": { - "debug": "2.6.4", - "depd": "~1.1.0", + "debug": "2.6.9", + "depd": "~1.1.2", "destroy": "~1.0.4", - "encodeurl": "~1.0.1", + "encodeurl": "~1.0.2", "escape-html": "~1.0.3", - "etag": "~1.8.0", - "fresh": "0.5.0", - "http-errors": "~1.6.1", - "mime": "1.3.4", - "ms": "1.0.0", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", "on-finished": "~2.3.0", "range-parser": "~1.2.0", - "statuses": "~1.3.1" + "statuses": "~1.4.0" }, "dependencies": { - "debug": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.4.tgz", - "integrity": "sha1-dYaps8OXQcAoKuM0RcTorHRzT+A=", - "dev": true, - "requires": { - "ms": "0.7.3" - }, - "dependencies": { - "ms": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.3.tgz", - "integrity": "sha1-cIFVpeROM/X9D8U+gdDUCpG+H/8=", - "dev": true - } - } - }, - "fresh": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", - "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44=", - "dev": true - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "dev": true, - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", - "dev": true - } - } - }, - "ms": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-1.0.0.tgz", - "integrity": "sha1-Wa3NIu3FQ/e1OBhi0xOHsfS8lHM=", + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", "dev": true }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", "dev": true } } @@ -12841,47 +12610,30 @@ } }, "serve-index": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.8.0.tgz", - "integrity": "sha1-fF2WwT+xMRAfk8HFd0+FFqHnjTs=", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", "dev": true, "requires": { - "accepts": "~1.3.3", - "batch": "0.5.3", - "debug": "~2.2.0", + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", "escape-html": "~1.0.3", - "http-errors": "~1.5.0", - "mime-types": "~2.1.11", - "parseurl": "~1.3.1" - }, - "dependencies": { - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "dev": true, - "requires": { - "ms": "0.7.1" - } - }, - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", - "dev": true - } + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" } }, "serve-static": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.2.tgz", - "integrity": "sha1-5UbicmCBuBtLzsjpCAjrzdMjr7o=", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", "dev": true, "requires": { - "encodeurl": "~1.0.1", + "encodeurl": "~1.0.2", "escape-html": "~1.0.3", - "parseurl": "~1.3.1", - "send": "0.15.2" + "parseurl": "~1.3.2", + "send": "0.16.2" } }, "server-destroy": { @@ -12935,9 +12687,9 @@ } }, "setprototypeof": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.2.tgz", - "integrity": "sha1-gaVSFB7BBLiOic44MQOtXGZWTQg=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", "dev": true }, "signal-exit": { @@ -13133,16 +12885,86 @@ } }, "socket.io": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.0.4.tgz", - "integrity": "sha1-waRZDO/4fs8TxyZS8Eb3FrKeYBQ=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.1.1.tgz", + "integrity": "sha512-rORqq9c+7W0DAK3cleWNSyfv/qKXV99hV4tZe+gGLfBECw3XEhBy7x85F3wypA9688LKjtwO9pX9L33/xQI8yA==", "dev": true, "requires": { - "debug": "~2.6.6", - "engine.io": "~3.1.0", + "debug": "~3.1.0", + "engine.io": "~3.2.0", + "has-binary2": "~1.0.2", "socket.io-adapter": "~1.1.0", - "socket.io-client": "2.0.4", - "socket.io-parser": "~3.1.1" + "socket.io-client": "2.1.1", + "socket.io-parser": "~3.2.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "engine.io-client": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", + "integrity": "sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.1", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~3.3.1", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + } + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true + }, + "socket.io-client": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.1.1.tgz", + "integrity": "sha512-jxnFyhAuFxYfjqIgduQlhzqTcOEQSn+OHKVfAxWaNWa7ecP7xSNk2Dx/3UEsDcY7NcFafxvNvKPmmO7HTwTxGQ==", + "dev": true, + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "engine.io-client": "~3.2.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.2.0", + "to-array": "0.1.4" + } + }, + "socket.io-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", + "integrity": "sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + } + } } }, "socket.io-adapter": { @@ -13173,17 +12995,26 @@ } }, "socket.io-parser": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.1.2.tgz", - "integrity": "sha1-28IoIVH8T6675Aru3Ady66YZ9/I=", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.1.3.tgz", + "integrity": "sha512-g0a2HPqLguqAczs3dMECuA1RgoGFPyvDqcbaDEdCWY9g59kdUAz3YRmaJBNKXflrHNwB7Q12Gkf/0CZXfdHR7g==", "dev": true, "requires": { "component-emitter": "1.2.1", - "debug": "~2.6.4", + "debug": "~3.1.0", "has-binary2": "~1.0.2", "isarray": "2.0.1" }, "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, "isarray": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", @@ -13307,9 +13138,9 @@ } }, "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", "dev": true, "requires": { "asn1": "~0.2.3", @@ -13319,6 +13150,7 @@ "ecc-jsbn": "~0.1.1", "getpass": "^0.1.1", "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" }, "dependencies": { @@ -13568,8 +13400,7 @@ }, "stringstream": { "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "resolved": "", "dev": true }, "strip-ansi": { @@ -13655,113 +13486,6 @@ "escape-string-regexp": "^1.0.2" } }, - "style-data": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/style-data/-/style-data-1.1.3.tgz", - "integrity": "sha512-x//3wVW/mz1een+tB8oLRXel8woAP3GqtxQsx3zFSoz3Yapq5bQEEgRGlwOs+wvGzYS9E7CXLDqzeGLjjRpgpg==", - "dev": true, - "requires": { - "cheerio": "^0.22.0", - "extend": "^3.0.0", - "mediaquery-text": "^1.0.0", - "object.pick": "^1.1.1" - }, - "dependencies": { - "cheerio": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", - "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", - "dev": true, - "requires": { - "css-select": "~1.2.0", - "dom-serializer": "~0.1.0", - "entities": "~1.1.1", - "htmlparser2": "^3.9.1", - "lodash.assignin": "^4.0.9", - "lodash.bind": "^4.1.4", - "lodash.defaults": "^4.0.1", - "lodash.filter": "^4.4.0", - "lodash.flatten": "^4.2.0", - "lodash.foreach": "^4.3.0", - "lodash.map": "^4.4.0", - "lodash.merge": "^4.4.0", - "lodash.pick": "^4.2.1", - "lodash.reduce": "^4.4.0", - "lodash.reject": "^4.4.0", - "lodash.some": "^4.4.0" - } - }, - "domhandler": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", - "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", - "dev": true - }, - "htmlparser2": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", - "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", - "dev": true, - "requires": { - "domelementtype": "^1.3.0", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.4.tgz", - "integrity": "sha512-vuYxeWYM+fde14+rajzqgeohAI7YoJcHE7kXDAc4Nk0EbuKnJfqtY9YtRkLo/tqkuF7MsBQRhPnPeyjYITp3ZQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "sum-up": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sum-up/-/sum-up-1.0.3.tgz", @@ -13807,6 +13531,12 @@ "mime-types": "^2.1.3" } }, + "mime": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", + "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=", + "dev": true + }, "qs": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/qs/-/qs-2.3.3.tgz", @@ -14344,9 +14074,9 @@ "dev": true }, "ua-parser-js": { - "version": "0.7.12", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.12.tgz", - "integrity": "sha1-BMgamb3V3FImPqKdJMa/jUgYpLs=", + "version": "0.7.17", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz", + "integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==", "dev": true }, "uglify-js": { @@ -14668,9 +14398,9 @@ } }, "universalify": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", - "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true }, "unpipe": { @@ -14893,9 +14623,9 @@ "dev": true }, "utils-merge": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", - "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", "dev": true }, "uuid": { @@ -14904,13 +14634,6 @@ "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", "dev": true }, - "uws": { - "version": "9.14.0", - "resolved": "https://registry.npmjs.org/uws/-/uws-9.14.0.tgz", - "integrity": "sha512-HNMztPP5A1sKuVFmdZ6BPVpBQd5bUjNC8EFMFiICK+oho/OQsAJy5hnIx4btMHiOk8j04f/DbIlqnEZ9d72dqg==", - "dev": true, - "optional": true - }, "v8flags": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.1.tgz", diff --git a/uk.co.compucorp.civicrm.hremails/email-templates/package.json b/uk.co.compucorp.civicrm.hremails/email-templates/package.json index 506890a550a..7083d027594 100644 --- a/uk.co.compucorp.civicrm.hremails/email-templates/package.json +++ b/uk.co.compucorp.civicrm.hremails/email-templates/package.json @@ -21,7 +21,7 @@ "babel-preset-es2015": "^6.3.13", "babel-register": "^6.7.2", "beepbeep": "^1.2.0", - "browser-sync": "^2.11.0", + "browser-sync": "^2.24.6", "civicrm-scssroot": "git://github.com/totten/civicrm-scssroot.git#v0.1.1", "colors": "^1.1.2", "gulp": "git+https://github.com/gulpjs/gulp.git#4.0", @@ -34,7 +34,7 @@ "gulp-inline-css": "^3.0.0", "gulp-litmus": "0.0.7", "gulp-load-plugins": "^1.1.0", - "gulp-mail": "^0.1.1", + "gulp-mail": "^0.3.0", "gulp-rename": "^1.2.2", "gulp-replace": "^0.5.4", "gulp-sass": "^3.1.0", diff --git a/uk.co.compucorp.civicrm.hremails/info.xml b/uk.co.compucorp.civicrm.hremails/info.xml index 570f05105f8..a7de4c642c3 100644 --- a/uk.co.compucorp.civicrm.hremails/info.xml +++ b/uk.co.compucorp.civicrm.hremails/info.xml @@ -8,8 +8,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/uk.co.compucorp.civicrm.hremails/package-lock.json b/uk.co.compucorp.civicrm.hremails/package-lock.json index caf12f0f3f2..8df2784474c 100644 --- a/uk.co.compucorp.civicrm.hremails/package-lock.json +++ b/uk.co.compucorp.civicrm.hremails/package-lock.json @@ -43,10 +43,13 @@ } }, "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } }, "assert-plus": { "version": "1.0.0", @@ -94,9 +97,9 @@ "dev": true }, "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, "balanced-match": { @@ -106,32 +109,15 @@ "dev": true }, "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, "optional": true, "requires": { "tweetnacl": "^0.14.3" } }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "dev": true, - "requires": { - "hoek": "4.x.x" - }, - "dependencies": { - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", - "dev": true - } - } - }, "bower": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/bower/-/bower-1.8.2.tgz", @@ -236,34 +222,6 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "dev": true, - "requires": { - "boom": "5.x.x" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "dev": true, - "requires": { - "hoek": "4.x.x" - }, - "dependencies": { - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", - "dev": true - } - } - } - } - }, "cwise-compiler": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/cwise-compiler/-/cwise-compiler-1.1.3.tgz", @@ -289,9 +247,9 @@ "dev": true }, "deep-extend": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true }, "delayed-stream": { @@ -313,13 +271,14 @@ } }, "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, "optional": true, "requires": { - "jsbn": "~0.1.0" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, "end-of-stream": { @@ -344,9 +303,9 @@ "dev": true }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "extsprintf": { @@ -356,9 +315,9 @@ "dev": true }, "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, "fast-json-stable-stringify": { @@ -515,12 +474,12 @@ "dev": true }, "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", "dev": true, "requires": { - "ajv": "^5.1.0", + "ajv": "^5.3.0", "har-schema": "^2.0.0" } }, @@ -541,26 +500,6 @@ } } }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "dev": true, - "requires": { - "boom": "4.x.x", - "cryptiles": "3.x.x", - "hoek": "4.x.x", - "sntp": "2.x.x" - }, - "dependencies": { - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", - "dev": true - } - } - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -2479,9 +2418,9 @@ } }, "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", "dev": true }, "object-assign": { @@ -2600,6 +2539,12 @@ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -2607,18 +2552,18 @@ "dev": true }, "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, "rc": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.5.tgz", - "integrity": "sha1-J1zWh/bjs2zHVrqibf7oCnkDAf0=", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, "requires": { - "deep-extend": "~0.4.0", + "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" @@ -2688,33 +2633,54 @@ } }, "request": { - "version": "2.83.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "dev": true, "requires": { "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", + "aws4": "^1.8.0", "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", - "hawk": "~6.0.2", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "stringstream": "~0.0.5", - "tough-cookie": "~2.3.3", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" + "uuid": "^3.3.2" + }, + "dependencies": { + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "dev": true, + "requires": { + "mime-db": "~1.35.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } } }, "rimraf": { @@ -2738,6 +2704,12 @@ "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "semver": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", @@ -2761,23 +2733,6 @@ } } }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "dev": true, - "requires": { - "hoek": "4.x.x" - }, - "dependencies": { - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", - "dev": true - } - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -2785,9 +2740,9 @@ "dev": true }, "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", "dev": true, "requires": { "asn1": "~0.2.3", @@ -2797,6 +2752,7 @@ "ecc-jsbn": "~0.1.1", "getpass": "^0.1.1", "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" } }, @@ -2833,12 +2789,6 @@ "safe-buffer": "~5.1.0" } }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", - "dev": true - }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -2904,11 +2854,12 @@ "dev": true }, "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, "requires": { + "psl": "^1.1.24", "punycode": "^1.4.1" } }, @@ -3018,9 +2969,9 @@ "dev": true }, "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "dev": true }, "verror": { diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/BAO/LeaveRequest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/BAO/LeaveRequest.php index b4731ab25d9..91591e6a00a 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/BAO/LeaveRequest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/BAO/LeaveRequest.php @@ -101,7 +101,6 @@ public static function validateParams($params, $validationMode = self::VALIDATIO self::validateAbsenceTypeIsActiveAndValid($params, $absenceType); self::validateTOILRequest($params, $absenceType, $absencePeriod); self::validateLeaveDaysAgainstAbsenceTypeMaxConsecutiveLeaveDays($params, $absenceType); - self::validateAbsenceTypeAllowRequestCancellationForLeaveRequestCancellation($params, $absenceType); self::validateAbsencePeriod($params, $absencePeriod); if($validationMode != self::IMPORT_VALIDATION) { @@ -731,46 +730,6 @@ private static function validateLeaveDaysAgainstAbsenceTypeMaxConsecutiveLeaveDa } } - /** - * This method checks if the absence type allows cancellation in advance of start date and that the leave request from_date - * should not be in the past in the event of a leave request cancellation by a user. - * - * Also checks that a user's leave request should not be cancelled if the absence type does not - * allow leave request cancellation - * - * @param array $params - * The params array received by the create method - * @param AbsenceType $absenceType - * - * @throws \CRM_HRLeaveAndAbsences_Exception_InvalidLeaveRequestException - */ - private static function validateAbsenceTypeAllowRequestCancellationForLeaveRequestCancellation($params, $absenceType) { - $leaveRequestStatuses = self::getStatuses(); - $leaveRequestIsForCurrentUser = CRM_Core_Session::getLoggedInContactID() == $params['contact_id']; - $isACancellationRequest = ($params['status_id'] == $leaveRequestStatuses['cancelled']); - - if($leaveRequestIsForCurrentUser && $isACancellationRequest) { - $today = new DateTime('today'); - $fromDate = new DateTime($params['from_date']); - - if($absenceType->allow_request_cancelation == AbsenceType::REQUEST_CANCELATION_IN_ADVANCE_OF_START_DATE && $fromDate < $today) { - throw new InvalidLeaveRequestException( - 'Leave Request with past days cannot be cancelled', - 'leave_request_past_days_cannot_be_cancelled', - 'type_id' - ); - } - - if($absenceType->allow_request_cancelation == AbsenceType::REQUEST_CANCELATION_NO) { - throw new InvalidLeaveRequestException( - 'Absence Type does not allow leave request cancellation', - 'leave_request_absence_type_disallows_cancellation', - 'type_id' - ); - } - } - } - /** * This method validates that the absence type is active and is valid for the * type of request. That is, if this is a Sickness Request, then only absence diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequest.php index 7e4708306b9..b3a75707294 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequest.php @@ -115,8 +115,17 @@ protected function update($params) { $this->getErrorMessageForInvalidStatusTransition($params)); } - $isTOILWithPastDates = LeaveRequest::isTOILWithPastDates($params); $isCancelledStatus = $this->isCancelledStatus($params); + + if ($isCancelledStatus) { + if (!$this->canCancelForAbsenceType($params)) { + throw new RuntimeException( + 'You cannot cancel leave requests for this Absence type' + ); + } + } + + $isTOILWithPastDates = LeaveRequest::isTOILWithPastDates($params); $canCanCancelTOILWithPastDates = $this->canCanCancelTOILWithPastDates($params); if ($isTOILWithPastDates && $isCancelledStatus && !$canCanCancelTOILWithPastDates) { @@ -128,6 +137,22 @@ protected function update($params) { return $this->createRequestWithBalanceChanges($params); } + /** + * Whether the current user can cancel a leave request for the absence + * type. + * + * @param array $params + * + * @return bool + */ + private function canCancelForAbsenceType($params) { + return $this->leaveRequestRightsService->canCancelForAbsenceType( + $params['type_id'], + $params['contact_id'], + new DateTime($params['from_date']) + ); + } + /** * Return an error message either for specific invalid status transition cases * or a default generic message @@ -137,13 +162,7 @@ protected function update($params) { * @return string */ private function getErrorMessageForInvalidStatusTransition($params) { - $leaveStatuses = LeaveRequest::getStatuses(); $leaveStatusesLabels = LeaveRequest::buildOptions('status_id'); - $isOwnRequest = CRM_Core_Session::getLoggedInContactID() === $params['contact_id']; - - if ($isOwnRequest && (int)$params['status_id'] === (int)$leaveStatuses['approved']) { - return "You can't approve your own leave requests"; - } return "You can't change the Leave Request status from \"" . $leaveStatusesLabels[$this->getCurrentStatus($params)] . '" to "' . diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestCalendarFeedData.php b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestCalendarFeedData.php index ec0d3cc3382..95babf79675 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestCalendarFeedData.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestCalendarFeedData.php @@ -165,8 +165,8 @@ private function getLeaveRequests() { $params = [ 'type_id' => ['IN' => $leaveTypes], 'status_id' => ['IN' => ['approved', 'admin_approved']], - 'from_date' => ['>=' => $this->startDate->format('Y-m-d H:i:s')], - 'to_date' => ['<=' => $this->endDate->format('Y-m-d H:i:s')], + 'from_date' => ['<=' => $this->endDate->format('Y-m-d H:i:s')], + 'to_date' => ['>=' => $this->startDate->format('Y-m-d H:i:s')], 'request_type' => ['!=' => LeaveRequest::REQUEST_TYPE_TOIL], ]; diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php index b3e919208ac..b3cd7e0f13b 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php @@ -53,19 +53,28 @@ public function canCreateAndUpdateFor($contactID) { * @return bool */ public function canChangeDatesFor($contactID, $statusID, $requestType) { + if ($this->currentUserIsAdmin()) { + return TRUE; + } + $leaveRequestStatuses = self::getLeaveRequestStatuses(); $openStatuses = [ $leaveRequestStatuses['awaiting_approval'], $leaveRequestStatuses['more_information_required'] ]; - $isSicknessRequest = $requestType === LeaveRequest::REQUEST_TYPE_SICKNESS; + $isOpenLeaveRequest = in_array($statusID, $openStatuses); + $currentUserIsLeaveContact = $this->currentUserIsLeaveContact($contactID); - $currentUserCanChangeDates = ($isSicknessRequest && $this->currentUserIsLeaveManagerOf($contactID)) || - ($this->currentUserIsLeaveContact($contactID) && $isOpenLeaveRequest) || - $this->currentUserIsAdmin(); + if ($currentUserIsLeaveContact && $isOpenLeaveRequest) { + return TRUE; + } + + $currentUserIsLeaveManager = $this->currentUserIsLeaveManagerOf($contactID); + $isOwnLeaveApprover = $currentUserIsLeaveManager && $currentUserIsLeaveContact; + $isSicknessRequest = $requestType === LeaveRequest::REQUEST_TYPE_SICKNESS; - return $currentUserCanChangeDates; + return $isOwnLeaveApprover || ($isSicknessRequest && $currentUserIsLeaveManager); } /** @@ -85,7 +94,9 @@ public function canChangeAbsenceTypeFor($contactID, $statusID) { } /** - * Checks whether the current user has permissions to delete the leave request + * Checks whether the current user has permissions to delete the leave request. + * Currently only allows the admin and a user who is own leave approver and its + * own request to delete a leave request. * * @param int $contactID * The contactID of the leave request @@ -93,7 +104,15 @@ public function canChangeAbsenceTypeFor($contactID, $statusID) { * @return bool */ public function canDeleteFor($contactID) { - return $this->currentUserIsAdmin(); + if ($this->currentUserIsAdmin()) { + return TRUE; + } + + if (!$this->currentUserIsLeaveContact($contactID)) { + return FALSE; + } + + return $this->currentUserIsLeaveManagerOf($contactID); } /** @@ -199,4 +218,35 @@ public function getLeaveContactsCurrentUserHasAccessTo() { return $results; } + + /** + * Checks if the current user can cancel the leave request for the given absence type, + * leave contact and leave from date. + * + * @param int $absenceTypeId + * @param int $contactId + * @param \DateTime $leaveFromDate + * + * @return bool + */ + public function canCancelForAbsenceType($absenceTypeId, $contactId, DateTime $leaveFromDate) { + if ($this->currentUserIsAdmin() || $this->currentUserIsLeaveManagerOf($contactId)) { + return TRUE; + } + + $absenceType = AbsenceType::findById($absenceTypeId); + if ($absenceType->allow_request_cancelation == AbsenceType::REQUEST_CANCELATION_ALWAYS) { + return TRUE; + } + + $today = new DateTime('today'); + + $absenceTypeAllowsFutureCancellation = + $absenceType->allow_request_cancelation == AbsenceType::REQUEST_CANCELATION_IN_ADVANCE_OF_START_DATE; + if ($absenceTypeAllowsFutureCancellation && $leaveFromDate > $today) { + return TRUE; + } + + return FALSE; + } } diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrix.php b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrix.php index 6fba8425325..05b29246f8e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrix.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrix.php @@ -149,10 +149,10 @@ private function getStatusMatrixForCurrentUser($leaveRequestContactID) { $currentUserID = CRM_Core_Session::getLoggedInContactID(); $statusMatrix = []; - if ($currentUserID == $leaveRequestContactID) { - $statusMatrix = $this->getStaffStatusMatrix(); - } elseif ($this->shouldUseManagerMatrixForCurrentUser($leaveRequestContactID)) { + if ($this->shouldUseManagerMatrixForCurrentUser($leaveRequestContactID)) { $statusMatrix = $this->getManagerStatusMatrix(); + } elseif ($currentUserID == $leaveRequestContactID) { + $statusMatrix = $this->getStaffStatusMatrix(); } return $statusMatrix; diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/css/leaveandabsence.css b/uk.co.compucorp.civicrm.hrleaveandabsences/css/leaveandabsence.css index 5d13f15eaca..e7f6a8f23a0 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/css/leaveandabsence.css +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/css/leaveandabsence.css @@ -1 +1 @@ -.sp-container{position:absolute;top:0;left:0;display:inline-block;*display:inline;*zoom:1;z-index:9999994;overflow:hidden}.sp-container.sp-flat{position:relative}.sp-container,.sp-container *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.sp-top{position:relative;width:100%;display:inline-block}.sp-top-inner{position:absolute;top:0;left:0;bottom:0;right:0}.sp-color{position:absolute;top:0;left:0;bottom:0;right:20%}.sp-hue{position:absolute;top:0;right:0;bottom:0;left:84%;height:100%}.sp-clear-enabled .sp-hue{top:33px;height:77.5%}.sp-fill{padding-top:80%}.sp-sat,.sp-val{position:absolute;top:0;left:0;right:0;bottom:0}.sp-alpha-enabled .sp-top{margin-bottom:18px}.sp-alpha-enabled .sp-alpha{display:block}.sp-alpha-handle{position:absolute;top:-4px;bottom:-4px;width:6px;left:50%;cursor:pointer;border:1px solid black;background:white;opacity:.8}.sp-alpha{display:none;position:absolute;bottom:-14px;right:0;left:0;height:8px}.sp-alpha-inner{border:solid 1px #333}.sp-clear{display:none}.sp-clear.sp-clear-display{background-position:center}.sp-clear-enabled .sp-clear{display:block;position:absolute;top:0px;right:0;bottom:0;left:84%;height:28px}.sp-container,.sp-replacer,.sp-preview,.sp-dragger,.sp-slider,.sp-alpha,.sp-clear,.sp-alpha-handle,.sp-container.sp-dragging .sp-input,.sp-container button{-webkit-user-select:none;-moz-user-select:-moz-none;-o-user-select:none;user-select:none}.sp-container.sp-input-disabled .sp-input-container{display:none}.sp-container.sp-buttons-disabled .sp-button-container{display:none}.sp-container.sp-palette-buttons-disabled .sp-palette-button-container{display:none}.sp-palette-only .sp-picker-container{display:none}.sp-palette-disabled .sp-palette-container{display:none}.sp-initial-disabled .sp-initial{display:none}.sp-sat{background-image:-webkit-gradient(linear, 0 0, 100% 0, from(#fff), to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-moz-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-o-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-ms-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:linear-gradient(to right, #fff, rgba(204,154,129,0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";filter:progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81')}.sp-val{background-image:-webkit-gradient(linear, 0 100%, 0 0, from(#000), to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-moz-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-o-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-ms-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:linear-gradient(to top, #000, rgba(204,154,129,0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000')}.sp-hue{background:-moz-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-ms-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-o-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-webkit-gradient(linear, left top, left bottom, from(red), color-stop(0.17, #ff0), color-stop(0.33, lime), color-stop(0.5, cyan), color-stop(0.67, blue), color-stop(0.83, #f0f), to(red));background:-webkit-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:linear-gradient(to bottom, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%)}.sp-1{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00')}.sp-2{height:16%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00')}.sp-3{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff')}.sp-4{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff')}.sp-5{height:16%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff')}.sp-6{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000')}.sp-hidden{display:none !important}.sp-cf:before,.sp-cf:after{content:"";display:table}.sp-cf:after{clear:both}.sp-cf{*zoom:1}@media (max-device-width: 480px){.sp-color{right:40%}.sp-hue{left:63%}.sp-fill{padding-top:60%}}.sp-dragger{border-radius:5px;height:5px;width:5px;border:1px solid #fff;background:#000;cursor:pointer;position:absolute;top:0;left:0}.sp-slider{position:absolute;top:0;cursor:pointer;height:3px;left:-1px;right:-1px;border:1px solid #000;background:white;opacity:.8}.sp-container{border-radius:0;background-color:#ECECEC;border:solid 1px #f0c49B;padding:0}.sp-container,.sp-container button,.sp-container input,.sp-color,.sp-hue,.sp-clear{font:normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.sp-top{margin-bottom:3px}.sp-color,.sp-hue,.sp-clear{border:solid 1px #666}.sp-input-container{float:right;width:100px;margin-bottom:4px}.sp-initial-disabled .sp-input-container{width:100%}.sp-input{font-size:12px !important;border:1px inset;padding:4px 5px;margin:0;width:100%;background:transparent;border-radius:3px;color:#222}.sp-input:focus{border:1px solid orange}.sp-input.sp-validation-error{border:1px solid red;background:#fdd}.sp-picker-container,.sp-palette-container{float:left;position:relative;padding:10px;padding-bottom:300px;margin-bottom:-290px}.sp-picker-container{width:172px;border-left:solid 1px #fff}.sp-palette-container{border-right:solid 1px #ccc}.sp-palette-only .sp-palette-container{border:0}.sp-palette .sp-thumb-el{display:block;position:relative;float:left;width:24px;height:15px;margin:3px;cursor:pointer;border:solid 2px transparent}.sp-palette .sp-thumb-el:hover,.sp-palette .sp-thumb-el.sp-thumb-active{border-color:orange}.sp-thumb-el{position:relative}.sp-initial{float:left;border:solid 1px #333}.sp-initial span{width:30px;height:25px;border:none;display:block;float:left;margin:0}.sp-initial .sp-clear-display{background-position:center}.sp-palette-button-container,.sp-button-container{float:right}.sp-replacer{margin:0;overflow:hidden;cursor:pointer;padding:4px;display:inline-block;*zoom:1;*display:inline;border:solid 1px #91765d;background:#eee;color:#333;vertical-align:middle}.sp-replacer:hover,.sp-replacer.sp-active{border-color:#F0C49B;color:#111}.sp-replacer.sp-disabled{cursor:default;border-color:silver;color:silver}.sp-dd{padding:2px 0;height:16px;line-height:16px;float:left;font-size:10px}.sp-preview{position:relative;width:25px;height:20px;border:solid 1px #222;margin-right:5px;float:left;z-index:0}.sp-palette{*width:220px;max-width:220px}.sp-palette .sp-thumb-el{width:16px;height:16px;margin:2px 1px;border:solid 1px #d0d0d0}.sp-container{padding-bottom:0}.sp-container button{background-color:#eeeeee;background-image:-webkit-linear-gradient(top, #eee, #ccc);background-image:-moz-linear-gradient(top, #eee, #ccc);background-image:-ms-linear-gradient(top, #eee, #ccc);background-image:-o-linear-gradient(top, #eee, #ccc);background-image:linear-gradient(to bottom, #eee, #ccc);border:1px solid #ccc;border-bottom:1px solid #bbb;border-radius:3px;color:#333;font-size:14px;line-height:1;padding:5px 4px;text-align:center;text-shadow:0 1px 0 #eee;vertical-align:middle}.sp-container button:hover{background-color:#dddddd;background-image:-webkit-linear-gradient(top, #ddd, #bbb);background-image:-moz-linear-gradient(top, #ddd, #bbb);background-image:-ms-linear-gradient(top, #ddd, #bbb);background-image:-o-linear-gradient(top, #ddd, #bbb);background-image:linear-gradient(to bottom, #ddd, #bbb);border:1px solid #bbb;border-bottom:1px solid #999;cursor:pointer;text-shadow:0 1px 0 #ddd}.sp-container button:active{border:1px solid #aaa;border-bottom:1px solid #888;-webkit-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-moz-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-ms-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-o-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee}.sp-cancel{font-size:11px;color:#d93f3f !important;margin:0;padding:2px;margin-right:5px;vertical-align:middle;text-decoration:none}.sp-cancel:hover{color:#d93f3f !important;text-decoration:underline}.sp-palette span:hover,.sp-palette span.sp-thumb-active{border-color:#000}.sp-preview,.sp-alpha,.sp-thumb-el{position:relative;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.sp-preview-inner,.sp-alpha-inner,.sp-thumb-inner{display:block;position:absolute;top:0;left:0;bottom:0;right:0}.sp-palette .sp-thumb-inner{background-position:50% 50%;background-repeat:no-repeat}.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=)}.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=)}.sp-clear-display{background-repeat:no-repeat;background-position:center;background-image:url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==)}#bootstrap-theme .chr_disabled{opacity:0.5;pointer-events:none}#bootstrap-theme .table-condensed>thead>tr>th{background:#fff !important;padding:8px 5px}#bootstrap-theme .table-condensed-mixed>thead>tr>th,#bootstrap-theme .table-condensed-mixed>thead>tr>td,#bootstrap-theme .table-condensed-mixed>tbody>tr>th,#bootstrap-theme .table-condensed-mixed>tbody>tr>td{padding-left:5px;padding-right:5px}#bootstrap-theme .table-condensed>tbody>tr>td:first-child,#bootstrap-theme .table-condensed>tbody>tr>th:first-child,#bootstrap-theme .table-condensed>thead>tr>td:first-child,#bootstrap-theme .table-condensed>thead>tr>th:first-child,#bootstrap-theme .table-condensed-mixed>tbody>tr>td:first-child,#bootstrap-theme .table-condensed-mixed>tbody>tr>th:first-child,#bootstrap-theme .table-condensed-mixed>thead>tr>td:first-child,#bootstrap-theme .table-condensed-mixed>thead>tr>th:first-child{padding-left:20px}#bootstrap-theme .table-condensed>tbody>tr>td:last-child,#bootstrap-theme .table-condensed>tbody>tr>th:last-child,#bootstrap-theme .table-condensed>thead>tr>td:last-child,#bootstrap-theme .table-condensed>thead>tr>th:last-child,#bootstrap-theme .table-condensed-mixed>tbody>tr>td:last-child,#bootstrap-theme .table-condensed-mixed>tbody>tr>th:last-child,#bootstrap-theme .table-condensed-mixed>thead>tr>td:last-child,#bootstrap-theme .table-condensed-mixed>thead>tr>th:last-child{padding-right:20px}#bootstrap-theme .table-nested{overflow-y:hidden;position:relative}#bootstrap-theme .table-nested:before{box-shadow:inset 0px 6px 9px -6px rgba(0,0,0,0.2);content:'';display:block;height:10px;left:0;position:absolute;top:0;width:100%;z-index:10}#bootstrap-theme .table-nested:after{box-shadow:inset 0px -4px 9px -6px rgba(0,0,0,0.2);content:'';display:block;height:10px;left:0;position:absolute;bottom:0;width:100%;z-index:10}#bootstrap-theme .table-nested>table,#bootstrap-theme .table-nested>.table{background-color:#fff}#bootstrap-theme .table-nested>table>tbody>tr>td:first-child,#bootstrap-theme .table-nested>table>tbody>tr>th:first-child,#bootstrap-theme .table-nested>table>thead>tr>td:first-child,#bootstrap-theme .table-nested>table>thead>tr>th:first-child,#bootstrap-theme .table-nested>.table>tbody>tr>td:first-child,#bootstrap-theme .table-nested>.table>tbody>tr>th:first-child,#bootstrap-theme .table-nested>.table>thead>tr>td:first-child,#bootstrap-theme .table-nested>.table>thead>tr>th:first-child{padding-left:30px;position:relative}#bootstrap-theme .table-nested>table>tbody>tr>td:first-child:before,#bootstrap-theme .table-nested>table>tbody>tr>th:first-child:before,#bootstrap-theme .table-nested>table>thead>tr>td:first-child:before,#bootstrap-theme .table-nested>table>thead>tr>th:first-child:before,#bootstrap-theme .table-nested>.table>tbody>tr>td:first-child:before,#bootstrap-theme .table-nested>.table>tbody>tr>th:first-child:before,#bootstrap-theme .table-nested>.table>thead>tr>td:first-child:before,#bootstrap-theme .table-nested>.table>thead>tr>th:first-child:before{background:#c2cfd8;content:'';display:block;height:110%;left:0;position:absolute;top:0;width:10px;z-index:2}#bootstrap-theme .table-nested>table>tbody>tr>td:last-child,#bootstrap-theme .table-nested>table>tbody>tr>th:last-child,#bootstrap-theme .table-nested>table>thead>tr>td:last-child,#bootstrap-theme .table-nested>table>thead>tr>th:last-child,#bootstrap-theme .table-nested>.table>tbody>tr>td:last-child,#bootstrap-theme .table-nested>.table>tbody>tr>th:last-child,#bootstrap-theme .table-nested>.table>thead>tr>td:last-child,#bootstrap-theme .table-nested>.table>thead>tr>th:last-child{padding-right:30px;position:relative}#bootstrap-theme .table-nested>table>tbody>tr>td:last-child:after,#bootstrap-theme .table-nested>table>tbody>tr>th:last-child:after,#bootstrap-theme .table-nested>table>thead>tr>td:last-child:after,#bootstrap-theme .table-nested>table>thead>tr>th:last-child:after,#bootstrap-theme .table-nested>.table>tbody>tr>td:last-child:after,#bootstrap-theme .table-nested>.table>tbody>tr>th:last-child:after,#bootstrap-theme .table-nested>.table>thead>tr>td:last-child:after,#bootstrap-theme .table-nested>.table>thead>tr>th:last-child:after{background:#c2cfd8;content:'';display:block;height:110%;right:0;position:absolute;top:0;width:10px;z-index:2}@media screen and (max-width: 767px){#bootstrap-theme .table-nested.table-responsive{border:0;margin-bottom:0}}#bootstrap-theme .table-nested-cell{padding:0 !important}#bootstrap-theme .chr_absence-work-pattern__add-custom{margin-bottom:20px}#bootstrap-theme .chr_absence-work-pattern__custom-work-pattern td:nth-child(1){width:40%}#bootstrap-theme .chr_absence-work-pattern__custom-work-pattern td:nth-child(2){width:15%}#bootstrap-theme .chr_absence-work-pattern__custom-work-pattern td:nth-child(3){width:35%}#bootstrap-theme .chr_absence-work-pattern__custom-work-pattern td:nth-child(4){width:10%}#bootstrap-theme .chr_absence-work-pattern__work-pattern-listing{display:inline-block}#bootstrap-theme .chr_absence-work-pattern__alert{margin-bottom:0 !important}#bootstrap-theme .annual-entitlement-change-log-component thead td{min-width:100px}#bootstrap-theme .annual-entitlement-change-log-component thead .annual-entitlement-change-log-component__comments{min-width:300px}#bootstrap-theme .chr_annual-entitlements__period{width:130px}#bootstrap-theme .chr_annual-entitlements__edit-entitlements{width:150px}@media screen and (max-width: 767px){#bootstrap-theme calendar-feeds-dropdown-button{margin-top:8px}#bootstrap-theme calendar-feeds-dropdown-button,#bootstrap-theme calendar-feeds-dropdown-button .btn-group,#bootstrap-theme calendar-feeds-dropdown-button .btn{width:100%}}#bootstrap-theme .chr_contract-entitlements__position{width:140px}@media (max-width: 992px){#bootstrap-theme .chr_leave-balance-tab .chr_leave-balance-tab__filter:not(:last-child){padding-bottom:15px}}#bootstrap-theme .chr_leave-balance-tab__body{padding:0}#bootstrap-theme .chr_leave-calendar__admin-filters-hint{display:inline-block;font-size:20px;vertical-align:middle}#bootstrap-theme .chr_leave-calendar__admin-filters-select{display:inline-block;margin-right:20px;width:calc(100% - 50px)}#bootstrap-theme .chr_leave-calendar__dates-container{overflow-x:auto}@media (min-width: 1200px){#bootstrap-theme .chr_leave-calendar__dates-container .chr_leave-calendar{table-layout:fixed}}#bootstrap-theme .chr_leave-calendar__day{font-size:10px !important;line-height:1.4em !important;padding:10px !important;text-align:center !important}@media (min-width: 1200px){#bootstrap-theme .chr_leave-calendar__day{padding:10px 0 !important}}#bootstrap-theme .chr_leave-calendar__day--disabled{opacity:0.5}#bootstrap-theme .chr_leave-calendar__day--current{color:#0071bd !important}#bootstrap-theme .chr_leave-calendar__day-container--type--non-working{background-color:#41afcb}#bootstrap-theme .chr_leave-calendar__day-container--type--public-holiday{background-color:#8ec68a}#bootstrap-theme .chr_leave-calendar__day-container--type--weekend{background-color:#c7cbd0}#bootstrap-theme .chr_leave-calendar__day-container{height:100%}#bootstrap-theme .chr_leave-calendar__item{color:#fff;display:block;font-size:10px;height:100%;position:relative;text-align:center;text-transform:uppercase;width:100%}#bootstrap-theme .chr_leave-calendar__item>span{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;height:1.2em}#bootstrap-theme .chr_leave-calendar__item>.chr_leave-calendar__time-unit{font-size:7px;height:1em;margin-left:-1px}#bootstrap-theme .chr_leave-calendar__item>a{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;cursor:pointer}#bootstrap-theme .chr_leave-calendar__item--half{height:50%}#bootstrap-theme .chr_leave-calendar__item--half:not(:first-child){height:calc(50% - 1px);margin-top:1px}#bootstrap-theme .chr_leave-calendar__item--more{border:2px solid #d3dee2}#bootstrap-theme .chr_leave-calendar__item--more .chr_leave-calendar__item__label{color:#4d4d69}#bootstrap-theme .chr_leave-calendar__item--disabled{cursor:not-allowed;opacity:0.5}#bootstrap-theme .chr_leave-calendar__item--type--late{background-color:#eca67e;border-color:#eca67e}#bootstrap-theme .chr_leave-calendar__item--alt{background-color:#fff !important;border:2px solid transparent;color:#464354}#bootstrap-theme .chr_leave-calendar__item--requested{background:repeating-linear-gradient(45deg, rgba(255,255,255,0.3), rgba(255,255,255,0.3) 5px, transparent 5px, transparent 7px)}#bootstrap-theme .chr_leave-calendar__item--requested.chr_leave-calendar__item--alt{background:repeating-linear-gradient(45deg, #fff, #fff 5px, transparent 5px, transparent 7px);background-color:#d3dee2 !important}#bootstrap-theme .chr_leave-calendar__items>td{height:35px;overflow:hidden}#bootstrap-theme .chr_leave-calendar__items .chr_leave-calendar__items_day-cell{padding:0 !important}#bootstrap-theme .chr_leave-calendar__items leave-calendar-day{display:block;height:100%}#bootstrap-theme .chr_leave-calendar__legend__title{font-size:12px}#bootstrap-theme .chr_leave-calendar__legend__header:not(:first-child){margin-top:20px}#bootstrap-theme .chr_leave-calendar__legend__type-badge,#bootstrap-theme .chr_leave-calendar__legend__other-badge-wrapper{float:left;line-height:24px;margin-top:10px;white-space:nowrap}#bootstrap-theme .chr_leave-calendar__legend__other-badge-wrapper{margin-right:20px}#bootstrap-theme .chr_leave-calendar__legend__type-badge,#bootstrap-theme .chr_leave-calendar__legend__other-badge{color:#4d4d69;height:24px}#bootstrap-theme .chr_leave-calendar__legend__type-badge{border-radius:2px;color:#fff;margin-right:10px;margin-top:10px;padding:0 8px}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-weekend{background-color:#c7cbd0}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-non-working-day{background-color:#41afcb}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-public-holiday{background-color:#8ec68a}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-generic-leave{background-color:#4d4d68}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-selected,#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-clickable:hover{border:solid 1px #fff;border-radius:4px;box-shadow:0 0 1px 0 #c7cbd0;height:26px;margin-bottom:-1px;margin-left:-2px;margin-right:9px;margin-top:9px;padding-left:9px}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-not-selected{opacity:0.4}#bootstrap-theme .chr_leave-calendar__legend__reset-absence-types-filter{color:#464354}#bootstrap-theme .chr_leave-calendar__legend__other-badge{border:solid 1px #d3dee2;border-radius:2px;float:left;font-size:12px;font-weight:600;margin-right:10px;text-align:center;width:24px}#bootstrap-theme .chr_leave-calendar__legend__other-badge.chr_leave-calendar__legend__other-badge-hours{font-size:6px;font-weight:400}#bootstrap-theme .chr_leave-calendar__legend__other-badge.chr_leave-calendar__legend__other-badge-requested{background:repeating-linear-gradient(45deg, rgba(255,255,255,0.6), rgba(255,255,255,0.6) 5px, transparent 5px, transparent 7px);background-color:#d3dee2 !important;border:0}#bootstrap-theme .chr_leave-calendar__month-container{margin:0}#bootstrap-theme .chr_leave-calendar__month-container>div{padding:0}#bootstrap-theme .chr_leave-calendar__month-header{background:#f3f6f7}#bootstrap-theme .chr_leave-calendar__month-header .panel-title{font-size:16px}#bootstrap-theme .chr_leave-calendar__month-header__go-to-current-month{text-transform:uppercase}#bootstrap-theme .chr_leave-calendar__month-header__go-to-current-month,#bootstrap-theme .chr_leave-calendar__month-header__month-paginator{margin-right:10px}#bootstrap-theme .chr_leave-calendar__month-header__month-paginator{color:#464354;padding-left:0;padding-right:0}#bootstrap-theme .chr_leave-calendar__name{font-size:12px !important;line-height:100%;padding:0 20px !important;text-align:left;text-overflow:ellipsis;width:100%}#bootstrap-theme .chr_leave-calendar__name_header,#bootstrap-theme .chr_leave-calendar__day{height:49px}#bootstrap-theme .chr_leave-calendar__name_header{padding-bottom:10px !important}#bootstrap-theme .chr_leave-calendar__name_cell{vertical-align:middle !important}#bootstrap-theme .chr_leave-calendar__names-container .chr_leave-calendar{table-layout:fixed}#bootstrap-theme .chr_leave-calendar__pagination{font-size:10px;text-align:center}#bootstrap-theme .chr_leave-calendar__pagination [class*='btn']{line-height:1em;outline:none;padding:0}#bootstrap-theme .chr_leave-calendar__pagination [class*='btn'] .fa{color:#555}#bootstrap-theme .chr_leave-calendar__pagination [class*='btn'][disabled] .fa{opacity:0.5}#bootstrap-theme .chr_leave-calendar__pagination [class*='btn']:hover:not([disabled]) .fa{color:#464354}#bootstrap-theme .chr_leave-calendar__pagination-next{border-top:0}#bootstrap-theme .chr_leave-calendar__pagination-next th{height:24px;padding:4px 0 6px !important}#bootstrap-theme .chr_leave-calendar__pagination-next .chr_leave-calendar__pagination{padding-right:3px !important}#bootstrap-theme .chr_leave-report .dropdown-toggle{color:#464354;padding:0 10px}#bootstrap-theme .chr_leave-report .dropdown-toggle:hover{background:#e6e6e6}#bootstrap-theme .chr_leave-report table{table-layout:fixed}#bootstrap-theme .chr_leave-report table thead th,#bootstrap-theme .chr_leave-report table tbody td{padding:8px 5px}#bootstrap-theme .chr_leave-report__label{color:#464354;font-weight:700}#bootstrap-theme .chr_leave-report__label>.fa{margin-right:5px}#bootstrap-theme .chr_leave-report__label--toggle{cursor:pointer;user-select:none}#bootstrap-theme .chr_leave-report__heading{background-color:#f3f6f7;border-bottom:1px solid #dadcde}#bootstrap-theme .chr_leave-report__heading .chr_leave-report__export-button{line-height:2.4}#bootstrap-theme .chr_leave-report__table table,#bootstrap-theme .chr_leave-report__table .table{border-collapse:separate}#bootstrap-theme .chr_leave-report__table table>tbody>tr:first-child>td,#bootstrap-theme .chr_leave-report__table .table>tbody>tr:first-child>td{border-top-width:0}#bootstrap-theme .chr_leave-report__table table>thead+tbody>tr:first-child>td,#bootstrap-theme .chr_leave-report__table .table>thead+tbody>tr:first-child>td{border-top-width:1px}#bootstrap-theme .chr_leave-report__table table:not(.table-bordered):not(.table-condensed)>tbody>tr:first-child>td,#bootstrap-theme .chr_leave-report__table .table:not(.table-bordered):not(.table-condensed)>tbody>tr:first-child>td{border-color:#f3f6f7}#bootstrap-theme .chr_leave-report__table table>thead>tr>th,#bootstrap-theme .chr_leave-report__table .table>thead>tr>th{background:#f3f6f7;border-bottom:0;color:#464354;text-transform:capitalize}#bootstrap-theme .chr_leave-report__table table>tbody>tr:first-child>td,#bootstrap-theme .chr_leave-report__table .table>tbody>tr:first-child>td{border-color:#e8eef0 !important}#bootstrap-theme .chr_leave-report__table table>tfoot>tr,#bootstrap-theme .chr_leave-report__table .table>tfoot>tr{background:#f3f6f7}#bootstrap-theme .chr_leave-report__table>table>thead>tr>th,#bootstrap-theme .chr_leave-report__table>.table>thead>tr>th{padding-bottom:13px;padding-top:13px}#bootstrap-theme .chr_leave-report__table-container{overflow:auto}#bootstrap-theme .chr_leave-report__table-container .panel{display:inline-block;min-width:100%}#bootstrap-theme .chr_leave-report__table__heading--action{width:45px}#bootstrap-theme .chr_leave-report__table__heading--label{width:280px}#bootstrap-theme .chr_leave-report__table__heading--dates{width:170px}#bootstrap-theme .chr_leave-report__table__heading--status{width:180px}#bootstrap-theme .chr_leave-report__table__heading--type{width:65px;word-break:break-word}#bootstrap-theme .chr_leave-request-comment{margin-top:10px}#bootstrap-theme .chr_leave-request-comment__text{border-bottom:1px solid #e8eef0;color:#c2cfd8;margin-right:10px;padding-bottom:20px}#bootstrap-theme .chr_leave-request-files_list{height:150px;overflow-y:auto;margin-top:20px;margin-bottom:20px}#bootstrap-theme .chr_leave-request-files_meta{margin-bottom:10px}#bootstrap-theme .chr_leave-request-files_upload{border:dashed 1px #464354;padding:20px}#bootstrap-theme .chr_leave-request-files_upload_action{padding:5px}#bootstrap-theme .chr_leave-request-files_file-name{display:inline-block;max-width:240px;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}#bootstrap-theme .chr_leave-request-files_delete{margin-top:-7px}#bootstrap-theme .chr_leave-request-modal .modal-title{font-size:18px !important}#bootstrap-theme .chr_leave-request-modal .table-responsive{border:0}#bootstrap-theme .chr_leave-request-modal .chr_leave-request-date-picker-container .input-group{width:100%}@media screen and (max-width: 767px){#bootstrap-theme .chr_leave-request-modal .chr_leave-request-date-picker-container{margin-bottom:10px}}#bootstrap-theme .chr_leave-request-modal__chevron{font-size:0.6em;margin-right:5px;vertical-align:middle}#bootstrap-theme .chr_leave-request-modal__comments{height:230px;margin-bottom:20px;overflow:auto}#bootstrap-theme .chr_leave-request-modal__comments_empty{margin-bottom:20px}#bootstrap-theme .chr_leave-request-modal__footer{margin:0}#bootstrap-theme .chr_leave-request-modal__delete{margin-left:15px;margin-top:8px}#bootstrap-theme .chr_leave-request-modal__form .ui-select-container{margin-bottom:20px}#bootstrap-theme .chr_leave-request-modal__form .ui-select-container ul{opacity:1 !important}#bootstrap-theme .chr_leave-request-modal__form .ui-select-container:not(.ui-select-multiple) input{width:100% !important}#bootstrap-theme .chr_leave-request-modal__form-group,#bootstrap-theme .chr_leave-request-modal__required-documents>div{margin-bottom:15px}#bootstrap-theme .chr_leave-request-modal__response{padding:20px 20px 0}#bootstrap-theme .chr_leave-request-modal__response label{font-size:17px;margin-top:-3px}#bootstrap-theme .chr_leave-request-modal__response .chr_wysiwyg{margin-top:15px}#bootstrap-theme .chr_leave-request-modal__required-documents input{margin-right:5px}#bootstrap-theme .chr_leave-request-modal__small_spinner>div.chr_spinner{margin-top:18px;min-height:initial}#bootstrap-theme .chr_leave-request-modal__tab input[uib-datepicker-popup]{font-size:13px}#bootstrap-theme .chr_leave-request-modal__table{border:1px solid #f3f6f7;margin-bottom:15px !important}#bootstrap-theme .chr_leave-request-modal__user-info{font-size:17px;padding:20px}#bootstrap-theme .chr_leave-request-modal__user-info>span:nth-child(1){color:#464354}#bootstrap-theme .chr_leave-request-modal__user-info>span:nth-child(2){color:#555}@media screen and (min-width: 480px){#bootstrap-theme .chr_leave-request-modal__user-info>span:nth-child(2){border-left:1px solid #e8eef0}}#bootstrap-theme .chr_leave-request-modal__span-expiry{display:inline-block;margin-top:7px}#bootstrap-theme .chr_leave-request-modal__expiry-clear{position:absolute;right:3.5em;top:0.6em;z-index:2}#bootstrap-theme .chr_leave-request-modal__small-text{font-size:80%}#bootstrap-theme .chr_leave-request-modal__custom-deduction-toggling-row{margin-top:-5px}@media screen and (min-width: 768px){#bootstrap-theme .chr_leave-request-modal__custom-deduction-label{text-align:right}}@media screen and (max-width: 767px){#bootstrap-theme .chr_leave-request-modal__custom-deduction-label{margin-bottom:10px}}#bootstrap-theme .chr_leave-request-modal .form-group{overflow:inherit !important}#bootstrap-theme .chr_leave-request-modal .alert{margin-bottom:0 !important}#bootstrap-theme .chr_leave-request-modal input[uib-datepicker-popup]{box-shadow:none !important;background-color:inherit !important;color:inherit !important;cursor:pointer !important;border-right:none}#bootstrap-theme leave-request-record-actions{display:block}#bootstrap-theme leave-request-record-actions .btn-group{float:left}#bootstrap-theme leave-request-record-actions .btn-group:first-child{margin-right:8px}#bootstrap-theme leave-request-record-actions .btn-group:first-child .dropdown-menu{left:auto;right:0}@media screen and (max-width: 767px){#bootstrap-theme leave-request-record-actions .btn-group{width:calc((100% - 8px) / 2)}#bootstrap-theme leave-request-record-actions .btn{padding-left:0;padding-right:0;width:100%}#bootstrap-theme leave-request-record-actions .btn-group:first-child .dropdown-menu{left:0;right:auto}}#bootstrap-theme .leave-widget h4{color:#4d4d69;font-size:13px;font-weight:normal;margin-bottom:0;padding-bottom:13px}#bootstrap-theme .leave-widget__types>table,#bootstrap-theme .leave-widget__sickness>table,#bootstrap-theme .leave-widget__next-leave>table{border:none}#bootstrap-theme .leave-widget__types>table thead tr th,#bootstrap-theme .leave-widget__sickness>table thead tr th,#bootstrap-theme .leave-widget__next-leave>table thead tr th{color:#4d4d69;font-size:13px;font-weight:normal;margin-bottom:0;padding-bottom:13px;background:none;width:35%}#bootstrap-theme .leave-widget__types>table thead tr th:first-child,#bootstrap-theme .leave-widget__sickness>table thead tr th:first-child,#bootstrap-theme .leave-widget__next-leave>table thead tr th:first-child{width:65%}#bootstrap-theme .leave-widget__types>table tbody tr td,#bootstrap-theme .leave-widget__sickness>table tbody tr td,#bootstrap-theme .leave-widget__next-leave>table tbody tr td{color:#0071bd;font-size:16px;font-weight:600;padding-bottom:9px}#bootstrap-theme .leave-widget__types>table tbody tr td:first-child,#bootstrap-theme .leave-widget__sickness>table tbody tr td:first-child,#bootstrap-theme .leave-widget__next-leave>table tbody tr td:first-child{color:#464354}#bootstrap-theme .leave-widget hr{border-color:#DEE4ED;margin-bottom:25px;margin-top:25px}#bootstrap-theme .leave-widget__sickness h4{margin-top:18px}#bootstrap-theme .leave-widget__next-leave h3{font-size:16px;margin-bottom:16px;margin-top:0}#bootstrap-theme .leave-widget__next-leave__deduction{font-size:16px;font-weight:600;color:#464354}#bootstrap-theme .chr_leave__page-selector-dropdown{margin-bottom:20px;margin-right:5px;position:relative;top:1px;width:100%}#bootstrap-theme .chr_leave__page-selector-dropdown select{height:40px}#bootstrap-theme .chr_leave__page-selector-dropdown .crm_custom-select__arrow{line-height:40px;width:40px}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header{padding-left:10px;padding-right:10px;background-color:#f7f7f9;border-bottom:1px solid #dadcde;margin:0}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header>*{padding-left:10px !important;padding-right:10px !important}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header .panel-title{margin-top:7px;display:inline-block}@media screen and (max-width: 992px){#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header>div:not(:last-child),#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header .panel-title{padding-bottom:20px}}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__filter{display:inline-block;margin-top:7px;white-space:nowrap}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__filter .fa{font-size:0.6em;margin-right:5px;margin-top:-2px;vertical-align:middle}@media screen and (max-width: 991px){#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__filter{margin-top:15px}}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header{padding-left:10px;padding-right:10px;background-color:#f7f7f9;border-bottom:1px solid #dadcde;margin:0;padding-top:15px}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header>*{padding-left:10px !important;padding-right:10px !important}@media screen and (max-width: 1199px){#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header>div:not(:last-child){padding-bottom:20px}}@media screen and (min-width: 992px) and (max-width: 1199px){#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header>.no_gutter{padding-bottom:0 !important}}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__panel_body{margin:0;padding:0}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__panel_body [class^="col-"],#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__panel_body [class*=" col-"]{padding:0}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__panel_body a{cursor:pointer}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__status_container{padding-left:10px;padding-right:10px;background-color:#f7f7f9}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__status_container>*{padding-left:10px !important;padding-right:10px !important}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__status_container>div{padding-left:15px;padding-right:15px}#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] .form-group{overflow:inherit !important}#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] .panel{background-image:none !important}#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] .panel-body,#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] .chr_vertical_tabs{background-color:#f7f7f9}#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] input[type="search"]{width:100% !important}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header .checkbox{margin-top:5px}#bootstrap-theme .page-manager-leave .chr_manage_leave_requests .btn-sm{font-size:100% !important}#bootstrap-theme .chr_manager_calendar__header{padding-left:10px;padding-right:10px;padding-top:15px;margin:0;background-color:#f7f7f9;border-bottom:1px solid #dadcde}#bootstrap-theme .chr_manager_calendar__header>*{padding-left:10px !important;padding-right:10px !important}#bootstrap-theme .chr_manager_calendar__header .checkbox{margin:0}@media screen and (max-width: 1199px){#bootstrap-theme .chr_manager_calendar__header>div:not(:last-child){padding-bottom:20px}}#bootstrap-theme .chr_manager_calendar__sub-header{padding-left:10px;padding-right:10px;background-color:#f7f7f9;margin:0}#bootstrap-theme .chr_manager_calendar__sub-header>*{padding-left:10px !important;padding-right:10px !important}@media screen and (max-width: 1199px){#bootstrap-theme .chr_manager_calendar__sub-header>div:not(:last-child){padding-bottom:20px}#bootstrap-theme .chr_manager_calendar__sub-header .ui-select-container{height:auto}}#bootstrap-theme .chr_leave-calendar__day-tooltip.tooltip.in{opacity:1}#bootstrap-theme .chr_leave-calendar__day-tooltip .tooltip-arrow{border-top-color:#fff !important}#bootstrap-theme .chr_leave-calendar__day-tooltip .tooltip-inner{background-color:#fff;border-radius:0;box-shadow:0 3px 8px 0 rgba(49,40,40,0.25);color:#464354;padding:0}#bootstrap-theme .chr_leave-calendar__day-tooltip__item{cursor:pointer;font-size:11px;min-width:154px;padding:8px}#bootstrap-theme .chr_leave-calendar__day-tooltip__item:hover{background-color:#e8eef0}#bootstrap-theme .chr_leave-calendar__day-tooltip__item_absence-type{font-size:13px}#bootstrap-theme .chr_leave-calendar__day-tooltip__item_request-status{color:#9494a5;margin-bottom:2px}#bootstrap-theme .time-amount-picker .crm_custom-select{display:inline-block;margin-right:2px}#bootstrap-theme .time-amount-picker .crm_custom-select:nth-child(2){margin-left:10px}#bootstrap-theme .absence-tab-page .tab-pane{padding:0 !important}#bootstrap-theme .absence-tab-page .tab-content{background-color:transparent !important}#bootstrap-theme .absence-tab-page leave-request-record-actions{margin-bottom:20px}#bootstrap-theme .crm-absence_type-form-block .crm-section .label{width:35%}#bootstrap-theme .crm-absence_type-form-block .crm-section .content{margin-left:40%}#bootstrap-theme .crm-absence_type-form-block .toil-option,#bootstrap-theme .crm-absence_type-form-block .carry-forward-option,#bootstrap-theme .crm-absence_type-form-block .toil-expiration,#bootstrap-theme .crm-absence_type-form-block .carry-forward-expiration-duration,#bootstrap-theme .crm-absence_type-form-block .carry-forward-expiration-date{display:none}#bootstrap-theme .crm-absence_type-form-block .sp-replacer{padding:2px}#bootstrap-theme .crm-absence_type-form-block .sp-preview{height:15px;width:15px}#bootstrap-theme .crm-absence_type-form-block .sp-dd{height:0;line-height:15px;font-size:9px}.page-civicrm-leaveandabsences-dashboard .page-title,.page-civicrm-leaveandabsences-dashboard #branding{display:none !important}.page-civicrm-leaveandabsences-dashboard #page{margin:0;padding:0}.admin-dashboard-page{position:relative}.admin-dashboard-page .crm_page__topbar{height:65px;padding:12px 16px}.admin-dashboard-page .chr_admin-dashboard_side-nav{background-color:#fff;height:calc(100% - 12px);overflow:hidden;position:absolute;width:170px}.admin-dashboard-page .chr_admin-dashboard_side-nav .active{background:#e8eef0}.admin-dashboard-page .chr_admin-dashboard_content{float:right;margin:16px;margin-bottom:0;width:calc(100% - 170px - 16px * 2)}#bootstrap-theme #calculation-details{background:#fff}#bootstrap-theme #calculation-details .base-contractual-entitlement{color:#0071bd}#bootstrap-theme #calculation-details .working-days-to-work{color:#44cb7e}#bootstrap-theme #calculation-details .working-days-in-period{color:#e6ab5e}#bootstrap-theme #calculation-details .contract-1-pro-rata{color:#E6807F}#bootstrap-theme #calculation-details .contract-2-pro-rata{color:#797300}#bootstrap-theme #calculation-details .contract-3-pro-rata{color:#904E1E}#bootstrap-theme #calculation-details .contract-4-pro-rata{color:#0511B1}#bootstrap-theme #calculation-details .contract-5-pro-rata{color:#4B9609}#bootstrap-theme #calculation-details .calculation-pro-rata{color:#95c0ff}#bootstrap-theme .crm-leave-and-absences-form-block .panel-body{padding-top:20px;padding-bottom:20px}#bootstrap-theme .crm-leave-and-absences-form-block .panel-body .row:first-child h3{margin-top:0}#bootstrap-theme .crm-leave-and-absences-form-block .panel-body h3{margin-bottom:20px}#bootstrap-theme .crm-leave-and-absences-form-block .panel-footer .crm-button:last-child{margin-right:0}#bootstrap-theme.crm-leave-and-balance-import .panel{background-color:#fff}#bootstrap-theme.crm-leave-and-balance-import .panel-header{position:relative}#bootstrap-theme.crm-leave-and-balance-import .panel-header h2{padding:10px 20px}#bootstrap-theme.crm-leave-and-balance-import .panel-body .row:not(:last-child){padding-bottom:2em}#bootstrap-theme.crm-leave-and-balance-import .table.date-formats .label{display:none}#bootstrap-theme.crm-leave-and-balance-import .table.date-formats label{font-weight:normal !important}#bootstrap-theme.crm-leave-and-balance-import .table.date-formats td{border:0;padding:0}#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block{box-shadow:none;padding:0}#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block #map-field table{margin-bottom:2em;width:100%}#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block #map-field table th{padding:10px 20px;border-right:none}#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block #map-field table th,#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block #map-field table td{padding:5px}#bootstrap-theme.crm-leave-and-balance-import #preview-counts,#bootstrap-theme.crm-leave-and-balance-import #summary-counts{box-shadow:none;margin-bottom:2em;width:100%}#bootstrap-theme.crm-leave-and-balance-import #preview-counts tr.danger td,#bootstrap-theme.crm-leave-and-balance-import #summary-counts tr.danger td{background-color:#f2dede !important;color:#cf3458}#bootstrap-theme.crm-leave-and-balance-import #preview-counts tr.danger td a,#bootstrap-theme.crm-leave-and-balance-import #summary-counts tr.danger td a{color:#bd2d4e;font-weight:bold}#bootstrap-theme.crm-leave-and-balance-import #preview-counts tr.danger td a:hover,#bootstrap-theme.crm-leave-and-balance-import #summary-counts tr.danger td a:hover{color:#0062a4}#bootstrap-theme.manage-entitlements-form .wider-hr{margin-left:-20px;margin-right:-20px;border-width:2px}#bootstrap-theme.manage-entitlements-form .wider-row{margin-left:-20px;margin-right:-20px}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters{padding:15px 0;text-align:center}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters .override-filters label{display:inline-block}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters .override-filters label:before{display:none}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters .absence-type-filter{margin-right:10px}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters .col-sm-4:last-child{text-align:right}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list{margin-bottom:0}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .proposed-entitlement-header .title{float:left;width:65%}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .proposed-entitlement-header .actions{float:right}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list tr.hidden{display:none}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .absence-type{color:#fff;display:inline-block;padding:5px}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .proposed-entitlement .overridden-proposed-entitlement,#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .proposed-entitlement .calculation-unit{display:none}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .borderless-button{background-color:transparent;border:0;cursor:pointer}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .add-comment{font-size:1.1em}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .comment-text{display:none}#bootstrap-theme.manage-entitlements-form .manage-entitlements-form__filters{padding-bottom:1em}#bootstrap-theme.manage-entitlements-form .table{background:#f9f9f9;border-top:1px solid #e8eef0;border-bottom:1px solid #e8eef0;margin-bottom:2em}#bootstrap-theme.manage-entitlements-form .table th{background:#f3f6f7 !important}#bootstrap-theme.manage-entitlements-form .table th.proposed-entitlement-header{border-left:1px solid #e8eef0;border-right:1px solid #e8eef0;background:#e4ebed !important;min-width:200px}#bootstrap-theme.manage-entitlements-form .table th.proposed-entitlement-header .row>div{display:table-cell;float:none;vertical-align:bottom}#bootstrap-theme.manage-entitlements-form .table th.proposed-entitlement-header .fa{color:#4d4d69}#bootstrap-theme.manage-entitlements-form .table th.proposed-entitlement-header .action-button-container{padding:0}#bootstrap-theme.manage-entitlements-form .table td.proposed-entitlement{border-left:1px solid #e8eef0;border-right:1px solid #e8eef0;background:white}#bootstrap-theme.manage-entitlements-form .table span.absence-type{border-radius:3px;padding:0 5px}#bootstrap-theme.manage-entitlements-form .table tbody .fa{color:#0071bd}#bootstrap-theme.manage-entitlements-form .crm-container .CRM_HRLeaveAndAbsences_Form_ManageEntitlements .crm-button-type-next{float:right !important}#bootstrap-theme.manage-entitlements-form .panel-footer{border-top:none}#add-comment-dialog{display:none}#add-comment-dialog .calculation_comment{box-sizing:border-box;padding:10px;width:100%}#bootstrap-theme .crm-work-pattern-form-block .ui-tabs.ui-widget-content{background:none}#bootstrap-theme .work-pattern-calendar .number-of-weeks{padding:15px 0 15px 0}#bootstrap-theme .work-pattern-calendar .work-pattern-week{border-top:1px solid rgba(0,0,0,0.2);padding:15px 0 15px 0;margin-bottom:15px}#bootstrap-theme .work-pattern-calendar .work-pattern-week.hidden-week{display:none}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-number{float:left;font-weight:bold;padding:5px 0 15px 5px}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-days{table-layout:fixed}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-hours{float:right;padding:5px 5px 15px 0}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-hours .number-of-hours{font-weight:bold}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-days td{padding:5px 10px 5px 10px}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-days input{min-width:0;text-align:center}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-days select{min-width:0;width:100% !important}#bootstrap-theme .work-pattern-calendar .work-pattern-week .hours-row td{padding-top:15px;padding-bottom:15px;border-top:1px solid rgba(0,0,0,0.2);border-bottom:1px solid rgba(0,0,0,0.2)}.chr_leave-calendar__day-tooltip.tooltip.in{opacity:1}.chr_leave-calendar__day-tooltip .tooltip-arrow{border-top-color:#fff !important}.chr_leave-calendar__day-tooltip .tooltip-inner{background-color:#fff;border-radius:0;box-shadow:0 3px 8px 0 rgba(49,40,40,0.25);color:#464354;padding:0}.chr_leave-calendar__day-tooltip__item{cursor:pointer;font-size:11px;min-width:154px;padding:8px}.chr_leave-calendar__day-tooltip__item:hover{background-color:#e8eef0}.chr_leave-calendar__day-tooltip__item_absence-type{font-size:13px}.chr_leave-calendar__day-tooltip__item_request-status{color:#9494a5;margin-bottom:2px}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid \9;border-right:4px solid transparent;border-left:4px solid transparent}.dropup,.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:13px;text-align:left;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);border-radius:2px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.5384615385;color:#4d4d69;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{text-decoration:none;color:#42425a;background-color:#f3f6f7}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;outline:0;background-color:#0071bd}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#e8eef0}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{left:auto;right:0}.dropdown-menu-left{left:0;right:auto}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.5384615385;color:#464354;white-space:nowrap}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px dashed;border-bottom:4px solid \9;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width: 768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{left:0;right:auto}}.dropdown-header{padding:7px 19px 7px 24px}.dropdown-menu{-webkit-box-shadow:0 3px 18px 0 rgba(48,40,40,0.25);box-shadow:0 3px 18px 0 rgba(48,40,40,0.25);border:0;margin:0;padding:4px 0 9px 0}.dropdown-menu>li{border:0;margin:0;padding:0}.dropdown-menu>li>a{padding:7px 19px 7px 24px}.dropdown-menu .divider{margin:7px 0} +.sp-container{position:absolute;top:0;left:0;display:inline-block;*display:inline;*zoom:1;z-index:9999994;overflow:hidden}.sp-container.sp-flat{position:relative}.sp-container,.sp-container *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.sp-top{position:relative;width:100%;display:inline-block}.sp-top-inner{position:absolute;top:0;left:0;bottom:0;right:0}.sp-color{position:absolute;top:0;left:0;bottom:0;right:20%}.sp-hue{position:absolute;top:0;right:0;bottom:0;left:84%;height:100%}.sp-clear-enabled .sp-hue{top:33px;height:77.5%}.sp-fill{padding-top:80%}.sp-sat,.sp-val{position:absolute;top:0;left:0;right:0;bottom:0}.sp-alpha-enabled .sp-top{margin-bottom:18px}.sp-alpha-enabled .sp-alpha{display:block}.sp-alpha-handle{position:absolute;top:-4px;bottom:-4px;width:6px;left:50%;cursor:pointer;border:1px solid black;background:white;opacity:.8}.sp-alpha{display:none;position:absolute;bottom:-14px;right:0;left:0;height:8px}.sp-alpha-inner{border:solid 1px #333}.sp-clear{display:none}.sp-clear.sp-clear-display{background-position:center}.sp-clear-enabled .sp-clear{display:block;position:absolute;top:0px;right:0;bottom:0;left:84%;height:28px}.sp-container,.sp-replacer,.sp-preview,.sp-dragger,.sp-slider,.sp-alpha,.sp-clear,.sp-alpha-handle,.sp-container.sp-dragging .sp-input,.sp-container button{-webkit-user-select:none;-moz-user-select:-moz-none;-o-user-select:none;user-select:none}.sp-container.sp-input-disabled .sp-input-container{display:none}.sp-container.sp-buttons-disabled .sp-button-container{display:none}.sp-container.sp-palette-buttons-disabled .sp-palette-button-container{display:none}.sp-palette-only .sp-picker-container{display:none}.sp-palette-disabled .sp-palette-container{display:none}.sp-initial-disabled .sp-initial{display:none}.sp-sat{background-image:-webkit-gradient(linear, 0 0, 100% 0, from(#fff), to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-moz-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-o-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:-ms-linear-gradient(left, #fff, rgba(204,154,129,0));background-image:linear-gradient(to right, #fff, rgba(204,154,129,0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";filter:progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81')}.sp-val{background-image:-webkit-gradient(linear, 0 100%, 0 0, from(#000), to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-moz-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-o-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:-ms-linear-gradient(bottom, #000, rgba(204,154,129,0));background-image:linear-gradient(to top, #000, rgba(204,154,129,0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000')}.sp-hue{background:-moz-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-ms-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-o-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-webkit-gradient(linear, left top, left bottom, from(red), color-stop(0.17, #ff0), color-stop(0.33, lime), color-stop(0.5, cyan), color-stop(0.67, blue), color-stop(0.83, #f0f), to(red));background:-webkit-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:linear-gradient(to bottom, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%)}.sp-1{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00')}.sp-2{height:16%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00')}.sp-3{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff')}.sp-4{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff')}.sp-5{height:16%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff')}.sp-6{height:17%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000')}.sp-hidden{display:none !important}.sp-cf:before,.sp-cf:after{content:"";display:table}.sp-cf:after{clear:both}.sp-cf{*zoom:1}@media (max-device-width: 480px){.sp-color{right:40%}.sp-hue{left:63%}.sp-fill{padding-top:60%}}.sp-dragger{border-radius:5px;height:5px;width:5px;border:1px solid #fff;background:#000;cursor:pointer;position:absolute;top:0;left:0}.sp-slider{position:absolute;top:0;cursor:pointer;height:3px;left:-1px;right:-1px;border:1px solid #000;background:white;opacity:.8}.sp-container{border-radius:0;background-color:#ECECEC;border:solid 1px #f0c49B;padding:0}.sp-container,.sp-container button,.sp-container input,.sp-color,.sp-hue,.sp-clear{font:normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.sp-top{margin-bottom:3px}.sp-color,.sp-hue,.sp-clear{border:solid 1px #666}.sp-input-container{float:right;width:100px;margin-bottom:4px}.sp-initial-disabled .sp-input-container{width:100%}.sp-input{font-size:12px !important;border:1px inset;padding:4px 5px;margin:0;width:100%;background:transparent;border-radius:3px;color:#222}.sp-input:focus{border:1px solid orange}.sp-input.sp-validation-error{border:1px solid red;background:#fdd}.sp-picker-container,.sp-palette-container{float:left;position:relative;padding:10px;padding-bottom:300px;margin-bottom:-290px}.sp-picker-container{width:172px;border-left:solid 1px #fff}.sp-palette-container{border-right:solid 1px #ccc}.sp-palette-only .sp-palette-container{border:0}.sp-palette .sp-thumb-el{display:block;position:relative;float:left;width:24px;height:15px;margin:3px;cursor:pointer;border:solid 2px transparent}.sp-palette .sp-thumb-el:hover,.sp-palette .sp-thumb-el.sp-thumb-active{border-color:orange}.sp-thumb-el{position:relative}.sp-initial{float:left;border:solid 1px #333}.sp-initial span{width:30px;height:25px;border:none;display:block;float:left;margin:0}.sp-initial .sp-clear-display{background-position:center}.sp-palette-button-container,.sp-button-container{float:right}.sp-replacer{margin:0;overflow:hidden;cursor:pointer;padding:4px;display:inline-block;*zoom:1;*display:inline;border:solid 1px #91765d;background:#eee;color:#333;vertical-align:middle}.sp-replacer:hover,.sp-replacer.sp-active{border-color:#F0C49B;color:#111}.sp-replacer.sp-disabled{cursor:default;border-color:silver;color:silver}.sp-dd{padding:2px 0;height:16px;line-height:16px;float:left;font-size:10px}.sp-preview{position:relative;width:25px;height:20px;border:solid 1px #222;margin-right:5px;float:left;z-index:0}.sp-palette{*width:220px;max-width:220px}.sp-palette .sp-thumb-el{width:16px;height:16px;margin:2px 1px;border:solid 1px #d0d0d0}.sp-container{padding-bottom:0}.sp-container button{background-color:#eeeeee;background-image:-webkit-linear-gradient(top, #eee, #ccc);background-image:-moz-linear-gradient(top, #eee, #ccc);background-image:-ms-linear-gradient(top, #eee, #ccc);background-image:-o-linear-gradient(top, #eee, #ccc);background-image:linear-gradient(to bottom, #eee, #ccc);border:1px solid #ccc;border-bottom:1px solid #bbb;border-radius:3px;color:#333;font-size:14px;line-height:1;padding:5px 4px;text-align:center;text-shadow:0 1px 0 #eee;vertical-align:middle}.sp-container button:hover{background-color:#dddddd;background-image:-webkit-linear-gradient(top, #ddd, #bbb);background-image:-moz-linear-gradient(top, #ddd, #bbb);background-image:-ms-linear-gradient(top, #ddd, #bbb);background-image:-o-linear-gradient(top, #ddd, #bbb);background-image:linear-gradient(to bottom, #ddd, #bbb);border:1px solid #bbb;border-bottom:1px solid #999;cursor:pointer;text-shadow:0 1px 0 #ddd}.sp-container button:active{border:1px solid #aaa;border-bottom:1px solid #888;-webkit-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-moz-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-ms-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;-o-box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;box-shadow:inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee}.sp-cancel{font-size:11px;color:#d93f3f !important;margin:0;padding:2px;margin-right:5px;vertical-align:middle;text-decoration:none}.sp-cancel:hover{color:#d93f3f !important;text-decoration:underline}.sp-palette span:hover,.sp-palette span.sp-thumb-active{border-color:#000}.sp-preview,.sp-alpha,.sp-thumb-el{position:relative;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.sp-preview-inner,.sp-alpha-inner,.sp-thumb-inner{display:block;position:absolute;top:0;left:0;bottom:0;right:0}.sp-palette .sp-thumb-inner{background-position:50% 50%;background-repeat:no-repeat}.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=)}.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=)}.sp-clear-display{background-repeat:no-repeat;background-position:center;background-image:url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==)}#bootstrap-theme .chr_disabled{opacity:0.5;pointer-events:none}#bootstrap-theme .table-condensed>thead>tr>th{background:#fff !important;padding:8px 5px}#bootstrap-theme .table-condensed-mixed>thead>tr>th,#bootstrap-theme .table-condensed-mixed>thead>tr>td,#bootstrap-theme .table-condensed-mixed>tbody>tr>th,#bootstrap-theme .table-condensed-mixed>tbody>tr>td{padding-left:5px;padding-right:5px}#bootstrap-theme .table-condensed>tbody>tr>td:first-child,#bootstrap-theme .table-condensed>tbody>tr>th:first-child,#bootstrap-theme .table-condensed>thead>tr>td:first-child,#bootstrap-theme .table-condensed>thead>tr>th:first-child,#bootstrap-theme .table-condensed-mixed>tbody>tr>td:first-child,#bootstrap-theme .table-condensed-mixed>tbody>tr>th:first-child,#bootstrap-theme .table-condensed-mixed>thead>tr>td:first-child,#bootstrap-theme .table-condensed-mixed>thead>tr>th:first-child{padding-left:20px}#bootstrap-theme .table-condensed>tbody>tr>td:last-child,#bootstrap-theme .table-condensed>tbody>tr>th:last-child,#bootstrap-theme .table-condensed>thead>tr>td:last-child,#bootstrap-theme .table-condensed>thead>tr>th:last-child,#bootstrap-theme .table-condensed-mixed>tbody>tr>td:last-child,#bootstrap-theme .table-condensed-mixed>tbody>tr>th:last-child,#bootstrap-theme .table-condensed-mixed>thead>tr>td:last-child,#bootstrap-theme .table-condensed-mixed>thead>tr>th:last-child{padding-right:20px}#bootstrap-theme .table-nested{overflow-y:hidden;position:relative}#bootstrap-theme .table-nested:before{box-shadow:inset 0px 6px 9px -6px rgba(0,0,0,0.2);content:'';display:block;height:10px;left:0;position:absolute;top:0;width:100%;z-index:10}#bootstrap-theme .table-nested:after{box-shadow:inset 0px -4px 9px -6px rgba(0,0,0,0.2);content:'';display:block;height:10px;left:0;position:absolute;bottom:0;width:100%;z-index:10}#bootstrap-theme .table-nested>table,#bootstrap-theme .table-nested>.table{background-color:#fff}#bootstrap-theme .table-nested>table>tbody>tr>td:first-child,#bootstrap-theme .table-nested>table>tbody>tr>th:first-child,#bootstrap-theme .table-nested>table>thead>tr>td:first-child,#bootstrap-theme .table-nested>table>thead>tr>th:first-child,#bootstrap-theme .table-nested>.table>tbody>tr>td:first-child,#bootstrap-theme .table-nested>.table>tbody>tr>th:first-child,#bootstrap-theme .table-nested>.table>thead>tr>td:first-child,#bootstrap-theme .table-nested>.table>thead>tr>th:first-child{padding-left:30px;position:relative}#bootstrap-theme .table-nested>table>tbody>tr>td:first-child:before,#bootstrap-theme .table-nested>table>tbody>tr>th:first-child:before,#bootstrap-theme .table-nested>table>thead>tr>td:first-child:before,#bootstrap-theme .table-nested>table>thead>tr>th:first-child:before,#bootstrap-theme .table-nested>.table>tbody>tr>td:first-child:before,#bootstrap-theme .table-nested>.table>tbody>tr>th:first-child:before,#bootstrap-theme .table-nested>.table>thead>tr>td:first-child:before,#bootstrap-theme .table-nested>.table>thead>tr>th:first-child:before{background:#c2cfd8;content:'';display:block;height:110%;left:0;position:absolute;top:0;width:10px;z-index:2}#bootstrap-theme .table-nested>table>tbody>tr>td:last-child,#bootstrap-theme .table-nested>table>tbody>tr>th:last-child,#bootstrap-theme .table-nested>table>thead>tr>td:last-child,#bootstrap-theme .table-nested>table>thead>tr>th:last-child,#bootstrap-theme .table-nested>.table>tbody>tr>td:last-child,#bootstrap-theme .table-nested>.table>tbody>tr>th:last-child,#bootstrap-theme .table-nested>.table>thead>tr>td:last-child,#bootstrap-theme .table-nested>.table>thead>tr>th:last-child{padding-right:30px;position:relative}#bootstrap-theme .table-nested>table>tbody>tr>td:last-child:after,#bootstrap-theme .table-nested>table>tbody>tr>th:last-child:after,#bootstrap-theme .table-nested>table>thead>tr>td:last-child:after,#bootstrap-theme .table-nested>table>thead>tr>th:last-child:after,#bootstrap-theme .table-nested>.table>tbody>tr>td:last-child:after,#bootstrap-theme .table-nested>.table>tbody>tr>th:last-child:after,#bootstrap-theme .table-nested>.table>thead>tr>td:last-child:after,#bootstrap-theme .table-nested>.table>thead>tr>th:last-child:after{background:#c2cfd8;content:'';display:block;height:110%;right:0;position:absolute;top:0;width:10px;z-index:2}@media screen and (max-width: 767px){#bootstrap-theme .table-nested.table-responsive{border:0;margin-bottom:0}}#bootstrap-theme .table-nested-cell{padding:0 !important}#bootstrap-theme .chr_absence-work-pattern__add-custom{margin-bottom:20px}#bootstrap-theme .chr_absence-work-pattern__custom-work-pattern td:nth-child(1){width:40%}#bootstrap-theme .chr_absence-work-pattern__custom-work-pattern td:nth-child(2){width:15%}#bootstrap-theme .chr_absence-work-pattern__custom-work-pattern td:nth-child(3){width:35%}#bootstrap-theme .chr_absence-work-pattern__custom-work-pattern td:nth-child(4){width:10%}#bootstrap-theme .chr_absence-work-pattern__work-pattern-listing{display:inline-block}#bootstrap-theme .chr_absence-work-pattern__alert{margin-bottom:0 !important}#bootstrap-theme .annual-entitlement-change-log-component thead td{min-width:100px}#bootstrap-theme .annual-entitlement-change-log-component thead .annual-entitlement-change-log-component__comments{min-width:300px}#bootstrap-theme .chr_annual-entitlements__period{width:130px}#bootstrap-theme .chr_annual-entitlements__edit-entitlements{width:150px}@media screen and (max-width: 767px){#bootstrap-theme calendar-feeds-dropdown-button{margin-top:8px}#bootstrap-theme calendar-feeds-dropdown-button,#bootstrap-theme calendar-feeds-dropdown-button .btn-group,#bootstrap-theme calendar-feeds-dropdown-button .btn{width:100%}}#bootstrap-theme .chr_contract-entitlements__position{width:140px}@media (max-width: 992px){#bootstrap-theme .chr_leave-balance-tab .chr_leave-balance-tab__filter:not(:last-child){padding-bottom:15px}}#bootstrap-theme .chr_leave-balance-tab__body{padding:0}#bootstrap-theme .chr_leave-calendar__admin-filters-hint{display:inline-block;font-size:20px;vertical-align:middle}#bootstrap-theme .chr_leave-calendar__admin-filters-select{display:inline-block;margin-right:20px;width:calc(100% - 50px)}#bootstrap-theme .chr_leave-calendar__dates-container{overflow-x:auto}@media (min-width: 1200px){#bootstrap-theme .chr_leave-calendar__dates-container .chr_leave-calendar{table-layout:fixed}}#bootstrap-theme .chr_leave-calendar__day{font-size:10px !important;line-height:1.4em !important;padding:10px !important;text-align:center !important}@media (min-width: 1200px){#bootstrap-theme .chr_leave-calendar__day{padding:10px 0 !important}}#bootstrap-theme .chr_leave-calendar__day--disabled{opacity:0.5}#bootstrap-theme .chr_leave-calendar__day--current{color:#0071bd !important}#bootstrap-theme .chr_leave-calendar__day-container--type--non-working{background-color:#41afcb}#bootstrap-theme .chr_leave-calendar__day-container--type--public-holiday{background-color:#8ec68a}#bootstrap-theme .chr_leave-calendar__day-container--type--weekend{background-color:#c7cbd0}#bootstrap-theme .chr_leave-calendar__day-container{height:100%}#bootstrap-theme .chr_leave-calendar__item{color:#fff;display:block;font-size:10px;height:100%;position:relative;text-align:center;text-transform:uppercase;width:100%}#bootstrap-theme .chr_leave-calendar__item>span{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;height:1.2em}#bootstrap-theme .chr_leave-calendar__item>.chr_leave-calendar__time-unit{font-size:7px;height:1em;margin-left:-1px}#bootstrap-theme .chr_leave-calendar__item>a{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;cursor:pointer}#bootstrap-theme .chr_leave-calendar__item--half{height:50%}#bootstrap-theme .chr_leave-calendar__item--half:not(:first-child){height:calc(50% - 1px);margin-top:1px}#bootstrap-theme .chr_leave-calendar__item--more{border:2px solid #d3dee2}#bootstrap-theme .chr_leave-calendar__item--more .chr_leave-calendar__item__label{color:#4d4d69}#bootstrap-theme .chr_leave-calendar__item--disabled{cursor:not-allowed;opacity:0.5}#bootstrap-theme .chr_leave-calendar__item--type--late{background-color:#eca67e;border-color:#eca67e}#bootstrap-theme .chr_leave-calendar__item--alt{background-color:#fff !important;border:2px solid transparent;color:#464354}#bootstrap-theme .chr_leave-calendar__item--requested{background:repeating-linear-gradient(45deg, rgba(255,255,255,0.3), rgba(255,255,255,0.3) 5px, transparent 5px, transparent 7px)}#bootstrap-theme .chr_leave-calendar__item--requested.chr_leave-calendar__item--alt{background:repeating-linear-gradient(45deg, #fff, #fff 5px, transparent 5px, transparent 7px);background-color:#d3dee2 !important}#bootstrap-theme .chr_leave-calendar__items>td{height:35px;overflow:hidden}#bootstrap-theme .chr_leave-calendar__items .chr_leave-calendar__items_day-cell{padding:0 !important}#bootstrap-theme .chr_leave-calendar__items leave-calendar-day{display:block;height:100%}#bootstrap-theme .chr_leave-calendar__legend__title{font-size:12px}#bootstrap-theme .chr_leave-calendar__legend__header:not(:first-child){margin-top:20px}#bootstrap-theme .chr_leave-calendar__legend__type-badge,#bootstrap-theme .chr_leave-calendar__legend__other-badge-wrapper{float:left;line-height:24px;margin-top:10px;white-space:nowrap}#bootstrap-theme .chr_leave-calendar__legend__other-badge-wrapper{margin-right:20px}#bootstrap-theme .chr_leave-calendar__legend__type-badge,#bootstrap-theme .chr_leave-calendar__legend__other-badge{color:#4d4d69;height:24px}#bootstrap-theme .chr_leave-calendar__legend__type-badge{border-radius:2px;color:#fff;margin-right:10px;margin-top:10px;padding:0 8px}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-weekend{background-color:#c7cbd0}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-non-working-day{background-color:#41afcb}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-public-holiday{background-color:#8ec68a}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-generic-leave{background-color:#4d4d68}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-selected,#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-clickable:hover{border:solid 1px #fff;border-radius:4px;box-shadow:0 0 1px 0 #c7cbd0;height:26px;margin-bottom:-1px;margin-left:-2px;margin-right:9px;margin-top:9px;padding-left:9px}#bootstrap-theme .chr_leave-calendar__legend__type-badge.chr_leave-calendar__legend__type-badge-not-selected{opacity:0.4}#bootstrap-theme .chr_leave-calendar__legend__reset-absence-types-filter{color:#464354}#bootstrap-theme .chr_leave-calendar__legend__other-badge{border:solid 1px #d3dee2;border-radius:2px;float:left;font-size:12px;font-weight:600;margin-right:10px;text-align:center;width:24px}#bootstrap-theme .chr_leave-calendar__legend__other-badge.chr_leave-calendar__legend__other-badge-hours{font-size:6px;font-weight:400}#bootstrap-theme .chr_leave-calendar__legend__other-badge.chr_leave-calendar__legend__other-badge-requested{background:repeating-linear-gradient(45deg, rgba(255,255,255,0.6), rgba(255,255,255,0.6) 5px, transparent 5px, transparent 7px);background-color:#d3dee2 !important;border:0}#bootstrap-theme .chr_leave-calendar__month-container{margin:0}#bootstrap-theme .chr_leave-calendar__month-container>div{padding:0}#bootstrap-theme .chr_leave-calendar__month-header{background:#f3f6f7}#bootstrap-theme .chr_leave-calendar__month-header .panel-title{font-size:16px}#bootstrap-theme .chr_leave-calendar__month-header__go-to-current-month{text-transform:uppercase}#bootstrap-theme .chr_leave-calendar__month-header__go-to-current-month,#bootstrap-theme .chr_leave-calendar__month-header__month-paginator{margin-right:10px}#bootstrap-theme .chr_leave-calendar__month-header__month-paginator{color:#464354;padding-left:0;padding-right:0}#bootstrap-theme .chr_leave-calendar__name{font-size:12px !important;line-height:100%;padding:0 20px !important;text-align:left;text-overflow:ellipsis;width:100%}#bootstrap-theme .chr_leave-calendar__name_header,#bootstrap-theme .chr_leave-calendar__day{height:49px}#bootstrap-theme .chr_leave-calendar__name_header{padding-bottom:10px !important}#bootstrap-theme .chr_leave-calendar__name_cell{vertical-align:middle !important}#bootstrap-theme .chr_leave-calendar__names-container .chr_leave-calendar{table-layout:fixed}#bootstrap-theme .chr_leave-calendar__pagination{font-size:10px;text-align:center}#bootstrap-theme .chr_leave-calendar__pagination [class*='btn']{line-height:1em;outline:none;padding:0}#bootstrap-theme .chr_leave-calendar__pagination [class*='btn'] .fa{color:#555}#bootstrap-theme .chr_leave-calendar__pagination [class*='btn'][disabled] .fa{opacity:0.5}#bootstrap-theme .chr_leave-calendar__pagination [class*='btn']:hover:not([disabled]) .fa{color:#464354}#bootstrap-theme .chr_leave-calendar__pagination-next{border-top:0}#bootstrap-theme .chr_leave-calendar__pagination-next th{height:24px;padding:4px 0 6px !important}#bootstrap-theme .chr_leave-calendar__pagination-next .chr_leave-calendar__pagination{padding-right:3px !important}#bootstrap-theme .chr_leave-report .dropdown-toggle{color:#464354;padding:0 10px}#bootstrap-theme .chr_leave-report .dropdown-toggle:hover{background:#e6e6e6}#bootstrap-theme .chr_leave-report table{table-layout:fixed}#bootstrap-theme .chr_leave-report table thead th,#bootstrap-theme .chr_leave-report table tbody td{padding:8px 5px}#bootstrap-theme .chr_leave-report__label{color:#464354;font-weight:700}#bootstrap-theme .chr_leave-report__label>.fa{margin-right:5px}#bootstrap-theme .chr_leave-report__label--toggle{cursor:pointer;user-select:none}#bootstrap-theme .chr_leave-report__heading{background-color:#f3f6f7;border-bottom:1px solid #dadcde}#bootstrap-theme .chr_leave-report__heading .chr_leave-report__export-button{line-height:2.4}#bootstrap-theme .chr_leave-report__table table,#bootstrap-theme .chr_leave-report__table .table{border-collapse:separate}#bootstrap-theme .chr_leave-report__table table>tbody>tr:first-child>td,#bootstrap-theme .chr_leave-report__table .table>tbody>tr:first-child>td{border-top-width:0}#bootstrap-theme .chr_leave-report__table table>thead+tbody>tr:first-child>td,#bootstrap-theme .chr_leave-report__table .table>thead+tbody>tr:first-child>td{border-top-width:1px}#bootstrap-theme .chr_leave-report__table table:not(.table-bordered):not(.table-condensed)>tbody>tr:first-child>td,#bootstrap-theme .chr_leave-report__table .table:not(.table-bordered):not(.table-condensed)>tbody>tr:first-child>td{border-color:#f3f6f7}#bootstrap-theme .chr_leave-report__table table>thead>tr>th,#bootstrap-theme .chr_leave-report__table .table>thead>tr>th{background:#f3f6f7;border-bottom:0;color:#464354;text-transform:capitalize}#bootstrap-theme .chr_leave-report__table table>tbody>tr:first-child>td,#bootstrap-theme .chr_leave-report__table .table>tbody>tr:first-child>td{border-color:#e8eef0 !important}#bootstrap-theme .chr_leave-report__table table>tfoot>tr,#bootstrap-theme .chr_leave-report__table .table>tfoot>tr{background:#f3f6f7}#bootstrap-theme .chr_leave-report__table>table>thead>tr>th,#bootstrap-theme .chr_leave-report__table>.table>thead>tr>th{padding-bottom:13px;padding-top:13px}#bootstrap-theme .chr_leave-report__table-container{overflow:auto}#bootstrap-theme .chr_leave-report__table-container .panel{display:inline-block;min-width:100%}#bootstrap-theme .chr_leave-report__table__heading--action{width:45px}#bootstrap-theme .chr_leave-report__table__heading--label{width:280px}#bootstrap-theme .chr_leave-report__table__heading--dates{width:170px}#bootstrap-theme .chr_leave-report__table__heading--status{width:180px}#bootstrap-theme .chr_leave-report__table__heading--type{width:65px;word-break:break-word}#bootstrap-theme .chr_leave-request-comment{margin-top:10px}#bootstrap-theme .chr_leave-request-comment__text{border-bottom:1px solid #e8eef0;color:#c2cfd8;margin-right:10px;padding-bottom:20px}#bootstrap-theme .chr_leave-request-files_list{height:150px;overflow-y:auto;margin-top:20px;margin-bottom:20px}#bootstrap-theme .chr_leave-request-files_meta{margin-bottom:10px}#bootstrap-theme .chr_leave-request-files_upload{border:dashed 1px #464354;padding:20px}#bootstrap-theme .chr_leave-request-files_upload_action{padding:5px}#bootstrap-theme .chr_leave-request-files_file-name{display:inline-block;max-width:240px;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}#bootstrap-theme .chr_leave-request-files_delete{margin-top:-7px}#bootstrap-theme .chr_leave-request-modal .modal-title{font-size:18px !important}#bootstrap-theme .chr_leave-request-modal .table-responsive{border:0}#bootstrap-theme .chr_leave-request-modal .chr_leave-request-date-picker-container .input-group{width:100%}@media screen and (max-width: 767px){#bootstrap-theme .chr_leave-request-modal .chr_leave-request-date-picker-container{margin-bottom:10px}}#bootstrap-theme .chr_leave-request-modal__chevron{font-size:0.6em;margin-right:5px;vertical-align:middle}#bootstrap-theme .chr_leave-request-modal__comments{height:230px;margin-bottom:20px;overflow:auto}#bootstrap-theme .chr_leave-request-modal__comments_empty{margin-bottom:20px}#bootstrap-theme .chr_leave-request-modal__footer{margin:0}#bootstrap-theme .chr_leave-request-modal__delete{margin-left:15px;margin-top:8px}#bootstrap-theme .chr_leave-request-modal__form .ui-select-container{margin-bottom:20px}#bootstrap-theme .chr_leave-request-modal__form .ui-select-container ul{opacity:1 !important}#bootstrap-theme .chr_leave-request-modal__form .ui-select-container:not(.ui-select-multiple) input{width:100% !important}#bootstrap-theme .chr_leave-request-modal__form-group,#bootstrap-theme .chr_leave-request-modal__required-documents>div{margin-bottom:15px}#bootstrap-theme .chr_leave-request-modal__response{padding:20px 20px 0}#bootstrap-theme .chr_leave-request-modal__response label{font-size:17px;margin-top:-3px}#bootstrap-theme .chr_leave-request-modal__response .chr_wysiwyg{margin-top:15px}#bootstrap-theme .chr_leave-request-modal__required-documents input{margin-right:5px}#bootstrap-theme .chr_leave-request-modal__small_spinner>div.chr_spinner{margin-top:18px;min-height:initial}#bootstrap-theme .chr_leave-request-modal__tab input[uib-datepicker-popup]{font-size:13px}#bootstrap-theme .chr_leave-request-modal__table{border:1px solid #f3f6f7;margin-bottom:15px !important}#bootstrap-theme .chr_leave-request-modal__user-info{font-size:17px;padding:20px}#bootstrap-theme .chr_leave-request-modal__user-info>span:nth-child(1){color:#464354}#bootstrap-theme .chr_leave-request-modal__user-info>span:nth-child(2){color:#555}@media screen and (min-width: 480px){#bootstrap-theme .chr_leave-request-modal__user-info>span:nth-child(2){border-left:1px solid #e8eef0}}#bootstrap-theme .chr_leave-request-modal__span-expiry{display:inline-block;margin-top:7px}#bootstrap-theme .chr_leave-request-modal__expiry-clear{position:absolute;right:3.5em;top:0.6em;z-index:2}#bootstrap-theme .chr_leave-request-modal__small-text{font-size:80%}#bootstrap-theme .chr_leave-request-modal__custom-deduction-toggling-row{margin-top:-5px}@media screen and (min-width: 768px){#bootstrap-theme .chr_leave-request-modal__custom-deduction-label{text-align:right}}@media screen and (max-width: 767px){#bootstrap-theme .chr_leave-request-modal__custom-deduction-label{margin-bottom:10px}}#bootstrap-theme .chr_leave-request-modal .form-group{overflow:inherit !important}#bootstrap-theme .chr_leave-request-modal .alert{margin-bottom:0 !important}#bootstrap-theme .chr_leave-request-modal input[uib-datepicker-popup]{box-shadow:none !important;background-color:inherit !important;color:inherit !important;cursor:pointer !important;border-right:none}#bootstrap-theme leave-request-record-actions{display:block}#bootstrap-theme leave-request-record-actions .btn-group{float:left}#bootstrap-theme leave-request-record-actions .btn-group:first-child{margin-right:8px}#bootstrap-theme leave-request-record-actions .btn-group:first-child .dropdown-menu{left:auto;right:0}@media screen and (max-width: 767px){#bootstrap-theme leave-request-record-actions .btn-group{width:calc((100% - 8px) / 2)}#bootstrap-theme leave-request-record-actions .btn{padding-left:0;padding-right:0;width:100%}#bootstrap-theme leave-request-record-actions .btn-group:first-child .dropdown-menu{left:0;right:auto}}#bootstrap-theme .leave-widget h4{color:#4d4d69;font-size:13px;font-weight:normal;margin-bottom:0;padding-bottom:13px}#bootstrap-theme .leave-widget__types>table,#bootstrap-theme .leave-widget__sickness>table,#bootstrap-theme .leave-widget__next-leave>table{border:none}#bootstrap-theme .leave-widget__types>table thead tr th,#bootstrap-theme .leave-widget__sickness>table thead tr th,#bootstrap-theme .leave-widget__next-leave>table thead tr th{color:#4d4d69;font-size:13px;font-weight:normal;margin-bottom:0;padding-bottom:13px;background:none;width:35%}#bootstrap-theme .leave-widget__types>table thead tr th:first-child,#bootstrap-theme .leave-widget__sickness>table thead tr th:first-child,#bootstrap-theme .leave-widget__next-leave>table thead tr th:first-child{width:65%}#bootstrap-theme .leave-widget__types>table tbody tr td,#bootstrap-theme .leave-widget__sickness>table tbody tr td,#bootstrap-theme .leave-widget__next-leave>table tbody tr td{color:#0071bd;font-size:16px;font-weight:600;padding-bottom:9px}#bootstrap-theme .leave-widget__types>table tbody tr td:first-child,#bootstrap-theme .leave-widget__sickness>table tbody tr td:first-child,#bootstrap-theme .leave-widget__next-leave>table tbody tr td:first-child{color:#464354}#bootstrap-theme .leave-widget hr{border-color:#DEE4ED;margin-bottom:25px;margin-top:25px}#bootstrap-theme .leave-widget__sickness h4{margin-top:18px}#bootstrap-theme .leave-widget__next-leave h3{font-size:16px;margin-bottom:16px;margin-top:0}#bootstrap-theme .leave-widget__next-leave__deduction{font-size:16px;font-weight:600;color:#464354}#bootstrap-theme .chr_leave__page-selector-dropdown{margin-bottom:20px;margin-right:5px;position:relative;top:1px;width:100%}#bootstrap-theme .chr_leave__page-selector-dropdown select{height:40px}#bootstrap-theme .chr_leave__page-selector-dropdown .crm_custom-select__arrow{line-height:40px;width:40px}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header{padding-left:10px;padding-right:10px;background-color:#f7f7f9;border-bottom:1px solid #dadcde;margin:0}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header>*{padding-left:10px !important;padding-right:10px !important}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header .panel-title{margin-top:7px;display:inline-block}@media screen and (max-width: 992px){#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header>div:not(:last-child),#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__header .panel-title{padding-bottom:20px}}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__filter{display:inline-block;margin-top:7px;white-space:nowrap}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__filter .fa{font-size:0.6em;margin-right:5px;margin-top:-2px;vertical-align:middle}@media screen and (max-width: 991px){#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__filter{margin-top:15px}}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header{padding-left:10px;padding-right:10px;background-color:#f7f7f9;border-bottom:1px solid #dadcde;margin:0;padding-top:15px}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header>*{padding-left:10px !important;padding-right:10px !important}@media screen and (max-width: 1199px){#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header>div:not(:last-child){padding-bottom:20px}}@media screen and (min-width: 992px) and (max-width: 1199px){#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header>.no_gutter{padding-bottom:0 !important}}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__panel_body{margin:0;padding:0}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__panel_body [class^="col-"],#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__panel_body [class*=" col-"]{padding:0}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__panel_body a{cursor:pointer}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__status_container{padding-left:10px;padding-right:10px;background-color:#f7f7f9}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__status_container>*{padding-left:10px !important;padding-right:10px !important}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__status_container>div{padding-left:15px;padding-right:15px}#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] .form-group{overflow:inherit !important}#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] .panel{background-image:none !important}#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] .panel-body,#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] .chr_vertical_tabs{background-color:#f7f7f9}#bootstrap-theme .chr_manage_leave_requests[data-role="admin"] input[type="search"]{width:100% !important}#bootstrap-theme .chr_manage_leave_requests .chr_manage_leave_requests__sub-header .checkbox{margin-top:5px}#bootstrap-theme .page-manager-leave .chr_manage_leave_requests .btn-sm{font-size:100% !important}#bootstrap-theme .chr_manager_calendar__header{padding-left:10px;padding-right:10px;padding-top:15px;margin:0;background-color:#f7f7f9;border-bottom:1px solid #dadcde}#bootstrap-theme .chr_manager_calendar__header>*{padding-left:10px !important;padding-right:10px !important}#bootstrap-theme .chr_manager_calendar__header .checkbox{margin:0}@media screen and (max-width: 1199px){#bootstrap-theme .chr_manager_calendar__header>div:not(:last-child){padding-bottom:20px}}#bootstrap-theme .chr_manager_calendar__sub-header{padding-left:10px;padding-right:10px;background-color:#f7f7f9;margin:0}#bootstrap-theme .chr_manager_calendar__sub-header>*{padding-left:10px !important;padding-right:10px !important}@media screen and (max-width: 1199px){#bootstrap-theme .chr_manager_calendar__sub-header>div:not(:last-child){padding-bottom:20px}#bootstrap-theme .chr_manager_calendar__sub-header .ui-select-container{height:auto}}#bootstrap-theme .time-amount-picker .crm_custom-select{display:inline-block;margin-right:2px}#bootstrap-theme .time-amount-picker .crm_custom-select:nth-child(2){margin-left:10px}#bootstrap-theme .absence-tab-page .tab-pane{padding:0 !important}#bootstrap-theme .absence-tab-page .tab-content{background-color:transparent !important}#bootstrap-theme .absence-tab-page leave-request-record-actions{margin-bottom:20px}#bootstrap-theme .crm-absence_type-form-block .crm-section .label{width:35%}#bootstrap-theme .crm-absence_type-form-block .crm-section .content{margin-left:40%}#bootstrap-theme .crm-absence_type-form-block .toil-option,#bootstrap-theme .crm-absence_type-form-block .carry-forward-option,#bootstrap-theme .crm-absence_type-form-block .toil-expiration,#bootstrap-theme .crm-absence_type-form-block .carry-forward-expiration-duration,#bootstrap-theme .crm-absence_type-form-block .carry-forward-expiration-date{display:none}#bootstrap-theme .crm-absence_type-form-block .sp-replacer{padding:2px}#bootstrap-theme .crm-absence_type-form-block .sp-preview{height:15px;width:15px}#bootstrap-theme .crm-absence_type-form-block .sp-dd{height:0;line-height:15px;font-size:9px}.page-civicrm-leaveandabsences-dashboard .page-title,.page-civicrm-leaveandabsences-dashboard #branding{display:none !important}.page-civicrm-leaveandabsences-dashboard #page{margin:0;padding:0}.admin-dashboard-page{position:relative}.admin-dashboard-page .crm_page__topbar{height:65px;padding:12px 16px}.admin-dashboard-page .chr_admin-dashboard_side-nav{background-color:#fff;height:calc(100% - 12px);overflow:hidden;position:absolute;width:170px}.admin-dashboard-page .chr_admin-dashboard_side-nav .active{background:#e8eef0}.admin-dashboard-page .chr_admin-dashboard_content{float:right;margin:16px;margin-bottom:0;width:calc(100% - 170px - 16px * 2)}#bootstrap-theme #calculation-details{background:#fff}#bootstrap-theme #calculation-details .base-contractual-entitlement{color:#0071bd}#bootstrap-theme #calculation-details .working-days-to-work{color:#44cb7e}#bootstrap-theme #calculation-details .working-days-in-period{color:#e6ab5e}#bootstrap-theme #calculation-details .contract-1-pro-rata{color:#E6807F}#bootstrap-theme #calculation-details .contract-2-pro-rata{color:#797300}#bootstrap-theme #calculation-details .contract-3-pro-rata{color:#904E1E}#bootstrap-theme #calculation-details .contract-4-pro-rata{color:#0511B1}#bootstrap-theme #calculation-details .contract-5-pro-rata{color:#4B9609}#bootstrap-theme #calculation-details .calculation-pro-rata{color:#95c0ff}#bootstrap-theme .crm-leave-and-absences-form-block .panel-body{padding-top:20px;padding-bottom:20px}#bootstrap-theme .crm-leave-and-absences-form-block .panel-body .row:first-child h3{margin-top:0}#bootstrap-theme .crm-leave-and-absences-form-block .panel-body h3{margin-bottom:20px}#bootstrap-theme .crm-leave-and-absences-form-block .panel-footer .crm-button:last-child{margin-right:0}#bootstrap-theme.crm-leave-and-balance-import .panel{background-color:#fff}#bootstrap-theme.crm-leave-and-balance-import .panel-header{position:relative}#bootstrap-theme.crm-leave-and-balance-import .panel-header h2{padding:10px 20px}#bootstrap-theme.crm-leave-and-balance-import .panel-body .row:not(:last-child){padding-bottom:2em}#bootstrap-theme.crm-leave-and-balance-import .table.date-formats .label{display:none}#bootstrap-theme.crm-leave-and-balance-import .table.date-formats label{font-weight:normal !important}#bootstrap-theme.crm-leave-and-balance-import .table.date-formats td{border:0;padding:0}#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block{box-shadow:none;padding:0}#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block #map-field table{margin-bottom:2em;width:100%}#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block #map-field table th{padding:10px 20px;border-right:none}#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block #map-field table th,#bootstrap-theme.crm-leave-and-balance-import .crm-activity_map_table-form-block #map-field table td{padding:5px}#bootstrap-theme.crm-leave-and-balance-import #preview-counts,#bootstrap-theme.crm-leave-and-balance-import #summary-counts{box-shadow:none;margin-bottom:2em;width:100%}#bootstrap-theme.crm-leave-and-balance-import #preview-counts tr.danger td,#bootstrap-theme.crm-leave-and-balance-import #summary-counts tr.danger td{background-color:#f2dede !important;color:#cf3458}#bootstrap-theme.crm-leave-and-balance-import #preview-counts tr.danger td a,#bootstrap-theme.crm-leave-and-balance-import #summary-counts tr.danger td a{color:#bd2d4e;font-weight:bold}#bootstrap-theme.crm-leave-and-balance-import #preview-counts tr.danger td a:hover,#bootstrap-theme.crm-leave-and-balance-import #summary-counts tr.danger td a:hover{color:#0062a4}#bootstrap-theme.manage-entitlements-form .wider-hr{margin-left:-20px;margin-right:-20px;border-width:2px}#bootstrap-theme.manage-entitlements-form .wider-row{margin-left:-20px;margin-right:-20px}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters{padding:15px 0;text-align:center}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters .override-filters label{display:inline-block}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters .override-filters label:before{display:none}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters .absence-type-filter{margin-right:10px}#bootstrap-theme.manage-entitlements-form .entitlement-calculation-filters .col-sm-4:last-child{text-align:right}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list{margin-bottom:0}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .proposed-entitlement-header .title{float:left;width:65%}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .proposed-entitlement-header .actions{float:right}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list tr.hidden{display:none}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .absence-type{color:#fff;display:inline-block;padding:5px}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .proposed-entitlement .overridden-proposed-entitlement,#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .proposed-entitlement .calculation-unit{display:none}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .borderless-button{background-color:transparent;border:0;cursor:pointer}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .add-comment{font-size:1.1em}#bootstrap-theme.manage-entitlements-form .table.entitlement-calculation-list .comment-text{display:none}#bootstrap-theme.manage-entitlements-form .manage-entitlements-form__filters{padding-bottom:1em}#bootstrap-theme.manage-entitlements-form .table{background:#f9f9f9;border-top:1px solid #e8eef0;border-bottom:1px solid #e8eef0;margin-bottom:2em}#bootstrap-theme.manage-entitlements-form .table th{background:#f3f6f7 !important}#bootstrap-theme.manage-entitlements-form .table th.proposed-entitlement-header{border-left:1px solid #e8eef0;border-right:1px solid #e8eef0;background:#e4ebed !important;min-width:200px}#bootstrap-theme.manage-entitlements-form .table th.proposed-entitlement-header .row>div{display:table-cell;float:none;vertical-align:bottom}#bootstrap-theme.manage-entitlements-form .table th.proposed-entitlement-header .fa{color:#4d4d69}#bootstrap-theme.manage-entitlements-form .table th.proposed-entitlement-header .action-button-container{padding:0}#bootstrap-theme.manage-entitlements-form .table td.proposed-entitlement{border-left:1px solid #e8eef0;border-right:1px solid #e8eef0;background:white}#bootstrap-theme.manage-entitlements-form .table span.absence-type{border-radius:3px;padding:0 5px}#bootstrap-theme.manage-entitlements-form .table tbody .fa{color:#0071bd}#bootstrap-theme.manage-entitlements-form .crm-container .CRM_HRLeaveAndAbsences_Form_ManageEntitlements .crm-button-type-next{float:right !important}#bootstrap-theme.manage-entitlements-form .panel-footer{border-top:none}#add-comment-dialog{display:none}#add-comment-dialog .calculation_comment{box-sizing:border-box;padding:10px;width:100%}#bootstrap-theme .crm-work-pattern-form-block .ui-tabs.ui-widget-content{background:none}#bootstrap-theme .work-pattern-calendar .number-of-weeks{padding:15px 0 15px 0}#bootstrap-theme .work-pattern-calendar .work-pattern-week{border-top:1px solid rgba(0,0,0,0.2);padding:15px 0 15px 0;margin-bottom:15px}#bootstrap-theme .work-pattern-calendar .work-pattern-week.hidden-week{display:none}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-number{float:left;font-weight:bold;padding:5px 0 15px 5px}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-days{table-layout:fixed}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-hours{float:right;padding:5px 5px 15px 0}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-hours .number-of-hours{font-weight:bold}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-days td{padding:5px 10px 5px 10px}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-days input{min-width:0;text-align:center}#bootstrap-theme .work-pattern-calendar .work-pattern-week .week-days select{min-width:0;width:100% !important}#bootstrap-theme .work-pattern-calendar .work-pattern-week .hours-row td{padding-top:15px;padding-bottom:15px;border-top:1px solid rgba(0,0,0,0.2);border-bottom:1px solid rgba(0,0,0,0.2)}.chr_leave-calendar__day-tooltip.tooltip.in{opacity:1}.chr_leave-calendar__day-tooltip .tooltip-arrow{border-top-color:#fff !important}.chr_leave-calendar__day-tooltip .tooltip-inner{background-color:#fff;border-radius:0;box-shadow:0 3px 8px 0 rgba(49,40,40,0.25);color:#464354;padding:0}.chr_leave-calendar__day-tooltip__item{cursor:pointer;font-size:11px;min-width:154px;padding:8px}.chr_leave-calendar__day-tooltip__item:hover{background-color:#e8eef0}.chr_leave-calendar__day-tooltip__item_absence-type{font-size:13px}.chr_leave-calendar__day-tooltip__item_request-status{color:#9494a5;margin-bottom:2px}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid \9;border-right:4px solid transparent;border-left:4px solid transparent}.dropup,.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:13px;text-align:left;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);border-radius:2px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.5384615385;color:#4d4d69;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{text-decoration:none;color:#42425a;background-color:#f3f6f7}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;outline:0;background-color:#0071bd}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#e8eef0}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{left:auto;right:0}.dropdown-menu-left{left:0;right:auto}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.5384615385;color:#464354;white-space:nowrap}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px dashed;border-bottom:4px solid \9;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width: 768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{left:0;right:auto}}.dropdown-header{padding:7px 19px 7px 24px}.dropdown-menu{-webkit-box-shadow:0 3px 18px 0 rgba(48,40,40,0.25);box-shadow:0 3px 18px 0 rgba(48,40,40,0.25);border:0;margin:0;padding:4px 0 9px 0}.dropdown-menu>li{border:0;margin:0;padding:0}.dropdown-menu>li>a{padding:7px 19px 7px 24px}.dropdown-menu .divider{margin:7px 0} diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/hrleaveandabsences.php b/uk.co.compucorp.civicrm.hrleaveandabsences/hrleaveandabsences.php index 193479a956e..17279cee077 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/hrleaveandabsences.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/hrleaveandabsences.php @@ -434,24 +434,6 @@ function hrleaveandabsences_hrcomments_selectWhereClause(&$conditions, $params) $conditions = array_merge($conditions, $commentsWhereClause->get()); } - -/** - * Implementation of the hook_civicrm_validateForm. - * - * @param string $formName - * @param array $fields - * @param array $files - * @param object $form - * @param array $errors - */ -function hrleaveandabsences_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) { - if($formName == 'CRM_Contact_Form_Relationship') { - if(_hrleaveandabsences_contact_is_being_assigned_as_its_own_leave_approver($form, $fields)){ - $errors['relationship_type_id'] = ts('You cannot assign a contact as its own leave approver'); - } - } -} - /** * Implementation of the hook_civicrm_apiWrappers hook * @@ -806,24 +788,3 @@ function _hrleaveandabsences_set_has_leave_approved_by_as_default_relationship_t ); } } - -/** - * A helper function that checks whether a contact being set as its own Leave - * Approver based on the leave approver relationships defined on L&A general settings page. - * - * @param object $form - * @param array $fields - * - * @return bool - */ -function _hrleaveandabsences_contact_is_being_assigned_as_its_own_leave_approver($form, $fields) { - if($fields['related_contact_id'] == $form->_contactId) { - $leaveApproverRelationships = Civi::service('hrleaveandabsences.settings_manager') - ->get('relationship_types_allowed_to_approve_leave'); - if(in_array($form->_relationshipTypeId, $leaveApproverRelationships)) { - return true; - } - } - - return false; -} diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/info.xml b/uk.co.compucorp.civicrm.hrleaveandabsences/info.xml index 3ae3ce34522..ad996d05d6f 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/info.xml +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/info.xml @@ -8,8 +8,8 @@ Compucorp Ltd info@compucorp.co.uk - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/absence-tab.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/absence-tab.min.js index c985d29220a..815bb77154d 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/absence-tab.min.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/absence-tab.min.js @@ -1,5 +1,5 @@ -!function(e){define("leave-absences/shared/config",[],function(){var n=CRM.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/shared";e.config({paths:{"leave-absences/shared/ui-router":"leave-absences/shared/vendor/angular-ui-router.min",mocks:"../test/mocks"},shim:{"leave-absences/shared/ui-router":{}}}),e.config({paths:{"leave-absences/shared/ui-router":n+"/vendor/angular-ui-router.min",mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(n){return n.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,n,t){"use strict";t.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(t,a,o){return t.debug("AbsenceTypeAPI"),a.extend({all:function(n){return t.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(n||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,s,i){return t.debug("AbsenceTypeAPI.calculateToilExpiryDate"),i=e.assign({},i,{absence_type_id:a,date:n(s).format(o.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",i).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,n){return e.debug("AbsenceTypeInstance"),n.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,n){"use strict";n.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(n,t,a,o,s,i){return n.debug("AbsenceType"),a.extend({all:function(e){return s.all(e).then(function(e){return e.map(function(e){return i.init(e,!0)})})},calculateToilExpiryDate:function(e,n,t){return s.calculateToilExpiryDate(e,n,t)},canExpire:function(e){return s.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(n){return o.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(t){return t=e.indexBy(t,"value"),e.map(n,function(n){return e.assign(n,{calculation_unit_label:t[n.calculation_unit].label,calculation_unit_name:t[n.calculation_unit].name})})})}})}])}),define("leave-absences/shared/apis/work-pattern.api",["common/lodash","leave-absences/shared/modules/apis","common/services/api"],function(e,n){"use strict";n.factory("WorkPatternAPI",["$log","api",function(n,t){function a(n){var t=e.clone(n);return t.workPattern=t["api.WorkPattern.get"].values[0],delete t["api.WorkPattern.get"],t}return n.debug("WorkPatternAPI"),t.extend({assignWorkPattern:function(n,t,a,o,s,i){return this.sendPOST("ContactWorkPattern","create",e.assign({},i,{contact_id:n,pattern_id:t,effective_date:a,effective_end_date:o,change_reason:s})).then(function(e){return e.values})},get:function(e){return this.sendGET("WorkPattern","get",e||{}).then(function(e){return e.values})},getCalendar:function(t,a,o,s){return n.debug("WorkPatternAPI.getCalendar",t,a,o,s),this.sendGET("WorkPattern","getcalendar",e.assign({},s,{contact_id:e.isArray(t)?{IN:t}:t,start_date:a,end_date:o}))},unassignWorkPattern:function(e){return this.sendPOST("ContactWorkPattern","delete",{id:e})},workPatternsOf:function(n,t,o){return this.sendGET("ContactWorkPattern","get",e.assign({},t,{contact_id:n,"api.WorkPattern.get":{id:"$value.pattern_id"}}),o).then(function(e){return e=e.values,e.map(a)})}})}])}),define("leave-absences/shared/instances/calendar.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance"],function(e,n,t){"use strict";t.factory("CalendarInstance",["$log","$q","ModelInstance","shared-settings","OptionGroup",function(t,a,o,s,i){function r(n,t){return u().then(function(a){var o=this.days[c(n).valueOf()];return!!o&&e.find(a,function(e){return e.name===t}).value===o.type}.bind(this))}function c(e){return n(e,s.serverDateFormat).clone()}function u(){return l=l||i.valuesOf("hrleaveandabsences_work_day_type")}var l;return o.extend({defaultCustomData:function(){return{days:[]}},isNonWorkingDay:function(e){return r.call(this,e,"non_working_day")},isWeekend:function(e){return r.call(this,e,"weekend")},isWorkingDay:function(e){return r.call(this,e,"working_day")},transformAttributes:function(n){var t={};return n.calendar.forEach(function(e){t[c(e.date).valueOf()]=e}),e(n).omit("calendar").assign({days:t}).value()}})}])}),define("leave-absences/shared/models/calendar.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/calendar.instance"],function(e,n){"use strict";n.factory("Calendar",["$log","Model","WorkPatternAPI","CalendarInstance",function(n,t,a,o){return n.debug("Calendar"),t.extend({get:function(t,s,i,r){return n.debug("Calendar.get"),a.getCalendar(t,s,i,r).then(function(n){var a=n.values.map(function(e){return o.init(e)});return e.isArray(t)?a:a[0]})}})}])}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,t){function a(e){var t=n.clone(e),a=t["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(t.remainder=a[0].remainder),delete t["api.LeavePeriodEntitlement.getremainder"],t}function o(e){var t=n.clone(e),a=t["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return t.value=a,delete t["api.LeavePeriodEntitlement.getentitlement"],t}return e.debug("EntitlementAPI"),t.extend({all:function(n,t){return e.debug("EntitlementAPI.all"),n["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},t&&(n["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",n,!1).then(function(e){return e.values}).then(function(e){return e=e.map(o),t&&(e=e.map(a)),e})},breakdown:function(n){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",n).then(function(e){return e.values})},getLeaveBalances:function(n,t,a,o,s){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",n,t,a,o,"getLeaveBalances",s)}})}])}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,n){return e.debug("EntitlementLogAPI"),n.extend({all:function(n){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",n,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,n,t){return e.debug("EntitlementInstance"),n.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return t.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,n){"use strict";n.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(n,t,a,o,s){return n.debug("Entitlement"),t.extend({all:function(e,n){return a.all(this.processFilters(e),n).then(function(e){return e.map(function(e){return o.init(e,!0)})})},breakdown:function(n,t){return a.breakdown(n).then(function(n){return t?(t.map(function(t){var a=e.find(n,function(e){return e.id===t.id});return a&&(t.breakdown=a.breakdown),t}),t):n.map(function(e){return o.init(e,!0)})})},logs:function(n){return n=e.cloneDeep(n||{}),n.contact_id&&(n["entitlement_id.contact_id"]=n.contact_id,delete n.contact_id),n.period_id&&(n["entitlement_id.period_id"]=n.period_id,delete n.period_id),n.return=n.return||[],n.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),s.all(n)}})}])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,t,a){return e.debug("LeaveRequestAPI"),t.extend({all:function(n,t,o,s,i){e.debug("LeaveRequestAPI.all");var r=a.defer();return n&&n.contact_id&&n.contact_id.IN&&0===n.contact_id.IN.length?r.resolve({list:[],total:0,allIds:[]}):r.resolve(this.getAll("LeaveRequest",n,t,o,s,"getFull",i)),r.promise},balanceChangeByAbsenceType:function(t){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var o=a.defer();return t.contact_id&&t.period_id||o.reject("contact_id and period_id are mandatory"),t=n.defaults(t,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",t,!1).then(function(e){o.resolve(e.values)}),o.promise},calculateBalanceChange:function(t){return e.debug("LeaveRequestAPI.calculateBalanceChange",t),this.sendPOST("LeaveRequest","calculatebalancechange",t).then(function(e){return e.values.breakdown=n.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,n){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:n.toString()},!1)},create:function(n){return e.debug("LeaveRequestAPI.create",n),this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,attachment_id:t}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,t){return t=n.assign({},t,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",t).then(function(e){return e.values})},find:function(n){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:n},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",t,!1).then(function(e){return e.values})},getComments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",t,!1).then(function(e){return e.values})},isManagedBy:function(n,t){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:n,contact_id:t}).then(function(e){return e.values})},isValid:function(t){e.debug("LeaveRequestAPI.isValid",t);var o=a.defer();return this.sendPOST("LeaveRequest","isValid",t).then(function(e){e.count>0?o.reject(n(e.values).map().flatten().value()):o.resolve(e.values)}),o.promise},saveComment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,text:t.text,contact_id:t.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(n){e.debug("LeaveRequestAPI.update",n);var t=a.defer();return n.id||t.reject("id is mandatory field"),this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]})}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,n,t){"use strict";t.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(t,a,o,s,i,r,c){function u(e){return p(e).then(function(e){var n=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=n,t.reject(e)}.bind(this))}.bind(this))}function l(){return c.all({id:this.type_id}).then(c.loadCalculationUnits).then(function(e){return t.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return p(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var n=[];return e.forEach(this.files,function(e){e.toBeDeleted&&n.push(r.deleteAttachment(this.id,e.attachment_id))}.bind(this)),t.all(n)}function f(e){return n.duration(e.time_to).subtract(n.duration(e.time_from)).asHours()}function p(n){return o.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){return e.find(t,function(e){return e.name===n})})}function h(n){var a=e.cloneDeep(n),o=a.breakdown.length>1,s=e.first(e.values(a.breakdown)),i=e.last(e.values(a.breakdown));return t.all([this.getWorkDayForDate(s.date),o&&this.getWorkDayForDate(i.date)]).then(function(n){return s.amount=n[0].time_from?Math.min(this.from_date_amount,f(n[0])):0,o&&(i.amount=n[1].time_from?Math.min(this.to_date_amount,f(n[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,n){return e+n.amount},0),a}.bind(this))}function v(){var e=this.id,n=[];return n.push(t.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(n){return function(){return r.saveComment(e,n)}}))),n=n.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return r.deleteComment(e.comment_id)})),t.all(n)}return i.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(n){var t=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===n&&e.pull(t,"from_date_type","to_date_type"),r.calculateBalanceChange(e.pick(this,t)).then(function(e){return"hours"===n?h.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,s.statusNames.cancelled)},approve:function(){return u.call(this,s.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,s.statusNames.rejected)},sendBack:function(){return u.call(this,s.statusNames.moreInformationRequired)},update:function(){return r.update(this.toAPI()).then(function(){return t.all([v.call(this),m.call(this)])}.bind(this))},create:function(){return r.create(this.toAPI()).then(function(e){return this.id=e.id,t.all([v.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(n){if(n.comment_id)return void(n.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return n.created_at===e.created_at&&n.text===e.text})},delete:function(){return r.delete(this.id)},getBalanceChangeBreakdown:function(){return r.getBalanceChangeBreakdown(this.id).then(function(n){return{amount:e.reduce(n.values,function(e,n){return e+parseFloat(n.amount)},0),breakdown:n.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return r.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return t.reject(e)})},isValid:function(){return r.isValid(this.toAPI())},isApproved:function(){return d.call(this,s.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,s.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,s.statusNames.cancelled)},isRejected:function(){return d.call(this,s.statusNames.rejected)},isSentBack:function(){return d.call(this,s.statusNames.moreInformationRequired)},loadComments:function(){return this.id?r.getComments(this.id).then(function(e){this.comments=e}.bind(this)):t.resolve()},roleOf:function(e){return this.contact_id===e?t.resolve("owner"):a(s.permissions.admin.administer).then(function(n){return n?"admin":r.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])},loadAttachments:function(){return this.id?r.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):t.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,n,t,a){return e.debug("LeaveRequest"),n.extend({all:function(e,n,o,s,i){return t.all(this.processFilters(e),n,o,s,i).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return t.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return t.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/instances/work-pattern.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("WorkPatternInstance",["$log","ModelInstance",function(e,n){return e.debug("WorkPatternInstance"),n.extend({})}])}),define("leave-absences/shared/models/work-pattern.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/work-pattern.instance"],function(e,n){"use strict";n.factory("WorkPattern",["$log","Model","WorkPatternAPI","WorkPatternInstance",function(n,t,a,o){return n.debug("WorkPattern"),t.extend({assignWorkPattern:function(e,n,t,o,s,i){return a.assignWorkPattern(e,n,t,o,s,i)},default:function(){return a.get({is_default:!0}).then(function(n){return o.init(e.first(n),!0)})},unassignWorkPattern:function(e){return a.unassignWorkPattern(e)},workPatternsOf:function(e,n,t){return a.workPatternsOf(e,n,t).then(function(e){return e.map(function(e){return o.init(e,!0)})})}})}])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/modules/controllers",["common/angular","common/angularBootstrap","leave-absences/shared/modules/models","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){return e.module("leave-absences.controllers",["ui.select","leave-absences.models","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers","common/models/contract","common/services/notification.service"],function(e,n,t){function a(n,t,a,o,s,i,r){function c(){return{loadContacts:function(){return l.loadContactsForAdmin()}}}function u(e){i.info("",["

    When All filter is selected, all staff members with contracts which are active in the selected absence period are displayed.

    ","

    People I approve filter displays only staff members who you approve leave for.

    ","

    People without approver filter displays all staff members with contracts which are active in the selected absence period and who do not have any leave approver assigned.

    "].join(""))}n.debug("LeaveCalendarAdminController");var l,d;return{init:function(n){return d=n,l=r.init(d),d.filters.userSettings.assignedTo=e.find(d.filtersByAssignee,{type:"me"}),d.showContactDetailsLink=!0,d.showContactName=!0,d.showFilters=!0,d.showAdminFilteringHint=u,c()}}}t.controller("LeaveCalendarAdminController",["$log","$q","Contact","ContactInstance","Contract","notificationService","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(n,t,a,o){function s(){return{loadContacts:function(){return i.loadLookUpAndFilteredContacts()}}}n.debug("LeaveCalendarManagerController");var i,r;return{init:function(n){return r=n,i=o.init(r),r.filters.userSettings.assignedTo=e.find(r.filtersByAssignee,{type:"me"}),r.showContactName=!0,r.showFilters=!0,s()}}}t.controller("LeaveCalendarManagerController",["$log","Contact","ContactInstance","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(e,n,t,a){function o(){return{loadContacts:function(){return i.displaySingleContact?s.loadFilteredContacts():"admin"===i.userPermissionRole?s.loadContactsForAdmin():s.loadLookUpAndFilteredContacts()}}}e.debug("LeaveCalendarStaffController");var s,i;return{init:function(e){return i=e,s=a.init(i),i.filters.userSettings.contacts_with_leaves=!0,i.showTheseContacts=[i.contactId],i.showContactName=!0,i.showFilters=!0,i.displaySingleContact&&(i.showFilters=!1,i.lookupContacts=[{id:i.contactId}]),o()}}}t.controller("LeaveCalendarStaffController",["$log","$q","Contact","LeaveCalendarService",a])}),define("leave-absences/shared/components/leave-calendar.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d){function m(){W.supportData.absenceTypes.push({id:"",title:"Leave",color:"#4D4D68",calculation_unit:e.chain(W.supportData.calculationUnits).find({name:"days"}).get("value").value()})}function f(){for(var e=[],t=n(W.selectedPeriod.start_date).clone().startOf("month"),a=n(W.selectedPeriod.end_date).clone().endOf("month");t.isBefore(a);)e.push(w(t)),t.add(1,"month");W.months=e}function p(){return e.includes(["admin","manager"],W.userPermissionRole)}function h(e){return e.format("YYYY-MM")}function v(){s.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,n){W.supportData.absenceTypesToFilterBy=n,L(!0)})}function b(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(B(),E(),L())})}function g(e){W.injectMonth=!0,U("injected").then(function(){L(e)}).then(function(){W.loading.calendar=!1})}function _(){N=t("LeaveCalendar"+e.capitalize(j)+"Controller").init(W)}function y(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return r.all().then(function(n){W.absencePeriods=e.sortBy(n,"start_date"),W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current})}).then(f).then(M)}function C(){return c.all().then(c.loadCalculationUnits)}function T(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function A(){return N.loadContacts().then(function(e){W.contacts=e})}function D(){return l.valuesOf(["hrjc_region","hrjc_location","hrjc_level_type","hrjc_department"]).then(function(e){W.filters.optionValues.regions=e.hrjc_region,W.filters.optionValues.locations=e.hrjc_location,W.filters.optionValues.levelTypes=e.hrjc_level_type,W.filters.optionValues.departments=e.hrjc_department})}function P(){return u.all()}function R(){return a.all([C(),P(),T()]).then(function(n){W.supportData.absenceTypes=n[0],W.supportData.publicHolidays=n[1],W.supportData.calculationUnits=n[2].hrleaveandabsences_absence_type_calculation_unit,W.supportData.dayTypes=n[2].hrleaveandabsences_leave_request_day_type,W.supportData.leaveRequestStatuses=n[2].hrleaveandabsences_leave_request_status,W.supportData.toilAmounts=e.indexBy(n[2].hrleaveandabsences_toil_amounts,"value")})}function I(){var e=a.resolve();return W.injectMonth&&(e=U("destroyed"),W.injectMonth=!1),e}function w(e){return{index:h(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:n().year(e.year()).month(e.month())}}function k(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&f(),M(),E(),O("month")}function S(e){var t="previous"===e?"subtract":"add";B(n(W.selectedMonth.moment)[t](1,"month")),E(),O("month")}function O(n){n=e.includes(["contacts","period","month"],n)?n:"period",a.resolve().then(I).then("period"===n&&f).then("period"===n&&x).then("contacts"===n&&A).then("month"===n&&E).then(function(){g("contacts"===n)})}function L(e){s.$emit("LeaveCalendar::showMonth",!!e)}function M(){B(n())}function x(){B(W.months[0].moment)}function $(t){var a="previous"===t?"first":"last",o=e[a](W.months),s=n().year(o.year).month(o.month);W.monthPaginatorsAvailability[t]=!W.selectedMonth.moment.isSame(s,"month")}function E(){$("previous"),$("next")}function B(n){n&&(W.selectedMonthIndex=h(n)),W.selectedMonth=e.find(W.months,{index:W.selectedMonthIndex})}function F(){return a.all([d(i.permissions.admin.administer),d(i.permissions.ssp.manage)]).then(function(e){W.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",j=W.roleOverride?W.roleOverride:W.userPermissionRole})}function U(n){return a(function(t){var a=s.$on("LeaveCalendar::month"+e.capitalize(n),function(){a(),t()})})}o.debug("Component: leave-calendar");var N,j,W=this;W.absencePeriods=[],W.contacts=[],W.contactIdsToReduceTo=null,W.injectMonth=!1,W.months=[],W.selectedMonth={},W.selectedMonthIndex="",W.selectedPeriod=null,W.showContactName=!1,W.showFilters=!1,W.userPermissionRole="staff",W.loading={calendar:!0,page:!0},W.filters={hideOnMobile:!0,optionValues:{},userSettings:{contact:null,contacts_with_leaves:!0,department:null,level_type:null,location:null,region:null},absenceTypes:{}},W.filtersByAssignee=[{type:"me",label:"People I approve"},{type:"unassigned",label:"People without approver"},{type:"all",label:"All"}],W.filters.userSettings.assignedTo=W.filtersByAssignee[2],W.monthPaginatorsAvailability={previous:!0,next:!0},W.supportData={absenceTypesToFilterBy:[]},W.canManageRequests=p,W.labelPeriod=y,W.navigateToCurrentMonth=k,W.paginateMonth=S,W.refresh=O,function(){F().then(b).then(v).then(_).then(I).then(function(){return a.all([q(),A(),R(),W.showFilters?D():e.noop])}).then(function(){m(),g(),E()}).then(function(){W.loading.page=!1})}()}t.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,t={from_date:{to:X.month.days[X.month.days.length-1].date+" 23:59:59"},to_date:{from:X.month.days[0].date+" 00:00:00"},status_id:{IN:S()},contact_id:{IN:X.contacts.map(function(e){return e.id})},type_id:{IN:n?X.supportData.absenceTypesToFilterBy:e.pluck(X.supportData.absenceTypes,"id")}};return g(),i.all(t,null,null,null,!1).then(function(e){return z={},n&&(e.list=y(e.list)),T(e.list)})}function M(){var n=X.month.days[0].date,t=X.month.days[X.month.days.length-1].date;return s.get(X.contacts.map(function(e){return e.id}),n,t).then(function(n){V=e.indexBy(n,"contact_id")})}function x(){return X.contactIdsToReduceTo&&(X.contacts=X.contacts.filter(function(n){return e.includes(X.contactIdsToReduceTo,n.contact_id)||e.find(z,function(e){return e.contact_id===n.contact_id})})),a.resolve()}function $(n){var t=w(n);z[n.contact_id]=z[n.contact_id]||{},t.forEach(function(t){e.remove(z[n.contact_id][t.date],function(e){return e.id===n.id})})}function E(){o.$emit("LeaveCalendar::monthDestroyed"),G.map(function(e){e.remove?e.remove():e()})}function B(n,t,o){var s,i;return n.contactsData[t]=n.contactsData[t]||{},i=m(t),s=!0===o?a.resolve():a.all([i.isWeekend(p(n.date)),i.isNonWorkingDay(p(n.date))]).then(function(a){e.assign(n.contactsData[t],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:R(n.date)})}),s.then(function(){return z[t]&&z[t][n.date]?z[t][n.date]:[]}).then(function(a){a=N(a),e.assign(n.contactsData[t],{leaveRequests:a,leaveRequestsToShowInCell:v(a),leaveRequestsAttributes:q(n,a)})})}function F(){return a.all(X.month.days.map(function(e){return a.all(X.contacts.map(function(n){return B(e,n.id)}))}))}function U(e,n){X.currentPage=0,X.visible=!0,(n||!Y)&&O()}function N(t){return e.sortBy(t,function(e){return+n(e.from_date).format("X")+(D("half_day_pm",e,e.from_date)?1:0)})}function j(n){var t=e.find(X.supportData.absenceTypes,function(e){return e.id===n.type_id});return n.balance_change>0?{borderColor:t.color}:{borderColor:t.color,backgroundColor:t.color}}function W(e){h(e),-1!==S().indexOf(e.status_id)&&u(e)}function H(e){return a.all(w(e).map(function(n){return B(n,e.contact_id,!0)}))}t.debug("Component: leave-calendar-month");var Y=!1,G=[],V={},z={},X=this;X.currentPage=0,X.pageSize=20,X.visible=!1,X.showContactName=!!X.showContactName,X.showOnlyWithLeaveRequests=!!X.showOnlyWithLeaveRequests,X.$onDestroy=E,X.contactsList=f,X.getContactUrl=_,function(){var e=n().month(X.month.month).year(X.month.year);C(),A(),X.month=l(e),o.$emit("LeaveCalendar::monthInjected")}()}t.component("leaveCalendarMonth",{bindings:{showTheseContacts:"<",contacts:"<",contactIdsToReduceTo:"<",month:"<",period:"<",showContactName:"<",showContactDetailsLink:"<",showOnlyWithLeaveRequests:"<",supportData:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-month.html"}],controllerAs:"month",controller:["$log","$q","$rootScope","Calendar","LeaveRequest","pubSub","shared-settings",a]})}),define("leave-absences/shared/modules/services",["common/angular","common/modules/services"],function(e){"use strict";return e.module("leave-absences.services",["common.services"])}),define("leave-absences/shared/services/leave-request.service",["common/lodash","leave-absences/shared/modules/services"],function(e,n){"use strict";function t(n,t,a){function o(){var n=t.defer();return a.open(e.defaults(s(),{onConfirm:function(){n.resolve(!0)}})),n.promise}function s(){return{title:"Recalculate Balance Change?",copyCancel:"Cancel",copyConfirm:"Yes",classConfirm:"btn-warning",msg:"The leave balance change has updated since this leave request was created. Do you want to recalculate the balance change?"}}return n.debug("LeaveRequest"),{getBalanceChangeRecalculationPromptOptions:s,promptBalanceChangeRecalculation:o}}n.factory("LeaveRequestService",t),t.$inject=["$log","$q","dialog"]}),define("leave-absences/shared/components/leave-request-actions.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/services/notification.service","common/services/pub-sub","leave-absences/shared/services/leave-request.service"],function(e,n,t){function a(t,a,o,s,i,r,c,u){function l(n){q=C.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===C.leaveRequest.request_type?o.open(h(n)):f(n)}function d(){return"admin"===C.role&&"public_holiday"===C.leaveRequest.request_type}function m(t){var a=C.absenceTypes[C.leaveRequest.type_id].allow_request_cancelation;return"admin"===C.role||("manager"===C.role?e.includes([T.awaitingApproval,T.moreInformationRequired],t):"3"===a?n().isBefore(C.leaveRequest.from_date):"2"===a)}function f(n){o.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return C.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(i.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){b(n)}}):h(n)})}})}function p(){e.isArray(C.leaveRequestStatuses)&&(C.leaveRequestStatuses=e.indexBy(C.leaveRequestStatuses,"value")),e.isArray(C.absenceTypes)&&(C.absenceTypes=e.indexBy(C.absenceTypes,"id"))}function h(e){var n=A[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return C.leaveRequest[e]().then(function(){g(e)}).catch(function(e){u.error("Error:",e)})}}}function v(e,n){e.stopPropagation(),s.openModal(n)}function b(e){s.openModal({leaveRequest:C.leaveRequest,leaveType:C.leaveRequest.request_type,selectedContactId:C.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:c.statusNames[D[e]]})}function g(n){var t=e.find(C.leaveRequestStatuses,function(e){return e.name===c.statusNames.awaitingApproval}).value;q===t&&r.publish("ManagerBadge:: Update Count"),r.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:C.leaveRequest})}function _(){var n=C.leaveRequestStatuses[C.leaveRequest.status_id].name,t=e.compact(e.map(A,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!m(n)&&e.pull(t,"cancel"),"admin"!==C.role&&e.pull(t,"delete"),"staff"===C.role&&e.pull(t,"approve","reject"),"staff"!==C.role&&y(t),d()&&t.push("delete"),C.allowedActions=e.map(t,function(e){return{key:e,label:A[e].label,isDirectAction:A[e].isDirectAction}})}function y(n){e.each(n,function(t,a){"edit"===t&&(n[a]="respond"),e.includes(["respond","view"],t)&&(n[a]="edit")})}t.debug("Component: leave-request-action-dropdown");var q,C=this,T=c.statusNames,A={edit:{label:"Edit",allowedStatuses:[T.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[T.moreInformationRequired]},view:{label:"View",allowedStatuses:[T.approved,T.rejected,T.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[T.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[T.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[T.awaitingApproval,T.approved,T.rejected,T.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[T.awaitingApproval,T.moreInformationRequired,T.approved,T.rejected,T.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},D={approve:"approved"};C.allowedActions=[],C.action=l,C.openLeavePopup=v,function(){p(),_()}()}t.component("leaveRequestActions",{bindings:{leaveRequest:"<",leaveRequestStatuses:"<",absenceTypes:"<",role:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-actions.html"}],controllerAs:"actions",controller:a}),a.$inject=["$log","$rootScope","dialog","LeavePopup","LeaveRequestService","pubSub","shared-settings","notificationService"]}),define("leave-absences/shared/components/leave-request-popup-comments-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/models/session.model"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){q.request.comments.push({contact_id:y,leave_request_id:q.request.id,text:q.comment.text}),q.comment.text=""}function l(){return q.comment.text.length>0}function d(e){return!e.comment_id||q.canManage}function m(e){return n.utc(e,i.serverDateTimeFormat).local().format(s.DATE_FORMAT.toUpperCase()+" HH:mm")}function f(){return q.request.comments.filter(function(e){return!e.toBeDeleted})}function p(e){return e===y?"Me":q.comment.contacts[e]?q.comment.contacts[e].display_name:void 0}function h(e){return q.mode===e}function v(){q.comment.text.length&&q.addComment()}function b(){var n=e.indexBy(q.request.comments,"contact_id"),t=Object.keys(n);return r.all({id:{IN:t}},{page:1,size:0}).then(function(n){q.comment.contacts=e.indexBy(n.list,"contact_id")})}function g(){return q.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),q.request.comments.length&&b()})}function _(){return q.loading.component=!0,c.get().then(function(e){y=e.contactId}).then(function(){q.loading.component=!1})}t.debug("Component: leave-request-popup-comments-tab");var y=null,q=this;q.loading={component:!0},q.comment={text:"",contacts:{}},q.addComment=u,q.canRemoveComment=d,q.canSubmit=l,q.formatDateTime=m,q.getActiveComments=f,q.getCommentorName=p,q.isMode=h,q.onBeforeSubmit=v,function(){o.$emit("LeaveRequestPopup::addTab",q),g(),_()}()}t.component("leaveRequestPopupCommentsTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-comments-tab.html"}],controllerAs:"commentsCtrl",controller:["$log","$rootScope","$scope","HR_settings","shared-settings","Contact","Session",a]})}),define("leave-absences/shared/components/leave-request-popup-details-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/session.model","leave-absences/shared/models/calendar.model"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d,m){function f(){ne.balance.closing=ne.balance.opening+ne.balance.change.amount}function p(e){return n(e,c.serverDateFormat).toDate()}function h(e){return n(e).format(c.serverDateFormat)}function v(e){var n;return i.resolve().then(function(){N(e),"from"===e&&U(),S("hours")&&(_(e),"from"!==e||ne.uiOptions.multipleDays||_("to")),ne.loading[e+"DayTypes"]=!0}).then(function(){return q(e)}).then(function(e){if(n=e.id!==ne.period.id,n&&(ne.period=e),!ne.period.id)return i.reject("Please change date as it is not in any absence period")}).then(W).then(function(){if(n)return x()}).then(function(){return ne.onDateChangeExtended&&ne.onDateChangeExtended(e)}).then(function(){if(V(),!n)return E();o.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(D).finally(y)}function b(){return V(),E()}function g(){return ne.uiOptions.toDate=null,N("to"),i.resolve().then(V).then(ne.setDaysSelectionModeExtended).then(y).then(!ne.uiOptions.multipleDays&&E)}function _(e){ne.uiOptions.times[e].loading=!0}function y(){["from","to"].forEach(function(e){ne.loading[e+"DayTypes"]=!1,S("hours")&&(ne.uiOptions.times[e].loading=!1)})}function q(t){var a=n(ne.uiOptions[t+"Date"]).format(ne.uiOptions.userDateFormat.toUpperCase());return e.find(ne.absencePeriods,function(e){return e.isInPeriod(a)})||{}}function C(){return ne.request?ne.request.request_type:ne.leaveType||null}function T(e){return n().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function A(){return z(),ne.loading.balanceChange=!0,ne.request.getBalanceChangeBreakdown().then(j).catch(D)}function D(n){o.$broadcast("LeaveRequestPopup::handleError",e.isArray(n)?n:[n]),ne.loading.fromDayTypes=!1,ne.loading.balanceChange=!1,ne.loading.tab=!1,ne.loading.toDayTypes=!1}function P(){return ne.isMode("create")||ne.forceRecalculateBalanceChange?E():A()}function R(){var e=ne.request.attributes();return ne.uiOptions.fromDate=p(ne.request.from_date),ne.request.to_date=e.to_date,ne.request.to_date_type=e.to_date_type,ne.uiOptions.toDate=p(ne.request.to_date),ne.initDayTypesExtended?ne.initDayTypesExtended():i.resolve()}function I(){ee.push(o.$on("LeaveRequestPopup::absenceTypeChanged",function(){Q()}),o.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,n){J(n)}),o.$on("LeaveRequestPopup::recalculateBalanceChange",E))}function w(){ne.isMode("edit")&&(ne.isLeaveStatus(c.statusNames.approved)||ne.isLeaveStatus(c.statusNames.adminApproved))&&(Z={absenceTypeId:ne.request.type_id,value:ne.selectedAbsenceType.remainder-ne.request.balance_change})}function k(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function S(e){return ne.selectedAbsenceType.calculation_unit_name===e}function O(e){return ne.request.request_type===e}function L(n){return e.includes(["weekend","non_working_day","public_holiday"],n)}function M(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){ne.requestDayTypes=e})}function x(){return u.get(ne.request.contact_id,ne.period.start_date,ne.period.end_date).then(function(e){ne.calendar=e})}function $(){var e=(ne.pagination.currentPage-1)*ne.pagination.numPerPage,n=e+ne.pagination.numPerPage;ne.pagination.filteredbreakdown=ne.balance.change.breakdown.slice(e,n)}function E(){return z(),ne.canCalculateChange()?(ne.loading.balanceChange=!0,ne.request.change_balance=!0,ne.calculateBalanceChange().then(j).catch(D).finally(function(){ne.loading.balanceChange=!1})):i.resolve()}function B(){ne.pagination.totalItems=ne.balance.change.breakdown.length,ne.pagination.filteredbreakdown=ne.balance.change.breakdown,ne.pagination.pageChanged()}function F(){return h(ne.request.from_date)===h(ne.request.to_date)}function U(){ne.uiOptions.toDate&&ne.uiOptions.fromDate&&ne.uiOptions.multipleDays&&n(ne.uiOptions.toDate).isSameOrBefore(ne.uiOptions.fromDate)&&(ne.uiOptions.toDate=null,N("to"))}function N(e){ne.resetUIInputsExtended&&ne.resetUIInputsExtended(e),V(),z()}function j(e){ne.balance.change=e,ne.request.balance_change=e.amount,f(),B(),ne.loading.balanceChange=!1}function W(){var e,t,a;ne.uiOptions.fromDate?(e=n(ne.uiOptions.fromDate).add(1,"day").toDate(),a=e,t=e):(a=p(ne.period.start_date),t=ne.uiOptions.date.to.options.minDate),ne.uiOptions.date.to.options.initDate=t,ne.uiOptions.date.to.options.minDate=a,ne.uiOptions.date.to.options.maxDate=p(ne.period.end_date)}function H(){return!ne.isMode("create")&&F()||ne.isMode("create")&&(O("sickness")||S("hours"))?ne.uiOptions.multipleDays=!1:ne.uiOptions.multipleDays=!0,i.resolve().then(ne.setDaysSelectionModeExtended)}function Y(){Z&&Z.absenceTypeId===ne.selectedAbsenceType.id?ne.balance.opening=Z.value||0:ne.balance.opening=ne.selectedAbsenceType.remainder}function G(){ne.selectedAbsenceType=e.find(ne.absenceTypes,function(e){return e.id===ne.request.type_id})}function V(){var e=ne.uiOptions,n=e.times;ne.request.from_date=e.fromDate?h(e.fromDate):null,ne.request.to_date=e.toDate?h(e.toDate):null,!e.multipleDays&&e.fromDate&&(ne.request.to_date=ne.request.from_date,ne.request.to_date_type=ne.request.from_date_type),(S("hours")||O("toil"))&&(ne.request.from_date=ne.request.from_date&&n.from.time?ne.request.from_date+" "+n.from.time:null,ne.request.to_date=ne.request.to_date&&n.to.time?ne.request.to_date+" "+n.to.time:null)}function z(){ne.uiOptions.showBalance=ne.canCalculateChange()}function X(){e.forEach(ee,function(e){e()})}function Q(){var e,n=ne.selectedAbsenceType.calculation_unit_name;return G(),e=n!==ne.selectedAbsenceType.calculation_unit_name,Y(),i.resolve().then(e&&H).then(e&&ne.onAbsenceTypeUpdateExtended).then(e&&V).then(y).then(E)}function J(e){return ne.absenceTypes=e,G(),n(ne.uiOptions.toDate).isAfter(ne.period.end_date)&&(ne.uiOptions.toDate=void 0,N("to")),Y(),E()}function K(e){var n=T(e).add(ne.uiOptions.time_interval,"minutes");n.isAfter(T(ne.uiOptions.times.to.max))||(ne.uiOptions.times.to.min=n.format("HH:mm"),n.isAfter(T(ne.uiOptions.times.to.time))&&(ne.uiOptions.times.to.time=""))}a.debug("Component: leave-request-popup-details-tab");var Z=null,ee=[],ne=this;ne.canManage=!1,ne.calendar={},ne.errors=[],ne.isRequired=!0,ne.requestDayTypes=[],ne.statusNames=c.statusNames,ne.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},ne.pagination={currentPage:1,filteredbreakdown:ne.balance.change.breakdown,numPerPage:7,totalItems:ne.balance.change.breakdown.length,pageChanged:$},ne.uiOptions={isChangeExpanded:!1,multipleDays:!0,userDateFormat:r.DATE_FORMAT,showBalance:!1,date:{from:{show:!1,options:{startingDay:1,showWeeks:!1}},to:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}},expiry:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}}},times:{from:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""},to:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""}},time_interval:15},ne.convertDateFormatFromServer=p,ne.convertDateToServerFormat=h,ne.dateChangeHandler=v,ne.dateTypeChangeHandler=b,ne.daysSelectionModeChangeHandler=g,ne.disableAndShowLoadingTimeInput=_,ne.getMomentDateWithGivenTime=T,ne.handleError=D,ne.isCalculationUnit=S,ne.isLeaveType=O,ne.isNotWorkingDay=L,ne.performBalanceChangeCalculation=E,ne.setRequestDateTimesAndDateTypes=V,ne.updateEndTimeInputMinTime=K,ne.$onDestroy=X,function(){t("RequestModalDetails"+e.capitalize(C(ne.leaveType,ne.request))+"Controller",{detailsController:ne}),ne.canManage=ne.isRole("manager")||ne.isRole("admin"),ne.loading.tab=!0,s.$emit("LeaveRequestPopup::addTab",ne),I(),ne.initChildController().then(function(){return i.all([x(),M()])}).then(!ne.isMode("create")&&R).then(H).then(function(){if(!ne.isMode("create"))return i.resolve().then(ne.initTimesExtended).then(V)}).then(!ne.isMode("create")&&W).then(w).then(Y).then(P).then(k).then(!ne.isMode("view")&&ne.initWatchersExtended).catch(D).finally(function(){ne.loading.tab=!1})}()}t.component("leaveRequestPopupDetailsTab",{bindings:{absencePeriods:"<",absenceTypes:"<",balance:"=",request:"<",isLeaveStatus:"<",leaveType:"<",isMode:"<",isSelfRecord:"<",period:"=",isRole:"<",selectedAbsenceType:"=",forceRecalculateBalanceChange:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-details-tab.html"}],controllerAs:"detailsTab",controller:a}),a.$inject=["$controller","$log","$rootScope","$scope","$q","HR_settings","shared-settings","Calendar","OptionGroup","LeaveRequest","$timeout"]}),define("leave-absences/shared/components/leave-request-popup-files-tab",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/file-upload","common/services/file-mime-types","common/services/hr-settings"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l){function d(){return k.fileUploader&&k.fileUploader.queue.length>0}function m(){return k.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return k.request.loadAttachments().then(function(){o.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function C(){return a.all(R.map(function(e){return l.getMimeTypeFor(e.label).then(function(n){w[e.label]=n})})).catch(function(){w=null})}function T(){return c.valuesOf("safe_file_extension").then(function(e){R=e})}function A(e){return!e.attachment_id||k.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){k.fileUploader.queue&&k.fileUploader.queue.length>0?k.fileUploader.uploadAll({entityID:k.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},k=Object.create(this);return k.filesLoaded=!1,k.fileUploader=null,k.today=Date.now(),k.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",k.userDateFormat=i.DATE_FORMAT,k.$onDestroy=D,k.canRemoveAttachment=A,k.canSubmit=d,k.canUploadMore=m,k.formatDateTime=f,k.getAuthorName=p,k.getFilesAmount=h,k.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",k),g(),a.all([T(),q()]).then(_).finally(function(){k.filesLoaded=!0})}(),k}t.component("leaveRequestPopupFilesTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-files-tab.html"}],controllerAs:"filesTab",controller:["$log","$q","$rootScope","$scope","HR_settings","shared-settings","OptionGroup","FileUpload","fileMimeTypes",a]})}),define("leave-absences/shared/components/leave-request-record-actions.component",["leave-absences/shared/modules/components","common/services/hr-settings","common/services/before-hash-query-params.service"],function(e){function n(e,n,t){function a(e){n.openModal(e)}e.debug("Component: leave-request-record-actions");var o,s=this;s.leaveRequestOptions=[{type:"leave",icon:"briefcase",label:"Leave"},{type:"sickness",icon:"stethoscope",label:"Sickness"}],s.openLeavePopup=a,function(){o=t.parse(),o.openModal&&a({leaveType:o.openModal,selectedContactId:s.selectedContactId})}()}e.component("leaveRequestRecordActions",{bindings:{contactId:"<",selectedContactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-record-actions.html"}],controllerAs:"vm",controller:["$log","LeavePopup","beforeHashQueryParams",n]})}),define("leave-absences/shared/components/staff-leave-report.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/pub-sub"],function(e,n,t){function a(n,t,a,o,s,i,r,c,u,l,d,m){function f(e,n){n.data.push(e),n.dataIndex[e.id]=e}function p(){G.absenceTypes=G.absenceTypes.map(function(n){var t=e.find(G.entitlements,function(e){return e.type_id===n.id});return n.entitlement=t?t.value:0,n.remainder=t?t.remainder:{current:0,future:0},n})}function h(e){U(e),G.sections.other.open&&f(e,G.sections.other)}function v(){Object.values(G.sections).forEach(function(e){e.data=[]})}function b(){G.absenceTypesFiltered=G.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function g(e){var n=Y[e.status];n?n(e.leaveRequest):G.refresh()}function _(n){n.dataIndex=e.indexBy(n.data,"id")}function y(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return s.all().then(function(n){G.absencePeriods=e.sortBy(n,"start_date"),G.selectedPeriod=e.find(G.absencePeriods,function(e){return!0===e.current})})}function C(){return i.all().then(i.loadCalculationUnits).then(function(n){G.absenceTypes=n,G.absenceTypesIndexed=e.indexBy(n,"id")})}function T(){return w("approved",{status_id:H(m.statusNames.approved)})}function A(){var n={contact_id:G.contactId,period_id:G.selectedPeriod.id};return t.all([c.balanceChangeByAbsenceType(e.assign({},n,{public_holiday:!0})),c.balanceChangeByAbsenceType(e.assign({},n,{expired:!0})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[H(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[H(m.statusNames.awaitingApproval),H(m.statusNames.moreInformationRequired)]}}))]).then(function(e){G.absenceTypes.forEach(function(n){n.balanceChanges={holidays:e[0][n.id],expired:e[1][n.id],approved:e[2][n.id],pending:e[3][n.id]}})})}function D(){return r.all({contact_id:G.contactId,period_id:G.selectedPeriod.id},!0).then(function(e){G.entitlements=e})}function P(){return r.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id},G.entitlements).then(function(){return E(G.entitlements)}).then(function(e){G.sections.entitlements.data=e})}function R(){return t.all([r.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id,expired:!0}),I({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:E(e[0]),expiredTOILS:B(e[1].list)})}).then(function(n){G.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),G.sections.expired.data=e.sortBy(G.sections.expired.data,"expiry_date")})}function I(n){return c.all(e.assign({contact_id:G.contactId,from_date:{from:G.selectedPeriod.start_date},to_date:{to:G.selectedPeriod.end_date},type_id:{IN:G.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function w(e,n){return I(n).then(function(n){G.sections[e].data=n.list})}function k(){return t.all(Object.values(G.sections).filter(function(e){return e.open}).map(M))}function S(){return w("other",{status_id:{in:[H(m.statusNames.rejected),H(m.statusNames.cancelled)]}})}function O(){return w("pending",{status_id:{in:[H(m.statusNames.awaitingApproval),H(m.statusNames.moreInformationRequired)]}})}function L(){return w("holidays",{public_holiday:!0})}function M(e){return e.loading=!0,e.loadLeaveRequests().then(_.bind(this,e)).then(function(){e.loading=!1})}function x(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){G.leaveRequestStatuses=e.indexBy(n,"value")})}function $(){p(),b()}function E(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(G.entitlements,function(e){return e.id===n.id});return n.breakdown.map(function(n){return e.assign(e.clone(n),{type_id:t.type_id})})})}).then(function(e){return Array.prototype.concat.apply([],e)})}function B(n){return t.resolve().then(function(){return n.map(function(n){return e.assign({},n,{expiry_date:n.toil_expiry_date,amount:n.toil_to_accrue,type:{label:"Accrued TOIL"}})})})}function F(){l.subscribe("LeaveRequest::new",function(){G.refresh()}),l.subscribe("LeaveRequest::edit",function(){G.refresh()}),l.subscribe("LeaveRequest::statusUpdate",g),l.subscribe("LeaveRequest::delete",function(e){U(e)})}function U(n){e.forEach(G.sections,function(t,a){t.dataIndex[n.id]&&(e.remove(t.data,function(e){return e.id===n.id}),delete t.dataIndex[n.id],"other"!==a&&N(n,a))})}function N(n,t){var a=["future","current"],o=G.absenceTypesIndexed[n.type_id];"pending"===t&&e.pull(a,"current"), -o.balanceChanges[t]-=n.balance_change,a.forEach(function(e){o.remainder[e]-=n.balance_change})}function j(){G.loading.content=!0,t.all([D(),A()]).then($).then(function(){G.loading.content=!1}).then(function(){return t.all([k(),v()])})}function W(e){var n=G.sections[e];n.open=!n.open,n.open&&!n.data.length&&M(n)}function H(n){return e.find(G.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var Y={delete:U,cancel:h},G=this;G.absencePeriods=[],G.absenceTypes=[],G.absenceTypesFiltered=[],G.absenceTypesIndexed={},G.dateFormat=d.DATE_FORMAT,G.leaveRequestStatuses={},G.selectedPeriod=null,G.role="absence-tab"===a.section?"admin":"staff",G.loading={content:!0,page:!0},G.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:T},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:R},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:S}},G.labelPeriod=y,G.refresh=j,G.toggleSection=W,function(){t.all([x(),C(),q()]).then(function(){G.loading.page=!1}).then(function(){return t.all([D(),A()])}).then($).then(function(){G.loading.content=!1}),F()}()}t.component("staffLeaveReport",{bindings:{contactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/staff-leave-report.html"}],controllerAs:"report",controller:["$log","$q","$rootScope","checkPermissions","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","OptionGroup","pubSub","HR_settings","shared-settings",a]})}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){return i.request.calculateBalanceChange(i.selectedAbsenceType.calculation_unit_name)}function l(){var e=i.request,n=!!e.from_date&&!!e.to_date,t=i.selectedAbsenceType.calculation_unit_name;return"days"===t?n=n&&!!e.from_date_type&&!!e.to_date_type:"hours"===t&&(n=n&&!isNaN(+e.from_date_amount)&&!isNaN(+e.to_date_amount)),n}function d(){return i.canCalculateChange()}function m(n,t){var a=i.uiOptions.times[n],o=e.clone(t.time_from),s=e.clone(t.time_to);i.uiOptions.multipleDays||("from"===n&&s&&o&&(s=i.getMomentDateWithGivenTime(s).subtract(i.uiOptions.time_interval,"minutes").format("HH:mm")),"to"===n&&o&&s&&(o=i.getMomentDateWithGivenTime(o).add(i.uiOptions.time_interval,"minutes").format("HH:mm"))),a.min=o||"00:00",a.max=s||"00:00",a.time="to"===n?a.max:a.min}function f(n,t){return n?(n=i.convertDateToServerFormat(n),v(n).then(function(t){return t?i.requestDayTypes.filter(function(e){return"public_holiday"===e.name}):p(n,i.requestDayTypes).then(function(n){return n.length?n:i.requestDayTypes.filter(function(n){return e.includes(["all_day","half_day_am","half_day_pm"],n.name)})})}).then(function(e){return I(t,e),e})):o.reject([])}function p(e,t){return e=n(e),o.all([i.calendar.isNonWorkingDay(e),i.calendar.isWeekend(e)]).then(function(e){return e[0]?"non_working_day":e[1]?"weekend":null}).then(function(e){return e?t.filter(function(n){return n.name===e}):[]})}function h(e,t){return n.duration(t).subtract(n.duration(e)).asHours()}function v(e){return c.all({public_holiday:1,contact_id:i.request.contact_id,from_date:{from:e},to_date:{to:e}}).then(function(e){return!!e.list.length})}function b(){return o.resolve()}function g(){return A(i.uiOptions.fromDate,"from").then(function(){return A(i.uiOptions.toDate,"to")})}function _(e){s.$watch(function(){return i.uiOptions.times[e].amount},function(e,n){i.isCalculationUnit("days")||+e==+n||(i.isRole("staff")&&(i.request.change_balance=!0),S(),i.performBalanceChangeCalculation())})}function y(e){var t=n(i.request[e+"_date"]).format("HH:mm"),a=i.uiOptions.times[e];(h(a.min,t)<=0||h(a.max,t)>=0)&&(t="from"===e?a.min:a.max),i.uiOptions.times[e].time=t}function q(){var e=i.uiOptions.multipleDays?["from","to"]:["from"],n=i.uiOptions.times;if(i.isCalculationUnit("hours"))return o.all(e.map(P)).then(function(){["from","to"].forEach(function(e){y(e),k(e),n[e].amount=Math.min(i.request[e+"_date_amount"],n[e].maxAmount).toString()}),i.uiOptions.multipleDays||i.updateEndTimeInputMinTime(i.uiOptions.times.from.time)}).then(S)}function C(){["from","to"].forEach(function(e){_(e),T(e)})}function T(e){s.$watch(function(){return i.uiOptions.times[e].time},function(n,t){i.isCalculationUnit("days")||n===t||(i.setRequestDateTimesAndDateTypes(),n&&k(e,!0))})}function A(e,n){return f(e,n).then(function(){i.loading[n+"DayTypes"]=!1})}function D(e){return A(i.uiOptions[e+"Date"],e).then(function(){if(i.isCalculationUnit("hours"))return P(e).then(function(){k(e,!0)})})}function P(e){var n=i.uiOptions[e+"Date"],t=!i.uiOptions.multipleDays;return n?i.request.getWorkDayForDate(i.convertDateToServerFormat(n)).then(function(n){L[e]=n,m(e,n),t&&"from"===e&&m("to",n)}).catch(function(n){return L[e]={},i.handleError(n)}).finally(function(){i.uiOptions.times[e].loading=!1,t&&(i.uiOptions.times.to.loading=!1)}):o.resolve()}function R(n){var t=i.uiOptions.times[n];i["request"+e.startCase(n)+"DayTypes"]=[],t.time="",t.min="00:00",t.max="00:00",t.amount="0",t.maxAmount="0"}function I(n,t){var a="request"+e.startCase(n)+"DayTypes";i[a]=t,i.isMode("create")&&(i.request[n+"_date_type"]=i[a][0].value)}function w(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?(i.disableAndShowLoadingTimeInput("from"),!i.uiOptions.multipleDays&&i.disableAndShowLoadingTimeInput("to"),P("from").then(function(){k("from",!0)})):o.resolve()}function k(e,n){var t=i.uiOptions,a=t.multipleDays?e:"from",o=t.times[a],s=t.multipleDays&&"to"===a?o.min:t.times.from.time,r=t.multipleDays&&"from"===a?o.max:t.times.to.time,c=L[a].number_of_hours?h(s,r).toString():"0";o.maxAmount=c,n&&(o.amount=o.maxAmount)}function S(){var e=i.uiOptions.times;i.request.from_date_amount=isNaN(+e.from.amount)?null:e.from.amount,i.request.to_date_amount=isNaN(+e.to.amount)?null:e.to.amount}function O(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?P("from").then(function(){k("from",!0)}):o.resolve()}var L={};a.debug("RequestModalDetailsLeaveController"),i.calculateBalanceChange=u,i.canCalculateChange=l,i.canSubmit=d,i.initChildController=b,i.initDayTypesExtended=g,i.initTimesExtended=q,i.initWatchersExtended=C,i.onAbsenceTypeUpdateExtended=O,i.onDateChangeExtended=D,i.resetUIInputsExtended=R,i.setDaysSelectionModeExtended=w}t.controller("RequestModalDetailsLeaveController",a),a.$inject=["$controller","$log","$q","$rootScope","detailsController","PublicHoliday","LeaveRequest"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller",["common/lodash","leave-absences/shared/modules/controllers"],function(e,n){function t(n,t,a,o,s,i,r){function c(){return!(!r.canCalculateChange()||!r.request.sickness_reason)}function u(){return a.all([m(),h(),f(!0)])}function l(n){var t=r.request.getDocumentArray();return!!e.find(t,function(e){return e===n})}function d(n){return!!e.find(r.sicknessDocumentTypes,function(e){return e.value===n})}function m(){return i.valuesOf("hrleaveandabsences_leave_request_required_document").then(function(e){r.sicknessDocumentTypes=e})}function f(n){return i.valuesOf("hrleaveandabsences_sickness_reason",n).then(function(n){r.sicknessReasons=e.indexBy(n,"name")})}function p(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_sickness_reason?reset=1").on("crmUnload",function(){f(!1)})}function h(){r.showSicknessOptionsEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}t.debug("RequestModalDetailsSicknessController"),n("RequestModalDetailsLeaveController",{detailsController:r}),r.canSubmit=c,r.initChildController=u,r.isChecked=l,r.isDocumentInRequest=d,r.openSicknessReasonOptionsEditor=p}n.controller("RequestModalDetailsSicknessController",t),t.$inject=["$controller","$log","$q","$rootScope","crmAngService","api.optionGroup","detailsController"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){return c.balance.change.amount=+c.request.toil_to_accrue,a.resolve(c.balance.change)}function l(){if(!c.request.from_date||!c.request.to_date)return c.uiOptions.max_toil_duration_and_accrual=null,void(c.uiOptions.toil_duration_in_hours=null);c.uiOptions.max_toil_duration_and_accrual=n.duration(n(c.request.to_date).diff(c.request.from_date)).asHours()}function d(){return v().catch(function(e){return e.length&&(c.errors=e),a.reject(e)}).then(function(e){return r.calculateToilExpiryDate(c.request.type_id,e)}).then(function(e){return c.request.toil_expiry_date=e,c.uiOptions.expiryDate=new Date(e),e})}function m(){return!!c.request.toil_to_accrue}function f(){var e=c.uiOptions.multipleDays&&!!c.request.to_date,n=!c.uiOptions.multipleDays&&!!c.request.from_date,t=n||e,a=N.from_date!==c.request.from_date||N.to_date!==c.request.to_date;return c.canDisplayToilExpirationField&&t&&W.hasExpirationFromAdminSettings&&a}function p(){return!!(c.request.from_date&&c.request.to_date&&c.request.toil_duration&&c.request.toil_to_accrue)}function h(){c.request.toil_expiry_date=!1,c.uiOptions.expiryDate=null}function v(){var e=c.uiOptions.multipleDays,n=c.request;return b({hasErrors:e?!n.to_date&&!n.from_date:!n.from_date,label:e?"To Date":"From Date",value:n.to_date})}function b(e){if(e.hasErrors){var t="Please select "+e.label+" to find expiry date";return a.reject([t])}return e.value?a.resolve(n(e.value).format("YYYY-MM-DD")):a.reject([])}function g(){var e=c.isMode("create")&&W.hasExpirationFromAdminSettings,n=W.hasPreviousExpirationDate,t=c.isLeaveType("toil"),a=c.canManage;c.canDisplayToilExpirationField=t&&(a||e||n)}function _(){c.uiOptions.toil_duration_in_hours=c.request.toil_duration/60}function y(){return W.hasPreviousExpirationDate=c.isMode("edit")&&!!c.request.toil_expiry_date,r.canExpire(c.request.type_id).then(function(e){W.hasExpirationFromAdminSettings=e})}function q(){return c.request.to_date_type=c.request.from_date_type="1",y().then(g).then(C).then(I)}function C(){c.canManage&&(c.uiOptions.expiryDate=c.convertDateFormatFromServer(c.request.toil_expiry_date))}function T(){o.$watch(function(){return c.request.toil_to_accrue},function(e,n){+e!=+n&&c.performBalanceChangeCalculation()})}function A(){o.$watch(function(){return c.uiOptions.toil_duration_in_hours},function(e,n){e!==n&&c.isCalculationUnit("hours")&&O(),c.request.toil_duration=c.uiOptions.toil_duration_in_hours?60*c.uiOptions.toil_duration_in_hours:null})}function D(){var e=c.uiOptions.times;e.from.time=n(c.request.from_date).format("HH:mm"),e.to.time=n(c.request.to_date).format("HH:mm"),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time)}function P(){["from","to"].forEach(function(e){o.$watch(function(){return c.uiOptions.times[e].time},function(e,n){e!==n&&(c.setRequestDateTimesAndDateTypes(),F(),l(),L())})})}function R(){c.isMode("view")||(T(),A(),P())}function I(n){return i.valuesOf("hrleaveandabsences_toil_amounts",n).then(function(n){c.toilAmounts=e.sortBy(n,function(e){return+e.weight})})}function w(){return l(),L(),F()}function k(){return x(),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time),l(),j?j=!1:L(),F()}function S(e){c.uiOptions.times[e].time=""}function O(){c.request.toil_to_accrue=c.uiOptions.toil_duration_in_hours}function L(){c.uiOptions.toil_duration_in_hours=c.uiOptions.max_toil_duration_and_accrual}function M(){N=e.cloneDeep(c.request.attributes())}function x(){c.uiOptions.multipleDays?["from","to"].forEach(function(e){c.uiOptions.times[e].min="00:00",c.uiOptions.times[e].max="23:45"}):(c.uiOptions.times.from.min="00:00",c.uiOptions.times.from.max="23:30",c.uiOptions.times.to.min="00:15",c.uiOptions.times.to.max="23:45")}function $(){c.setRequestDateTimesAndDateTypes(),l(),L(),c.isCalculationUnit("hours")?O():c.request.toil_to_accrue=null}function E(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_toil_amounts?reset=1").on("crmUnload",function(){I(!1)})}function B(){c.showTOILAccrualsOptionEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}function F(){return f()?d().catch(a.resolve):a.resolve()}function U(){c.uiOptions.expiryDate&&(c.request.toil_expiry_date=c.convertDateToServerFormat(c.uiOptions.expiryDate))}t.debug("RequestModalDetailsToilController");var N,j=!c.isMode("create"),W={hasPreviousExpirationDate:null,hasExpirationFromAdminSettings:null};c.canDisplayToilExpirationField=!1,c.calculateBalanceChange=u,c.canCalculateChange=m,c.canSubmit=p,c.clearExpiryDate=h,c.initChildController=q,c.initTimesExtended=D,c.initWatchersExtended=R,c.onAbsenceTypeUpdateExtended=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=S,c.setDaysSelectionModeExtended=k,c.updateExpiryDate=U,function(){M(),x(),B(),!c.isMode("create")&&_()}()}t.controller("RequestModalDetailsToilController",a),a.$inject=["$log","$q","$rootScope","crmAngService","OptionGroup","AbsenceType","detailsController"]}),define("leave-absences/shared/services/leave-calendar.service",["common/lodash","common/moment","leave-absences/shared/modules/services"],function(e,n,t){"use strict";function a(t,a,o,s){function i(t){function i(){return o.all().then(function(e){return e.list})}function r(){return o.leaveManagees(void 0,{unassigned:!0})}function c(){var n=e.get(t,"filters.userSettings.assignedTo.type","all");return m().then(function(e){return t.lookupContacts=e,a.all([d(),"me"!==n?u():a.resolve(null)])}).then(function(e){var n=e[0];return t.contactIdsToReduceTo=e[1],n})}function u(){return l().then(function(a){var o=a.filter(function(e){var a=e.info.details;return n(a.period_start_date).isSameOrBefore(t.selectedPeriod.end_date)&&(n(a.period_end_date).isSameOrAfter(t.selectedPeriod.start_date)||!a.period_end_date)});return e.uniq(o.map(function(e){return e.contact_id}))})}function l(){return v?a.resolve(v):s.all()}function d(){return o.all(h(),null,"display_name").then(function(e){return e.list})}function m(){var n=e.get(t,"filters.userSettings.assignedTo.type","all");return(0,b[n])()}function f(){return m().then(function(e){t.lookupContacts=e}).then(d)}function p(){return o.leaveManagees(t.contactId)}function h(){var n={department:e.get(t,"filters.userSettings.department.value",null),level_type:e.get(t,"filters.userSettings.level_type.value",null),location:e.get(t,"filters.userSettings.location.value",null),region:e.get(t,"filters.userSettings.region.value",null)},a=!!t.filters.userSettings.contact,o=e.isArray(t.lookupContacts)&&t.lookupContacts.length,s="all"!==e.get(t,"filters.userSettings.assignedTo.type","all");return a?n.id={IN:[t.filters.userSettings.contact.id]}:(s||o)&&(n.id={IN:e.pluck(t.lookupContacts,"id")}),n}var v,b={all:i,me:p,unassigned:r};return{loadContactsForAdmin:c,loadFilteredContacts:d,loadLookUpContacts:m,loadLookUpAndFilteredContacts:f}}return t.debug("LeaveCalendarService"),{init:i}}t.factory("LeaveCalendarService",a),a.$inject=["$log","$q","Contact","Contract"]}),define("leave-absences/shared/instances/absence-period.instance",["leave-absences/shared/modules/models-instances","common/moment","common/models/instances/instance","common/services/hr-settings"],function(e,n){"use strict";e.factory("AbsencePeriodInstance",["$log","ModelInstance","HR_settings",function(e,t,a){return e.debug("AbsencePeriodInstance"),t.extend({defaultCustomData:function(){return{current:!1}},transformAttributes:function(e){var t=n();return e.current=!1,n(e.start_date).isSameOrBefore(t,"day")&&n(e.end_date).isSameOrAfter(t,"day")&&(e.current=!0),e},isInPeriod:function(e){var t=a.DATE_FORMAT.toUpperCase(),o=n(e,t);return n(this.start_date).isSameOrBefore(o)&&n(this.end_date).isSameOrAfter(o)}})}])}),define("leave-absences/shared/apis/absence-period.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("AbsencePeriodAPI",["$log","api",function(e,n){return e.debug("AbsencePeriodAPI"),n.extend({all:function(n){return e.debug("AbsencePeriodAPI"),this.sendGET("AbsencePeriod","get",n).then(function(e){return e.values})}})}])}),define("leave-absences/shared/models/absence-period.model",["leave-absences/shared/modules/models","common/moment","leave-absences/shared/modules/shared-settings","leave-absences/shared/instances/absence-period.instance","leave-absences/shared/apis/absence-period.api","common/models/model","common/services/hr-settings"],function(e,n){"use strict";e.factory("AbsencePeriod",["$log","Model","AbsencePeriodAPI","AbsencePeriodInstance","shared-settings",function(e,t,a,o,s){return e.debug("AbsencePeriod"),t.extend({all:function(e){return a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},current:function(){var e=n().format(s.serverDateFormat),t={start_date:{"<=":e},end_date:{">=":e}};return a.all(t).then(function(e){return e&&e.length?o.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/public-holiday.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("PublicHolidayAPI",["$log","api",function(e,n){return e.debug("PublicHolidayAPI"),n.extend({all:function(n){return e.debug("PublicHolidayAPI"),this.sendGET("PublicHoliday","get",n).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/public-holiday.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("PublicHolidayInstance",["$log","ModelInstance",function(e,n){return e.debug("PublicHolidayInstance"),n.extend({})}])}),define("leave-absences/shared/models/public-holiday.model",["common/moment","leave-absences/shared/modules/models","common/models/model","common/services/hr-settings","leave-absences/shared/apis/public-holiday.api","leave-absences/shared/instances/public-holiday.instance"],function(e,n){"use strict";n.factory("PublicHoliday",["$log","Model","PublicHolidayAPI","PublicHolidayInstance","shared-settings",function(n,t,a,o,s){return n.debug("PublicHoliday"),t.extend({all:function(e){return n.debug("PublicHoliday.all",e),a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},isPublicHoliday:function(t){n.debug("PublicHoliday.isPublicHoliday",t);var o=e(t).format(s.serverDateFormat),i={date:o};return a.all(i).then(function(e){return!!e.length})}})}])}),define("leave-absences/shared/instances/sickness-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,n){"use strict";n.factory("SicknessRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(n,t){return t.extend({defaultCustomData:function(){var n={sickness_reason:null,sickness_required_documents:"",request_type:"sickness"};return e.assign({},t.defaultCustomData(),n)},getDocumentArray:function(){return this.sickness_required_documents?this.sickness_required_documents.split(","):[]},toggleDocument:function(n){var t=this.getDocumentArray(),a=t.indexOf(n);e.contains(t,n)?t.splice(a,1):t.push(n),this.sickness_required_documents=t.join(",")},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])}})}])}),define("leave-absences/shared/instances/toil-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,n){"use strict";n.factory("TOILRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(n,t){return t.extend({defaultCustomData:function(){var n={from_date_amount:0,to_date_amount:0,request_type:"toil"};return e.assign({},t.defaultCustomData(),n)},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])}})}])}),define("leave-absences/shared/controllers/request.controller",["common/angular","leave-absences/shared/modules/controllers","common/lodash","common/moment","common/models/contact","common/models/session.model","common/services/api/option-group","common/services/hr-settings","common/services/pub-sub","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/instances/leave-request.instance","leave-absences/shared/instances/sickness-request.instance","leave-absences/shared/instances/toil-request.instance","leave-absences/shared/services/leave-request.service"],function(e,n,t,a){"use strict";function o(n,o,s,i,r,c,u,l,d,m,f,p,h,v,b,g,_,y,q,C,T){function A(e){"days"===Ee.selectedAbsenceType.calculation_unit_name?delete Ee.request[e+"_date_amount"]:delete Ee.request[e+"_date_type"]}function D(){["from","to"].forEach(A)}function P(){var e=Ee.requestStatuses[y.statusNames.awaitingApproval].value;Se.status_id===e&&e!==Ee.request.status_id&&d.publish("ManagerBadge:: Update Count")}function R(){return $e.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return $e.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function w(){return!Ee.loading.entitlements&&(!!re("admin")||!se("view")&&!(re("manager")&&!se("create")))}function k(){var e=R();return Ee.isMode("edit")&&(e=e&&(G()||I())),Ee.canManage&&Ee.requestStatuses&&(e=e&&!!Ee.getStatusFromValue(Ee.newStatusOnSave)),(e=e&&!!Ee.period.id)&&!Ee.isMode("view")}function S(){Ee.isSelfRecord?Ee.request.status_id=Ee.requestStatuses[y.statusNames.awaitingApproval].value:Ee.canManage&&(Ee.request.status_id=Ee.newStatusOnSave||Ee.request.status_id)}function O(){if(Ee.isMode("edit")&&!Ee.isRole("staff")&&"toil"!==j())return Ee.request.calculateBalanceChange(Ee.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Ee.balance.change.amount!=+e.amount)return T.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function L(){return"toil"!==j()&&!Ee.request.change_balance}function M(){Ee.errors=[]}function x(){return Ee.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function $(){te()&&!Ee.isRole("staff")&&(Ee.request.change_balance=!0)}function E(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Ee.request.delete().then(function(){Ee.dismissModal(),d.publish("LeaveRequest::delete",Ee.request)})}})}function B(){r.dismiss({$value:"cancel"})}function F(){var e=j();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function U(){return N(Ee.getStatusFromValue(Ee.request.status_id).name)}function N(e){return t.map(we[e],function(e){return Ee.requestStatuses[e]})}function j(){return Ee.request?Ee.request.request_type:Ee.leaveType||null}function W(){return!Ee.request||e.equals({},Ee.requestStatuses)?[]:Ee.request.status_id?U():N("none")}function H(e){return t.find(Ee.requestStatuses,function(n){return n.value===e})}function Y(e){Ee.errors=t.isArray(e)?e:[e],Ee.loading.absenceTypes=!1,Ee.submitting=!1}function G(){return!e.equals(Se,Ee.request.attributes())||Ee.canManage&&Ee.newStatusOnSave}function V(){return Ee.postContactSelection=!0,Ee.staffMemberSelectionComplete=!1,Ee.request.contact_id?o.resolve().then(ue).then(le).then(be).then(_e).then(ne).then(X).then(Ee.isMode("edit")?ye:t.noop).then(function(){Ee.postContactSelection=!1,Ee.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return o.reject(e)}):o.reject("The contact id was not set")}function z(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];we.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],we.awaiting_approval=e,we.more_information_required=e,we.rejected=e,we.approved=e,we.cancelled=[y.statusNames.awaitingApproval].concat(e)}function X(){return Ee.canManage?f.find(Ee.request.contact_id).then(function(e){Ee.contactName=e.display_name}):o.resolve()}function Q(){var e="my-leave"===s.section,n=+Le==+t.get(Ee,"leaveRequest.contact_id"),a=!t.get(Ee,"leaveRequest.id");Ee.isSelfRecord=e&&(n||a)}function J(){Oe.push(s.$on("LeaveRequestPopup::requestObjectUpdated",ye),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){le().then(be).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Ee.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,n){Y(n)}),s.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),i.$on("$destroy",De),i.$on("LeaveRequestPopup::addTab",function(e,n){$e.push(n)})}function K(){var e,n;Ee.request=Ee.leaveRequest||null,e=j(),n=Ee.initRequestAttributes(),"leave"===e?Ee.request=_.init(n):"sickness"===e?Ee.request=q.init(n):"toil"===e&&(Ee.request=C.init(n))}function Z(){var e={};return Ee.request?e=Ee.request.attributes():Ee.canManage||(e={contact_id:Le}),e}function ee(){if(xe="staff",!Ee.isSelfRecord)return c(y.permissions.admin.administer).then(function(e){e&&(xe="admin")}).then(function(){return"staff"===xe&&c(y.permissions.ssp.manage).then(function(e){e&&(xe="manager")})}).finally(function(){Ee.canManage=Ee.isRole("manager")||Ee.isRole("admin")})}function ne(){Ee.defaultStatus?Ee.newStatusOnSave=Ee.requestStatuses[y.statusNames[Ee.defaultStatus]].value:(Ee.isRole("admin")||Ee.isMode("create")&&Ee.isRole("manager"))&&(Ee.newStatusOnSave=Ee.requestStatuses[y.statusNames.approved].value)}function te(){return!Ee.request.status_id||!t.includes(["cancelled","rejected"],H(Ee.request.status_id).name)}function ae(e){var n=Ee.getStatusFromValue(Ee.request.status_id);return!!n&&n.name===e}function oe(e){return Ee.request&&Ee.request.request_type===e}function se(e){return Ee.mode===e}function ie(e,n){var t=a(e.from_date),o=a(e.to_date);return t.isSameOrAfter(n.start_date,"day")&&o.isSameOrBefore(n.end_date,"day")}function re(e){return xe===e}function ce(){return h.all().then(function(e){Ee.absencePeriods=e})}function ue(){return v.all(F()).then(v.loadCalculationUnits).then(function(e){Ie={types:e,ids:e.map(function(e){return e.id})}})}function le(){return Ee.loading.entitlements=!0,b.all({contact_id:Ee.request.contact_id,period_id:Ee.period.id,type_id:{IN:Ie.ids}},!0).finally(function(){Ee.loading.entitlements=!1})}function de(){return p.get().then(function(e){Le=e.contactId})}function me(){return Ee.selectedContactId?f.find(Ee.selectedContactId).then(function(e){Ee.managedContacts=[e]}):Ee.isRole("admin")?f.all().then(function(e){Ee.managedContacts=t.remove(e.list,function(e){return e.id!==Le})}):f.find(Le).then(function(e){return e.leaveManagees()}).then(function(e){Ee.managedContacts=e})}function fe(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Ee.requestStatuses=t.indexBy(e,"name")})}function pe(e,n){var a;return t.compact(e.map(function(e){if(a=t.find(n,{type_id:e.id}))return{id:a.type_id,title:e.title+" ( "+a.remainder.current+" ) ",remainder:a.remainder.current,allow_overuse:e.allow_overuse,calculation_unit_name:e.calculation_unit_name}}))}function he(e){P(),d.publish(e,Ee.request),Ee.errors=[],Ee.dismissModal()}function ve(){["from","to"].forEach(function(e){Ee.request[e+"_date"]=Se[e+"_date"]})}function be(e){if(Ee.absenceTypes=pe(Ie.types,e),!Ee.absenceTypes.length)return o.reject(Me)}function ge(){Ee.period=t.find(Ee.absencePeriods,function(e){return Ee.isMode("create")?e.current:ie(Ee.request,e)})}function _e(){Ee.isMode("create")?(Ee.selectedAbsenceType=Ee.absenceTypes[0],Ee.request.type_id=Ee.selectedAbsenceType.id):Ee.selectedAbsenceType=t.find(Ee.absenceTypes,function(e){return e.id===Ee.request.type_id})}function ye(){Se=e.copy(Ee.request.attributes())}function qe(){var e;Ee.request.id?(e=[Ee.requestStatuses[y.statusNames.approved].value,Ee.requestStatuses[y.statusNames.adminApproved].value,Ee.requestStatuses[y.statusNames.rejected].value,Ee.requestStatuses[y.statusNames.cancelled].value],Ee.mode="edit",Ee.isRole("staff")&&e.indexOf(Ee.request.status_id)>-1&&(Ee.mode="view")):Ee.mode="create"}function Ce(){var e=Ee.request.status_id;if(!Ee.isMode("view")&&!Ee.submitting)return Ee.submitting=!0,S(),D(),Ee.request.isValid().then(te()&&O).then($).then(L()&&ve).then(Te).then(function(){return Ee.isMode("edit")?Re():x()}).catch(function(n){Ee.request.status_id=e,n&&Y(n)}).finally(function(){Ee.submitting=!1})}function Te(){return o.all($e.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Ae(){function e(e){e&&t.push(e),++a===ke&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return ke>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function De(){Oe.forEach(function(e){e()})}function Pe(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Re(){return Ee.request.update().then(Ae).then(function(){Ee.isRole("manager")?he("LeaveRequest::updatedByManager"):(Ee.isRole("staff")||Ee.isRole("admin"))&&he("LeaveRequest::edit")})}n.debug("RequestCtrl");var Ie,we={},ke=0,Se={},Oe=[],Le="",Me="No entitlement",xe="",$e=[],Ee=t.assign(this,m);Ee.absencePeriods=[],Ee.absenceTypes=[],Ee.canManage=!1,Ee.contactName=null,Ee.errors=[],Ee.loading={absenceTypes:!0,entitlements:!0},Ee.managedContacts=[],Ee.mode="",Ee.newStatusOnSave=null,Ee.period={},Ee.postContactSelection=!1,Ee.requestStatuses={},Ee.selectedAbsenceType={},Ee.staffMemberSelectionComplete=!1,Ee.submitting=!1,Ee.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Ee.canChangeAbsenceType=w,Ee.canSubmit=k,Ee.closeAlert=M,Ee.deleteLeaveRequest=E,Ee.dismissModal=B,Ee.getStatuses=W,Ee.getStatusFromValue=H,Ee.initAfterContactSelection=V,Ee.initRequestAttributes=Z,Ee.isLeaveStatus=ae,Ee.isLeaveType=oe,Ee.isMode=se,Ee.isRole=re,Ee.submit=Ce,Ee.updateAbsenceType=Pe,function(){Ee.loading.absenceTypes=!0,z(),J(),de().then(Q).then(function(){return o.all([ee(),ce(),fe()])}).then(K).then(qe).then(ge).then(function(){return Ee.canManage&&!Ee.isMode("edit")&&me()}).then(function(){if(Ee.selectedContactId&&(Ee.request.contact_id=Ee.selectedContactId),Ee.request.contact_id)return Ee.initAfterContactSelection()}).catch(Y).finally(function(){Ee.loading.absenceTypes=!1})}()}n.controller("RequestCtrl",o),o.$inject=["$log","$q","$rootScope","$scope","$uibModalInstance","checkPermissions","api.optionGroup","dialog","pubSub","directiveOptions","Contact","Session","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","LeaveRequestInstance","shared-settings","SicknessRequestInstance","TOILRequestInstance","LeaveRequestService"]}),define("leave-absences/shared/services/leave-popup.service",["common/lodash","common/modules/angular-date","leave-absences/shared/modules/services","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/controllers/request.controller"],function(e,n){"use strict";function t(e,n,t,a,o,s,i,r,c){function u(e){return r.get().then(function(n){return e.roleOf(n.contactId)}).then(function(e){return"none"!==e})}function l(e){a.open({appendTo:n.children().eq(0),templateUrl:s.sharedPathTpl+"components/leave-request-popup/leave-request-popup.html",controller:"RequestCtrl",controllerAs:"$ctrl",windowClass:"chr_leave-request-modal",resolve:{directiveOptions:function(){return e},format:["DateFormat",function(e){return e.getDateFormat()}]}})}function d(e){return c.find(e).then(function(e){return u(e).then(function(n){n?l({leaveRequest:e,leaveType:e.request_type,selectedContactId:e.contact_id -}):o.error("Error","You dont have permission to see this leave request")})}).catch(function(e){o.error("Error",e)})}return e.debug("LeavePopup"),{openModal:l,openModalByID:d}}n.factory("LeavePopup",t),t.$inject=["$log","$rootElement","$rootScope","$uibModal","notificationService","shared-settings","DateFormat","Session","LeaveRequest"]}),define("leave-absences/absence-tab/modules/components",["common/angular"],function(e){return e.module("absence-tab.components",[])}),function(e){define("leave-absences/absence-tab/components/absence-tab-container.component",["leave-absences/absence-tab/modules/components"],function(n){function t(n,t,a){n.debug("Component: absence-tab-container"),t.section="absence-tab",this.contactId=e.adminId,function(){a.getDateFormat()}()}n.component("absenceTabContainer",{templateUrl:["settings",function(e){return e.pathTpl+"components/absence-tab-container.html"}],controllerAs:"absence",controller:t}),t.$inject=["$log","$rootScope","DateFormat"]})}(CRM),define("leave-absences/absence-tab/components/absence-tab-entitlements.component",["common/lodash","leave-absences/absence-tab/modules/components"],function(e,n){function t(e,n,t){function a(){return t.all().then(t.loadCalculationUnits).then(function(e){o.absenceTypes=e})}n.debug("Component: absence-tab-entitlements");var o=this;o.absenceTypes=[],o.loading={component:!0},function(){a().finally(function(){o.loading.component=!1})}()}n.component("absenceTabEntitlements",{bindings:{contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/absence-tab-entitlements.html"}],controllerAs:"entitlements",controller:t}),t.$inject=["$q","$log","AbsenceType"]}),define("leave-absences/absence-tab/components/absence-tab-custom-work-pattern-modal.component",["common/moment","leave-absences/absence-tab/modules/components"],function(e,n){function t(n,t,a,o,s,i,r){function c(e){m.errorMessage=e}function u(){return r.get({is_active:!0}).then(function(e){m.workPatterns=e})}function l(e){return s.valuesOf("hrleaveandabsences_work_pattern_change_reason",e).then(function(e){m.changeReasons=e})}function d(){o.loadForm("/civicrm/admin/options/hrleaveandabsences_work_pattern_change_reason?reset=1").on("crmUnload",function(){l(!1)})}n.debug("Component: absence-tab-custom-work-pattern-modal");var m=Object.create(this);return m.changeReasons=[],m.errorMessage="",m.saveInProgress=!1,m.workPatterns=[],m.loading={content:!0},m.selected={workPattern:null,effectiveDate:null,changeReason:null},m.uiOptions={effectiveDate:{show:!1,options:{startingDay:1,showWeeks:!1}}},m.openWorkPatternChangeReasonEditor=d,function(){t.all([u(),l(!0)]).finally(function(){m.loading.content=!1})}(),m.closeModal=function(){m.dismiss({$value:"cancel"})},m.closeAlert=function(){m.errorMessage=""},m.save=function(){var n=e(m.selected.effectiveDate).format(i.serverDateFormat);return m.saveInProgress=!0,r.assignWorkPattern(m.contactId,m.selected.workPattern.id,n,null,m.selected.changeReason).then(function(){a.$broadcast("CustomWorkPattern::Added"),m.closeModal()}).catch(c).finally(function(){m.saveInProgress=!1})},m}n.component("absenceTabCustomWorkPatternModal",{bindings:{contactId:"<",dismiss:"&"},templateUrl:["settings",function(e){return e.pathTpl+"components/absence-tab-custom-work-pattern-modal.html"}],controllerAs:"workPatternModal",controller:["$log","$q","$rootScope","crmAngService","OptionGroup","shared-settings","WorkPatternAPI",t]})}),define("leave-absences/absence-tab/components/absence-tab-work-patterns.component",["common/lodash","common/moment","leave-absences/absence-tab/modules/components","leave-absences/absence-tab/components/absence-tab-custom-work-pattern-modal.component"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d){function m(){return d.workPatternsOf(g.contactId,{},!1).then(function(e){g.customWorkPatterns=e})}function f(){return d.default().then(function(e){g.defaultWorkPattern=e})}function p(){return l.valuesOf("hrleaveandabsences_work_pattern_change_reason").then(function(n){b=e.indexBy(n,"value")})}function h(e){var n=[m()];return e&&(n=n.concat(e)),g.loading.workPattern=!0,a.all(n).then(function(){v()}).finally(function(){g.loading.workPattern=!1})}function v(){var t,a=u.DATE_FORMAT.toUpperCase();g.customWorkPatterns=e(g.customWorkPatterns).map(function(e){return t=b[e.change_reason],e.change_reason_label=t?t.label:"",e.effective_date=e.effective_date?n(e.effective_date).format(a):"",e}).sortBy(function(e){return-n(e.effective_date,a).valueOf()}).value()}t.debug("Component: absence-tab-work-patterns");var b=[],g=Object.create(this);return g.customWorkPatterns=[],g.defaultWorkPattern=null,g.linkToWorkPatternListingPage=function(){var e=CRM.url("civicrm/contact/view",{cid:g.contactId,selectedChild:"absence"});return CRM.url("civicrm/admin/leaveandabsences/work_patterns",{cid:g.contactId,returnUrl:e})}(),g.loading={workPattern:!0},function(){h([p(),f(),c.getDateFormat()]),s.$on("CustomWorkPattern::Added",function(){h()})}(),g.deleteWorkPattern=function(e){r.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){d.unassignWorkPattern(e).then(function(){h()})}})},g.openModal=function(){i.open({appendTo:o.children().eq(0),template:'',controller:["$uibModalInstance",function(e){this.dismiss=e.dismiss}],controllerAs:"$ctrl"})},g}t.component("absenceTabWorkPatterns",{bindings:{contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/absence-tab-work-patterns.html"}],controllerAs:"workpatterns",controller:["$log","$q","$rootElement","$rootScope","$uibModal","dialog","DateFormat","HR_settings","OptionGroup","WorkPattern",a]})}),define("leave-absences/absence-tab/components/annual-entitlement-change-log.component",["common/lodash","common/moment","leave-absences/absence-tab/modules/components","common/models/contract"],function(e,n,t){function a(t,a,o,s,i){function r(){return l().then(function(e){q=q.concat(e)})}function c(){var n=e.groupBy(q,"created_date");C.changeLogRows=e.map(n,d).sort(function(e,n){return n.date.diff(e.date)})}function u(e,n){var t,a,o=m(e);e.entitlements.forEach(function(s,i){t=o.entitlements.slice(0,i),a=e.entitlements.slice(i+1),n(s,t,a)})}function l(){return o.all({contact_id:C.contactId,period_id:C.periodId},!1).then(function(e){return e.map(function(e){return{comment:e.comment,contact_id:e.contact_id,created_date:e.created_date,editor_id:e.editor_id,entitlement_amount:e.value,entitlement_id:e.id,"entitlement_id.type_id":e.type_id}})})}function d(t,a){var o,s,i;return s=e.indexBy(t,"entitlement_id.type_id"),i=C.absenceTypes.map(function(n){return o=s[n.id],e.extend({calculation_unit:n.calculation_unit_name},o)}),{date:n(a),entitlements:i}}function m(e){var n;return n=C.changeLogRows.indexOf(e),C.changeLogRows[n+1]||{date:e.date.clone(),entitlements:e.entitlements.map(function(){return{}})}}function f(){for(var n,t,a,o=C.changeLogRows.length-1;o>=0;o--)if(n=C.changeLogRows[o],t=e.pluck(n.entitlements,"comment"),a=e.compact(t),1===a.length){var s=e.findIndex(t,"length");n.highlightedEntitlement=n.entitlements[s]}else a.length>1&&_(o)}function p(e,n){C.changeLogRows.splice(n,0,e)}function h(){return t.all({id:C.periodId}).then(function(e){C.absencePeriod=e[0]})}function v(e){return a.all().then(a.loadCalculationUnits).then(function(e){C.absenceTypes=e})}function b(){return o.logs({contact_id:C.contactId,period_id:C.periodId}).then(function(e){q=e})}function g(){var e,n;if(!(C.changeLogRows.length<=1))for(e=C.changeLogRows.length-2,n=C.changeLogRows.length-1;e>=0;){var t=C.changeLogRows[e],a=C.changeLogRows[n];t.entitlements.forEach(function(e,n){var t=a.entitlements[n];e.comment===t.comment&&delete e.comment}),e--,n--}}function _(e){var n,t,a=C.changeLogRows[e];u(a,function(o,s,i){o.comment&&(n=s.concat(o).concat(i),t={date:a.date.clone(),entitlements:n},t.highlightedEntitlement=o,p(t,e++))}),y(e)}function y(e){C.changeLogRows.splice(e,1)}var q=[],C=this;C.absencePeriod=null,C.absenceTypes=[],C.changeLogRows=[],C.loading={component:!0},function(){h().then(v).then(b).then(r).then(c).then(g).then(f).finally(function(){C.loading.component=!1})}()}t.component("annualEntitlementChangeLog",{bindings:{contactId:"<",periodId:"<",dismissModal:"&"},templateUrl:["settings",function(e){return e.pathTpl+"components/annual-entitlement-change-log.html"}],controllerAs:"changeLog",controller:a}),a.$inject=["AbsencePeriod","AbsenceType","Entitlement","OptionGroup","shared-settings"]}),function(e){define("leave-absences/absence-tab/components/annual-entitlements.component",["common/lodash","common/moment","leave-absences/absence-tab/modules/components","common/models/contact"],function(n,t,a){function o(a,o,s,i,r,c,u,l,d){function m(){T.absencePeriods=n.chain(T.absencePeriods).filter(function(e){return n.find(q,function(n){return n.period_id===e.id})}).sortBy(function(e){return-t(e.start_date).valueOf()}).value()}function f(){T.absenceTypes=n.filter(T.absenceTypes,function(e){return n.find(q,function(n){return n.type_id===e.id})})}function p(n){var t=e.url("civicrm/contact/view",{cid:T.contactId,selectedChild:"absence"});return e.url("civicrm/admin/leaveandabsences/periods/manage_entitlements",{id:n,cid:T.contactId,returnUrl:t})}function h(){return c.all().then(function(e){T.absencePeriods=e})}function v(){var e=n.uniq(n.map(q,function(e){return e.editor_id}));return l.all({id:{IN:e}}).then(function(e){C=n.indexBy(e.list,"contact_id")})}function b(){return u.all({contact_id:T.contactId}).then(function(e){q=e})}function g(e){i.open({appendTo:s.children().eq(0),templateUrl:"annual-entitlement-change-log-modal",controller:["$uibModalInstance",function(n){this.contactId=T.contactId,this.dismiss=n.dismiss,this.periodId=e}],controllerAs:"modal"})}function _(){T.absencePeriods=n.map(T.absencePeriods,function(e){var t=n.map(T.absenceTypes,function(t){var a=n.find(q,function(n){return n.type_id===t.id&&n.period_id===e.id});return a?{amount:a.value,calculation_unit:t.calculation_unit_name,comment:a.comment?{message:a.comment,author_name:C[a.editor_id].display_name,date:a.created_date}:null}:null});return{id:e.id,title:e.title,entitlements:t}})}function y(e){var n=e.message+"

    Last updated:
    By: "+e.author_name+"
    Date: "+t.utc(e.date).local().format("DD/M/YYYY HH:mm")+"
    ";d.info("Calculation comment:",n)}a.debug("Component: annual-entitlements");var q=[],C=[],T=this;T.absencePeriods=[],T.loading={absencePeriods:!0},T.getEditEntitlementsPageURL=p,T.openAnnualEntitlementChangeLog=g,T.showComment=y,function(){b().then(v).then(h).then(m).then(f).then(_).finally(function(){T.loading.absencePeriods=!1})}()}a.component("annualEntitlements",{bindings:{absenceTypes:"<",contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/annual-entitlements.html"}],controllerAs:"entitlements",controller:o}),o.$inject=["$log","$q","$rootElement","$uibModal","AbsenceType","AbsencePeriod","Entitlement","Contact","notificationService"]})}(CRM),define("leave-absences/absence-tab/components/contract-entitlements.component",["common/lodash","common/moment","leave-absences/absence-tab/modules/components","common/models/contract"],function(e,n,t){function a(t,a,o,s,i,r){function c(){m.absenceTypes=e.filter(m.absenceTypes,function(n){return e.find(m.contracts,function(t){return e.find(t.info.leave,function(e){return e.leave_type===n.id})})})}function u(e){var t=o.DATE_FORMAT.toUpperCase();return e?n(e).format(t):""}function l(){return i.all({contact_id:m.contactId}).then(function(e){m.contracts=e})}function d(){m.contracts=e.sortBy(m.contracts,function(e){return n(e.info.details.period_start_date)}).map(function(n){var t=n.info,a=t.details,o=e.map(m.absenceTypes,function(n){var a=e.filter(t.leave,function(e){return e.leave_type===n.id})[0];return{amount:a?a.leave_amount:"",calculation_unit:n.calculation_unit_name}});return{position:a.position,start_date:u(a.period_start_date),end_date:u(a.period_end_date),absences:o}})}t.debug("Component: contract-entitlements");var m=this;m.contracts=[],m.loading={contracts:!0},function(){r.getDateFormat().then(l).then(c).then(d).finally(function(){m.loading.contracts=!1})}()}t.component("contractEntitlements",{bindings:{absenceTypes:"<",contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/contract-entitlements.html"}],controllerAs:"entitlements",controller:a}),a.$inject=["$log","$q","HR_settings","AbsenceType","Contract","DateFormat"]}),function(e){define("leave-absences/absence-tab/modules/settings",["common/angular"],function(n){return n.module("absence-tab.settings",[]).constant("settings",{contactId:e.vars.leaveAndAbsences.contactId,debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/absence-tab/"})})}(CRM),define("leave-absences/absence-tab/modules/config",["common/angular","leave-absences/absence-tab/modules/settings"],function(e){return e.module("absence-tab.config",["absence-tab.settings"]).config(["$resourceProvider","$httpProvider","$logProvider","settings",function(e,n,t,a){t.debugEnabled(a.debug),e.defaults.stripTrailingSlashes=!1,n.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}])}),define("leave-absences/absence-tab/app",["common/angular","common/angularBootstrap","common/text-angular","common/directives/scroll-shadows.directive","common/directives/time-amount-picker.directive","common/directives/timepicker-select.directive","common/filters/angular-date/format-date","common/filters/time-unit-applier.filter","common/modules/dialog","common/modules/directives","common/services/check-permissions","common/services/crm-ang.service","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/modules/shared-settings","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/calendar.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/work-pattern.model","leave-absences/shared/components/leave-calendar.component","leave-absences/shared/components/leave-calendar-day.component","leave-absences/shared/components/leave-calendar-legend.component","leave-absences/shared/components/leave-calendar-month.component","leave-absences/shared/components/leave-request-actions.component","leave-absences/shared/components/leave-request-popup-comments-tab.component","leave-absences/shared/components/leave-request-popup-details-tab.component","leave-absences/shared/components/leave-request-popup-files-tab","leave-absences/shared/components/leave-request-record-actions.component","leave-absences/shared/components/staff-leave-report.component","leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/calendar.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/work-pattern.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/modules/shared-settings","leave-absences/shared/services/leave-calendar.service","leave-absences/shared/services/leave-popup.service","leave-absences/absence-tab/components/absence-tab-container.component","leave-absences/absence-tab/components/absence-tab-entitlements.component","leave-absences/absence-tab/components/absence-tab-work-patterns.component","leave-absences/absence-tab/components/annual-entitlement-change-log.component","leave-absences/absence-tab/components/annual-entitlements.component","leave-absences/absence-tab/components/contract-entitlements.component","leave-absences/absence-tab/modules/config"],function(e){return e.module("absence-tab",["ngResource","ui.bootstrap","textAngular","common.angularDate","common.dialog","common.directives","common.filters","common.services","common.mocks","leave-absences.settings","leave-absences.models","leave-absences.components","leave-absences.controllers","leave-absences.models","leave-absences.services","leave-absences.settings","absence-tab.config","absence-tab.components"]).run(["$log","$rootScope","shared-settings","settings",function(e,n,t,a){e.debug("app.run"),n.sharedPathTpl=t.sharedPathTpl,n.settings=a}]),e}),function(e,n){var t=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";n.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":t+"/shared","leave-absences/absence-tab":t+"/absence-tab"}}),n(["leave-absences/shared/config"],function(){n(["leave-absences/absence-tab/app"],function(){document.dispatchEvent("function"==typeof window.CustomEvent?new CustomEvent("absenceTabReady"):function(){var e=document.createEvent("Event");return e.initEvent("absenceTabReady",!0,!0),e}())})})}(CRM,require),define("absence-tab",function(){}); +!function(e){define("leave-absences/shared/config",[],function(){e.config({paths:{mocks:"../test/mocks"}}),e.config({paths:{mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(n){return n.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,n,t){"use strict";t.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(t,a,o){return t.debug("AbsenceTypeAPI"),a.extend({all:function(n){return t.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(n||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,s,i){return t.debug("AbsenceTypeAPI.calculateToilExpiryDate"),i=e.assign({},i,{absence_type_id:a,date:n(s).format(o.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",i).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,n){return e.debug("AbsenceTypeInstance"),n.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,n){"use strict";n.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(n,t,a,o,s,i){return n.debug("AbsenceType"),a.extend({all:function(e){return s.all(e).then(function(e){return e.map(function(e){return i.init(e,!0)})})},calculateToilExpiryDate:function(e,n,t){return s.calculateToilExpiryDate(e,n,t)},canExpire:function(e){return s.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(n){return o.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(t){return t=e.indexBy(t,"value"),e.map(n,function(n){return e.assign(n,{calculation_unit_label:t[n.calculation_unit].label,calculation_unit_name:t[n.calculation_unit].name})})})}})}])}),define("leave-absences/shared/apis/work-pattern.api",["common/lodash","leave-absences/shared/modules/apis","common/services/api"],function(e,n){"use strict";n.factory("WorkPatternAPI",["$log","api",function(n,t){function a(n){var t=e.clone(n);return t.workPattern=t["api.WorkPattern.get"].values[0],delete t["api.WorkPattern.get"],t}return n.debug("WorkPatternAPI"),t.extend({assignWorkPattern:function(n,t,a,o,s,i){return this.sendPOST("ContactWorkPattern","create",e.assign({},i,{contact_id:n,pattern_id:t,effective_date:a,effective_end_date:o,change_reason:s})).then(function(e){return e.values})},get:function(e){return this.sendGET("WorkPattern","get",e||{}).then(function(e){return e.values})},getCalendar:function(t,a,o,s){return n.debug("WorkPatternAPI.getCalendar",t,a,o,s),this.sendGET("WorkPattern","getcalendar",e.assign({},s,{contact_id:e.isArray(t)?{IN:t}:t,start_date:a,end_date:o}))},unassignWorkPattern:function(e){return this.sendPOST("ContactWorkPattern","delete",{id:e})},workPatternsOf:function(n,t,o){return this.sendGET("ContactWorkPattern","get",e.assign({},t,{contact_id:n,"api.WorkPattern.get":{id:"$value.pattern_id"}}),o).then(function(e){return e=e.values,e.map(a)})}})}])}),define("leave-absences/shared/instances/calendar.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance"],function(e,n,t){"use strict";t.factory("CalendarInstance",["$log","$q","ModelInstance","shared-settings","OptionGroup",function(t,a,o,s,i){function r(n,t){return u().then(function(a){var o=this.days[c(n).valueOf()];return!!o&&e.find(a,function(e){return e.name===t}).value===o.type}.bind(this))}function c(e){return n(e,s.serverDateFormat).clone()}function u(){return l=l||i.valuesOf("hrleaveandabsences_work_day_type")}var l;return o.extend({defaultCustomData:function(){return{days:[]}},isNonWorkingDay:function(e){return r.call(this,e,"non_working_day")},isWeekend:function(e){return r.call(this,e,"weekend")},isWorkingDay:function(e){return r.call(this,e,"working_day")},transformAttributes:function(n){var t={};return n.calendar.forEach(function(e){t[c(e.date).valueOf()]=e}),e(n).omit("calendar").assign({days:t}).value()}})}])}),define("leave-absences/shared/models/calendar.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/calendar.instance"],function(e,n){"use strict";n.factory("Calendar",["$log","Model","WorkPatternAPI","CalendarInstance",function(n,t,a,o){return n.debug("Calendar"),t.extend({get:function(t,s,i,r){return n.debug("Calendar.get"),a.getCalendar(t,s,i,r).then(function(n){var a=n.values.map(function(e){return o.init(e)});return e.isArray(t)?a:a[0]})}})}])}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,t){function a(e){var t=n.clone(e),a=t["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(t.remainder=a[0].remainder),delete t["api.LeavePeriodEntitlement.getremainder"],t}function o(e){var t=n.clone(e),a=t["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return t.value=a,delete t["api.LeavePeriodEntitlement.getentitlement"],t}return e.debug("EntitlementAPI"),t.extend({all:function(n,t){return e.debug("EntitlementAPI.all"),n["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},t&&(n["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",n,!1).then(function(e){return e.values}).then(function(e){return e=e.map(o),t&&(e=e.map(a)),e})},breakdown:function(n){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",n).then(function(e){return e.values})},getLeaveBalances:function(n,t,a,o,s){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",n,t,a,o,"getLeaveBalances",s)}})}])}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,n){return e.debug("EntitlementLogAPI"),n.extend({all:function(n){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",n,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,n,t){return e.debug("EntitlementInstance"),n.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return t.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,n){"use strict";n.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(n,t,a,o,s){return n.debug("Entitlement"),t.extend({all:function(e,n){return a.all(this.processFilters(e),n).then(function(e){return e.map(function(e){return o.init(e,!0)})})},breakdown:function(n,t){return a.breakdown(n).then(function(n){return t?(t.map(function(t){var a=e.find(n,function(e){return e.id===t.id});return a&&(t.breakdown=a.breakdown),t}),t):n.map(function(e){return o.init(e,!0)})})},logs:function(n){return n=e.cloneDeep(n||{}),n.contact_id&&(n["entitlement_id.contact_id"]=n.contact_id,delete n.contact_id),n.period_id&&(n["entitlement_id.period_id"]=n.period_id,delete n.period_id),n.return=n.return||[],n.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),s.all(n)}})}])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,t,a){return e.debug("LeaveRequestAPI"),t.extend({all:function(n,t,o,s,i){e.debug("LeaveRequestAPI.all");var r=a.defer();return n&&n.contact_id&&n.contact_id.IN&&0===n.contact_id.IN.length?r.resolve({list:[],total:0,allIds:[]}):r.resolve(this.getAll("LeaveRequest",n,t,o,s,"getFull",i)),r.promise},balanceChangeByAbsenceType:function(t){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var o=a.defer();return t.contact_id&&t.period_id||o.reject("contact_id and period_id are mandatory"),t=n.defaults(t,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",t,!1).then(function(e){o.resolve(e.values)}),o.promise},calculateBalanceChange:function(t){return e.debug("LeaveRequestAPI.calculateBalanceChange",t),this.sendPOST("LeaveRequest","calculatebalancechange",t).then(function(e){return e.values.breakdown=n.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,n){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:n.toString()},!1)},create:function(n){return e.debug("LeaveRequestAPI.create",n),this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,attachment_id:t}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,t){return t=n.assign({},t,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",t).then(function(e){return e.values})},find:function(n){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:n},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",t,!1).then(function(e){return e.values})},getComments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",t,!1).then(function(e){return e.values})},isManagedBy:function(n,t){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:n,contact_id:t}).then(function(e){return e.values})},isValid:function(t){e.debug("LeaveRequestAPI.isValid",t);var o=a.defer();return this.sendPOST("LeaveRequest","isValid",t).then(function(e){e.count>0?o.reject(n(e.values).map().flatten().value()):o.resolve(e.values)}),o.promise},saveComment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,text:t.text,contact_id:t.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(n){return e.debug("LeaveRequestAPI.update",n),n.id?this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]}):a.reject("id is mandatory field")}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,n,t){"use strict";t.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(t,a,o,s,i,r,c){function u(e){return p(e).then(function(e){var n=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=n,t.reject(e)}.bind(this))}.bind(this))}function l(){return c.all({id:this.type_id}).then(c.loadCalculationUnits).then(function(e){return t.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return p(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var n=[];return e.forEach(this.files,function(e){e.toBeDeleted&&n.push(r.deleteAttachment(this.id,e.attachment_id))}.bind(this)),t.all(n)}function f(e){return n.duration(e.time_to).subtract(n.duration(e.time_from)).asHours()}function p(n){return o.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){return e.find(t,function(e){return e.name===n})})}function h(n){var a=e.cloneDeep(n),o=a.breakdown.length>1,s=e.first(e.values(a.breakdown)),i=e.last(e.values(a.breakdown));return t.all([this.getWorkDayForDate(s.date),o&&this.getWorkDayForDate(i.date)]).then(function(n){return s.amount=n[0].time_from?Math.min(this.from_date_amount,f(n[0])):0,o&&(i.amount=n[1].time_from?Math.min(this.to_date_amount,f(n[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,n){return e+n.amount},0),a}.bind(this))}function v(){var e=this.id,n=[];return n.push(t.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(n){return function(){return r.saveComment(e,n)}}))),n=n.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return r.deleteComment(e.comment_id)})),t.all(n)}return i.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(n){var t=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===n&&e.pull(t,"from_date_type","to_date_type"),r.calculateBalanceChange(e.pick(this,t)).then(function(e){return"hours"===n?h.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,s.statusNames.cancelled)},approve:function(){return u.call(this,s.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,s.statusNames.rejected)},sendBack:function(){return u.call(this,s.statusNames.moreInformationRequired)},update:function(){return r.update(this.toAPI()).then(function(){return t.all([v.call(this),m.call(this)])}.bind(this))},create:function(){return r.create(this.toAPI()).then(function(e){return this.id=e.id,t.all([v.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(n){if(n.comment_id)return void(n.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return n.created_at===e.created_at&&n.text===e.text})},delete:function(){return r.delete(this.id)},getBalanceChangeBreakdown:function(){return r.getBalanceChangeBreakdown(this.id).then(function(n){return{amount:e.reduce(n.values,function(e,n){return e+parseFloat(n.amount)},0),breakdown:n.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return r.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return t.reject(e)})},isValid:function(){return r.isValid(this.toAPI())},isApproved:function(){return d.call(this,s.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,s.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,s.statusNames.cancelled)},isRejected:function(){return d.call(this,s.statusNames.rejected)},isSentBack:function(){return d.call(this,s.statusNames.moreInformationRequired)},loadComments:function(){return this.id?r.getComments(this.id).then(function(e){this.comments=e}.bind(this)):t.resolve()},roleOf:function(e){return this.contact_id===e?t.resolve("owner"):a(s.permissions.admin.administer).then(function(n){return n?"admin":r.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])},loadAttachments:function(){return this.id?r.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):t.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,n,t,a){return e.debug("LeaveRequest"),n.extend({all:function(e,n,o,s,i){return t.all(this.processFilters(e),n,o,s,i).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return t.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return t.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/instances/work-pattern.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("WorkPatternInstance",["$log","ModelInstance",function(e,n){return e.debug("WorkPatternInstance"),n.extend({})}])}),define("leave-absences/shared/models/work-pattern.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/work-pattern.instance"],function(e,n){"use strict";n.factory("WorkPattern",["$log","Model","WorkPatternAPI","WorkPatternInstance",function(n,t,a,o){return n.debug("WorkPattern"),t.extend({assignWorkPattern:function(e,n,t,o,s,i){return a.assignWorkPattern(e,n,t,o,s,i)},default:function(){return a.get({is_default:!0}).then(function(n){return o.init(e.first(n),!0)})},unassignWorkPattern:function(e){return a.unassignWorkPattern(e)},workPatternsOf:function(e,n,t){return a.workPatternsOf(e,n,t).then(function(e){return e.map(function(e){return o.init(e,!0)})})}})}])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/modules/controllers",["common/angular","common/angularBootstrap","leave-absences/shared/modules/models","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){return e.module("leave-absences.controllers",["ui.select","leave-absences.models","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers","common/models/contract","common/services/notification.service"],function(e,n,t){function a(n,t,a,o,s,i,r){function c(){return{loadContacts:function(){return l.loadContactsForAdmin()}}}function u(e){i.info("",["

    When All filter is selected, all staff members with contracts which are active in the selected absence period are displayed.

    ","

    People I approve filter displays only staff members who you approve leave for.

    ","

    People without approver filter displays all staff members with contracts which are active in the selected absence period and who do not have any leave approver assigned.

    "].join(""))}n.debug("LeaveCalendarAdminController");var l,d;return{init:function(n){return d=n,l=r.init(d),d.filters.userSettings.assignedTo=e.find(d.filtersByAssignee,{type:"me"}),d.showContactDetailsLink=!0,d.showContactName=!0,d.showFilters=!0,d.showAdminFilteringHint=u,c()}}}t.controller("LeaveCalendarAdminController",["$log","$q","Contact","ContactInstance","Contract","notificationService","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(n,t,a,o){function s(){return{loadContacts:function(){return i.loadLookUpAndFilteredContacts()}}}n.debug("LeaveCalendarManagerController");var i,r;return{init:function(n){return r=n,i=o.init(r),r.filters.userSettings.assignedTo=e.find(r.filtersByAssignee,{type:"me"}),r.showContactName=!0,r.showFilters=!0,s()}}}t.controller("LeaveCalendarManagerController",["$log","Contact","ContactInstance","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(e,n,t,a){function o(){return{loadContacts:function(){return i.displaySingleContact?s.loadFilteredContacts():"admin"===i.userPermissionRole?s.loadContactsForAdmin():s.loadLookUpAndFilteredContacts()}}}e.debug("LeaveCalendarStaffController");var s,i;return{init:function(e){return i=e,s=a.init(i),i.filters.userSettings.contacts_with_leaves=!0,i.showTheseContacts=[i.contactId],i.showContactName=!0,i.showFilters=!0,i.displaySingleContact&&(i.showFilters=!1,i.lookupContacts=[{id:i.contactId}]),o()}}}t.controller("LeaveCalendarStaffController",["$log","$q","Contact","LeaveCalendarService",a])}),define("leave-absences/shared/components/leave-calendar.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d){function m(){U().then(g).then(b).then(y).then(w).then(function(){return a.all([C(),D(),I(),H.showFilters?P():e.noop])}).then(function(){f(),_(),B()}).then(function(){H.loading.page=!1})}function f(){H.supportData.absenceTypes.push({id:"",title:"Leave",color:"#4D4D68",calculation_unit:e.chain(H.supportData.calculationUnits).find({name:"days"}).get("value").value()})}function p(){for(var e=[],t=n(H.selectedPeriod.start_date).clone().startOf("month"),a=n(H.selectedPeriod.end_date).clone().endOf("month");t.isBefore(a);)e.push(S(t)),t.add(1,"month");H.months=e}function h(){return e.includes(["admin","manager"],H.userPermissionRole)}function v(e){return e.format("YYYY-MM")}function b(){s.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,n){H.supportData.absenceTypesToFilterBy=n,M(!0)})}function g(){s.$new().$watch(function(){return H.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(F(),B(),M())})}function _(e){H.injectMonth=!0,N("injected").then(function(){M(e)}).then(function(){H.loading.calendar=!1})}function y(){j=t("LeaveCalendar"+e.capitalize(W)+"Controller").init(H)}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return r.all().then(function(n){H.absencePeriods=e.sortBy(n,"start_date"),H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current})}).then(p).then($)}function T(){return c.all().then(c.loadCalculationUnits)}function A(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function D(){return j.loadContacts().then(function(e){H.contacts=e})}function P(){return l.valuesOf(["hrjc_region","hrjc_location","hrjc_level_type","hrjc_department"]).then(function(e){H.filters.optionValues.regions=e.hrjc_region,H.filters.optionValues.locations=e.hrjc_location,H.filters.optionValues.levelTypes=e.hrjc_level_type,H.filters.optionValues.departments=e.hrjc_department})}function R(){return u.all()}function I(){return a.all([T(),R(),A()]).then(function(n){H.supportData.absenceTypes=n[0],H.supportData.publicHolidays=n[1],H.supportData.calculationUnits=n[2].hrleaveandabsences_absence_type_calculation_unit,H.supportData.dayTypes=n[2].hrleaveandabsences_leave_request_day_type,H.supportData.leaveRequestStatuses=n[2].hrleaveandabsences_leave_request_status,H.supportData.toilAmounts=e.indexBy(n[2].hrleaveandabsences_toil_amounts,"value")})}function w(){var e=a.resolve();return H.injectMonth&&(e=N("destroyed"),H.injectMonth=!1),e}function S(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:n().year(e.year()).month(e.month())}}function k(){var n=H.selectedPeriod.id;H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current}),n!==H.selectedPeriod.id&&p(),$(),B(),O("month")}function L(e){var t="previous"===e?"subtract":"add";F(n(H.selectedMonth.moment)[t](1,"month")),B(),O("month")}function O(n){n=e.includes(["contacts","period","month"],n)?n:"period",a.resolve().then(w).then("period"===n&&p).then("period"===n&&x).then("contacts"===n&&D).then("month"===n&&B).then(function(){_("contacts"===n)})}function M(e){s.$emit("LeaveCalendar::showMonth",!!e)}function $(){F(n())}function x(){F(H.months[0].moment)}function E(t){var a="previous"===t?"first":"last",o=e[a](H.months),s=n().year(o.year).month(o.month);H.monthPaginatorsAvailability[t]=!H.selectedMonth.moment.isSame(s,"month")}function B(){E("previous"),E("next")}function F(n){n&&(H.selectedMonthIndex=v(n)),H.selectedMonth=e.find(H.months,{index:H.selectedMonthIndex})}function U(){return a.all([d(i.permissions.admin.administer),d(i.permissions.ssp.manage)]).then(function(e){H.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",W=H.roleOverride?H.roleOverride:H.userPermissionRole})}function N(n){return a(function(t){var a=s.$on("LeaveCalendar::month"+e.capitalize(n),function(){a(),t()})})}o.debug("Component: leave-calendar");var j,W,H=this;H.absencePeriods=[],H.contacts=[],H.contactIdsToReduceTo=null,H.injectMonth=!1,H.months=[],H.selectedMonth={},H.selectedMonthIndex="",H.selectedPeriod=null,H.showContactName=!1,H.showFilters=!1,H.userPermissionRole="staff",H.loading={calendar:!0,page:!0},H.filters={hideOnMobile:!0,optionValues:{},userSettings:{contact:null,contacts_with_leaves:!0,department:null,level_type:null,location:null,region:null},absenceTypes:{}},H.filtersByAssignee=[{type:"me",label:"People I approve"},{type:"unassigned",label:"People without approver"},{type:"all",label:"All"}],H.filters.userSettings.assignedTo=H.filtersByAssignee[2],H.monthPaginatorsAvailability={previous:!0,next:!0},H.supportData={absenceTypesToFilterBy:[]},H.$onInit=m,H.canManageRequests=h,H.labelPeriod=q,H.navigateToCurrentMonth=k,H.paginateMonth=L,H.refresh=O}t.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,t={from_date:{to:Q.month.days[Q.month.days.length-1].date+" 23:59:59"},to_date:{from:Q.month.days[0].date+" 00:00:00"},status_id:{IN:L()},contact_id:{IN:Q.contacts.map(function(e){return e.id})},type_id:{IN:n?Q.supportData.absenceTypesToFilterBy:e.pluck(Q.supportData.absenceTypes,"id")}};return _(),i.all(t,null,null,null,!1).then(function(e){return X={},n&&(e.list=q(e.list)),A(e.list)})}function $(){var n=Q.month.days[0].date,t=Q.month.days[Q.month.days.length-1].date;return s.get(Q.contacts.map(function(e){return e.id}),n,t).then(function(n){z=e.indexBy(n,"contact_id")})}function x(){return Q.contactIdsToReduceTo&&(Q.contacts=Q.contacts.filter(function(n){return e.includes(Q.contactIdsToReduceTo,n.contact_id)||e.find(X,function(e){return e.contact_id===n.contact_id})})),a.resolve()}function E(n){var t=S(n);X[n.contact_id]=X[n.contact_id]||{},t.forEach(function(t){e.remove(X[n.contact_id][t.date],function(e){return e.id===n.id})})}function B(){o.$emit("LeaveCalendar::monthDestroyed"),V.map(function(e){e.remove?e.remove():e()})}function F(n,t,o){var s,i;return n.contactsData[t]=n.contactsData[t]||{},i=f(t),s=!0===o?a.resolve():a.all([i.isWeekend(h(n.date)),i.isNonWorkingDay(h(n.date))]).then(function(a){e.assign(n.contactsData[t],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:I(n.date)})}),s.then(function(){return X[t]&&X[t][n.date]?X[t][n.date]:[]}).then(function(a){a=j(a),e.assign(n.contactsData[t],{leaveRequests:a,leaveRequestsToShowInCell:b(a),leaveRequestsAttributes:C(n,a)})})}function U(){return a.all(Q.month.days.map(function(e){return a.all(Q.contacts.map(function(n){return F(e,n.id)}))}))}function N(e,n){Q.currentPage=0,Q.visible=!0,(n||!G)&&O()}function j(t){return e.sortBy(t,function(e){return+n(e.from_date).format("X")+(P("half_day_pm",e,e.from_date)?1:0)})}function W(n){var t=e.find(Q.supportData.absenceTypes,function(e){return e.id===n.type_id});return n.balance_change>0?{borderColor:t.color}:{borderColor:t.color,backgroundColor:t.color}}function H(e){v(e),-1!==L().indexOf(e.status_id)&&l(e)}function Y(e){return a.all(S(e).map(function(n){return F(n,e.contact_id,!0)}))}t.debug("Component: leave-calendar-month");var G=!1,V=[],z={},X={},Q=this;Q.currentPage=0,Q.pageSize=20,Q.visible=!1,Q.showContactName=!!Q.showContactName,Q.showOnlyWithLeaveRequests=!!Q.showOnlyWithLeaveRequests,Q.$onDestroy=B,Q.$onInit=u,Q.contactsList=p,Q.getContactUrl=y}t.component("leaveCalendarMonth",{bindings:{showTheseContacts:"<",contacts:"<",contactIdsToReduceTo:"<",month:"<",period:"<",showContactName:"<",showContactDetailsLink:"<",showOnlyWithLeaveRequests:"<",supportData:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-month.html"}],controllerAs:"month",controller:["$log","$q","$rootScope","Calendar","LeaveRequest","pubSub","shared-settings",a]})}),define("leave-absences/shared/modules/services",["common/angular","common/modules/services"],function(e){"use strict";return e.module("leave-absences.services",["common.services"])}),define("leave-absences/shared/services/leave-request.service",["common/lodash","leave-absences/shared/modules/services"],function(e,n){"use strict";function t(n,t,a){function o(){var n=t.defer();return a.open(e.defaults(s(),{onConfirm:function(){n.resolve(!0)}})),n.promise}function s(){return{title:"Recalculate Balance Change?",copyCancel:"Cancel",copyConfirm:"Yes",classConfirm:"btn-warning",msg:"The leave balance change has updated since this leave request was created. Do you want to recalculate the balance change?"}}return n.debug("LeaveRequest"),{getBalanceChangeRecalculationPromptOptions:s,promptBalanceChangeRecalculation:o}}n.factory("LeaveRequestService",t),t.$inject=["$log","$q","dialog"]}),define("leave-absences/shared/components/leave-request-actions.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/contact","common/models/session.model","common/services/hr-settings","common/services/notification.service","common/services/pub-sub","leave-absences/shared/services/leave-request.service"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d,m){function f(){a.resolve().then(y).then(C).then(function(){return _()&&"admin"!==k.role&&R()}).then(P).finally(function(){k.loading.component=!1})}function p(n){S=k.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===k.leaveRequest.request_type?i.open(q(n)):b(n)}function h(){return"admin"===k.role&&"public_holiday"===k.leaveRequest.request_type}function v(t){var a=k.absenceTypes[k.leaveRequest.type_id].allow_request_cancelation;return"admin"===k.role||("manager"===k.role?e.includes([L.awaitingApproval,L.moreInformationRequired],t):"3"===a?n().isBefore(k.leaveRequest.from_date):"2"===a)}function b(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return k.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){A(n)}}):q(n)})}})}function g(){return s.find(w).then(function(e){return e.checkIfSelfLeaveApprover()})}function _(){return w===k.leaveRequest.contact_id}function y(){e.isArray(k.leaveRequestStatuses)&&(k.leaveRequestStatuses=e.indexBy(k.leaveRequestStatuses,"value")),e.isArray(k.absenceTypes)&&(k.absenceTypes=e.indexBy(k.absenceTypes,"id"))}function q(e){var n=O[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return k.leaveRequest[e]().then(function(){D(e)}).catch(function(e){d.error("Error:",e)})}}}function C(){return m.get().then(function(e){w=e.contactId})}function T(e,n){e.stopPropagation(),r.openModal(n)}function A(e){r.openModal({leaveRequest:k.leaveRequest,leaveType:k.leaveRequest.request_type,selectedContactId:k.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[M[e]]})}function D(n){var t=e.find(k.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:k.leaveRequest})}function P(){var n=k.leaveRequestStatuses[k.leaveRequest.status_id].name,t=e.compact(e.map(O,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!v(n)&&e.pull(t,"cancel"),"admin"!==k.role&&e.pull(t,"delete"),"staff"===k.role&&e.pull(t,"approve","reject"),"staff"!==k.role&&I(t),h()&&t.push("delete"),k.allowedActions=e.map(t,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function R(){return g().then(function(e){e&&(k.role="admin")})}function I(n){e.each(n,function(t,a){"edit"===t&&(n[a]="respond"),e.includes(["respond","view"],t)&&(n[a]="edit")})}t.debug("Component: leave-request-action-dropdown");var w,S,k=this,L=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[L.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[L.moreInformationRequired]},view:{label:"View",allowedStatuses:[L.approved,L.rejected,L.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[L.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[L.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[L.awaitingApproval,L.approved,L.rejected,L.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[L.awaitingApproval,L.moreInformationRequired,L.approved,L.rejected,L.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},M={approve:"approved"};k.allowedActions=[],k.loading={component:!0},k.$onInit=f,k.action=p,k.openLeavePopup=T}t.component("leaveRequestActions",{bindings:{leaveRequest:"<",leaveRequestStatuses:"<",absenceTypes:"<",role:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-actions.html"}],controllerAs:"actions",controller:a}),a.$inject=["$log","$q","$rootScope","Contact","dialog","LeavePopup","LeaveRequestService","pubSub","shared-settings","notificationService","Session"]}),define("leave-absences/shared/components/leave-request-popup-comments-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/models/session.model"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){o.$emit("LeaveRequestPopup::addTab",C),_(),y()}function l(){C.request.comments.push({contact_id:q,leave_request_id:C.request.id,text:C.comment.text}),C.comment.text=""}function d(){return C.comment.text.length>0}function m(e){return!e.comment_id||C.canManage}function f(e){return n.utc(e,i.serverDateTimeFormat).local().format(s.DATE_FORMAT.toUpperCase()+" HH:mm")}function p(){return C.request.comments.filter(function(e){return!e.toBeDeleted})}function h(e){return e===q?"Me":C.comment.contacts[e]?C.comment.contacts[e].display_name:void 0}function v(e){return C.mode===e}function b(){C.comment.text.length&&C.addComment()}function g(){var n=e.indexBy(C.request.comments,"contact_id"),t=Object.keys(n);return r.all({id:{IN:t}},{page:1,size:0}).then(function(n){C.comment.contacts=e.indexBy(n.list,"contact_id")})}function _(){return C.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),C.request.comments.length&&g()})}function y(){return C.loading.component=!0,c.get().then(function(e){q=e.contactId}).then(function(){C.loading.component=!1})}t.debug("Component: leave-request-popup-comments-tab");var q=null,C=this;C.loading={component:!0},C.comment={text:"",contacts:{}},C.$onInit=u,C.addComment=l,C.canRemoveComment=m,C.canSubmit=d,C.formatDateTime=f,C.getActiveComments=p,C.getCommentorName=h,C.isMode=v,C.onBeforeSubmit=b}t.component("leaveRequestPopupCommentsTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-comments-tab.html"}],controllerAs:"commentsCtrl",controller:["$log","$rootScope","$scope","HR_settings","shared-settings","Contact","Session",a]})}),define("leave-absences/shared/components/leave-request-popup-details-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/session.model","leave-absences/shared/models/calendar.model"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d,m){function f(){t("RequestModalDetails"+e.capitalize(T(te.leaveType,te.request))+"Controller",{detailsController:te}),te.canManage=te.isRole("manager")||te.isRole("admin"),te.loading.tab=!0,s.$emit("LeaveRequestPopup::addTab",te),w(),te.initChildController().then(function(){return i.all([x(),$()])}).then(!te.isMode("create")&&I).then(Y).then(function(){if(!te.isMode("create"))return i.resolve().then(te.initTimesExtended).then(z)}).then(!te.isMode("create")&&H).then(S).then(G).then(R).then(k).then(!te.isMode("view")&&te.initWatchersExtended).catch(P).then(function(){te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.totalItems=te.balance.change.breakdown.length}).finally(function(){te.loading.tab=!1})}function p(){te.balance.closing=te.balance.opening+te.balance.change.amount}function h(e){return n(e,c.serverDateFormat).toDate()}function v(e){return n(e).format(c.serverDateFormat)}function b(e){var n;return i.resolve().then(function(){j(e),"from"===e&&N(),L("hours")&&(y(e),"from"!==e||te.uiOptions.multipleDays||y("to")),te.loading[e+"DayTypes"]=!0}).then(function(){return C(e)}).then(function(e){if(n=e.id!==te.period.id,n&&(te.period=e),!te.period.id)return i.reject("Please change date as it is not in any absence period")}).then(H).then(function(){if(n)return x()}).then(function(){return te.onDateChangeExtended&&te.onDateChangeExtended(e)}).then(function(){if(z(),!n)return B();o.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(P).finally(q)}function g(){return z(),B()}function _(){return te.uiOptions.toDate=null,j("to"),i.resolve().then(z).then(te.setDaysSelectionModeExtended).then(q).then(!te.uiOptions.multipleDays&&B)}function y(e){te.uiOptions.times[e].loading=!0}function q(){["from","to"].forEach(function(e){te.loading[e+"DayTypes"]=!1,L("hours")&&(te.uiOptions.times[e].loading=!1)})}function C(t){var a=n(te.uiOptions[t+"Date"]).format(te.uiOptions.userDateFormat.toUpperCase());return e.find(te.absencePeriods,function(e){return e.isInPeriod(a)})||{}}function T(){return te.request?te.request.request_type:te.leaveType||null}function A(e){return n().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function D(){return X(),te.loading.balanceChange=!0,te.request.getBalanceChangeBreakdown().then(W).catch(P)}function P(n){o.$broadcast("LeaveRequestPopup::handleError",e.isArray(n)?n:[n]),te.loading.fromDayTypes=!1,te.loading.balanceChange=!1,te.loading.tab=!1,te.loading.toDayTypes=!1}function R(){return te.isMode("create")||te.forceRecalculateBalanceChange?B():D()}function I(){var e=te.request.attributes();return te.uiOptions.fromDate=h(te.request.from_date),te.request.to_date=e.to_date,te.request.to_date_type=e.to_date_type,te.uiOptions.toDate=h(te.request.to_date),te.initDayTypesExtended?te.initDayTypesExtended():i.resolve()}function w(){ne.push(o.$on("LeaveRequestPopup::absenceTypeChanged",function(){J()}),o.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,n){K(n)}),o.$on("LeaveRequestPopup::recalculateBalanceChange",B))}function S(){te.isMode("edit")&&(te.isLeaveStatus(c.statusNames.approved)||te.isLeaveStatus(c.statusNames.adminApproved))&&(ee={absenceTypeId:te.request.type_id,value:te.selectedAbsenceType.remainder-te.request.balance_change})}function k(){o.$watch(function(){return te.uiOptions.times.from.time},function(e,n){e!==n&&(te.uiOptions.multipleDays||(Z(e),z()))})}function L(e){return te.selectedAbsenceType.calculation_unit_name===e}function O(e){return te.request.request_type===e}function M(n){return e.includes(["weekend","non_working_day","public_holiday"],n)}function $(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){te.requestDayTypes=e})}function x(){return u.get(te.request.contact_id,te.period.start_date,te.period.end_date).then(function(e){te.calendar=e})}function E(){var e=(te.pagination.currentPage-1)*te.pagination.numPerPage,n=e+te.pagination.numPerPage;te.pagination.filteredbreakdown=te.balance.change.breakdown.slice(e,n)}function B(){return X(),te.canCalculateChange()?(te.loading.balanceChange=!0,te.request.change_balance=!0,te.calculateBalanceChange().then(W).catch(P).finally(function(){te.loading.balanceChange=!1})):i.resolve()}function F(){te.pagination.totalItems=te.balance.change.breakdown.length,te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.pageChanged()}function U(){return v(te.request.from_date)===v(te.request.to_date)}function N(){te.uiOptions.toDate&&te.uiOptions.fromDate&&te.uiOptions.multipleDays&&n(te.uiOptions.toDate).isSameOrBefore(te.uiOptions.fromDate)&&(te.uiOptions.toDate=null,j("to"))}function j(e){te.resetUIInputsExtended&&te.resetUIInputsExtended(e),z(),X()}function W(e){te.balance.change=e,te.request.balance_change=e.amount,p(),F(),te.loading.balanceChange=!1}function H(){var e,t,a;te.uiOptions.fromDate?(e=n(te.uiOptions.fromDate).add(1,"day").toDate(),a=e,t=e):(a=h(te.period.start_date),t=te.uiOptions.date.to.options.minDate),te.uiOptions.date.to.options.initDate=t,te.uiOptions.date.to.options.minDate=a,te.uiOptions.date.to.options.maxDate=h(te.period.end_date)}function Y(){return!te.isMode("create")&&U()||te.isMode("create")&&(O("sickness")||L("hours"))?te.uiOptions.multipleDays=!1:te.uiOptions.multipleDays=!0,i.resolve().then(te.setDaysSelectionModeExtended)}function G(){ee&&ee.absenceTypeId===te.selectedAbsenceType.id?te.balance.opening=ee.value||0:te.balance.opening=te.selectedAbsenceType.remainder}function V(){te.selectedAbsenceType=e.find(te.absenceTypes,function(e){return e.id===te.request.type_id})}function z(){var e=te.uiOptions,n=e.times;te.request.from_date=e.fromDate?v(e.fromDate):null,te.request.to_date=e.toDate?v(e.toDate):null,!e.multipleDays&&e.fromDate&&(te.request.to_date=te.request.from_date,te.request.to_date_type=te.request.from_date_type),(L("hours")||O("toil"))&&(te.request.from_date=te.request.from_date&&n.from.time?te.request.from_date+" "+n.from.time:null,te.request.to_date=te.request.to_date&&n.to.time?te.request.to_date+" "+n.to.time:null)}function X(){te.uiOptions.showBalance=te.canCalculateChange()}function Q(){e.forEach(ne,function(e){e()})}function J(){var e,n=te.selectedAbsenceType.calculation_unit_name;return V(),e=n!==te.selectedAbsenceType.calculation_unit_name,G(),i.resolve().then(e&&Y).then(e&&te.onAbsenceTypeUpdateExtended).then(e&&z).then(q).then(B)}function K(e){return te.absenceTypes=e,V(),n(te.uiOptions.toDate).isAfter(te.period.end_date)&&(te.uiOptions.toDate=void 0,j("to")),G(),B()}function Z(e){var n=A(e).add(te.uiOptions.time_interval,"minutes");n.isAfter(A(te.uiOptions.times.to.max))||(te.uiOptions.times.to.min=n.format("HH:mm"),n.isAfter(A(te.uiOptions.times.to.time))&&(te.uiOptions.times.to.time=""))}a.debug("Component: leave-request-popup-details-tab");var ee=null,ne=[],te=this;te.canManage=!1,te.calendar={},te.errors=[],te.isRequired=!0,te.requestDayTypes=[],te.statusNames=c.statusNames,te.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},te.pagination={currentPage:1,filteredbreakdown:[],numPerPage:7,totalItems:0,pageChanged:E},te.uiOptions={isChangeExpanded:!1,multipleDays:!0,userDateFormat:r.DATE_FORMAT,showBalance:!1,date:{from:{show:!1,options:{startingDay:1,showWeeks:!1}},to:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}},expiry:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}}},times:{from:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""},to:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""}},time_interval:15},te.$onInit=f,te.convertDateFormatFromServer=h,te.convertDateToServerFormat=v,te.dateChangeHandler=b,te.dateTypeChangeHandler=g,te.daysSelectionModeChangeHandler=_,te.disableAndShowLoadingTimeInput=y,te.getMomentDateWithGivenTime=A,te.handleError=P,te.isCalculationUnit=L,te.isLeaveType=O,te.isNotWorkingDay=M,te.performBalanceChangeCalculation=B,te.setRequestDateTimesAndDateTypes=z,te.updateEndTimeInputMinTime=Z,te.$onDestroy=Q}t.component("leaveRequestPopupDetailsTab",{bindings:{absencePeriods:"<",absenceTypes:"<",balance:"=",request:"<",isLeaveStatus:"<",leaveType:"<",isMode:"<",isSelfRecord:"<",period:"=",isRole:"<",selectedAbsenceType:"=",forceRecalculateBalanceChange:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-details-tab.html"}],controllerAs:"detailsTab",controller:a}),a.$inject=["$controller","$log","$rootScope","$scope","$q","HR_settings","shared-settings","Calendar","OptionGroup","LeaveRequest","$timeout"]}),define("leave-absences/shared/components/leave-request-popup-files-tab",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/file-upload","common/services/file-mime-types","common/services/hr-settings"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l){function d(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",k),_(),a.all([A(),C()]).then(y).finally(function(){k.filesLoaded=!0})}function m(){return k.fileUploader&&k.fileUploader.queue.length>0}function f(){return k.getFilesAmount()0?I.map(function(e){return e.label}).join(", "):""}function C(){return k.request.loadAttachments().then(function(){o.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function T(){return a.all(I.map(function(e){return l.getMimeTypeFor(e.label).then(function(n){S[e.label]=n})})).catch(function(){S=null})}function A(){return c.valuesOf("safe_file_extension").then(function(e){I=e})}function D(e){return!e.attachment_id||k.canManage}function P(){e.forEach(w,function(e){e()})}function R(e,n){k.fileUploader.queue&&k.fileUploader.queue.length>0?k.fileUploader.uploadAll({entityID:k.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var I=[],w=[],S={},k=Object.create(this);return k.filesLoaded=!1,k.fileUploader=null,k.today=Date.now(),k.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",k.userDateFormat=i.DATE_FORMAT,k.$onDestroy=P,k.$onInit=d,k.canRemoveAttachment=D,k.canSubmit=m,k.canUploadMore=f,k.formatDateTime=p,k.getAuthorName=h,k.getFilesAmount=v,k.listFileTypes=q,k}t.component("leaveRequestPopupFilesTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-files-tab.html"}],controllerAs:"filesTab",controller:["$log","$q","$rootScope","$scope","HR_settings","shared-settings","OptionGroup","FileUpload","fileMimeTypes",a]})}),define("leave-absences/shared/components/leave-request-record-actions.component",["leave-absences/shared/modules/components","common/services/hr-settings","common/services/before-hash-query-params.service"],function(e){function n(e,n,t){function a(){s=t.parse(),s.openModal&&o({leaveType:s.openModal,selectedContactId:i.selectedContactId})}function o(e){n.openModal(e)}e.debug("Component: leave-request-record-actions");var s,i=this;i.leaveRequestOptions=[{type:"leave",icon:"briefcase",label:"Leave"},{type:"sickness",icon:"stethoscope",label:"Sickness"}],i.$onInit=a,i.openLeavePopup=o}e.component("leaveRequestRecordActions",{bindings:{contactId:"<",selectedContactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-record-actions.html"}],controllerAs:"vm",controller:["$log","LeavePopup","beforeHashQueryParams",n]})}),define("leave-absences/shared/components/staff-leave-report.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/pub-sub"],function(e,n,t){function a(n,t,a,o,s,i,r,c,u,l,d,m){function f(){t.all([q(),E(),A(),T()]).then(function(){z.loading.page=!1}).then(function(){return t.all([R(),P()])}).then(B).then(function(){z.loading.content=!1}),N()}function p(e,n){n.data.push(e),n.dataIndex[e.id]=e}function h(){z.absenceTypes=z.absenceTypes.map(function(n){var t=e.find(z.entitlements,function(e){return e.type_id===n.id});return n.entitlement=t?t.value:0,n.remainder=t?t.remainder:{current:0,future:0},n})}function v(e){j(e),z.sections.other.open&&p(e,z.sections.other)}function b(){Object.values(z.sections).forEach(function(e){e.data=[]})}function g(){z.absenceTypesFiltered=z.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function _(e){var n=V[e.status];n?n(e.leaveRequest):z.refresh()}function y(n){n.dataIndex=e.indexBy(n.data,"id")}function q(){return z.role="staff","absence-tab"===a.section?(z.role="admin",t.resolve()):o(m.permissions.admin.administer).then(function(e){e&&(z.role="admin")})}function C(e){return e.current?"Current Period ("+e.title+")":e.title}function T(){return s.all().then(function(n){z.absencePeriods=e.sortBy(n,"start_date"),z.selectedPeriod=e.find(z.absencePeriods,function(e){return!0===e.current})})}function A(){return i.all().then(i.loadCalculationUnits).then(function(n){z.absenceTypes=n,z.absenceTypesIndexed=e.indexBy(n,"id")})}function D(){return k("approved",{status_id:G(m.statusNames.approved)})}function P(){var n={contact_id:z.contactId,period_id:z.selectedPeriod.id};return t.all([c.balanceChangeByAbsenceType(e.assign({},n,{public_holiday:!0})),c.balanceChangeByAbsenceType(e.assign({},n,{expired:!0})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[G(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[G(m.statusNames.awaitingApproval),G(m.statusNames.moreInformationRequired)]}}))]).then(function(e){z.absenceTypes.forEach(function(n){n.balanceChanges={holidays:e[0][n.id],expired:e[1][n.id],approved:e[2][n.id],pending:e[3][n.id]}})})}function R(){return r.all({contact_id:z.contactId,period_id:z.selectedPeriod.id},!0).then(function(e){z.entitlements=e})}function I(){return r.breakdown({contact_id:z.contactId,period_id:z.selectedPeriod.id},z.entitlements).then(function(){return F(z.entitlements)}).then(function(e){z.sections.entitlements.data=e})}function w(){return t.all([r.breakdown({contact_id:z.contactId,period_id:z.selectedPeriod.id,expired:!0}),S({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:F(e[0]),expiredTOILS:U(e[1].list)})}).then(function(n){z.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),z.sections.expired.data=e.sortBy(z.sections.expired.data,"expiry_date")})}function S(n){return c.all(e.assign({contact_id:z.contactId,from_date:{from:z.selectedPeriod.start_date},to_date:{to:z.selectedPeriod.end_date},type_id:{IN:z.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function k(e,n){return S(n).then(function(n){z.sections[e].data=n.list})}function L(){return t.all(Object.values(z.sections).filter(function(e){return e.open}).map(x))}function O(){return k("other",{status_id:{in:[G(m.statusNames.rejected),G(m.statusNames.cancelled)]}})}function M(){return k("pending",{status_id:{in:[G(m.statusNames.awaitingApproval),G(m.statusNames.moreInformationRequired)]}})}function $(){return k("holidays",{public_holiday:!0})}function x(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function E(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){z.leaveRequestStatuses=e.indexBy(n,"value")})}function B(){h(),g()}function F(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(z.entitlements,function(e){return e.id===n.id});return n.breakdown.map(function(n){return e.assign(e.clone(n),{type_id:t.type_id})})})}).then(function(e){return Array.prototype.concat.apply([],e)})} +function U(n){return t.resolve().then(function(){return n.map(function(n){return e.assign({},n,{expiry_date:n.toil_expiry_date,amount:n.toil_to_accrue,type:{label:"Accrued TOIL"}})})})}function N(){l.subscribe("LeaveRequest::new",function(){z.refresh()}),l.subscribe("LeaveRequest::edit",function(){z.refresh()}),l.subscribe("LeaveRequest::statusUpdate",_),l.subscribe("LeaveRequest::delete",function(e){j(e)})}function j(n){e.forEach(z.sections,function(t,a){t.dataIndex[n.id]&&(e.remove(t.data,function(e){return e.id===n.id}),delete t.dataIndex[n.id],"other"!==a&&W(n,a))})}function W(n,t){var a=["future","current"],o=z.absenceTypesIndexed[n.type_id];"pending"===t&&e.pull(a,"current"),o.balanceChanges[t]-=n.balance_change,a.forEach(function(e){o.remainder[e]-=n.balance_change})}function H(){z.loading.content=!0,t.all([R(),P()]).then(B).then(function(){z.loading.content=!1}).then(function(){return t.all([L(),b()])})}function Y(e){var n=z.sections[e];n.open=!n.open,n.open&&!n.data.length&&x(n)}function G(n){return e.find(z.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var V={delete:j,cancel:v},z=this;z.absencePeriods=[],z.absenceTypes=[],z.absenceTypesFiltered=[],z.absenceTypesIndexed={},z.dateFormat=d.DATE_FORMAT,z.leaveRequestStatuses={},z.selectedPeriod=null,z.role=null,z.loading={content:!0,page:!0},z.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:D},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:w},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:$},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O}},z.$onInit=f,z.labelPeriod=C,z.refresh=H,z.toggleSection=Y}t.component("staffLeaveReport",{bindings:{contactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/staff-leave-report.html"}],controllerAs:"report",controller:a}),a.$inject=["$log","$q","$rootScope","checkPermissions","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","OptionGroup","pubSub","HR_settings","shared-settings"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){return i.request.calculateBalanceChange(i.selectedAbsenceType.calculation_unit_name)}function l(){var e=i.request,n=!!e.from_date&&!!e.to_date,t=i.selectedAbsenceType.calculation_unit_name;return"days"===t?n=n&&!!e.from_date_type&&!!e.to_date_type:"hours"===t&&(n=n&&!isNaN(+e.from_date_amount)&&!isNaN(+e.to_date_amount)),n}function d(){return i.canCalculateChange()}function m(n,t){var a=i.uiOptions.times[n],o=e.clone(t.time_from),s=e.clone(t.time_to);i.uiOptions.multipleDays||("from"===n&&s&&o&&(s=i.getMomentDateWithGivenTime(s).subtract(i.uiOptions.time_interval,"minutes").format("HH:mm")),"to"===n&&o&&s&&(o=i.getMomentDateWithGivenTime(o).add(i.uiOptions.time_interval,"minutes").format("HH:mm"))),a.min=o||"00:00",a.max=s||"00:00",a.time="to"===n?a.max:a.min}function f(n,t){return n?(n=i.convertDateToServerFormat(n),v(n).then(function(t){return t?i.requestDayTypes.filter(function(e){return"public_holiday"===e.name}):p(n,i.requestDayTypes).then(function(n){return n.length?n:i.requestDayTypes.filter(function(n){return e.includes(["all_day","half_day_am","half_day_pm"],n.name)})})}).then(function(e){return I(t,e),e})):o.reject([])}function p(e,t){return e=n(e),o.all([i.calendar.isNonWorkingDay(e),i.calendar.isWeekend(e)]).then(function(e){return e[0]?"non_working_day":e[1]?"weekend":null}).then(function(e){return e?t.filter(function(n){return n.name===e}):[]})}function h(e,t){return n.duration(t).subtract(n.duration(e)).asHours()}function v(e){return c.all({public_holiday:1,contact_id:i.request.contact_id,from_date:{from:e},to_date:{to:e}}).then(function(e){return!!e.list.length})}function b(){return o.resolve()}function g(){return A(i.uiOptions.fromDate,"from").then(function(){return A(i.uiOptions.toDate,"to")})}function _(e){s.$watch(function(){return i.uiOptions.times[e].amount},function(e,n){i.isCalculationUnit("days")||+e==+n||(i.isRole("staff")&&(i.request.change_balance=!0),k(),i.performBalanceChangeCalculation())})}function y(e){var t=n(i.request[e+"_date"]).format("HH:mm"),a=i.uiOptions.times[e];(h(a.min,t)<=0||h(a.max,t)>=0)&&(t="from"===e?a.min:a.max),i.uiOptions.times[e].time=t}function q(){var e=i.uiOptions.multipleDays?["from","to"]:["from"],n=i.uiOptions.times;if(i.isCalculationUnit("hours"))return o.all(e.map(P)).then(function(){["from","to"].forEach(function(e){y(e),S(e),n[e].amount=Math.min(i.request[e+"_date_amount"],n[e].maxAmount).toString()}),i.uiOptions.multipleDays||i.updateEndTimeInputMinTime(i.uiOptions.times.from.time)}).then(k)}function C(){["from","to"].forEach(function(e){_(e),T(e)})}function T(e){s.$watch(function(){return i.uiOptions.times[e].time},function(n,t){i.isCalculationUnit("days")||n===t||(i.setRequestDateTimesAndDateTypes(),n&&S(e,!0))})}function A(e,n){return f(e,n).then(function(){i.loading[n+"DayTypes"]=!1})}function D(e){return A(i.uiOptions[e+"Date"],e).then(function(){if(i.isCalculationUnit("hours"))return P(e).then(function(){S(e,!0)})})}function P(e){var n=i.uiOptions[e+"Date"],t=!i.uiOptions.multipleDays;return n?i.request.getWorkDayForDate(i.convertDateToServerFormat(n)).then(function(n){O[e]=n,m(e,n),t&&"from"===e&&m("to",n)}).catch(function(n){return O[e]={},i.handleError(n)}).finally(function(){i.uiOptions.times[e].loading=!1,t&&(i.uiOptions.times.to.loading=!1)}):o.resolve()}function R(n){var t=i.uiOptions.times[n];i["request"+e.startCase(n)+"DayTypes"]=[],t.time="",t.min="00:00",t.max="00:00",t.amount="0",t.maxAmount="0"}function I(n,t){var a="request"+e.startCase(n)+"DayTypes";i[a]=t,i.isMode("create")&&(i.request[n+"_date_type"]=i[a][0].value)}function w(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?(i.disableAndShowLoadingTimeInput("from"),!i.uiOptions.multipleDays&&i.disableAndShowLoadingTimeInput("to"),P("from").then(function(){S("from",!0)})):o.resolve()}function S(e,n){var t=i.uiOptions,a=t.multipleDays?e:"from",o=t.times[a],s=t.multipleDays&&"to"===a?o.min:t.times.from.time,r=t.multipleDays&&"from"===a?o.max:t.times.to.time,c=O[a].number_of_hours?h(s,r).toString():"0";o.maxAmount=c,n&&(o.amount=o.maxAmount)}function k(){var e=i.uiOptions.times;i.request.from_date_amount=isNaN(+e.from.amount)?null:e.from.amount,i.request.to_date_amount=isNaN(+e.to.amount)?null:e.to.amount}function L(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?P("from").then(function(){S("from",!0)}):o.resolve()}var O={};a.debug("RequestModalDetailsLeaveController"),i.calculateBalanceChange=u,i.canCalculateChange=l,i.canSubmit=d,i.initChildController=b,i.initDayTypesExtended=g,i.initTimesExtended=q,i.initWatchersExtended=C,i.onAbsenceTypeUpdateExtended=L,i.onDateChangeExtended=D,i.resetUIInputsExtended=R,i.setDaysSelectionModeExtended=w}t.controller("RequestModalDetailsLeaveController",a),a.$inject=["$controller","$log","$q","$rootScope","detailsController","PublicHoliday","LeaveRequest"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller",["common/lodash","leave-absences/shared/modules/controllers"],function(e,n){function t(n,t,a,o,s,i,r){function c(){return!(!r.canCalculateChange()||!r.request.sickness_reason)}function u(){return a.all([m(),h(),f(!0)])}function l(n){var t=r.request.getDocumentArray();return!!e.find(t,function(e){return e===n})}function d(n){return!!e.find(r.sicknessDocumentTypes,function(e){return e.value===n})}function m(){return i.valuesOf("hrleaveandabsences_leave_request_required_document").then(function(e){r.sicknessDocumentTypes=e})}function f(n){return i.valuesOf("hrleaveandabsences_sickness_reason",n).then(function(n){r.sicknessReasons=e.indexBy(n,"name")})}function p(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_sickness_reason?reset=1").on("crmUnload",function(){f(!1)})}function h(){r.showSicknessOptionsEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}t.debug("RequestModalDetailsSicknessController"),n("RequestModalDetailsLeaveController",{detailsController:r}),r.canSubmit=c,r.initChildController=u,r.isChecked=l,r.isDocumentInRequest=d,r.openSicknessReasonOptionsEditor=p}n.controller("RequestModalDetailsSicknessController",t),t.$inject=["$controller","$log","$q","$rootScope","crmAngService","api.optionGroup","detailsController"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){return c.balance.change.amount=+c.request.toil_to_accrue,a.resolve(c.balance.change)}function l(){if(!c.request.from_date||!c.request.to_date)return c.uiOptions.max_toil_duration_and_accrual=null,void(c.uiOptions.toil_duration_in_hours=null);c.uiOptions.max_toil_duration_and_accrual=n.duration(n(c.request.to_date).diff(c.request.from_date)).asHours()}function d(){return v().catch(function(e){return e.length&&(c.errors=e),a.reject(e)}).then(function(e){return r.calculateToilExpiryDate(c.request.type_id,e)}).then(function(e){return c.request.toil_expiry_date=e,c.uiOptions.expiryDate=new Date(e),e})}function m(){return!!c.request.toil_to_accrue}function f(){var e=c.uiOptions.multipleDays&&!!c.request.to_date,n=!c.uiOptions.multipleDays&&!!c.request.from_date,t=n||e,a=N.from_date!==c.request.from_date||N.to_date!==c.request.to_date;return c.canDisplayToilExpirationField&&t&&W.hasExpirationFromAdminSettings&&a}function p(){return!!(c.request.from_date&&c.request.to_date&&c.request.toil_duration&&c.request.toil_to_accrue)}function h(){c.request.toil_expiry_date=!1,c.uiOptions.expiryDate=null}function v(){var e=c.uiOptions.multipleDays,n=c.request;return b({hasErrors:e?!n.to_date&&!n.from_date:!n.from_date,label:e?"To Date":"From Date",value:n.to_date})}function b(e){if(e.hasErrors){var t="Please select "+e.label+" to find expiry date";return a.reject([t])}return e.value?a.resolve(n(e.value).format("YYYY-MM-DD")):a.reject([])}function g(){var e=c.isMode("create")&&W.hasExpirationFromAdminSettings,n=W.hasPreviousExpirationDate,t=c.isLeaveType("toil"),a=c.canManage;c.canDisplayToilExpirationField=t&&(a||e||n)}function _(){c.uiOptions.toil_duration_in_hours=c.request.toil_duration/60}function y(){return W.hasPreviousExpirationDate=c.isMode("edit")&&!!c.request.toil_expiry_date,r.canExpire(c.request.type_id).then(function(e){W.hasExpirationFromAdminSettings=e})}function q(){return c.request.to_date_type=c.request.from_date_type="1",y().then(g).then(C).then(I)}function C(){c.canManage&&(c.uiOptions.expiryDate=c.convertDateFormatFromServer(c.request.toil_expiry_date))}function T(){o.$watch(function(){return c.request.toil_to_accrue},function(e,n){+e!=+n&&c.performBalanceChangeCalculation()})}function A(){o.$watch(function(){return c.uiOptions.toil_duration_in_hours},function(e,n){e!==n&&c.isCalculationUnit("hours")&&L(),c.request.toil_duration=c.uiOptions.toil_duration_in_hours?60*c.uiOptions.toil_duration_in_hours:null})}function D(){var e=c.uiOptions.times;e.from.time=n(c.request.from_date).format("HH:mm"),e.to.time=n(c.request.to_date).format("HH:mm"),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time)}function P(){["from","to"].forEach(function(e){o.$watch(function(){return c.uiOptions.times[e].time},function(e,n){e!==n&&(c.setRequestDateTimesAndDateTypes(),F(),l(),O())})})}function R(){c.isMode("view")||(T(),A(),P())}function I(n){return i.valuesOf("hrleaveandabsences_toil_amounts",n).then(function(n){c.toilAmounts=e.sortBy(n,function(e){return+e.weight})})}function w(){return l(),O(),F()}function S(){return $(),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time),l(),j?j=!1:O(),F()}function k(e){c.uiOptions.times[e].time=""}function L(){c.request.toil_to_accrue=c.uiOptions.toil_duration_in_hours}function O(){c.uiOptions.toil_duration_in_hours=c.uiOptions.max_toil_duration_and_accrual}function M(){N=e.cloneDeep(c.request.attributes())}function $(){c.uiOptions.multipleDays?["from","to"].forEach(function(e){c.uiOptions.times[e].min="00:00",c.uiOptions.times[e].max="23:45"}):(c.uiOptions.times.from.min="00:00",c.uiOptions.times.from.max="23:30",c.uiOptions.times.to.min="00:15",c.uiOptions.times.to.max="23:45")}function x(){c.setRequestDateTimesAndDateTypes(),l(),O(),c.isCalculationUnit("hours")?L():c.request.toil_to_accrue=null}function E(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_toil_amounts?reset=1").on("crmUnload",function(){I(!1)})}function B(){c.showTOILAccrualsOptionEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}function F(){return f()?d().catch(a.resolve):a.resolve()}function U(){c.uiOptions.expiryDate&&(c.request.toil_expiry_date=c.convertDateToServerFormat(c.uiOptions.expiryDate))}t.debug("RequestModalDetailsToilController");var N,j=!c.isMode("create"),W={hasPreviousExpirationDate:null,hasExpirationFromAdminSettings:null};c.canDisplayToilExpirationField=!1,c.calculateBalanceChange=u,c.canCalculateChange=m,c.canSubmit=p,c.clearExpiryDate=h,c.initChildController=q,c.initTimesExtended=D,c.initWatchersExtended=R,c.onAbsenceTypeUpdateExtended=x,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,c.updateExpiryDate=U,function(){M(),$(),B(),!c.isMode("create")&&_()}()}t.controller("RequestModalDetailsToilController",a),a.$inject=["$log","$q","$rootScope","crmAngService","OptionGroup","AbsenceType","detailsController"]}),define("leave-absences/shared/services/leave-calendar.service",["common/lodash","common/moment","leave-absences/shared/modules/services"],function(e,n,t){"use strict";function a(t,a,o,s){function i(t){function i(){return o.all().then(function(e){return e.list})}function r(){return o.leaveManagees(void 0,{unassigned:!0})}function c(){var n=e.get(t,"filters.userSettings.assignedTo.type","all");return m().then(function(e){return t.lookupContacts=e,a.all([d(),"me"!==n?u():a.resolve(null)])}).then(function(e){var n=e[0];return t.contactIdsToReduceTo=e[1],n})}function u(){return l().then(function(a){var o=a.filter(function(e){var a=e.info.details;return n(a.period_start_date).isSameOrBefore(t.selectedPeriod.end_date)&&(n(a.period_end_date).isSameOrAfter(t.selectedPeriod.start_date)||!a.period_end_date)});return e.uniq(o.map(function(e){return e.contact_id}))})}function l(){return v?a.resolve(v):s.all()}function d(){return o.all(h(),null,"display_name").then(function(e){return e.list})}function m(){var n=e.get(t,"filters.userSettings.assignedTo.type","all");return(0,b[n])()}function f(){return m().then(function(e){t.lookupContacts=e}).then(d)}function p(){return o.leaveManagees(t.contactId)}function h(){var n={department:e.get(t,"filters.userSettings.department.value",null),level_type:e.get(t,"filters.userSettings.level_type.value",null),location:e.get(t,"filters.userSettings.location.value",null),region:e.get(t,"filters.userSettings.region.value",null)},a=!!t.filters.userSettings.contact,o=e.isArray(t.lookupContacts)&&t.lookupContacts.length,s="all"!==e.get(t,"filters.userSettings.assignedTo.type","all");return a?n.id={IN:[t.filters.userSettings.contact.id]}:(s||o)&&(n.id={IN:e.pluck(t.lookupContacts,"id")}),n}var v,b={all:i,me:p,unassigned:r};return{loadContactsForAdmin:c,loadFilteredContacts:d,loadLookUpContacts:m,loadLookUpAndFilteredContacts:f}}return t.debug("LeaveCalendarService"),{init:i}}t.factory("LeaveCalendarService",a),a.$inject=["$log","$q","Contact","Contract"]}),define("leave-absences/shared/instances/absence-period.instance",["leave-absences/shared/modules/models-instances","common/moment","common/models/instances/instance","common/services/hr-settings"],function(e,n){"use strict";e.factory("AbsencePeriodInstance",["$log","ModelInstance","HR_settings",function(e,t,a){return e.debug("AbsencePeriodInstance"),t.extend({defaultCustomData:function(){return{current:!1}},transformAttributes:function(e){var t=n();return e.current=!1,n(e.start_date).isSameOrBefore(t,"day")&&n(e.end_date).isSameOrAfter(t,"day")&&(e.current=!0),e},isInPeriod:function(e){var t=a.DATE_FORMAT.toUpperCase(),o=n(e,t);return n(this.start_date).isSameOrBefore(o)&&n(this.end_date).isSameOrAfter(o)}})}])}),define("leave-absences/shared/apis/absence-period.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("AbsencePeriodAPI",["$log","api",function(e,n){return e.debug("AbsencePeriodAPI"),n.extend({all:function(n){return e.debug("AbsencePeriodAPI"),this.sendGET("AbsencePeriod","get",n).then(function(e){return e.values})}})}])}),define("leave-absences/shared/models/absence-period.model",["leave-absences/shared/modules/models","common/moment","leave-absences/shared/modules/shared-settings","leave-absences/shared/instances/absence-period.instance","leave-absences/shared/apis/absence-period.api","common/models/model","common/services/hr-settings"],function(e,n){"use strict";e.factory("AbsencePeriod",["$log","Model","AbsencePeriodAPI","AbsencePeriodInstance","shared-settings",function(e,t,a,o,s){return e.debug("AbsencePeriod"),t.extend({all:function(e){return a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},current:function(){var e=n().format(s.serverDateFormat),t={start_date:{"<=":e},end_date:{">=":e}};return a.all(t).then(function(e){return e&&e.length?o.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/public-holiday.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("PublicHolidayAPI",["$log","api",function(e,n){return e.debug("PublicHolidayAPI"),n.extend({all:function(n){return e.debug("PublicHolidayAPI"),this.sendGET("PublicHoliday","get",n).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/public-holiday.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("PublicHolidayInstance",["$log","ModelInstance",function(e,n){return e.debug("PublicHolidayInstance"),n.extend({})}])}),define("leave-absences/shared/models/public-holiday.model",["common/moment","leave-absences/shared/modules/models","common/models/model","common/services/hr-settings","leave-absences/shared/apis/public-holiday.api","leave-absences/shared/instances/public-holiday.instance"],function(e,n){"use strict";n.factory("PublicHoliday",["$log","Model","PublicHolidayAPI","PublicHolidayInstance","shared-settings",function(n,t,a,o,s){return n.debug("PublicHoliday"),t.extend({all:function(e){return n.debug("PublicHoliday.all",e),a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},isPublicHoliday:function(t){n.debug("PublicHoliday.isPublicHoliday",t);var o=e(t).format(s.serverDateFormat),i={date:o};return a.all(i).then(function(e){return!!e.length})}})}])}),define("leave-absences/shared/instances/sickness-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,n){"use strict";n.factory("SicknessRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(n,t){return t.extend({defaultCustomData:function(){var n={sickness_reason:null,sickness_required_documents:"",request_type:"sickness"};return e.assign({},t.defaultCustomData(),n)},getDocumentArray:function(){return this.sickness_required_documents?this.sickness_required_documents.split(","):[]},toggleDocument:function(n){var t=this.getDocumentArray(),a=t.indexOf(n);e.contains(t,n)?t.splice(a,1):t.push(n),this.sickness_required_documents=t.join(",")},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])}})}])}),define("leave-absences/shared/instances/toil-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,n){"use strict";n.factory("TOILRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(n,t){return t.extend({defaultCustomData:function(){var n={from_date_amount:0,to_date_amount:0,request_type:"toil"};return e.assign({},t.defaultCustomData(),n)},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])}})}])}),define("leave-absences/shared/controllers/request.controller",["common/angular","leave-absences/shared/modules/controllers","common/lodash","common/moment","common/models/contact","common/services/api/option-group","common/services/hr-settings","common/services/pub-sub","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/instances/leave-request.instance","leave-absences/shared/instances/sickness-request.instance","leave-absences/shared/instances/toil-request.instance","leave-absences/shared/services/leave-request.service"],function(e,n,t,a){"use strict";function o(n,o,s,i,r,c,u,l,d,m,f,p,h,v,b,g,_,y,q,C){function T(e){"days"===Ue.selectedAbsenceType.calculation_unit_name?delete Ue.request[e+"_date_amount"]:delete Ue.request[e+"_date_type"]}function A(){["from","to"].forEach(T)}function D(){return Le.checkIfSelfLeaveApprover().then(function(e){e&&(Be="admin")})}function P(){var e=Ue.requestStatuses[_.statusNames.awaitingApproval].value;$e.status_id===e&&e!==Ue.request.status_id&&d.publish("ManagerBadge:: Update Count")}function R(){return Fe.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return Fe.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function w(){return!Ue.loading.entitlements&&(!!le("admin")||!ce("view")&&!(le("manager")&&!ce("create")))}function S(){var e=R();return Ue.isMode("edit")&&(e=e&&(G()||I())),Ue.canManage&&Ue.requestStatuses&&(e=e&&!!Ue.getStatusFromValue(Ue.newStatusOnSave)),(e=e&&!!Ue.period.id)&&!Ue.isMode("view")}function k(){Ue.isSelfRecord&&!Ue.isSelfLeaveApprover?Ue.request.status_id=Ue.requestStatuses[_.statusNames.awaitingApproval].value:Ue.canManage&&(Ue.request.status_id=Ue.newStatusOnSave||Ue.request.status_id)}function L(){if(Ue.isMode("edit")&&!Ue.isRole("staff")&&"toil"!==j())return Ue.request.calculateBalanceChange(Ue.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Ue.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function O(){return"toil"!==j()&&!Ue.request.change_balance}function M(){Ue.errors=[]}function $(){return Ue.request.create().then(Re).then(function(){ge("LeaveRequest::new")})}function x(){se()&&!Ue.isRole("staff")&&(Ue.request.change_balance=!0)}function E(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Ue.request.delete().then(function(){Ue.dismissModal(),d.publish("LeaveRequest::delete",Ue.request)})}})}function B(){r.dismiss({$value:"cancel"})}function F(){var e=j();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function U(){return N(Ue.getStatusFromValue(Ue.request.status_id).name)}function N(e){return t.map(Oe[e],function(e){return Ue.requestStatuses[e]})}function j(){return Ue.request?Ue.request.request_type:Ue.leaveType||null}function W(){return!Ue.request||e.equals({},Ue.requestStatuses)?[]:Ue.request.status_id?U():N("none")}function H(e){return t.find(Ue.requestStatuses,function(n){return n.value===e})}function Y(e){Ue.errors=t.isArray(e)?e:[e],Ue.loading.absenceTypes=!1,Ue.submitting=!1}function G(){return!e.equals($e,Ue.request.attributes())||Ue.canManage&&Ue.newStatusOnSave}function V(){return Ue.postContactSelection=!0,Ue.staffMemberSelectionComplete=!1,Ue.request.contact_id?o.resolve().then(me).then(fe).then(ye).then(Ce).then(oe).then(Q).then(Ue.isMode("edit")?Te:t.noop).then(function(){Ue.postContactSelection=!1,Ue.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return o.reject(e)}):o.reject("The contact id was not set")}function z(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];Oe.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Oe.awaiting_approval=e,Oe.more_information_required=e,Oe.rejected=e,Oe.approved=e,Oe.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){Ue.canManage=Ue.isRole("manager")||Ue.isRole("admin")}function Q(){return Ue.canManage?f.find(Ue.request.contact_id).then(function(e){Ue.contactName=e.display_name}):o.resolve()}function J(){Ue.isRole("admin")&&Ue.isSelfRecord&&(Ue.isSelfLeaveApprover=!0)}function K(){var e="my-leave"===s.section,n=+Le.id==+t.get(Ue,"leaveRequest.contact_id"),a=!t.get(Ue,"leaveRequest.id");Ue.isSelfRecord=e&&a||n}function Z(){xe.push(s.$on("LeaveRequestPopup::requestObjectUpdated",Te),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Ue.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,n){Y(n)}),s.$on("LeaveRequestPopup::childComponent::register",function(){Me++})),i.$on("$destroy",Ie),i.$on("LeaveRequestPopup::addTab",function(e,n){Fe.push(n)})}function ee(){var e,n;Ue.request=Ue.leaveRequest||null,e=j(),n=Ue.initRequestAttributes(),"leave"===e?Ue.request=g.init(n):"sickness"===e?Ue.request=y.init(n):"toil"===e&&(Ue.request=q.init(n))}function ne(){var e={};return Ue.request?e=Ue.request.attributes():Ue.canManage||(e={contact_id:Le.id}),e}function te(){return Be="staff",ae().then(Ue.isSelfRecord&&!Ue.isRole("admin")&&D)}function ae(){return c(_.permissions.admin.administer).then(function(e){e&&(Be="admin")}).then(function(){return"admin"!==Be&&c(_.permissions.ssp.manage)}).then(function(e){e&&(Be="manager")})}function oe(){Ue.defaultStatus?Ue.newStatusOnSave=Ue.requestStatuses[_.statusNames[Ue.defaultStatus]].value:(Ue.isRole("admin")||Ue.isMode("create")&&Ue.isRole("manager"))&&(Ue.newStatusOnSave=Ue.requestStatuses[_.statusNames.approved].value)}function se(){return!Ue.request.status_id||!t.includes(["cancelled","rejected"],H(Ue.request.status_id).name)}function ie(e){var n=Ue.getStatusFromValue(Ue.request.status_id);return!!n&&n.name===e}function re(e){return Ue.request&&Ue.request.request_type===e}function ce(e){return Ue.mode===e}function ue(e,n){var t=a(e.from_date),o=a(e.to_date);return t.isSameOrAfter(n.start_date,"day")&&o.isSameOrBefore(n.end_date,"day")}function le(e){return Be===e}function de(){return p.all().then(function(e){Ue.absencePeriods=e})}function me(){return h.all(F()).then(h.loadCalculationUnits).then(function(e){ke={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Ue.loading.entitlements=!0,v.all({contact_id:Ue.request.contact_id,period_id:Ue.period.id,type_id:{IN:ke.ids}},!0).finally(function(){Ue.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){Le=e})}function he(){return Ue.selectedContactId?f.find(Ue.selectedContactId).then(function(e){Ue.managedContacts=[e]}):Ue.isRole("admin")?f.all().then(function(e){Ue.managedContacts=e.list}):Le.leaveManagees().then(function(e){Ue.managedContacts=e})}function ve(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Ue.requestStatuses=t.indexBy(e,"name")})}function be(e,n){var a;return t.compact(e.map(function(e){if(a=t.find(n,{type_id:e.id}))return{id:a.type_id,title:e.title+" ( "+a.remainder.current+" ) ",remainder:a.remainder.current,allow_overuse:e.allow_overuse,calculation_unit_name:e.calculation_unit_name}}))}function ge(e){P(),d.publish(e,Ue.request),Ue.errors=[],Ue.dismissModal()}function _e(){["from","to"].forEach(function(e){Ue.request[e+"_date"]=$e[e+"_date"]})}function ye(e){if(Ue.absenceTypes=be(ke.types,e),!Ue.absenceTypes.length)return o.reject(Ee)}function qe(){Ue.period=t.find(Ue.absencePeriods,function(e){return Ue.isMode("create")?e.current:ue(Ue.request,e)})}function Ce(){Ue.isMode("create")?(Ue.selectedAbsenceType=Ue.absenceTypes[0],Ue.request.type_id=Ue.selectedAbsenceType.id):Ue.selectedAbsenceType=t.find(Ue.absenceTypes,function(e){return e.id===Ue.request.type_id})}function Te(){$e=e.copy(Ue.request.attributes())}function Ae(){var e;Ue.request.id?(e=[Ue.requestStatuses[_.statusNames.approved].value,Ue.requestStatuses[_.statusNames.adminApproved].value,Ue.requestStatuses[_.statusNames.rejected].value,Ue.requestStatuses[_.statusNames.cancelled].value],Ue.mode="edit",Ue.isRole("staff")&&e.indexOf(Ue.request.status_id)>-1&&(Ue.mode="view")):Ue.mode="create"}function De(){var e=Ue.request.status_id;if(!Ue.isMode("view")&&!Ue.submitting)return Ue.submitting=!0,k(),A(),Ue.request.isValid().then(se()&&L).then(x).then(O()&&_e).then(Pe).then(function(){return Ue.isMode("edit")?Se():$()}).catch(function(n){Ue.request.status_id=e,n&&Y(n)}).finally(function(){Ue.submitting=!1})}function Pe(){return o.all(Fe.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Re(){function e(e){e&&t.push(e),++a===Me&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Me>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function Ie(){xe.forEach(function(e){e()})}function we(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Ue.request.update().then(Re).then(function(){Ue.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Ue.isRole("staff")||Ue.isRole("admin"))&&ge("LeaveRequest::edit")})}n.debug("RequestCtrl");var ke,Le,Oe={},Me=0,$e={},xe=[],Ee="No entitlement",Be="",Fe=[],Ue=t.assign(this,m);Ue.absencePeriods=[],Ue.absenceTypes=[],Ue.canManage=!1,Ue.contactName=null,Ue.errors=[],Ue.isSelfLeaveApprover=!1,Ue.loading={absenceTypes:!0,entitlements:!0},Ue.managedContacts=[],Ue.mode="",Ue.newStatusOnSave=null,Ue.period={},Ue.postContactSelection=!1,Ue.requestStatuses={},Ue.selectedAbsenceType={},Ue.staffMemberSelectionComplete=!1,Ue.submitting=!1,Ue.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Ue.canChangeAbsenceType=w,Ue.canSubmit=S,Ue.closeAlert=M,Ue.deleteLeaveRequest=E,Ue.dismissModal=B,Ue.getStatuses=W,Ue.getStatusFromValue=H,Ue.initAfterContactSelection=V,Ue.initRequestAttributes=ne,Ue.isLeaveStatus=ie,Ue.isLeaveType=re,Ue.isMode=ce,Ue.isRole=le,Ue.submit=De,Ue.updateAbsenceType=we,function(){Ue.loading.absenceTypes=!0,z(),Z(),pe().then(K).then(function(){return o.all([te(),de(),ve()])}).then(X).then(J).then(ee).then(Ae).then(qe).then(function(){return Ue.canManage&&!Ue.isMode("edit")&&he()}).then(function(){if(Ue.selectedContactId&&(Ue.request.contact_id=Ue.selectedContactId),Ue.request.contact_id)return Ue.initAfterContactSelection()}).catch(Y).finally(function(){Ue.loading.absenceTypes=!1})}()}n.controller("RequestCtrl",o),o.$inject=["$log","$q","$rootScope","$scope","$uibModalInstance","checkPermissions","api.optionGroup","dialog","pubSub","directiveOptions","Contact","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","LeaveRequestInstance","shared-settings","SicknessRequestInstance","TOILRequestInstance","LeaveRequestService"]}), +define("leave-absences/shared/services/leave-popup.service",["common/lodash","common/modules/angular-date","leave-absences/shared/modules/services","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/controllers/request.controller"],function(e,n){"use strict";function t(e,n,t,a,o,s,i,r,c){function u(e){return r.get().then(function(n){return e.roleOf(n.contactId)}).then(function(e){return"none"!==e})}function l(e){a.open({appendTo:n.children().eq(0),templateUrl:s.sharedPathTpl+"components/leave-request-popup/leave-request-popup.html",controller:"RequestCtrl",controllerAs:"$ctrl",windowClass:"chr_leave-request-modal",resolve:{directiveOptions:function(){return e},format:["DateFormat",function(e){return e.getDateFormat()}]}})}function d(e){return c.find(e).then(function(e){return u(e).then(function(n){n?l({leaveRequest:e,leaveType:e.request_type,selectedContactId:e.contact_id}):o.error("Error","You dont have permission to see this leave request")})}).catch(function(e){o.error("Error",e)})}return e.debug("LeavePopup"),{openModal:l,openModalByID:d}}n.factory("LeavePopup",t),t.$inject=["$log","$rootElement","$rootScope","$uibModal","notificationService","shared-settings","DateFormat","Session","LeaveRequest"]}),define("leave-absences/absence-tab/modules/components",["common/angular"],function(e){return e.module("absence-tab.components",[])}),function(e){define("leave-absences/absence-tab/components/absence-tab-container.component",["leave-absences/absence-tab/modules/components"],function(n){function t(n,t,a){function o(){a.getDateFormat()}n.debug("Component: absence-tab-container"),t.section="absence-tab";var s=this;s.contactId=e.adminId,s.$onInit=o}n.component("absenceTabContainer",{templateUrl:["settings",function(e){return e.pathTpl+"components/absence-tab-container.html"}],controllerAs:"absence",controller:t}),t.$inject=["$log","$rootScope","DateFormat"]})}(CRM),define("leave-absences/absence-tab/components/absence-tab-entitlements.component",["common/lodash","leave-absences/absence-tab/modules/components"],function(e,n){function t(e,n,t){function a(){o().finally(function(){s.loading.component=!1})}function o(){return t.all().then(t.loadCalculationUnits).then(function(e){s.absenceTypes=e})}n.debug("Component: absence-tab-entitlements");var s=this;s.absenceTypes=[],s.loading={component:!0},s.$onInit=a}n.component("absenceTabEntitlements",{bindings:{contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/absence-tab-entitlements.html"}],controllerAs:"entitlements",controller:t}),t.$inject=["$q","$log","AbsenceType"]}),define("leave-absences/absence-tab/components/absence-tab-custom-work-pattern-modal.component",["common/moment","leave-absences/absence-tab/modules/components"],function(e,n){function t(n,t,a,o,s,i,r){function c(){return t.all([l(),d(!0)]).finally(function(){f.loading.content=!1})}function u(e){f.errorMessage=e}function l(){return r.get({is_active:!0}).then(function(e){f.workPatterns=e})}function d(e){return s.valuesOf("hrleaveandabsences_work_pattern_change_reason",e).then(function(e){f.changeReasons=e})}function m(){o.loadForm("/civicrm/admin/options/hrleaveandabsences_work_pattern_change_reason?reset=1").on("crmUnload",function(){d(!1)})}n.debug("Component: absence-tab-custom-work-pattern-modal");var f=Object.create(this);return f.changeReasons=[],f.errorMessage="",f.saveInProgress=!1,f.workPatterns=[],f.loading={content:!0},f.selected={workPattern:null,effectiveDate:null,changeReason:null},f.uiOptions={effectiveDate:{show:!1,options:{startingDay:1,showWeeks:!1}}},f.$onInit=c,f.openWorkPatternChangeReasonEditor=m,f.closeModal=function(){f.dismiss({$value:"cancel"})},f.closeAlert=function(){f.errorMessage=""},f.save=function(){var n=e(f.selected.effectiveDate).format(i.serverDateFormat);return f.saveInProgress=!0,r.assignWorkPattern(f.contactId,f.selected.workPattern.id,n,null,f.selected.changeReason).then(function(){a.$broadcast("CustomWorkPattern::Added"),f.closeModal()}).catch(u).finally(function(){f.saveInProgress=!1})},f}n.component("absenceTabCustomWorkPatternModal",{bindings:{contactId:"<",dismiss:"&"},templateUrl:["settings",function(e){return e.pathTpl+"components/absence-tab-custom-work-pattern-modal.html"}],controllerAs:"workPatternModal",controller:["$log","$q","$rootScope","crmAngService","OptionGroup","shared-settings","WorkPatternAPI",t]})}),define("leave-absences/absence-tab/components/absence-tab-work-patterns.component",["common/lodash","common/moment","leave-absences/absence-tab/modules/components","leave-absences/absence-tab/components/absence-tab-custom-work-pattern-modal.component"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d){function m(){y.linkToWorkPatternListingPage=g(),v([h(),p(),c.getDateFormat()]),s.$on("CustomWorkPattern::Added",function(){v()})}function f(){return d.workPatternsOf(y.contactId,{},!1).then(function(e){y.customWorkPatterns=e})}function p(){return d.default().then(function(e){y.defaultWorkPattern=e})}function h(){return l.valuesOf("hrleaveandabsences_work_pattern_change_reason").then(function(n){_=e.indexBy(n,"value")})}function v(e){var n=[f()];return e&&(n=n.concat(e)),y.loading.workPattern=!0,a.all(n).then(function(){b()}).finally(function(){y.loading.workPattern=!1})}function b(){var t,a=u.DATE_FORMAT.toUpperCase();y.customWorkPatterns=e(y.customWorkPatterns).map(function(e){return t=_[e.change_reason],e.change_reason_label=t?t.label:"",e.effective_date=e.effective_date?n(e.effective_date).format(a):"",e}).sortBy(function(e){return-n(e.effective_date,a).valueOf()}).value()}function g(){var e=CRM.url("civicrm/contact/view",{cid:y.contactId,selectedChild:"absence"});return CRM.url("civicrm/admin/leaveandabsences/work_patterns",{cid:y.contactId,returnUrl:e})}t.debug("Component: absence-tab-work-patterns");var _=[],y=Object.create(this);return y.customWorkPatterns=[],y.defaultWorkPattern=null,y.loading={workPattern:!0},y.$onInit=m,y.deleteWorkPattern=function(e){r.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){d.unassignWorkPattern(e).then(function(){v()})}})},y.openModal=function(){i.open({appendTo:o.children().eq(0),template:'',controller:["$uibModalInstance",function(e){this.dismiss=e.dismiss}],controllerAs:"$ctrl"})},y}t.component("absenceTabWorkPatterns",{bindings:{contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/absence-tab-work-patterns.html"}],controllerAs:"workpatterns",controller:["$log","$q","$rootElement","$rootScope","$uibModal","dialog","DateFormat","HR_settings","OptionGroup","WorkPattern",a]})}),define("leave-absences/absence-tab/components/annual-entitlement-change-log.component",["common/lodash","common/moment","leave-absences/absence-tab/modules/components","common/models/contract"],function(e,n,t){function a(t,a,o,s,i){function r(){v().then(b).then(g).then(c).then(u).then(_).then(p).finally(function(){T.loading.component=!1})}function c(){return d().then(function(e){C=C.concat(e)})}function u(){var n=e.groupBy(C,"created_date");T.changeLogRows=e.map(n,m).sort(function(e,n){return n.date.diff(e.date)})}function l(e,n){var t,a,o=f(e);e.entitlements.forEach(function(s,i){t=o.entitlements.slice(0,i),a=e.entitlements.slice(i+1),n(s,t,a)})}function d(){return o.all({contact_id:T.contactId,period_id:T.periodId},!1).then(function(e){return e.map(function(e){return{comment:e.comment,contact_id:e.contact_id,created_date:e.created_date,editor_id:e.editor_id,entitlement_amount:e.value,entitlement_id:e.id,"entitlement_id.type_id":e.type_id}})})}function m(t,a){var o,s,i;return s=e.indexBy(t,"entitlement_id.type_id"),i=T.absenceTypes.map(function(n){return o=s[n.id],e.extend({calculation_unit:n.calculation_unit_name},o)}),{date:n(a),entitlements:i}}function f(e){var n;return n=T.changeLogRows.indexOf(e),T.changeLogRows[n+1]||{date:e.date.clone(),entitlements:e.entitlements.map(function(){return{}})}}function p(){for(var n,t,a,o=T.changeLogRows.length-1;o>=0;o--)if(n=T.changeLogRows[o],t=e.pluck(n.entitlements,"comment"),a=e.compact(t),1===a.length){var s=e.findIndex(t,"length");n.highlightedEntitlement=n.entitlements[s]}else a.length>1&&y(o)}function h(e,n){T.changeLogRows.splice(n,0,e)}function v(){return t.all({id:T.periodId}).then(function(e){T.absencePeriod=e[0]})}function b(e){return a.all().then(a.loadCalculationUnits).then(function(e){T.absenceTypes=e})}function g(){return o.logs({contact_id:T.contactId,period_id:T.periodId}).then(function(e){C=e})}function _(){var e,n;if(!(T.changeLogRows.length<=1))for(e=T.changeLogRows.length-2,n=T.changeLogRows.length-1;e>=0;){var t=T.changeLogRows[e],a=T.changeLogRows[n];t.entitlements.forEach(function(e,n){var t=a.entitlements[n];e.comment===t.comment&&delete e.comment}),e--,n--}}function y(e){var n,t,a=T.changeLogRows[e];l(a,function(o,s,i){o.comment&&(n=s.concat(o).concat(i),t={date:a.date.clone(),entitlements:n},t.highlightedEntitlement=o,h(t,e++))}),q(e)}function q(e){T.changeLogRows.splice(e,1)}var C=[],T=this;T.absencePeriod=null,T.absenceTypes=[],T.changeLogRows=[],T.loading={component:!0},T.$onInit=r}t.component("annualEntitlementChangeLog",{bindings:{contactId:"<",periodId:"<",dismissModal:"&"},templateUrl:["settings",function(e){return e.pathTpl+"components/annual-entitlement-change-log.html"}],controllerAs:"changeLog",controller:a}),a.$inject=["AbsencePeriod","AbsenceType","Entitlement","OptionGroup","shared-settings"]}),function(e){define("leave-absences/absence-tab/components/annual-entitlements.component",["common/lodash","common/moment","leave-absences/absence-tab/modules/components","common/models/contact"],function(n,t,a){function o(a,o,s,i,r,c,u,l,d){function m(){g().then(b).then(v).then(f).then(p).then(y).finally(function(){A.loading.absencePeriods=!1})}function f(){A.absencePeriods=n.chain(A.absencePeriods).filter(function(e){return n.find(C,function(n){return n.period_id===e.id})}).sortBy(function(e){return-t(e.start_date).valueOf()}).value()}function p(){A.absenceTypes=n.filter(A.absenceTypes,function(e){return n.find(C,function(n){return n.type_id===e.id})})}function h(n){var t=e.url("civicrm/contact/view",{cid:A.contactId,selectedChild:"absence"});return e.url("civicrm/admin/leaveandabsences/periods/manage_entitlements",{id:n,cid:A.contactId,returnUrl:t})}function v(){return c.all().then(function(e){A.absencePeriods=e})}function b(){var e=n.uniq(n.map(C,function(e){return e.editor_id}));return l.all({id:{IN:e}}).then(function(e){T=n.indexBy(e.list,"contact_id")})}function g(){return u.all({contact_id:A.contactId}).then(function(e){C=e})}function _(e){i.open({appendTo:s.children().eq(0),templateUrl:"annual-entitlement-change-log-modal",controller:["$uibModalInstance",function(n){this.contactId=A.contactId,this.dismiss=n.dismiss,this.periodId=e}],controllerAs:"modal"})}function y(){A.absencePeriods=n.map(A.absencePeriods,function(e){var t=n.map(A.absenceTypes,function(t){var a=n.find(C,function(n){return n.type_id===t.id&&n.period_id===e.id});return a?{amount:a.value,calculation_unit:t.calculation_unit_name,comment:a.comment?{message:a.comment,author_name:T[a.editor_id].display_name,date:a.created_date}:null}:null});return{id:e.id,title:e.title,entitlements:t}})}function q(e){var n=e.message+"

    Last updated:
    By: "+e.author_name+"
    Date: "+t.utc(e.date).local().format("DD/M/YYYY HH:mm")+"
    ";d.info("Calculation comment:",n)}a.debug("Component: annual-entitlements");var C=[],T=[],A=this;A.absencePeriods=[],A.loading={absencePeriods:!0},A.$onInit=m,A.getEditEntitlementsPageURL=h,A.openAnnualEntitlementChangeLog=_,A.showComment=q}a.component("annualEntitlements",{bindings:{absenceTypes:"<",contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/annual-entitlements.html"}],controllerAs:"entitlements",controller:o}),o.$inject=["$log","$q","$rootElement","$uibModal","AbsenceType","AbsencePeriod","Entitlement","Contact","notificationService"]})}(CRM),define("leave-absences/absence-tab/components/contract-entitlements.component",["common/lodash","common/moment","leave-absences/absence-tab/modules/components","common/models/contract"],function(e,n,t){function a(t,a,o,s,i,r){function c(){r.getDateFormat().then(d).then(u).then(m).finally(function(){f.loading.contracts=!1})}function u(){f.absenceTypes=e.filter(f.absenceTypes,function(n){return e.find(f.contracts,function(t){return e.find(t.info.leave,function(e){return e.leave_type===n.id})})})}function l(e){var t=o.DATE_FORMAT.toUpperCase();return e?n(e).format(t):""}function d(){return i.all({contact_id:f.contactId}).then(function(e){f.contracts=e})}function m(){f.contracts=e.sortBy(f.contracts,function(e){return n(e.info.details.period_start_date)}).map(function(n){var t=n.info,a=t.details,o=e.map(f.absenceTypes,function(n){var a=e.filter(t.leave,function(e){return e.leave_type===n.id})[0];return{amount:a?a.leave_amount:"",calculation_unit:n.calculation_unit_name}});return{position:a.position,start_date:l(a.period_start_date),end_date:l(a.period_end_date),absences:o}})}t.debug("Component: contract-entitlements");var f=this;f.contracts=[],f.loading={contracts:!0},f.$onInit=c}t.component("contractEntitlements",{bindings:{absenceTypes:"<",contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/contract-entitlements.html"}],controllerAs:"entitlements",controller:a}),a.$inject=["$log","$q","HR_settings","AbsenceType","Contract","DateFormat"]}),function(e){define("leave-absences/absence-tab/modules/settings",["common/angular"],function(n){return n.module("absence-tab.settings",[]).constant("settings",{contactId:e.vars.leaveAndAbsences.contactId,debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/absence-tab/"})})}(CRM),define("leave-absences/absence-tab/modules/config",["common/angular","leave-absences/absence-tab/modules/settings"],function(e){return e.module("absence-tab.config",["absence-tab.settings"]).config(["$resourceProvider","$httpProvider","$logProvider","settings",function(e,n,t,a){t.debugEnabled(a.debug),e.defaults.stripTrailingSlashes=!1,n.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}])}),define("leave-absences/absence-tab/app",["common/angular","common/angularBootstrap","common/text-angular","common/directives/scroll-shadows.directive","common/directives/time-amount-picker.directive","common/directives/timepicker-select.directive","common/filters/angular-date/format-date","common/filters/time-unit-applier.filter","common/modules/dialog","common/modules/directives","common/services/check-permissions","common/services/crm-ang.service","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/modules/shared-settings","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/calendar.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/work-pattern.model","leave-absences/shared/components/leave-calendar.component","leave-absences/shared/components/leave-calendar-day.component","leave-absences/shared/components/leave-calendar-legend.component","leave-absences/shared/components/leave-calendar-month.component","leave-absences/shared/components/leave-request-actions.component","leave-absences/shared/components/leave-request-popup-comments-tab.component","leave-absences/shared/components/leave-request-popup-details-tab.component","leave-absences/shared/components/leave-request-popup-files-tab","leave-absences/shared/components/leave-request-record-actions.component","leave-absences/shared/components/staff-leave-report.component","leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/calendar.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/work-pattern.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/modules/shared-settings","leave-absences/shared/services/leave-calendar.service","leave-absences/shared/services/leave-popup.service","leave-absences/absence-tab/components/absence-tab-container.component","leave-absences/absence-tab/components/absence-tab-entitlements.component","leave-absences/absence-tab/components/absence-tab-work-patterns.component","leave-absences/absence-tab/components/annual-entitlement-change-log.component","leave-absences/absence-tab/components/annual-entitlements.component","leave-absences/absence-tab/components/contract-entitlements.component","leave-absences/absence-tab/modules/config"],function(e){return e.module("absence-tab",["ngResource","ui.bootstrap","textAngular","common.angularDate","common.dialog","common.directives","common.filters","common.services","common.mocks","leave-absences.settings","leave-absences.models","leave-absences.components","leave-absences.controllers","leave-absences.models","leave-absences.services","leave-absences.settings","absence-tab.config","absence-tab.components"]).run(["$log","$rootScope","shared-settings","settings",function(e,n,t,a){e.debug("app.run"),n.sharedPathTpl=t.sharedPathTpl,n.settings=a}]),e}),function(e,n){var t=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";n.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":t+"/shared","leave-absences/absence-tab":t+"/absence-tab"}}),n(["leave-absences/shared/config"],function(){n(["leave-absences/absence-tab/app"],function(){document.dispatchEvent("function"==typeof window.CustomEvent?new CustomEvent("absenceTabReady"):function(){var e=document.createEvent("Event");return e.initEvent("absenceTabReady",!0,!0),e}())})})}(CRM,require),define("absence-tab",function(){}); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/absence-tab.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/admin-dashboard.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/admin-dashboard.min.js index 2e9f57f347c..f607a46ba58 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/admin-dashboard.min.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/admin-dashboard.min.js @@ -1,14 +1,5 @@ -/** - * State-based routing for AngularJS - * @version v0.3.2 - * @link http://angular-ui.github.com/ - * @license MIT License, http://www.opensource.org/licenses/MIT - */ - - -!function(e){define("leave-absences/shared/config",[],function(){var t=CRM.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/shared";e.config({paths:{"leave-absences/shared/ui-router":"leave-absences/shared/vendor/angular-ui-router.min",mocks:"../test/mocks"},shim:{"leave-absences/shared/ui-router":{}}}),e.config({paths:{"leave-absences/shared/ui-router":t+"/vendor/angular-ui-router.min",mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/ui-router",[],function(){return function(){"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(e,t,n){"use strict";function a(e,t){return W(new(W(function(){},{prototype:e})),t)}function r(e){return H(arguments,function(t){t!==e&&H(t,function(t,n){e.hasOwnProperty(n)||(e[n]=t)})}),e}function o(e,t){var n=[];for(var a in e.path){if(e.path[a]!==t.path[a])break;n.push(e.path[a])}return n}function s(e){if(Object.keys)return Object.keys(e);var t=[];return H(e,function(e,n){t.push(n)}),t}function i(e,t){if(Array.prototype.indexOf)return e.indexOf(t,Number(arguments[2])||0);var n=e.length>>>0,a=Number(arguments[2])||0;for((a=a<0?Math.ceil(a):Math.floor(a))<0&&(a+=n);a=0||(l.push(r[f]),c[r[f]]=e[r[f]]);return W({},c,t)}function c(e,t,n){if(!n){n=[];for(var a in e)n.push(a)}for(var r=0;r "));if(g[n]=a,F(e))v.push(n,[function(){return t.get(e)}],c);else{var r=t.annotate(e);H(r,function(e){e!==n&&u.hasOwnProperty(e)&&m(u[e],e)}),v.push(n,e,r)}b.pop(),g[n]=o}}function p(e){return N(e)&&e.then&&e.$$promises}if(!N(u))throw new Error("'invocables' must be an object");var h=s(u||{}),v=[],b=[],g={};return H(u,m),u=b=g=null,function(a,o,s){function i(){--y||(_||r(g,o.$$values),m.$$values=g,m.$$promises=m.$$promises||!0,delete m.$$inheritedValues,c.resolve(g))}function u(e){m.$$failure=e,c.reject(e)}if(p(a)&&s===n&&(s=o,o=a,a=null),a){if(!N(a))throw new Error("'locals' must be an object")}else a=l;if(o){if(!p(o))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else o=d;var c=e.defer(),m=c.promise,b=m.$$promises={},g=W({},a),y=1+v.length/3,_=!1;if(j(o.$$failure))return u(o.$$failure),m;o.$$inheritedValues&&r(g,f(o.$$inheritedValues,h)),W(b,o.$$promises),o.$$values?(_=r(g,f(o.$$values,h)),m.$$inheritedValues=f(o.$$values,h),i()):(o.$$inheritedValues&&(m.$$inheritedValues=f(o.$$inheritedValues,h)),o.then(i,u));for(var q=0,$=v.length;q<$;q+=3)a.hasOwnProperty(v[q])?i():function(n,r,o){function c(e){d.reject(e),u(e)}function l(){if(!j(m.$$failure))try{d.resolve(t.invoke(r,s,g)),d.promise.then(function(e){g[n]=e,i()},c)}catch(e){c(e)}}var d=e.defer(),f=0;H(o,function(e){b.hasOwnProperty(e)&&!a.hasOwnProperty(e)&&(f++,b[e].then(function(t){g[e]=t,--f||l()},c))}),f||l(),b[n]=d.promise}(v[q],v[q+1],v[q+2]);return m}},this.resolve=function(e,t,n,a){return this.study(e)(t,n,a)}}function b(e,t,n){this.fromConfig=function(e,t,n){return j(e.template)?this.fromString(e.template,t):j(e.templateUrl)?this.fromUrl(e.templateUrl,t):j(e.templateProvider)?this.fromProvider(e.templateProvider,t,n):null},this.fromString=function(e,t){return B(e)?e(t):e},this.fromUrl=function(n,a){return B(n)&&(n=n(a)),null==n?null:e.get(n,{cache:t,headers:{Accept:"text/html"}}).then(function(e){return e.data})},this.fromProvider=function(e,t,a){return n.invoke(e,null,a||{params:t})}}function g(e,t,r){function o(t,n,a,r){if(v.push(t),p[t])return p[t];if(!/^\w+([-.]+\w+)*(?:\[\])?$/.test(t))throw new Error("Invalid parameter name '"+t+"' in pattern '"+e+"'");if(h[t])throw new Error("Duplicate parameter name '"+t+"' in pattern '"+e+"'");return h[t]=new G.Param(t,n,a,r),h[t]}function s(e,t,n,a){var r=["",""],o=e.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!t)return o;switch(n){case!1:r=["(",")"+(a?"?":"")];break;case!0:o=o.replace(/\/$/,""),r=["(?:/(",")|/)?"];break;default:r=["("+n+"|",")?"]}return o+r[0]+t+r[1]}function i(r,o){var s,i,u,c,l;return s=r[2]||r[3],l=t.params[s],u=e.substring(f,r.index),i=o?r[4]:r[4]||("*"==r[1]?".*":null),i&&(c=G.type(i)||a(G.type("string"),{pattern:new RegExp(i,t.caseInsensitive?"i":n)})),{id:s,regexp:i,segment:u,type:c,cfg:l}}t=W({params:{}},N(t)?t:{});var u,c=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,d="^",f=0,m=this.segments=[],p=r?r.params:{},h=this.params=r?r.params.$$new():new G.ParamSet,v=[];this.source=e;for(var b,g,y;(u=c.exec(e))&&(b=i(u,!1),!(b.segment.indexOf("?")>=0));)g=o(b.id,b.type,b.cfg,"path"),d+=s(b.segment,g.type.pattern.source,g.squash,g.isOptional),m.push(b.segment),f=c.lastIndex;y=e.substring(f);var _=y.indexOf("?");if(_>=0){var q=this.sourceSearch=y.substring(_);if(y=y.substring(0,_),this.sourcePath=e.substring(0,f+_),q.length>0)for(f=0;u=l.exec(q);)b=i(u,!0),g=o(b.id,b.type,b.cfg,"search"),f=c.lastIndex}else this.sourcePath=e,this.sourceSearch="";d+=s(y)+(!1===t.strict?"/?":"")+"$",m.push(y),this.regexp=new RegExp(d,t.caseInsensitive?"i":n),this.prefix=m[0],this.$$paramNames=v}function y(e){W(this,e)}function _(){function e(e){return null!=e?e.toString().replace(/(~|\/)/g,function(e){return{"~":"~~","/":"~2F"}[e]}):e}function r(e){return null!=e?e.toString().replace(/(~~|~2F)/g,function(e){return{"~~":"~","~2F":"/"}[e]}):e}function o(){return{strict:h,caseInsensitive:f}}function u(e){return B(e)||U(e)&&B(e[e.length-1])}function c(){for(;$.length;){var e=$.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");t.extend(b[e.name],d.invoke(e.def))}}function l(e){W(this,e||{})}G=this;var d,f=!1,h=!0,v=!1,b={},q=!0,$=[],C={string:{encode:e,decode:r,is:function(e){return null==e||!j(e)||"string"==typeof e},pattern:/[^\/]*/},int:{encode:e,decode:function(e){return parseInt(e,10)},is:function(e){return j(e)&&this.decode(e.toString())===e},pattern:/\d+/},bool:{encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:function(e){return!0===e||!1===e},pattern:/0|1/},date:{encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):n},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):n},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return this.is(e)&&this.is(t)&&e.toISOString()===t.toISOString()},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:{encode:t.toJson,decode:t.fromJson,is:t.isObject,equals:t.equals,pattern:/[^\/]*/},any:{encode:t.identity,decode:t.identity,equals:t.equals,pattern:/.*/}};_.$$getDefaultValue=function(e){if(!u(e.value))return e.value;if(!d)throw new Error("Injectable functions cannot be called at configuration time");return d.invoke(e.value)},this.caseInsensitive=function(e){return j(e)&&(f=e),f},this.strictMode=function(e){return j(e)&&(h=e),h},this.defaultSquashPolicy=function(e){if(!j(e))return v;if(!0!==e&&!1!==e&&!F(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return v=e,e},this.compile=function(e,t){return new g(e,W(o(),t))},this.isMatcher=function(e){if(!N(e))return!1;var t=!0;return H(g.prototype,function(n,a){B(n)&&(t=t&&j(e[a])&&B(e[a]))}),t},this.type=function(e,t,n){if(!j(t))return b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new y(W({name:e},t)),n&&($.push({name:e,def:n}),q||c()),this},H(C,function(e,t){b[t]=new y(W({name:t},e))}),b=a(b,{}),this.$get=["$injector",function(e){return d=e,q=!1,c(),H(C,function(e,t){b[t]||(b[t]=new y(e))}),this}],this.Param=function(e,a,r,o){function c(){if(!d)throw new Error("Injectable functions cannot be called at configuration time");var e=d.invoke(r.$$fn);if(null!==e&&e!==n&&!h.type.is(e))throw new Error("Default value ("+e+") for parameter '"+h.id+"' is not an instance of Type ("+h.type.name+")");return e}function l(e){function t(e){return function(t){return t.from===e}}return e=function(e){var n=p(m(h.replace,t(e)),function(e){return e.to});return n.length?n[0]:e}(e),j(e)?h.type.$normalize(e):c()}function f(){return"{Param:"+e+" "+a+" squash: '"+q+"' optional: "+_+"}"}var h=this;r=function(e){var t=N(e)?s(e):[];return-1===i(t,"value")&&-1===i(t,"type")&&-1===i(t,"squash")&&-1===i(t,"array")&&(e={value:e}),e.$$fn=u(e.value)?e.value:function(){return e.value},e}(r),a=function(n,a,r){if(n.type&&a)throw new Error("Param '"+e+"' has two type configurations.");return a||(n.type?t.isString(n.type)?b[n.type]:n.type instanceof y?n.type:new y(n.type):"config"===r?b.any:b.string)}(r,a,o);var g=function(){var t={array:"search"===o&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return W(t,n,r).array}();a=g?a.$asArray(g,"search"===o):a,"string"!==a.name||g||"path"!==o||r.value!==n||(r.value="");var _=r.value!==n,q=function(e,t){var n=e.squash;if(!t||!1===n)return!1;if(!j(n)||null==n)return v;if(!0===n||F(n))return n;throw new Error("Invalid squash policy: '"+n+"'. Valid policies: false, true, or arbitrary string")}(r,_),$=function(e,t,a,r){var o,s,u=[{from:"",to:a||t?n:""},{from:null,to:a||t?n:""}];return o=U(e.replace)?e.replace:[],F(r)&&o.push({from:r,to:n}),s=p(o,function(e){return e.from}),m(u,function(e){return-1===i(s,e.from)}).concat(o)}(r,g,_,q);W(this,{id:e,type:a,location:o,array:g,squash:q,replace:$,isOptional:_,value:l,dynamic:n,config:r,toString:f})},l.prototype={$$new:function(){return a(this,W(new l,{$$parent:this}))},$$keys:function(){for(var e=[],t=[],n=this,a=s(l.prototype);n;)t.push(n),n=n.$$parent;return t.reverse(),H(t,function(t){H(s(t),function(t){-1===i(e,t)&&-1===i(a,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return H(n.$$keys(),function(a){t[a]=n[a].value(e&&e[a])}),t},$$equals:function(e,t){var n=!0,a=this;return H(a.$$keys(),function(r){var o=e&&e[r],s=t&&t[r];a[r].type.equals(o,s)||(n=!1)}),n},$$validates:function(e){var a,r,o,s,i,u=this.$$keys();for(a=0;a=0)throw new Error("State must have a valid name");if(T.hasOwnProperty(n))throw new Error("State '"+n+"' is already defined");var r=-1!==n.indexOf(".")?n.substring(0,n.lastIndexOf(".")):F(t.parent)?t.parent:N(t.parent)&&F(t.parent.name)?t.parent.name:"";if(r&&!T[r])return m(r,t.self);for(var o in R)B(R[o])&&(t[o]=R[o](t,R.$delegates[o]));return T[n]=t,!t[D]&&t.url&&e.when(t.url,["$match","$stateParams",function(e,n){w.$current.navigable==t&&c(e,n)||w.transitionTo(t,e,{inherit:!0,location:!1})}]),v(n),t}function g(e){return e.indexOf("*")>-1}function y(e){for(var t=e.split("."),n=w.$current.name.split("."),a=0,r=t.length;a=T;a--)s=p[a],s.self.onExit&&i.invoke(s.self.onExit,s.self,s.locals.globals),s.locals=null;for(a=T;a<_.length;a++)r=_[a],r.locals=x[a],r.self.onEnter&&i.invoke(r.self.onEnter,r.self,r.locals.globals);return w.transition!==B?(e.$broadcast("$stateChangeCancel",t.self,n,c.self,d),R):(w.$current=t,w.current=t.self,w.params=n,V(w.params,m),w.transition=null,o.location&&t.navigable&&v.push(t.navigable.url,t.navigable.locals.globals.$stateParams,{$$avoidResync:!0,replace:"replace"===o.location}),o.notify&&e.$broadcast("$stateChangeSuccess",t.self,n,c.self,d),v.update(!0),w.current)}).then(null,function(a){return a===P?R:w.transition!==B?(e.$broadcast("$stateChangeCancel",t.self,n,c.self,d),R):(w.transition=null,s=e.$broadcast("$stateChangeError",t.self,n,c.self,d,a),s.defaultPrevented||v.update(),r.reject(a))});return B},w.is=function(e,t,a){a=W({relative:w.$current},a||{});var r=f(e,a.relative);return j(r)?w.$current===r&&(!t||c(r.params.$$values(t),m)):n},w.includes=function(e,t,a){if(a=W({relative:w.$current},a||{}),F(e)&&g(e)){if(!y(e))return!1;e=w.$current.name}var r=f(e,a.relative);if(!j(r))return n;if(!j(w.$current.includes[r.name]))return!1;if(!t)return!0;for(var o=s(t),i=0;i2?c.enter(e,null,n).then(a):c.enter(e,null,n,a)},leave:function(e,n){t.version.minor>2?c.leave(e).then(n):c.leave(e,n)}};if(u){var a=u&&u(n,e);return{enter:function(e,t,n){a.enter(e,null,t),n()},leave:function(e,t){a.leave(e),t()}}}return function(){return{enter:function(e,t,n){t.after(e),n()},leave:function(e,t){e.remove(),t()}}}()}var i=function(){return n.has?function(e){return n.has(e)?n.get(e):null}:function(e){try{return n.get(e)}catch(e){return null}}}(),u=i("$animator"),c=i("$animate");return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(n,i,u){return function(n,i,c){function l(){if(f&&(f.remove(),f=null),p&&(p.$destroy(),p=null),m){var e=m.data("$uiViewAnim");g.leave(m,function(){e.$$animLeave.resolve(),f=null}),f=m,m=null}}function d(s){var d,f=P(n,c,i,r),y=f&&e.$current&&e.$current.locals[f];if(s||y!==h){d=n.$new(),h=e.$current.locals[f],d.$emit("$viewContentLoading",f);var _=u(d,function(e){var r=o.defer(),s=o.defer(),u={$animEnter:r.promise,$animLeave:s.promise,$$animLeave:s};e.data("$uiViewAnim",u),g.enter(e,i,function(){r.resolve(),p&&p.$emit("$viewContentAnimationEnded"),(t.isDefined(b)&&!b||n.$eval(b))&&a(e)}),l()});m=_,p=d,p.$emit("$viewContentLoaded",f),p.$eval(v)}}var f,m,p,h,v=c.onload||"",b=c.autoscroll,g=s(c,n);i.inheritedData("$uiView"),n.$on("$stateChangeSuccess",function(){d(!1)}),d(!0)}}}}function T(e,n,a,r){return{restrict:"ECA",priority:-400,compile:function(o){var s=o.html();return function(o,i,u){var c=a.$current,l=P(o,u,i,r),d=c&&c.locals[l];if(d){i.data("$uiView",{name:l,state:d.$$state}),i.html(d.$template?d.$template:s);var f=t.extend({},d);o[d.$$resolveAs]=f;var m=e(i.contents());if(d.$$controller){d.$scope=o,d.$element=i;var p=n(d.$$controller,d);d.$$controllerAs&&(o[d.$$controllerAs]=p,o[d.$$controllerAs][d.$$resolveAs]=f),B(p.$onInit)&&p.$onInit(),i.data("$ngControllerController",p),i.children().data("$ngControllerController",p)}m(o)}}}}}function P(e,t,n,a){var r=a(t.uiView||t.name||"")(e),o=n.inheritedData("$uiView");return r.indexOf("@")>=0?r:r+"@"+(o?o.state.name:"")}function D(e,t){var n,a=e.match(/^\s*({[^}]*})\s*$/);if(a&&(e=t+"("+a[1]+")"),!(n=e.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/))||4!==n.length)throw new Error("Invalid state ref '"+e+"'");return{state:n[1],paramExpr:n[3]||null}}function R(e){var t=e.parent().inheritedData("$uiView");if(t&&t.state&&t.state.name)return t.state}function S(e){var t="[object SVGAnimatedString]"===Object.prototype.toString.call(e.prop("href")),n="FORM"===e[0].nodeName;return{attr:n?"action":t?"xlink:href":"href",isAnchor:"A"===e.prop("tagName").toUpperCase(),clickable:!n}}function I(e,t,n,a,r){return function(o){var s=o.which||o.button,i=r();if(!(s>1||o.ctrlKey||o.metaKey||o.shiftKey||e.attr("target"))){var u=n(function(){t.go(i.state,i.params,i.options)});o.preventDefault();var c=a.isAnchor&&!i.href?1:0;o.preventDefault=function(){c--<=0&&n.cancel(u)}}}}function O(e,t){return{relative:R(e)||t.$current,inherit:!0}}function k(e,n){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(a,r,o,s){var i,u=D(o.uiSref,e.current.name),c={state:u.state,href:null,params:null},l=S(r),d=s[1]||s[0],f=null;c.options=W(O(r,e),o.uiSrefOpts?a.$eval(o.uiSrefOpts):{});var m=function(n){n&&(c.params=t.copy(n)),c.href=e.href(u.state,c.params,c.options),f&&f(),d&&(f=d.$$addStateInfo(u.state,c.params)),null!==c.href&&o.$set(l.attr,c.href)};u.paramExpr&&(a.$watch(u.paramExpr,function(e){e!==c.params&&m(e)},!0),c.params=t.copy(a.$eval(u.paramExpr))),m(),l.clickable&&(i=I(r,e,n,l,function(){return c}),r[r.on?"on":"bind"]("click",i),a.$on("$destroy",function(){r[r.off?"off":"unbind"]("click",i)}))}}}function x(e,t){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,a,r,o){function s(t){f.state=t[0],f.params=t[1],f.options=t[2],f.href=e.href(f.state,f.params,f.options),m&&m(),c&&(m=c.$$addStateInfo(f.state,f.params)),f.href&&r.$set(u.attr,f.href)}var i,u=S(a),c=o[1]||o[0],l=[r.uiState,r.uiStateParams||null,r.uiStateOpts||null],d="["+l.map(function(e){return e||"null"}).join(", ")+"]",f={state:null,params:null,options:null,href:null},m=null;n.$watch(d,s,!0),s(n.$eval(d)),u.clickable&&(i=I(a,e,t,u,function(){return f}),a[a.on?"on":"bind"]("click",i),n.$on("$destroy",function(){a[a.off?"off":"unbind"]("click",i)}))}}}function M(e,t,n){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(t,a,r,o){function s(t,n,r){var o=e.get(t,R(a)),s=i(t,n),u={state:o||{name:t},params:n,hash:s};return h.push(u),v[s]=r,function(){var e=h.indexOf(u);-1!==e&&h.splice(e,1)}}function i(e,n){if(!F(e))throw new Error("state should be a string");return N(n)?e+Y(n):(n=t.$eval(n),N(n)?e+Y(n):e)}function u(){for(var e=0;e0)){var n=s(e,t,p);return u(),n}},t.$on("$stateChangeSuccess",u),u()}]}}function L(e){var t=function(t,n){return e.is(t,n)};return t.$stateful=!0,t}function E(e){var t=function(t,n,a){return e.includes(t,n,a)};return t.$stateful=!0,t}var j=t.isDefined,B=t.isFunction,F=t.isString,N=t.isObject,U=t.isArray,H=t.forEach,W=t.extend,V=t.copy,Y=t.toJson;t.module("ui.router.util",["ng"]),t.module("ui.router.router",["ui.router.util"]),t.module("ui.router.state",["ui.router.router","ui.router.util"]),t.module("ui.router",["ui.router.state"]),t.module("ui.router.compat",["ui.router"]),v.$inject=["$q","$injector"],t.module("ui.router.util").service("$resolve",v),b.$inject=["$http","$templateCache","$injector"],t.module("ui.router.util").service("$templateFactory",b);var G;g.prototype.concat=function(e,t){var n={caseInsensitive:G.caseInsensitive(),strict:G.strictMode(),squash:G.defaultSquashPolicy()};return new g(this.sourcePath+e+this.sourceSearch,W(n,t),this)},g.prototype.toString=function(){return this.source},g.prototype.exec=function(e,t){var n=this.regexp.exec(e);if(!n)return null;t=t||{};var a,r,o,s=this.parameters(),i=s.length,u=this.segments.length-1,c={};if(u!==n.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var l,d;for(a=0;aWhen All filter is selected, all staff members with contracts which are active in the selected absence period are displayed.

    ","

    People I approve filter displays only staff members who you approve leave for.

    ","

    People without approver filter displays all staff members with contracts which are active in the selected absence period and who do not have any leave approver assigned.

    "].join(""))}t.debug("LeaveCalendarAdminController");var l,d;return{init:function(t){return d=t,l=i.init(d),d.filters.userSettings.assignedTo=e.find(d.filtersByAssignee,{type:"me"}),d.showContactDetailsLink=!0,d.showContactName=!0,d.showFilters=!0,d.showAdminFilteringHint=c,u()}}}n.controller("LeaveCalendarAdminController",["$log","$q","Contact","ContactInstance","Contract","notificationService","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(t,n,a,r){function o(){return{loadContacts:function(){return s.loadLookUpAndFilteredContacts()}}}t.debug("LeaveCalendarManagerController");var s,i;return{init:function(t){return i=t,s=r.init(i),i.filters.userSettings.assignedTo=e.find(i.filtersByAssignee,{type:"me"}),i.showContactName=!0,i.showFilters=!0,o()}}}n.controller("LeaveCalendarManagerController",["$log","Contact","ContactInstance","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(e,t,n,a){function r(){return{loadContacts:function(){return s.displaySingleContact?o.loadFilteredContacts():"admin"===s.userPermissionRole?o.loadContactsForAdmin():o.loadLookUpAndFilteredContacts()}}}e.debug("LeaveCalendarStaffController");var o,s;return{init:function(e){return s=e,o=a.init(s),s.filters.userSettings.contacts_with_leaves=!0,s.showTheseContacts=[s.contactId],s.showContactName=!0,s.showFilters=!0,s.displaySingleContact&&(s.showFilters=!1,s.lookupContacts=[{id:s.contactId}]),r()}}}n.controller("LeaveCalendarStaffController",["$log","$q","Contact","LeaveCalendarService",a])}),define("leave-absences/shared/components/leave-calendar.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l,d){function f(){H.supportData.absenceTypes.push({id:"",title:"Leave",color:"#4D4D68",calculation_unit:e.chain(H.supportData.calculationUnits).find({name:"days"}).get("value").value()})}function m(){for(var e=[],n=t(H.selectedPeriod.start_date).clone().startOf("month"),a=t(H.selectedPeriod.end_date).clone().endOf("month");n.isBefore(a);)e.push(R(n)),n.add(1,"month");H.months=e}function p(){return e.includes(["admin","manager"],H.userPermissionRole)}function h(e){return e.format("YYYY-MM")}function v(){o.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){H.supportData.absenceTypesToFilterBy=t,k(!0)})}function b(){o.$new().$watch(function(){return H.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(j(),E(),k())})}function g(e){H.injectMonth=!0,F("injected").then(function(){k(e)}).then(function(){H.loading.calendar=!1})}function y(){N=n("LeaveCalendar"+e.capitalize(U)+"Controller").init(H)}function _(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return i.all().then(function(t){H.absencePeriods=e.sortBy(t,"start_date"),H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current})}).then(m).then(x)}function $(){return u.all().then(u.loadCalculationUnits)}function C(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function A(){return N.loadContacts().then(function(e){H.contacts=e})}function w(){return l.valuesOf(["hrjc_region","hrjc_location","hrjc_level_type","hrjc_department"]).then(function(e){H.filters.optionValues.regions=e.hrjc_region,H.filters.optionValues.locations=e.hrjc_location,H.filters.optionValues.levelTypes=e.hrjc_level_type,H.filters.optionValues.departments=e.hrjc_department})}function T(){return c.all()}function P(){return a.all([$(),T(),C()]).then(function(t){H.supportData.absenceTypes=t[0],H.supportData.publicHolidays=t[1],H.supportData.calculationUnits=t[2].hrleaveandabsences_absence_type_calculation_unit,H.supportData.dayTypes=t[2].hrleaveandabsences_leave_request_day_type,H.supportData.leaveRequestStatuses=t[2].hrleaveandabsences_leave_request_status,H.supportData.toilAmounts=e.indexBy(t[2].hrleaveandabsences_toil_amounts,"value")})}function D(){var e=a.resolve();return H.injectMonth&&(e=F("destroyed"),H.injectMonth=!1),e}function R(e){return{index:h(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:t().year(e.year()).month(e.month())}}function S(){var t=H.selectedPeriod.id;H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current}),t!==H.selectedPeriod.id&&m(),x(),E(),O("month")}function I(e){var n="previous"===e?"subtract":"add";j(t(H.selectedMonth.moment)[n](1,"month")),E(),O("month")}function O(t){t=e.includes(["contacts","period","month"],t)?t:"period",a.resolve().then(D).then("period"===t&&m).then("period"===t&&M).then("contacts"===t&&A).then("month"===t&&E).then(function(){g("contacts"===t)})}function k(e){o.$emit("LeaveCalendar::showMonth",!!e)}function x(){j(t())}function M(){j(H.months[0].moment)}function L(n){var a="previous"===n?"first":"last",r=e[a](H.months),o=t().year(r.year).month(r.month);H.monthPaginatorsAvailability[n]=!H.selectedMonth.moment.isSame(o,"month")}function E(){L("previous"),L("next")}function j(t){t&&(H.selectedMonthIndex=h(t)),H.selectedMonth=e.find(H.months,{index:H.selectedMonthIndex})}function B(){return a.all([d(s.permissions.admin.administer),d(s.permissions.ssp.manage)]).then(function(e){H.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",U=H.roleOverride?H.roleOverride:H.userPermissionRole})}function F(t){return a(function(n){var a=o.$on("LeaveCalendar::month"+e.capitalize(t),function(){a(),n()})})}r.debug("Component: leave-calendar");var N,U,H=this;H.absencePeriods=[],H.contacts=[],H.contactIdsToReduceTo=null,H.injectMonth=!1,H.months=[],H.selectedMonth={},H.selectedMonthIndex="",H.selectedPeriod=null,H.showContactName=!1,H.showFilters=!1,H.userPermissionRole="staff",H.loading={calendar:!0,page:!0},H.filters={hideOnMobile:!0,optionValues:{},userSettings:{contact:null,contacts_with_leaves:!0,department:null,level_type:null,location:null,region:null},absenceTypes:{}},H.filtersByAssignee=[{type:"me",label:"People I approve"},{type:"unassigned",label:"People without approver"},{type:"all",label:"All"}],H.filters.userSettings.assignedTo=H.filtersByAssignee[2],H.monthPaginatorsAvailability={previous:!0,next:!0},H.supportData={absenceTypesToFilterBy:[]},H.canManageRequests=p,H.labelPeriod=_,H.navigateToCurrentMonth=S,H.paginateMonth=I,H.refresh=O,function(){B().then(b).then(v).then(y).then(D).then(function(){return a.all([q(),A(),P(),H.showFilters?w():e.noop])}).then(function(){f(),g(),E()}).then(function(){H.loading.page=!1})}()}n.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,n={from_date:{to:X.month.days[X.month.days.length-1].date+" 23:59:59"},to_date:{from:X.month.days[0].date+" 00:00:00"},status_id:{IN:I()},contact_id:{IN:X.contacts.map(function(e){return e.id})},type_id:{IN:t?X.supportData.absenceTypesToFilterBy:e.pluck(X.supportData.absenceTypes,"id")}};return g(),s.all(n,null,null,null,!1).then(function(e){return z={},t&&(e.list=_(e.list)),C(e.list)})}function x(){var t=X.month.days[0].date,n=X.month.days[X.month.days.length-1].date;return o.get(X.contacts.map(function(e){return e.id}),t,n).then(function(t){G=e.indexBy(t,"contact_id")})}function M(){return X.contactIdsToReduceTo&&(X.contacts=X.contacts.filter(function(t){return e.includes(X.contactIdsToReduceTo,t.contact_id)||e.find(z,function(e){return e.contact_id===t.contact_id})})),a.resolve()}function L(t){var n=R(t);z[t.contact_id]=z[t.contact_id]||{},n.forEach(function(n){e.remove(z[t.contact_id][n.date],function(e){return e.id===t.id})})}function E(){r.$emit("LeaveCalendar::monthDestroyed"),Y.map(function(e){e.remove?e.remove():e()})}function j(t,n,r){var o,s;return t.contactsData[n]=t.contactsData[n]||{},s=f(n),o=!0===r?a.resolve():a.all([s.isWeekend(p(t.date)),s.isNonWorkingDay(p(t.date))]).then(function(a){e.assign(t.contactsData[n],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:P(t.date)})}),o.then(function(){return z[n]&&z[n][t.date]?z[n][t.date]:[]}).then(function(a){a=N(a),e.assign(t.contactsData[n],{leaveRequests:a,leaveRequestsToShowInCell:v(a),leaveRequestsAttributes:q(t,a)})})}function B(){return a.all(X.month.days.map(function(e){return a.all(X.contacts.map(function(t){return j(e,t.id)}))}))}function F(e,t){X.currentPage=0,X.visible=!0,(t||!V)&&O()}function N(n){return e.sortBy(n,function(e){return+t(e.from_date).format("X")+(w("half_day_pm",e,e.from_date)?1:0)})}function U(t){var n=e.find(X.supportData.absenceTypes,function(e){return e.id===t.type_id});return t.balance_change>0?{borderColor:n.color}:{borderColor:n.color,backgroundColor:n.color}}function H(e){h(e),-1!==I().indexOf(e.status_id)&&c(e)}function W(e){return a.all(R(e).map(function(t){return j(t,e.contact_id,!0)}))}n.debug("Component: leave-calendar-month");var V=!1,Y=[],G={},z={},X=this;X.currentPage=0,X.pageSize=20,X.visible=!1,X.showContactName=!!X.showContactName,X.showOnlyWithLeaveRequests=!!X.showOnlyWithLeaveRequests,X.$onDestroy=E,X.contactsList=m,X.getContactUrl=y,function(){var e=t().month(X.month.month).year(X.month.year);$(),A(),X.month=l(e),r.$emit("LeaveCalendar::monthInjected")}()}n.component("leaveCalendarMonth",{bindings:{showTheseContacts:"<",contacts:"<",contactIdsToReduceTo:"<",month:"<",period:"<",showContactName:"<",showContactDetailsLink:"<",showOnlyWithLeaveRequests:"<",supportData:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-month.html"}],controllerAs:"month",controller:["$log","$q","$rootScope","Calendar","LeaveRequest","pubSub","shared-settings",a]})}),define("leave-absences/shared/modules/services",["common/angular","common/modules/services"],function(e){"use strict";return e.module("leave-absences.services",["common.services"])}),define("leave-absences/shared/services/leave-request.service",["common/lodash","leave-absences/shared/modules/services"],function(e,t){"use strict";function n(t,n,a){function r(){var t=n.defer();return a.open(e.defaults(o(),{onConfirm:function(){t.resolve(!0)}})),t.promise}function o(){return{title:"Recalculate Balance Change?",copyCancel:"Cancel",copyConfirm:"Yes",classConfirm:"btn-warning",msg:"The leave balance change has updated since this leave request was created. Do you want to recalculate the balance change?"}}return t.debug("LeaveRequest"),{getBalanceChangeRecalculationPromptOptions:o,promptBalanceChangeRecalculation:r}}t.factory("LeaveRequestService",n),n.$inject=["$log","$q","dialog"]}),define("leave-absences/shared/components/leave-request-actions.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/services/notification.service","common/services/pub-sub","leave-absences/shared/services/leave-request.service"],function(e,t,n){function a(n,a,r,o,s,i,u,c){function l(t){q=$.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===$.leaveRequest.request_type?r.open(h(t)):m(t)}function d(){return"admin"===$.role&&"public_holiday"===$.leaveRequest.request_type}function f(n){var a=$.absenceTypes[$.leaveRequest.type_id].allow_request_cancelation;return"admin"===$.role||("manager"===$.role?e.includes([C.awaitingApproval,C.moreInformationRequired],n):"3"===a?t().isBefore($.leaveRequest.from_date):"2"===a)}function m(t){r.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return $.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(s.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){b(t)}}):h(t)})}})}function p(){e.isArray($.leaveRequestStatuses)&&($.leaveRequestStatuses=e.indexBy($.leaveRequestStatuses,"value")),e.isArray($.absenceTypes)&&($.absenceTypes=e.indexBy($.absenceTypes,"id"))}function h(e){var t=A[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return $.leaveRequest[e]().then(function(){g(e)}).catch(function(e){c.error("Error:",e)})}}}function v(e,t){e.stopPropagation(),o.openModal(t)}function b(e){o.openModal({leaveRequest:$.leaveRequest,leaveType:$.leaveRequest.request_type,selectedContactId:$.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:u.statusNames[w[e]]})}function g(t){var n=e.find($.leaveRequestStatuses,function(e){return e.name===u.statusNames.awaitingApproval}).value;q===n&&i.publish("ManagerBadge:: Update Count"),i.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:$.leaveRequest})}function y(){var t=$.leaveRequestStatuses[$.leaveRequest.status_id].name,n=e.compact(e.map(A,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!f(t)&&e.pull(n,"cancel"),"admin"!==$.role&&e.pull(n,"delete"),"staff"===$.role&&e.pull(n,"approve","reject"),"staff"!==$.role&&_(n),d()&&n.push("delete"),$.allowedActions=e.map(n,function(e){return{key:e,label:A[e].label,isDirectAction:A[e].isDirectAction}})}function _(t){e.each(t,function(n,a){"edit"===n&&(t[a]="respond"),e.includes(["respond","view"],n)&&(t[a]="edit")})}n.debug("Component: leave-request-action-dropdown");var q,$=this,C=u.statusNames,A={edit:{label:"Edit",allowedStatuses:[C.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[C.moreInformationRequired]},view:{label:"View",allowedStatuses:[C.approved,C.rejected,C.cancelled]},approve:{label:"Approve",isDirectAction:!0, -allowedStatuses:[C.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[C.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[C.awaitingApproval,C.approved,C.rejected,C.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[C.awaitingApproval,C.moreInformationRequired,C.approved,C.rejected,C.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},w={approve:"approved"};$.allowedActions=[],$.action=l,$.openLeavePopup=v,function(){p(),y()}()}n.component("leaveRequestActions",{bindings:{leaveRequest:"<",leaveRequestStatuses:"<",absenceTypes:"<",role:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-actions.html"}],controllerAs:"actions",controller:a}),a.$inject=["$log","$rootScope","dialog","LeavePopup","LeaveRequestService","pubSub","shared-settings","notificationService"]}),define("leave-absences/shared/components/leave-request-popup-comments-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/models/session.model"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){q.request.comments.push({contact_id:_,leave_request_id:q.request.id,text:q.comment.text}),q.comment.text=""}function l(){return q.comment.text.length>0}function d(e){return!e.comment_id||q.canManage}function f(e){return t.utc(e,s.serverDateTimeFormat).local().format(o.DATE_FORMAT.toUpperCase()+" HH:mm")}function m(){return q.request.comments.filter(function(e){return!e.toBeDeleted})}function p(e){return e===_?"Me":q.comment.contacts[e]?q.comment.contacts[e].display_name:void 0}function h(e){return q.mode===e}function v(){q.comment.text.length&&q.addComment()}function b(){var t=e.indexBy(q.request.comments,"contact_id"),n=Object.keys(t);return i.all({id:{IN:n}},{page:1,size:0}).then(function(t){q.comment.contacts=e.indexBy(t.list,"contact_id")})}function g(){return q.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),q.request.comments.length&&b()})}function y(){return q.loading.component=!0,u.get().then(function(e){_=e.contactId}).then(function(){q.loading.component=!1})}n.debug("Component: leave-request-popup-comments-tab");var _=null,q=this;q.loading={component:!0},q.comment={text:"",contacts:{}},q.addComment=c,q.canRemoveComment=d,q.canSubmit=l,q.formatDateTime=f,q.getActiveComments=m,q.getCommentorName=p,q.isMode=h,q.onBeforeSubmit=v,function(){r.$emit("LeaveRequestPopup::addTab",q),g(),y()}()}n.component("leaveRequestPopupCommentsTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-comments-tab.html"}],controllerAs:"commentsCtrl",controller:["$log","$rootScope","$scope","HR_settings","shared-settings","Contact","Session",a]})}),define("leave-absences/shared/apis/work-pattern.api",["common/lodash","leave-absences/shared/modules/apis","common/services/api"],function(e,t){"use strict";t.factory("WorkPatternAPI",["$log","api",function(t,n){function a(t){var n=e.clone(t);return n.workPattern=n["api.WorkPattern.get"].values[0],delete n["api.WorkPattern.get"],n}return t.debug("WorkPatternAPI"),n.extend({assignWorkPattern:function(t,n,a,r,o,s){return this.sendPOST("ContactWorkPattern","create",e.assign({},s,{contact_id:t,pattern_id:n,effective_date:a,effective_end_date:r,change_reason:o})).then(function(e){return e.values})},get:function(e){return this.sendGET("WorkPattern","get",e||{}).then(function(e){return e.values})},getCalendar:function(n,a,r,o){return t.debug("WorkPatternAPI.getCalendar",n,a,r,o),this.sendGET("WorkPattern","getcalendar",e.assign({},o,{contact_id:e.isArray(n)?{IN:n}:n,start_date:a,end_date:r}))},unassignWorkPattern:function(e){return this.sendPOST("ContactWorkPattern","delete",{id:e})},workPatternsOf:function(t,n,r){return this.sendGET("ContactWorkPattern","get",e.assign({},n,{contact_id:t,"api.WorkPattern.get":{id:"$value.pattern_id"}}),r).then(function(e){return e=e.values,e.map(a)})}})}])}),define("leave-absences/shared/instances/calendar.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance"],function(e,t,n){"use strict";n.factory("CalendarInstance",["$log","$q","ModelInstance","shared-settings","OptionGroup",function(n,a,r,o,s){function i(t,n){return c().then(function(a){var r=this.days[u(t).valueOf()];return!!r&&e.find(a,function(e){return e.name===n}).value===r.type}.bind(this))}function u(e){return t(e,o.serverDateFormat).clone()}function c(){return l=l||s.valuesOf("hrleaveandabsences_work_day_type")}var l;return r.extend({defaultCustomData:function(){return{days:[]}},isNonWorkingDay:function(e){return i.call(this,e,"non_working_day")},isWeekend:function(e){return i.call(this,e,"weekend")},isWorkingDay:function(e){return i.call(this,e,"working_day")},transformAttributes:function(t){var n={};return t.calendar.forEach(function(e){n[u(e.date).valueOf()]=e}),e(t).omit("calendar").assign({days:n}).value()}})}])}),define("leave-absences/shared/models/calendar.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/calendar.instance"],function(e,t){"use strict";t.factory("Calendar",["$log","Model","WorkPatternAPI","CalendarInstance",function(t,n,a,r){return t.debug("Calendar"),n.extend({get:function(n,o,s,i){return t.debug("Calendar.get"),a.getCalendar(n,o,s,i).then(function(t){var a=t.values.map(function(e){return r.init(e)});return e.isArray(n)?a:a[0]})}})}])}),define("leave-absences/shared/components/leave-request-popup-details-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/session.model","leave-absences/shared/models/calendar.model"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l,d,f){function m(){te.balance.closing=te.balance.opening+te.balance.change.amount}function p(e){return t(e,u.serverDateFormat).toDate()}function h(e){return t(e).format(u.serverDateFormat)}function v(e){var t;return s.resolve().then(function(){N(e),"from"===e&&F(),I("hours")&&(y(e),"from"!==e||te.uiOptions.multipleDays||y("to")),te.loading[e+"DayTypes"]=!0}).then(function(){return q(e)}).then(function(e){if(t=e.id!==te.period.id,t&&(te.period=e),!te.period.id)return s.reject("Please change date as it is not in any absence period")}).then(H).then(function(){if(t)return M()}).then(function(){return te.onDateChangeExtended&&te.onDateChangeExtended(e)}).then(function(){if(G(),!t)return E();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(w).finally(_)}function b(){return G(),E()}function g(){return te.uiOptions.toDate=null,N("to"),s.resolve().then(G).then(te.setDaysSelectionModeExtended).then(_).then(!te.uiOptions.multipleDays&&E)}function y(e){te.uiOptions.times[e].loading=!0}function _(){["from","to"].forEach(function(e){te.loading[e+"DayTypes"]=!1,I("hours")&&(te.uiOptions.times[e].loading=!1)})}function q(n){var a=t(te.uiOptions[n+"Date"]).format(te.uiOptions.userDateFormat.toUpperCase());return e.find(te.absencePeriods,function(e){return e.isInPeriod(a)})||{}}function $(){return te.request?te.request.request_type:te.leaveType||null}function C(e){return t().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function A(){return z(),te.loading.balanceChange=!0,te.request.getBalanceChangeBreakdown().then(U).catch(w)}function w(t){r.$broadcast("LeaveRequestPopup::handleError",e.isArray(t)?t:[t]),te.loading.fromDayTypes=!1,te.loading.balanceChange=!1,te.loading.tab=!1,te.loading.toDayTypes=!1}function T(){return te.isMode("create")||te.forceRecalculateBalanceChange?E():A()}function P(){var e=te.request.attributes();return te.uiOptions.fromDate=p(te.request.from_date),te.request.to_date=e.to_date,te.request.to_date_type=e.to_date_type,te.uiOptions.toDate=p(te.request.to_date),te.initDayTypesExtended?te.initDayTypesExtended():s.resolve()}function D(){ee.push(r.$on("LeaveRequestPopup::absenceTypeChanged",function(){J()}),r.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,t){K(t)}),r.$on("LeaveRequestPopup::recalculateBalanceChange",E))}function R(){te.isMode("edit")&&(te.isLeaveStatus(u.statusNames.approved)||te.isLeaveStatus(u.statusNames.adminApproved))&&(Z={absenceTypeId:te.request.type_id,value:te.selectedAbsenceType.remainder-te.request.balance_change})}function S(){r.$watch(function(){return te.uiOptions.times.from.time},function(e,t){e!==t&&(te.uiOptions.multipleDays||(Q(e),G()))})}function I(e){return te.selectedAbsenceType.calculation_unit_name===e}function O(e){return te.request.request_type===e}function k(t){return e.includes(["weekend","non_working_day","public_holiday"],t)}function x(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){te.requestDayTypes=e})}function M(){return c.get(te.request.contact_id,te.period.start_date,te.period.end_date).then(function(e){te.calendar=e})}function L(){var e=(te.pagination.currentPage-1)*te.pagination.numPerPage,t=e+te.pagination.numPerPage;te.pagination.filteredbreakdown=te.balance.change.breakdown.slice(e,t)}function E(){return z(),te.canCalculateChange()?(te.loading.balanceChange=!0,te.request.change_balance=!0,te.calculateBalanceChange().then(U).catch(w).finally(function(){te.loading.balanceChange=!1})):s.resolve()}function j(){te.pagination.totalItems=te.balance.change.breakdown.length,te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.pageChanged()}function B(){return h(te.request.from_date)===h(te.request.to_date)}function F(){te.uiOptions.toDate&&te.uiOptions.fromDate&&te.uiOptions.multipleDays&&t(te.uiOptions.toDate).isSameOrBefore(te.uiOptions.fromDate)&&(te.uiOptions.toDate=null,N("to"))}function N(e){te.resetUIInputsExtended&&te.resetUIInputsExtended(e),G(),z()}function U(e){te.balance.change=e,te.request.balance_change=e.amount,m(),j(),te.loading.balanceChange=!1}function H(){var e,n,a;te.uiOptions.fromDate?(e=t(te.uiOptions.fromDate).add(1,"day").toDate(),a=e,n=e):(a=p(te.period.start_date),n=te.uiOptions.date.to.options.minDate),te.uiOptions.date.to.options.initDate=n,te.uiOptions.date.to.options.minDate=a,te.uiOptions.date.to.options.maxDate=p(te.period.end_date)}function W(){return!te.isMode("create")&&B()||te.isMode("create")&&(O("sickness")||I("hours"))?te.uiOptions.multipleDays=!1:te.uiOptions.multipleDays=!0,s.resolve().then(te.setDaysSelectionModeExtended)}function V(){Z&&Z.absenceTypeId===te.selectedAbsenceType.id?te.balance.opening=Z.value||0:te.balance.opening=te.selectedAbsenceType.remainder}function Y(){te.selectedAbsenceType=e.find(te.absenceTypes,function(e){return e.id===te.request.type_id})}function G(){var e=te.uiOptions,t=e.times;te.request.from_date=e.fromDate?h(e.fromDate):null,te.request.to_date=e.toDate?h(e.toDate):null,!e.multipleDays&&e.fromDate&&(te.request.to_date=te.request.from_date,te.request.to_date_type=te.request.from_date_type),(I("hours")||O("toil"))&&(te.request.from_date=te.request.from_date&&t.from.time?te.request.from_date+" "+t.from.time:null,te.request.to_date=te.request.to_date&&t.to.time?te.request.to_date+" "+t.to.time:null)}function z(){te.uiOptions.showBalance=te.canCalculateChange()}function X(){e.forEach(ee,function(e){e()})}function J(){var e,t=te.selectedAbsenceType.calculation_unit_name;return Y(),e=t!==te.selectedAbsenceType.calculation_unit_name,V(),s.resolve().then(e&&W).then(e&&te.onAbsenceTypeUpdateExtended).then(e&&G).then(_).then(E)}function K(e){return te.absenceTypes=e,Y(),t(te.uiOptions.toDate).isAfter(te.period.end_date)&&(te.uiOptions.toDate=void 0,N("to")),V(),E()}function Q(e){var t=C(e).add(te.uiOptions.time_interval,"minutes");t.isAfter(C(te.uiOptions.times.to.max))||(te.uiOptions.times.to.min=t.format("HH:mm"),t.isAfter(C(te.uiOptions.times.to.time))&&(te.uiOptions.times.to.time=""))}a.debug("Component: leave-request-popup-details-tab");var Z=null,ee=[],te=this;te.canManage=!1,te.calendar={},te.errors=[],te.isRequired=!0,te.requestDayTypes=[],te.statusNames=u.statusNames,te.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},te.pagination={currentPage:1,filteredbreakdown:te.balance.change.breakdown,numPerPage:7,totalItems:te.balance.change.breakdown.length,pageChanged:L},te.uiOptions={isChangeExpanded:!1,multipleDays:!0,userDateFormat:i.DATE_FORMAT,showBalance:!1,date:{from:{show:!1,options:{startingDay:1,showWeeks:!1}},to:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}},expiry:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}}},times:{from:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""},to:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""}},time_interval:15},te.convertDateFormatFromServer=p,te.convertDateToServerFormat=h,te.dateChangeHandler=v,te.dateTypeChangeHandler=b,te.daysSelectionModeChangeHandler=g,te.disableAndShowLoadingTimeInput=y,te.getMomentDateWithGivenTime=C,te.handleError=w,te.isCalculationUnit=I,te.isLeaveType=O,te.isNotWorkingDay=k,te.performBalanceChangeCalculation=E,te.setRequestDateTimesAndDateTypes=G,te.updateEndTimeInputMinTime=Q,te.$onDestroy=X,function(){n("RequestModalDetails"+e.capitalize($(te.leaveType,te.request))+"Controller",{detailsController:te}),te.canManage=te.isRole("manager")||te.isRole("admin"),te.loading.tab=!0,o.$emit("LeaveRequestPopup::addTab",te),D(),te.initChildController().then(function(){return s.all([M(),x()])}).then(!te.isMode("create")&&P).then(W).then(function(){if(!te.isMode("create"))return s.resolve().then(te.initTimesExtended).then(G)}).then(!te.isMode("create")&&H).then(R).then(V).then(T).then(S).then(!te.isMode("view")&&te.initWatchersExtended).catch(w).finally(function(){te.loading.tab=!1})}()}n.component("leaveRequestPopupDetailsTab",{bindings:{absencePeriods:"<",absenceTypes:"<",balance:"=",request:"<",isLeaveStatus:"<",leaveType:"<",isMode:"<",isSelfRecord:"<",period:"=",isRole:"<",selectedAbsenceType:"=",forceRecalculateBalanceChange:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-details-tab.html"}],controllerAs:"detailsTab",controller:a}),a.$inject=["$controller","$log","$rootScope","$scope","$q","HR_settings","shared-settings","Calendar","OptionGroup","LeaveRequest","$timeout"]}),define("leave-absences/shared/components/leave-request-popup-files-tab",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/file-upload","common/services/file-mime-types","common/services/hr-settings"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l){function d(){return S.fileUploader&&S.fileUploader.queue.length>0}function f(){return S.getFilesAmount()0?P.map(function(e){return e.label}).join(", "):""}function q(){return S.request.loadAttachments().then(function(){r.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function $(){return a.all(P.map(function(e){return l.getMimeTypeFor(e.label).then(function(t){R[e.label]=t})})).catch(function(){R=null})}function C(){return u.valuesOf("safe_file_extension").then(function(e){P=e})}function A(e){return!e.attachment_id||S.canManage}function w(){e.forEach(D,function(e){e()})}function T(e,t){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){t()}).catch(t):t()}n.debug("Component: leave-request-popup-files-tab");var P=[],D=[],R={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=s.DATE_FORMAT+" HH:mm",S.userDateFormat=s.DATE_FORMAT,S.$onDestroy=w,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=f,S.formatDateTime=m,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=_,function(){r.$broadcast("LeaveRequestPopup::childComponent::register"),o.$emit("LeaveRequestPopup::addTab",S),g(),a.all([C(),q()]).then(y).finally(function(){S.filesLoaded=!0})}(),S}n.component("leaveRequestPopupFilesTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-files-tab.html"}],controllerAs:"filesTab",controller:["$log","$q","$rootScope","$scope","HR_settings","shared-settings","OptionGroup","FileUpload","fileMimeTypes",a]})}),define("leave-absences/shared/components/leave-request-record-actions.component",["leave-absences/shared/modules/components","common/services/hr-settings","common/services/before-hash-query-params.service"],function(e){function t(e,t,n){function a(e){t.openModal(e)}e.debug("Component: leave-request-record-actions");var r,o=this;o.leaveRequestOptions=[{type:"leave",icon:"briefcase",label:"Leave"},{type:"sickness",icon:"stethoscope",label:"Sickness"}],o.openLeavePopup=a,function(){r=n.parse(),r.openModal&&a({leaveType:r.openModal,selectedContactId:o.selectedContactId})}()}e.component("leaveRequestRecordActions",{bindings:{contactId:"<",selectedContactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-record-actions.html"}],controllerAs:"vm",controller:["$log","LeavePopup","beforeHashQueryParams",t]})}),define("leave-absences/shared/components/manage-leave-requests.component",["common/lodash","leave-absences/shared/modules/components","common/models/contact","common/services/pub-sub"],function(e,t){function n(t,n,a,r,o,s,i,u,c,l,d,f){"use strict";function m(){U.filters.leaveRequest.contact_id=null,U.refresh()}function p(){var e=U.filters.contact;return{department:e.department,level_type:e.level_type,location:e.location,region:e.region}}function h(e){return"all"===e.name||""===e?U.leaveRequests.filter.list.length:U.leaveRequests.filter.list.filter(function(t){return t.status_id===e.value}).length}function v(t){return e.find(U.absenceTypes,{id:t})}function b(e){return new Array(e||0)}function g(t){var n=e.find(U.leaveRequestStatuses,function(e){return e.value===t});return n?n.label:null}function y(e){switch(e){case i.statusNames.approved:return"badge-success";case i.statusNames.rejected:return"badge-danger";case i.statusNames.cancelled:case"all":return"";default:return"badge-primary"}}function _(t){return e.find(U.leaveRequestStatuses,function(e){return e.name===t}).value}function q(t){var n=e.find(U.filteredUsers,function(e){return e.id===t});return n?n.display_name:null}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return u.all().then(function(t){U.absencePeriods=e.sortBy(t,"start_date"),U.filters.leaveRequest.selectedPeriod=e.find(U.absencePeriods,function(e){return!!e.current})})}function A(){return c.all().then(c.loadCalculationUnits).then(function(e){U.absenceTypes=e})}function w(e){return(U.isAdmin?r.all(p()):r.leaveManagees(U.contactId,p())).then(function(t){return U.filteredUsers=U.isAdmin?t.list:t,e?P(e):n.all([P("table"),P("filter")])}).then(function(){U.filters.leaveRequest.leaveStatus!==H&&0===U.leaveRequests.table.list.length&&U.refresh(1,!0)})}function T(){return s.valuesOf("hrjc_department").then(function(e){U.departments=e})}function P(e){var t="filter"!==e,n="table"===e?e:"content",a="filter"===e?{size:0}:U.pagination,r="filter"===e?{return:["status_id"]}:{};return U.loading[n]=!0,l.all(S(t),a,"from_date DESC",r,!1).then(function(t){U.leaveRequests[e]=t}).catch(function(){U.leaveRequests[e].list=[]}).finally(function(){U.loading[n]=!1})}function D(){return s.valuesOf("hrjc_level_type").then(function(e){U.levelTypes=e})}function R(){return s.valuesOf("hrjc_location").then(function(e){U.locations=e})}function S(t){var n=U.filters.leaveRequest;return{contact_id:x(),managed_by:U.isAdmin&&"me"!==n.assignedTo.type?void 0:U.contactId,status_id:L(t),type_id:n.selectedAbsenceTypes?n.selectedAbsenceTypes.id:{IN:e.pluck(U.absenceTypes,"id")},from_date:{from:n.selectedPeriod.start_date},to_date:{to:n.selectedPeriod.end_date},unassigned:"unassigned"===n.assignedTo.type||void 0}}function I(){return s.valuesOf("hrjc_region").then(function(e){U.regions=e})}function O(){return s.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){U.leaveRequestStatuses=e.concat(U.leaveRequestStatuses)})}function k(e){d.openModal(e)}function x(){return U.filteredUsers.length>0&&U.filters.leaveRequest.contact_id?U.filters.leaveRequest.contact_id:{IN:U.filteredUsers.map(function(e){return e.id})}}function M(e){var t=[_(i.statusNames.moreInformationRequired),_(i.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function L(e){var t=U.filters.leaveRequest,n=[];if(e&&t.leaveStatus&&t.leaveStatus.value&&n.push(t.leaveStatus.value),t.pending_requests&&(n=M(n)),n.length)return{IN:n}}function E(e,t,n){e="number"==typeof e?e:1,t&&(U.filters.leaveRequest.leaveStatus=H),(e<=U.totalNoOfPages()||0===U.totalNoOfPages())&&(U.pagination.page=e,w(n))}function j(e){U.filters.leaveRequest.leaveStatus=e,U.refresh(1,!1,"table")}function B(e){U.filters.leaveRequest.assignedTo=e,U.refresh()}function F(){f.subscribe("LeaveRequest::updatedByManager",function(){U.refresh()}),f.subscribe("LeaveRequest::new",function(){U.refresh()}),f.subscribe("LeaveRequest::edit",function(){U.refresh()}),f.subscribe("LeaveRequest::delete",function(){U.refresh()}),f.subscribe("LeaveRequest::statusUpdate",function(){U.refresh()})}function N(){return Math.ceil(U.leaveRequests.table.total/U.pagination.size)}t.debug("Component: manage-leave-requests");var U=this,H={name:"all",label:"All"};U.absencePeriods=[],U.absenceTypes=[],U.filteredUsers=[],U.isFilterExpanded=!1,U.isAdmin=!1,U.leaveRequests={table:{list:[]},filter:{list:[]}},U.leaveRequestStatuses=[H],U.loading={content:!0,page:!0,table:!0},U.pagination={page:1,size:7},U.filtersByAssignee=[{type:"me",label:"Assigned To Me"},{type:"unassigned",label:"Unassigned"},{type:"all",label:"All"}],U.filters={contact:{department:null,level_type:null,location:null,region:null},leaveRequest:{leaveStatus:U.leaveRequestStatuses[0],pending_requests:!0,contact_id:null,selectedPeriod:null,selectedAbsenceTypes:null,assignedTo:U.filtersByAssignee[0]}},U.clearStaffSelection=m,U.countLeaveRequestByStatus=h,U.getAbsenceTypeByID=v,U.getArrayOfSize=b,U.getLeaveStatusByValue=g,U.getNavBadge=y,U.getUserNameByID=q,U.labelPeriod=$,U.openLeavePopup=k,U.refresh=E,U.refreshWithFilter=j,U.refreshWithFilterByAssignee=B,U.totalNoOfPages=N,function(){o(i.permissions.admin.administer).then(function(e){U.isAdmin=e,n.all([C(),A(),I(),T(),R(),D(),O()]).then(function(){U.loading.page=!1,w()}),F()})}()}t.component("manageLeaveRequests",{bindings:{contactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/manage-leave-requests.html"}],controllerAs:"vm",controller:n}),n.$inject=["$log","$q","$rootScope","Contact","checkPermissions","OptionGroup","shared-settings","AbsencePeriod","AbsenceType","LeaveRequest","LeavePopup","pubSub"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){return s.request.calculateBalanceChange(s.selectedAbsenceType.calculation_unit_name)}function l(){var e=s.request,t=!!e.from_date&&!!e.to_date,n=s.selectedAbsenceType.calculation_unit_name;return"days"===n?t=t&&!!e.from_date_type&&!!e.to_date_type:"hours"===n&&(t=t&&!isNaN(+e.from_date_amount)&&!isNaN(+e.to_date_amount)),t}function d(){return s.canCalculateChange()}function f(t,n){var a=s.uiOptions.times[t],r=e.clone(n.time_from),o=e.clone(n.time_to);s.uiOptions.multipleDays||("from"===t&&o&&r&&(o=s.getMomentDateWithGivenTime(o).subtract(s.uiOptions.time_interval,"minutes").format("HH:mm")),"to"===t&&r&&o&&(r=s.getMomentDateWithGivenTime(r).add(s.uiOptions.time_interval,"minutes").format("HH:mm"))),a.min=r||"00:00",a.max=o||"00:00",a.time="to"===t?a.max:a.min}function m(t,n){return t?(t=s.convertDateToServerFormat(t),v(t).then(function(n){return n?s.requestDayTypes.filter(function(e){return"public_holiday"===e.name}):p(t,s.requestDayTypes).then(function(t){return t.length?t:s.requestDayTypes.filter(function(t){return e.includes(["all_day","half_day_am","half_day_pm"],t.name)})})}).then(function(e){return D(n,e),e})):r.reject([])}function p(e,n){return e=t(e),r.all([s.calendar.isNonWorkingDay(e),s.calendar.isWeekend(e)]).then(function(e){return e[0]?"non_working_day":e[1]?"weekend":null}).then(function(e){return e?n.filter(function(t){return t.name===e}):[]})}function h(e,n){return t.duration(n).subtract(t.duration(e)).asHours()}function v(e){return u.all({public_holiday:1,contact_id:s.request.contact_id,from_date:{from:e},to_date:{to:e}}).then(function(e){return!!e.list.length})}function b(){return r.resolve()}function g(){return A(s.uiOptions.fromDate,"from").then(function(){return A(s.uiOptions.toDate,"to")})}function y(e){o.$watch(function(){return s.uiOptions.times[e].amount},function(e,t){s.isCalculationUnit("days")||+e==+t||(s.isRole("staff")&&(s.request.change_balance=!0),I(),s.performBalanceChangeCalculation())})}function _(e){var n=t(s.request[e+"_date"]).format("HH:mm"),a=s.uiOptions.times[e];(h(a.min,n)<=0||h(a.max,n)>=0)&&(n="from"===e?a.min:a.max),s.uiOptions.times[e].time=n}function q(){var e=s.uiOptions.multipleDays?["from","to"]:["from"],t=s.uiOptions.times;if(s.isCalculationUnit("hours"))return r.all(e.map(T)).then(function(){["from","to"].forEach(function(e){_(e),S(e),t[e].amount=Math.min(s.request[e+"_date_amount"],t[e].maxAmount).toString()}),s.uiOptions.multipleDays||s.updateEndTimeInputMinTime(s.uiOptions.times.from.time)}).then(I)}function $(){["from","to"].forEach(function(e){y(e),C(e)})}function C(e){o.$watch(function(){return s.uiOptions.times[e].time},function(t,n){s.isCalculationUnit("days")||t===n||(s.setRequestDateTimesAndDateTypes(),t&&S(e,!0))})}function A(e,t){return m(e,t).then(function(){s.loading[t+"DayTypes"]=!1})}function w(e){return A(s.uiOptions[e+"Date"],e).then(function(){if(s.isCalculationUnit("hours"))return T(e).then(function(){S(e,!0)})})}function T(e){var t=s.uiOptions[e+"Date"],n=!s.uiOptions.multipleDays;return t?s.request.getWorkDayForDate(s.convertDateToServerFormat(t)).then(function(t){k[e]=t,f(e,t),n&&"from"===e&&f("to",t)}).catch(function(t){return k[e]={},s.handleError(t)}).finally(function(){s.uiOptions.times[e].loading=!1,n&&(s.uiOptions.times.to.loading=!1)}):r.resolve()}function P(t){var n=s.uiOptions.times[t];s["request"+e.startCase(t)+"DayTypes"]=[],n.time="",n.min="00:00",n.max="00:00",n.amount="0",n.maxAmount="0"}function D(t,n){var a="request"+e.startCase(t)+"DayTypes";s[a]=n,s.isMode("create")&&(s.request[t+"_date_type"]=s[a][0].value)}function R(){return s.isCalculationUnit("hours")&&s.uiOptions.fromDate?(s.disableAndShowLoadingTimeInput("from"),!s.uiOptions.multipleDays&&s.disableAndShowLoadingTimeInput("to"),T("from").then(function(){S("from",!0)})):r.resolve()}function S(e,t){var n=s.uiOptions,a=n.multipleDays?e:"from",r=n.times[a],o=n.multipleDays&&"to"===a?r.min:n.times.from.time,i=n.multipleDays&&"from"===a?r.max:n.times.to.time,u=k[a].number_of_hours?h(o,i).toString():"0";r.maxAmount=u,t&&(r.amount=r.maxAmount)}function I(){var e=s.uiOptions.times;s.request.from_date_amount=isNaN(+e.from.amount)?null:e.from.amount,s.request.to_date_amount=isNaN(+e.to.amount)?null:e.to.amount}function O(){return s.isCalculationUnit("hours")&&s.uiOptions.fromDate?T("from").then(function(){S("from",!0)}):r.resolve()}var k={};a.debug("RequestModalDetailsLeaveController"),s.calculateBalanceChange=c,s.canCalculateChange=l,s.canSubmit=d,s.initChildController=b,s.initDayTypesExtended=g,s.initTimesExtended=q,s.initWatchersExtended=$,s.onAbsenceTypeUpdateExtended=O,s.onDateChangeExtended=w,s.resetUIInputsExtended=P,s.setDaysSelectionModeExtended=R}n.controller("RequestModalDetailsLeaveController",a),a.$inject=["$controller","$log","$q","$rootScope","detailsController","PublicHoliday","LeaveRequest"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller",["common/lodash","leave-absences/shared/modules/controllers"],function(e,t){function n(t,n,a,r,o,s,i){function u(){return!(!i.canCalculateChange()||!i.request.sickness_reason)}function c(){return a.all([f(),h(),m(!0)])}function l(t){var n=i.request.getDocumentArray();return!!e.find(n,function(e){return e===t})}function d(t){return!!e.find(i.sicknessDocumentTypes,function(e){return e.value===t})}function f(){return s.valuesOf("hrleaveandabsences_leave_request_required_document").then(function(e){i.sicknessDocumentTypes=e})}function m(t){return s.valuesOf("hrleaveandabsences_sickness_reason",t).then(function(t){i.sicknessReasons=e.indexBy(t,"name")})}function p(){o.loadForm("/civicrm/admin/options/hrleaveandabsences_sickness_reason?reset=1").on("crmUnload",function(){m(!1)})}function h(){i.showSicknessOptionsEditorIcon=e.includes(["admin-dashboard","absence-tab"],r.section)}n.debug("RequestModalDetailsSicknessController"),t("RequestModalDetailsLeaveController",{detailsController:i}),i.canSubmit=u,i.initChildController=c,i.isChecked=l,i.isDocumentInRequest=d,i.openSicknessReasonOptionsEditor=p}t.controller("RequestModalDetailsSicknessController",n),n.$inject=["$controller","$log","$q","$rootScope","crmAngService","api.optionGroup","detailsController"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){return u.balance.change.amount=+u.request.toil_to_accrue,a.resolve(u.balance.change)}function l(){if(!u.request.from_date||!u.request.to_date)return u.uiOptions.max_toil_duration_and_accrual=null,void(u.uiOptions.toil_duration_in_hours=null);u.uiOptions.max_toil_duration_and_accrual=t.duration(t(u.request.to_date).diff(u.request.from_date)).asHours()}function d(){return v().catch(function(e){return e.length&&(u.errors=e),a.reject(e)}).then(function(e){return i.calculateToilExpiryDate(u.request.type_id,e)}).then(function(e){return u.request.toil_expiry_date=e,u.uiOptions.expiryDate=new Date(e),e})}function f(){return!!u.request.toil_to_accrue}function m(){var e=u.uiOptions.multipleDays&&!!u.request.to_date,t=!u.uiOptions.multipleDays&&!!u.request.from_date,n=t||e,a=N.from_date!==u.request.from_date||N.to_date!==u.request.to_date;return u.canDisplayToilExpirationField&&n&&H.hasExpirationFromAdminSettings&&a}function p(){return!!(u.request.from_date&&u.request.to_date&&u.request.toil_duration&&u.request.toil_to_accrue)}function h(){u.request.toil_expiry_date=!1,u.uiOptions.expiryDate=null}function v(){var e=u.uiOptions.multipleDays,t=u.request;return b({hasErrors:e?!t.to_date&&!t.from_date:!t.from_date,label:e?"To Date":"From Date", -value:t.to_date})}function b(e){if(e.hasErrors){var n="Please select "+e.label+" to find expiry date";return a.reject([n])}return e.value?a.resolve(t(e.value).format("YYYY-MM-DD")):a.reject([])}function g(){var e=u.isMode("create")&&H.hasExpirationFromAdminSettings,t=H.hasPreviousExpirationDate,n=u.isLeaveType("toil"),a=u.canManage;u.canDisplayToilExpirationField=n&&(a||e||t)}function y(){u.uiOptions.toil_duration_in_hours=u.request.toil_duration/60}function _(){return H.hasPreviousExpirationDate=u.isMode("edit")&&!!u.request.toil_expiry_date,i.canExpire(u.request.type_id).then(function(e){H.hasExpirationFromAdminSettings=e})}function q(){return u.request.to_date_type=u.request.from_date_type="1",_().then(g).then($).then(D)}function $(){u.canManage&&(u.uiOptions.expiryDate=u.convertDateFormatFromServer(u.request.toil_expiry_date))}function C(){r.$watch(function(){return u.request.toil_to_accrue},function(e,t){+e!=+t&&u.performBalanceChangeCalculation()})}function A(){r.$watch(function(){return u.uiOptions.toil_duration_in_hours},function(e,t){e!==t&&u.isCalculationUnit("hours")&&O(),u.request.toil_duration=u.uiOptions.toil_duration_in_hours?60*u.uiOptions.toil_duration_in_hours:null})}function w(){var e=u.uiOptions.times;e.from.time=t(u.request.from_date).format("HH:mm"),e.to.time=t(u.request.to_date).format("HH:mm"),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time)}function T(){["from","to"].forEach(function(e){r.$watch(function(){return u.uiOptions.times[e].time},function(e,t){e!==t&&(u.setRequestDateTimesAndDateTypes(),B(),l(),k())})})}function P(){u.isMode("view")||(C(),A(),T())}function D(t){return s.valuesOf("hrleaveandabsences_toil_amounts",t).then(function(t){u.toilAmounts=e.sortBy(t,function(e){return+e.weight})})}function R(){return l(),k(),B()}function S(){return M(),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time),l(),U?U=!1:k(),B()}function I(e){u.uiOptions.times[e].time=""}function O(){u.request.toil_to_accrue=u.uiOptions.toil_duration_in_hours}function k(){u.uiOptions.toil_duration_in_hours=u.uiOptions.max_toil_duration_and_accrual}function x(){N=e.cloneDeep(u.request.attributes())}function M(){u.uiOptions.multipleDays?["from","to"].forEach(function(e){u.uiOptions.times[e].min="00:00",u.uiOptions.times[e].max="23:45"}):(u.uiOptions.times.from.min="00:00",u.uiOptions.times.from.max="23:30",u.uiOptions.times.to.min="00:15",u.uiOptions.times.to.max="23:45")}function L(){u.setRequestDateTimesAndDateTypes(),l(),k(),u.isCalculationUnit("hours")?O():u.request.toil_to_accrue=null}function E(){o.loadForm("/civicrm/admin/options/hrleaveandabsences_toil_amounts?reset=1").on("crmUnload",function(){D(!1)})}function j(){u.showTOILAccrualsOptionEditorIcon=e.includes(["admin-dashboard","absence-tab"],r.section)}function B(){return m()?d().catch(a.resolve):a.resolve()}function F(){u.uiOptions.expiryDate&&(u.request.toil_expiry_date=u.convertDateToServerFormat(u.uiOptions.expiryDate))}n.debug("RequestModalDetailsToilController");var N,U=!u.isMode("create"),H={hasPreviousExpirationDate:null,hasExpirationFromAdminSettings:null};u.canDisplayToilExpirationField=!1,u.calculateBalanceChange=c,u.canCalculateChange=f,u.canSubmit=p,u.clearExpiryDate=h,u.initChildController=q,u.initTimesExtended=w,u.initWatchersExtended=P,u.onAbsenceTypeUpdateExtended=L,u.onDateChangeExtended=R,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=I,u.setDaysSelectionModeExtended=S,u.updateExpiryDate=F,function(){x(),M(),j(),!u.isMode("create")&&y()}()}n.controller("RequestModalDetailsToilController",a),a.$inject=["$log","$q","$rootScope","crmAngService","OptionGroup","AbsenceType","detailsController"]}),define("leave-absences/shared/services/leave-calendar.service",["common/lodash","common/moment","leave-absences/shared/modules/services"],function(e,t,n){"use strict";function a(n,a,r,o){function s(n){function s(){return r.all().then(function(e){return e.list})}function i(){return r.leaveManagees(void 0,{unassigned:!0})}function u(){var t=e.get(n,"filters.userSettings.assignedTo.type","all");return f().then(function(e){return n.lookupContacts=e,a.all([d(),"me"!==t?c():a.resolve(null)])}).then(function(e){var t=e[0];return n.contactIdsToReduceTo=e[1],t})}function c(){return l().then(function(a){var r=a.filter(function(e){var a=e.info.details;return t(a.period_start_date).isSameOrBefore(n.selectedPeriod.end_date)&&(t(a.period_end_date).isSameOrAfter(n.selectedPeriod.start_date)||!a.period_end_date)});return e.uniq(r.map(function(e){return e.contact_id}))})}function l(){return v?a.resolve(v):o.all()}function d(){return r.all(h(),null,"display_name").then(function(e){return e.list})}function f(){var t=e.get(n,"filters.userSettings.assignedTo.type","all");return(0,b[t])()}function m(){return f().then(function(e){n.lookupContacts=e}).then(d)}function p(){return r.leaveManagees(n.contactId)}function h(){var t={department:e.get(n,"filters.userSettings.department.value",null),level_type:e.get(n,"filters.userSettings.level_type.value",null),location:e.get(n,"filters.userSettings.location.value",null),region:e.get(n,"filters.userSettings.region.value",null)},a=!!n.filters.userSettings.contact,r=e.isArray(n.lookupContacts)&&n.lookupContacts.length,o="all"!==e.get(n,"filters.userSettings.assignedTo.type","all");return a?t.id={IN:[n.filters.userSettings.contact.id]}:(o||r)&&(t.id={IN:e.pluck(n.lookupContacts,"id")}),t}var v,b={all:s,me:p,unassigned:i};return{loadContactsForAdmin:u,loadFilteredContacts:d,loadLookUpContacts:f,loadLookUpAndFilteredContacts:m}}return n.debug("LeaveCalendarService"),{init:s}}n.factory("LeaveCalendarService",a),a.$inject=["$log","$q","Contact","Contract"]}),define("leave-absences/shared/instances/absence-period.instance",["leave-absences/shared/modules/models-instances","common/moment","common/models/instances/instance","common/services/hr-settings"],function(e,t){"use strict";e.factory("AbsencePeriodInstance",["$log","ModelInstance","HR_settings",function(e,n,a){return e.debug("AbsencePeriodInstance"),n.extend({defaultCustomData:function(){return{current:!1}},transformAttributes:function(e){var n=t();return e.current=!1,t(e.start_date).isSameOrBefore(n,"day")&&t(e.end_date).isSameOrAfter(n,"day")&&(e.current=!0),e},isInPeriod:function(e){var n=a.DATE_FORMAT.toUpperCase(),r=t(e,n);return t(this.start_date).isSameOrBefore(r)&&t(this.end_date).isSameOrAfter(r)}})}])}),define("leave-absences/shared/apis/absence-period.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("AbsencePeriodAPI",["$log","api",function(e,t){return e.debug("AbsencePeriodAPI"),t.extend({all:function(t){return e.debug("AbsencePeriodAPI"),this.sendGET("AbsencePeriod","get",t).then(function(e){return e.values})}})}])}),define("leave-absences/shared/models/absence-period.model",["leave-absences/shared/modules/models","common/moment","leave-absences/shared/modules/shared-settings","leave-absences/shared/instances/absence-period.instance","leave-absences/shared/apis/absence-period.api","common/models/model","common/services/hr-settings"],function(e,t){"use strict";e.factory("AbsencePeriod",["$log","Model","AbsencePeriodAPI","AbsencePeriodInstance","shared-settings",function(e,n,a,r,o){return e.debug("AbsencePeriod"),n.extend({all:function(e){return a.all(e).then(function(e){return e.map(function(e){return r.init(e,!0)})})},current:function(){var e=t().format(o.serverDateFormat),n={start_date:{"<=":e},end_date:{">=":e}};return a.all(n).then(function(e){return e&&e.length?r.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,t,n){"use strict";n.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(n,a,r){return n.debug("AbsenceTypeAPI"),a.extend({all:function(t){return n.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(t||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,o,s){return n.debug("AbsenceTypeAPI.calculateToilExpiryDate"),s=e.assign({},s,{absence_type_id:a,date:t(o).format(r.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",s).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,t){return e.debug("AbsenceTypeInstance"),t.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,t){"use strict";t.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(t,n,a,r,o,s){return t.debug("AbsenceType"),a.extend({all:function(e){return o.all(e).then(function(e){return e.map(function(e){return s.init(e,!0)})})},calculateToilExpiryDate:function(e,t,n){return o.calculateToilExpiryDate(e,t,n)},canExpire:function(e){return o.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(t){return r.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(n){return n=e.indexBy(n,"value"),e.map(t,function(t){return e.assign(t,{calculation_unit_label:n[t.calculation_unit].label,calculation_unit_name:n[t.calculation_unit].name})})})}})}])}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,t){return e.debug("EntitlementLogAPI"),t.extend({all:function(t){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",t,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,t,n){return e.debug("EntitlementInstance"),t.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return n.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,t){"use strict";t.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(t,n,a,r,o){return t.debug("Entitlement"),n.extend({all:function(e,t){return a.all(this.processFilters(e),t).then(function(e){return e.map(function(e){return r.init(e,!0)})})},breakdown:function(t,n){return a.breakdown(t).then(function(t){return n?(n.map(function(n){var a=e.find(t,function(e){return e.id===n.id});return a&&(n.breakdown=a.breakdown),n}),n):t.map(function(e){return r.init(e,!0)})})},logs:function(t){return t=e.cloneDeep(t||{}),t.contact_id&&(t["entitlement_id.contact_id"]=t.contact_id,delete t.contact_id),t.period_id&&(t["entitlement_id.period_id"]=t.period_id,delete t.period_id),t.return=t.return||[],t.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),o.all(t)}})}])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,n,a){return e.debug("LeaveRequestAPI"),n.extend({all:function(t,n,r,o,s){e.debug("LeaveRequestAPI.all");var i=a.defer();return t&&t.contact_id&&t.contact_id.IN&&0===t.contact_id.IN.length?i.resolve({list:[],total:0,allIds:[]}):i.resolve(this.getAll("LeaveRequest",t,n,r,o,"getFull",s)),i.promise},balanceChangeByAbsenceType:function(n){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var r=a.defer();return n.contact_id&&n.period_id||r.reject("contact_id and period_id are mandatory"),n=t.defaults(n,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",n,!1).then(function(e){r.resolve(e.values)}),r.promise},calculateBalanceChange:function(n){return e.debug("LeaveRequestAPI.calculateBalanceChange",n),this.sendPOST("LeaveRequest","calculatebalancechange",n).then(function(e){return e.values.breakdown=t.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,t){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:t.toString()},!1)},create:function(t){return e.debug("LeaveRequestAPI.create",t),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,attachment_id:n}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,n){return n=t.assign({},n,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",n).then(function(e){return e.values})},find:function(t){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:t},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",n,!1).then(function(e){return e.values})},getComments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",n,!1).then(function(e){return e.values})},isManagedBy:function(t,n){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:t,contact_id:n}).then(function(e){return e.values})},isValid:function(n){e.debug("LeaveRequestAPI.isValid",n);var r=a.defer();return this.sendPOST("LeaveRequest","isValid",n).then(function(e){e.count>0?r.reject(t(e.values).map().flatten().value()):r.resolve(e.values)}),r.promise},saveComment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,text:n.text,contact_id:n.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(t){e.debug("LeaveRequestAPI.update",t);var n=a.defer();return t.id||n.reject("id is mandatory field"),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,t,n){"use strict";n.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(n,a,r,o,s,i,u){function c(e){return p(e).then(function(e){var t=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=t,n.reject(e)}.bind(this))}.bind(this))}function l(){return u.all({id:this.type_id}).then(u.loadCalculationUnits).then(function(e){return n.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return p(e).then(function(e){return this.status_id===e.value}.bind(this))}function f(){var t=[];return e.forEach(this.files,function(e){e.toBeDeleted&&t.push(i.deleteAttachment(this.id,e.attachment_id))}.bind(this)),n.all(t)}function m(e){return t.duration(e.time_to).subtract(t.duration(e.time_from)).asHours()}function p(t){return r.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){return e.find(n,function(e){return e.name===t})})}function h(t){var a=e.cloneDeep(t),r=a.breakdown.length>1,o=e.first(e.values(a.breakdown)),s=e.last(e.values(a.breakdown));return n.all([this.getWorkDayForDate(o.date),r&&this.getWorkDayForDate(s.date)]).then(function(t){return o.amount=t[0].time_from?Math.min(this.from_date_amount,m(t[0])):0,r&&(s.amount=t[1].time_from?Math.min(this.to_date_amount,m(t[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,t){return e+t.amount},0),a}.bind(this))}function v(){var e=this.id,t=[];return t.push(n.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(t){return function(){return i.saveComment(e,t)}}))),t=t.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return i.deleteComment(e.comment_id)})),n.all(t)}return s.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(t){var n=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===t&&e.pull(n,"from_date_type","to_date_type"),i.calculateBalanceChange(e.pick(this,n)).then(function(e){return"hours"===t?h.call(this,e):e}.bind(this))},cancel:function(){return c.call(this,o.statusNames.cancelled)},approve:function(){return c.call(this,o.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return c.call(this,o.statusNames.rejected)},sendBack:function(){return c.call(this,o.statusNames.moreInformationRequired)},update:function(){return i.update(this.toAPI()).then(function(){return n.all([v.call(this),f.call(this)])}.bind(this))},create:function(){return i.create(this.toAPI()).then(function(e){return this.id=e.id,n.all([v.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(t){if(t.comment_id)return void(t.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return t.created_at===e.created_at&&t.text===e.text})},delete:function(){return i.delete(this.id)},getBalanceChangeBreakdown:function(){return i.getBalanceChangeBreakdown(this.id).then(function(t){return{amount:e.reduce(t.values,function(e,t){return e+parseFloat(t.amount)},0),breakdown:t.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return i.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return n.reject(e)})},isValid:function(){return i.isValid(this.toAPI())},isApproved:function(){return d.call(this,o.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,o.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,o.statusNames.cancelled)},isRejected:function(){return d.call(this,o.statusNames.rejected)},isSentBack:function(){return d.call(this,o.statusNames.moreInformationRequired)},loadComments:function(){return this.id?i.getComments(this.id).then(function(e){this.comments=e}.bind(this)):n.resolve()},roleOf:function(e){return this.contact_id===e?n.resolve("owner"):a(o.permissions.admin.administer).then(function(t){return t?"admin":i.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])},loadAttachments:function(){return this.id?i.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):n.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,t,n,a){return e.debug("LeaveRequest"),t.extend({all:function(e,t,r,o,s){return n.all(this.processFilters(e),t,r,o,s).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return n.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return n.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/apis/public-holiday.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("PublicHolidayAPI",["$log","api",function(e,t){return e.debug("PublicHolidayAPI"),t.extend({all:function(t){return e.debug("PublicHolidayAPI"),this.sendGET("PublicHoliday","get",t).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/public-holiday.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("PublicHolidayInstance",["$log","ModelInstance",function(e,t){return e.debug("PublicHolidayInstance"),t.extend({})}])}),define("leave-absences/shared/models/public-holiday.model",["common/moment","leave-absences/shared/modules/models","common/models/model","common/services/hr-settings","leave-absences/shared/apis/public-holiday.api","leave-absences/shared/instances/public-holiday.instance"],function(e,t){"use strict";t.factory("PublicHoliday",["$log","Model","PublicHolidayAPI","PublicHolidayInstance","shared-settings",function(t,n,a,r,o){return t.debug("PublicHoliday"),n.extend({all:function(e){return t.debug("PublicHoliday.all",e),a.all(e).then(function(e){return e.map(function(e){return r.init(e,!0)})})},isPublicHoliday:function(n){t.debug("PublicHoliday.isPublicHoliday",n);var r=e(n).format(o.serverDateFormat),s={date:r};return a.all(s).then(function(e){return!!e.length})}})}])}),define("leave-absences/shared/instances/sickness-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,t){"use strict";t.factory("SicknessRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(t,n){return n.extend({defaultCustomData:function(){var t={sickness_reason:null,sickness_required_documents:"",request_type:"sickness"};return e.assign({},n.defaultCustomData(),t)},getDocumentArray:function(){return this.sickness_required_documents?this.sickness_required_documents.split(","):[]},toggleDocument:function(t){var n=this.getDocumentArray(),a=n.indexOf(t);e.contains(n,t)?n.splice(a,1):n.push(t),this.sickness_required_documents=n.join(",")},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])}})}])}),define("leave-absences/shared/instances/toil-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,t){"use strict";t.factory("TOILRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(t,n){return n.extend({defaultCustomData:function(){var t={from_date_amount:0,to_date_amount:0,request_type:"toil"};return e.assign({},n.defaultCustomData(),t)},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])}})}])}),define("leave-absences/shared/controllers/request.controller",["common/angular","leave-absences/shared/modules/controllers","common/lodash","common/moment","common/models/contact","common/models/session.model","common/services/api/option-group","common/services/hr-settings","common/services/pub-sub","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/instances/leave-request.instance","leave-absences/shared/instances/sickness-request.instance","leave-absences/shared/instances/toil-request.instance","leave-absences/shared/services/leave-request.service"],function(e,t,n,a){"use strict";function r(t,r,o,s,i,u,c,l,d,f,m,p,h,v,b,g,y,_,q,$,C){function A(e){"days"===Ee.selectedAbsenceType.calculation_unit_name?delete Ee.request[e+"_date_amount"]:delete Ee.request[e+"_date_type"]}function w(){["from","to"].forEach(A)}function T(){var e=Ee.requestStatuses[_.statusNames.awaitingApproval].value;Ie.status_id===e&&e!==Ee.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Le.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Le.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function R(){return!Ee.loading.entitlements&&(!!ie("admin")||!oe("view")&&!(ie("manager")&&!oe("create")))}function S(){var e=P();return Ee.isMode("edit")&&(e=e&&(Y()||D())),Ee.canManage&&Ee.requestStatuses&&(e=e&&!!Ee.getStatusFromValue(Ee.newStatusOnSave)),(e=e&&!!Ee.period.id)&&!Ee.isMode("view")}function I(){Ee.isSelfRecord?Ee.request.status_id=Ee.requestStatuses[_.statusNames.awaitingApproval].value:Ee.canManage&&(Ee.request.status_id=Ee.newStatusOnSave||Ee.request.status_id)}function O(){if(Ee.isMode("edit")&&!Ee.isRole("staff")&&"toil"!==U())return Ee.request.calculateBalanceChange(Ee.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Ee.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function k(){return"toil"!==U()&&!Ee.request.change_balance}function x(){Ee.errors=[]}function M(){return Ee.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function L(){ne()&&!Ee.isRole("staff")&&(Ee.request.change_balance=!0)}function E(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Ee.request.delete().then(function(){Ee.dismissModal(),d.publish("LeaveRequest::delete",Ee.request)})}})}function j(){i.dismiss({$value:"cancel"})}function B(){var e=U();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function F(){return N(Ee.getStatusFromValue(Ee.request.status_id).name)}function N(e){return n.map(Re[e],function(e){return Ee.requestStatuses[e]})}function U(){return Ee.request?Ee.request.request_type:Ee.leaveType||null}function H(){return!Ee.request||e.equals({},Ee.requestStatuses)?[]:Ee.request.status_id?F():N("none")}function W(e){return n.find(Ee.requestStatuses,function(t){return t.value===e})}function V(e){Ee.errors=n.isArray(e)?e:[e],Ee.loading.absenceTypes=!1,Ee.submitting=!1}function Y(){return!e.equals(Ie,Ee.request.attributes())||Ee.canManage&&Ee.newStatusOnSave}function G(){return Ee.postContactSelection=!0,Ee.staffMemberSelectionComplete=!1,Ee.request.contact_id?r.resolve().then(ce).then(le).then(be).then(ye).then(te).then(X).then(Ee.isMode("edit")?_e:n.noop).then(function(){Ee.postContactSelection=!1,Ee.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==xe)return r.reject(e)}):r.reject("The contact id was not set")}function z(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];Re.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Re.awaiting_approval=e,Re.more_information_required=e,Re.rejected=e,Re.approved=e,Re.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){return Ee.canManage?m.find(Ee.request.contact_id).then(function(e){Ee.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+ke==+n.get(Ee,"leaveRequest.contact_id"),a=!n.get(Ee,"leaveRequest.id");Ee.isSelfRecord=e&&(t||a)}function K(){Oe.push(o.$on("LeaveRequestPopup::requestObjectUpdated",_e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){le().then(be).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Ee.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Se++})),s.$on("$destroy",we),s.$on("LeaveRequestPopup::addTab",function(e,t){Le.push(t)})}function Q(){var e,t;Ee.request=Ee.leaveRequest||null,e=U(),t=Ee.initRequestAttributes(),"leave"===e?Ee.request=y.init(t):"sickness"===e?Ee.request=q.init(t):"toil"===e&&(Ee.request=$.init(t))}function Z(){var e={};return Ee.request?e=Ee.request.attributes():Ee.canManage||(e={contact_id:ke}),e}function ee(){if(Me="staff",!Ee.isSelfRecord)return u(_.permissions.admin.administer).then(function(e){e&&(Me="admin")}).then(function(){return"staff"===Me&&u(_.permissions.ssp.manage).then(function(e){e&&(Me="manager")})}).finally(function(){Ee.canManage=Ee.isRole("manager")||Ee.isRole("admin")})}function te(){Ee.defaultStatus?Ee.newStatusOnSave=Ee.requestStatuses[_.statusNames[Ee.defaultStatus]].value:(Ee.isRole("admin")||Ee.isMode("create")&&Ee.isRole("manager"))&&(Ee.newStatusOnSave=Ee.requestStatuses[_.statusNames.approved].value)}function ne(){return!Ee.request.status_id||!n.includes(["cancelled","rejected"],W(Ee.request.status_id).name)}function ae(e){var t=Ee.getStatusFromValue(Ee.request.status_id);return!!t&&t.name===e}function re(e){return Ee.request&&Ee.request.request_type===e}function oe(e){return Ee.mode===e}function se(e,t){var n=a(e.from_date),r=a(e.to_date);return n.isSameOrAfter(t.start_date,"day")&&r.isSameOrBefore(t.end_date,"day")}function ie(e){return Me===e}function ue(){return h.all().then(function(e){Ee.absencePeriods=e})}function ce(){return v.all(B()).then(v.loadCalculationUnits).then(function(e){De={types:e,ids:e.map(function(e){return e.id})}})}function le(){return Ee.loading.entitlements=!0,b.all({contact_id:Ee.request.contact_id,period_id:Ee.period.id,type_id:{IN:De.ids}},!0).finally(function(){Ee.loading.entitlements=!1})}function de(){return p.get().then(function(e){ke=e.contactId})}function fe(){return Ee.selectedContactId?m.find(Ee.selectedContactId).then(function(e){Ee.managedContacts=[e]}):Ee.isRole("admin")?m.all().then(function(e){Ee.managedContacts=n.remove(e.list,function(e){return e.id!==ke})}):m.find(ke).then(function(e){return e.leaveManagees()}).then(function(e){Ee.managedContacts=e})}function me(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Ee.requestStatuses=n.indexBy(e,"name")})}function pe(e,t){var a;return n.compact(e.map(function(e){if(a=n.find(t,{type_id:e.id}))return{id:a.type_id,title:e.title+" ( "+a.remainder.current+" ) ",remainder:a.remainder.current,allow_overuse:e.allow_overuse,calculation_unit_name:e.calculation_unit_name}}))}function he(e){T(),d.publish(e,Ee.request),Ee.errors=[],Ee.dismissModal()}function ve(){["from","to"].forEach(function(e){Ee.request[e+"_date"]=Ie[e+"_date"]})}function be(e){if(Ee.absenceTypes=pe(De.types,e),!Ee.absenceTypes.length)return r.reject(xe)}function ge(){Ee.period=n.find(Ee.absencePeriods,function(e){return Ee.isMode("create")?e.current:se(Ee.request,e)})}function ye(){Ee.isMode("create")?(Ee.selectedAbsenceType=Ee.absenceTypes[0],Ee.request.type_id=Ee.selectedAbsenceType.id):Ee.selectedAbsenceType=n.find(Ee.absenceTypes,function(e){return e.id===Ee.request.type_id})}function _e(){Ie=e.copy(Ee.request.attributes())}function qe(){var e -;Ee.request.id?(e=[Ee.requestStatuses[_.statusNames.approved].value,Ee.requestStatuses[_.statusNames.adminApproved].value,Ee.requestStatuses[_.statusNames.rejected].value,Ee.requestStatuses[_.statusNames.cancelled].value],Ee.mode="edit",Ee.isRole("staff")&&e.indexOf(Ee.request.status_id)>-1&&(Ee.mode="view")):Ee.mode="create"}function $e(){var e=Ee.request.status_id;if(!Ee.isMode("view")&&!Ee.submitting)return Ee.submitting=!0,I(),w(),Ee.request.isValid().then(ne()&&O).then(L).then(k()&&ve).then(Ce).then(function(){return Ee.isMode("edit")?Pe():M()}).catch(function(t){Ee.request.status_id=e,t&&V(t)}).finally(function(){Ee.submitting=!1})}function Ce(){return r.all(Le.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Ae(){function e(e){e&&n.push(e),++a===Se&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Se>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function we(){Oe.forEach(function(e){e()})}function Te(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Pe(){return Ee.request.update().then(Ae).then(function(){Ee.isRole("manager")?he("LeaveRequest::updatedByManager"):(Ee.isRole("staff")||Ee.isRole("admin"))&&he("LeaveRequest::edit")})}t.debug("RequestCtrl");var De,Re={},Se=0,Ie={},Oe=[],ke="",xe="No entitlement",Me="",Le=[],Ee=n.assign(this,f);Ee.absencePeriods=[],Ee.absenceTypes=[],Ee.canManage=!1,Ee.contactName=null,Ee.errors=[],Ee.loading={absenceTypes:!0,entitlements:!0},Ee.managedContacts=[],Ee.mode="",Ee.newStatusOnSave=null,Ee.period={},Ee.postContactSelection=!1,Ee.requestStatuses={},Ee.selectedAbsenceType={},Ee.staffMemberSelectionComplete=!1,Ee.submitting=!1,Ee.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Ee.canChangeAbsenceType=R,Ee.canSubmit=S,Ee.closeAlert=x,Ee.deleteLeaveRequest=E,Ee.dismissModal=j,Ee.getStatuses=H,Ee.getStatusFromValue=W,Ee.initAfterContactSelection=G,Ee.initRequestAttributes=Z,Ee.isLeaveStatus=ae,Ee.isLeaveType=re,Ee.isMode=oe,Ee.isRole=ie,Ee.submit=$e,Ee.updateAbsenceType=Te,function(){Ee.loading.absenceTypes=!0,z(),K(),de().then(J).then(function(){return r.all([ee(),ue(),me()])}).then(Q).then(qe).then(ge).then(function(){return Ee.canManage&&!Ee.isMode("edit")&&fe()}).then(function(){if(Ee.selectedContactId&&(Ee.request.contact_id=Ee.selectedContactId),Ee.request.contact_id)return Ee.initAfterContactSelection()}).catch(V).finally(function(){Ee.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$inject=["$log","$q","$rootScope","$scope","$uibModalInstance","checkPermissions","api.optionGroup","dialog","pubSub","directiveOptions","Contact","Session","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","LeaveRequestInstance","shared-settings","SicknessRequestInstance","TOILRequestInstance","LeaveRequestService"]}),define("leave-absences/shared/services/leave-popup.service",["common/lodash","common/modules/angular-date","leave-absences/shared/modules/services","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/controllers/request.controller"],function(e,t){"use strict";function n(e,t,n,a,r,o,s,i,u){function c(e){return i.get().then(function(t){return e.roleOf(t.contactId)}).then(function(e){return"none"!==e})}function l(e){a.open({appendTo:t.children().eq(0),templateUrl:o.sharedPathTpl+"components/leave-request-popup/leave-request-popup.html",controller:"RequestCtrl",controllerAs:"$ctrl",windowClass:"chr_leave-request-modal",resolve:{directiveOptions:function(){return e},format:["DateFormat",function(e){return e.getDateFormat()}]}})}function d(e){return u.find(e).then(function(e){return c(e).then(function(t){t?l({leaveRequest:e,leaveType:e.request_type,selectedContactId:e.contact_id}):r.error("Error","You dont have permission to see this leave request")})}).catch(function(e){r.error("Error",e)})}return e.debug("LeavePopup"),{openModal:l,openModalByID:d}}t.factory("LeavePopup",n),n.$inject=["$log","$rootElement","$rootScope","$uibModal","notificationService","shared-settings","DateFormat","Session","LeaveRequest"]}),function(e){define("leave-absences/admin-dashboard/modules/settings",["common/angular"],function(t){return t.module("admin-dashboard.settings",[]).constant("settings",{contactId:e.vars.leaveAndAbsences.loggedInUserId,debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/admin-dashboard/"})})}(CRM),define("leave-absences/admin-dashboard/modules/config",["common/angular","common/lodash","leave-absences/admin-dashboard/modules/settings"],function(e,t){function n(e){e.settings.ga={userId:t.get(CRM,"vars.session.contact_id")},e.withAutoBase(!0)}return e.module("admin-dashboard.config",["admin-dashboard.settings"]).config(["$stateProvider","$resourceProvider","$urlRouterProvider","$httpProvider","$logProvider","$analyticsProvider","settings",function(e,t,a,r,o,s,i){var u={format:["DateFormat",function(e){return e.getDateFormat()}]};t.defaults.stripTrailingSlashes=!1,r.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",n(s),o.debugEnabled(i.debug),a.otherwise("/requests"),e.state("requests",{url:"/requests",template:'',resolve:u}).state("calendar",{url:"/calendar",template:'',resolve:u}).state("leave-balances",{url:"/leave-balances",template:"",resolve:u})}])}),define("leave-absences/admin-dashboard/modules/components",["common/angular"],function(e){return e.module("admin-dashboard.components",[])}),define("leave-absences/admin-dashboard/components/admin-dashboard-container",["leave-absences/admin-dashboard/modules/components"],function(e){function t(e,t){e.debug("Component: admin-dashboard-container"),t.section="admin-dashboard"}e.component("adminDashboardContainer",{templateUrl:["settings",function(e){return e.pathTpl+"components/admin-dashboard-container.html"}],controllerAs:"vm",controller:["$log","$rootScope",t]})}),define("leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component",[],function(){function e(e,t,n,a){function r(){return n("can administer calendar feeds").then(function(e){i.canCreateNewFeed=!!e})}function o(){return i.loading.feeds=!0,e.all().then(function(e){i.feeds=e}).finally(function(){i.loading.feeds=!1})}function s(e,n){t.open(e,n)}var i=this;i.canCreateNewFeed=!1,i.feeds=[],i.loading={feeds:!1},i.openLinkModal=s,function(){o(),r()}()}return e.$inject=["CalendarFeed","CalendarFeedsLinkModal","checkPermissions","shared-settings"],{__name:"calendarFeedsDropdownButton",bindings:{dropdownPosition:"@"},controller:e,controllerAs:"dropdownButton",templateUrl:["shared-settings",function(e){return e.sourcePath+"calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.html"}]}}),define("leave-absences/calendar-feeds/calendar-feeds.core",["common/angular","leave-absences/shared/modules/shared-settings"],function(e){e.module("calendar-feeds.core",["leave-absences.settings"])}),define("leave-absences/calendar-feeds/services/apis/calendar-feed.api",["common/lodash"],function(e){"use strict";function t(e,t,n){function a(){return this.sendGET("LeaveRequestCalendarFeedConfig","get",{is_active:!0}).then(function(e){return e.values})}return e.debug("CalendarFeedAPI"),n.extend({all:a})}return t.__name="CalendarFeedAPI",t.$inject=["$log","$q","api"],t}),define("leave-absences/calendar-feeds/services/models/calendar-feed.model",[],function(){"use strict";function e(e,t,n){function a(){return t.all().then(function(e){return e.map(function(e){return n.init(e)})})}return e.extend({all:a})}return e.__name="CalendarFeed",e.$inject=["Model","CalendarFeedAPI","CalendarFeedInstance"],e}),define("leave-absences/calendar-feeds/services/models/calendar-feed.instance",[],function(){"use strict";function e(e){return e.extend({})}return e.__name="CalendarFeedInstance",e.$inject=["ModelInstance"],e}),define("leave-absences/calendar-feeds/calendar-feeds.models",["common/angular","leave-absences/calendar-feeds/services/apis/calendar-feed.api","leave-absences/calendar-feeds/services/models/calendar-feed.model","leave-absences/calendar-feeds/services/models/calendar-feed.instance","common/models/model","common/services/api"],function(e,t,n,a){e.module("calendar-feeds.models",["common.apis","common.models"]).factory(t.__name,t).factory(n.__name,n).factory(a.__name,a)}),define("leave-absences/calendar-feeds/link-modal/components/calendar-feeds-link-modal.component",["common/lodash"],function(e){return{__name:"calendarFeedsLinkModal",bindings:{dismiss:"<",url:"<",title:"<"},controller:e.noop,controllerAs:"linkModal",templateUrl:["shared-settings",function(e){return e.sourcePath+"calendar-feeds/link-modal/components/calendar-feeds-link-modal.html"}]}}),define("leave-absences/calendar-feeds/link-modal/services/calendar-feeds-link-modal.service",[],function(){function e(e,t,n){function a(e,a){var o=r(),s=n+"civicrm/calendar-feed?hash="+a;t.open({controllerAs:"modal",size:"md",template:'',controller:["$uibModalInstance","title","url",function(e,t,n){this.dismiss=e.dismiss,this.title=t,this.url=n}],appendTo:o,resolve:{title:function(){return e},url:function(){return s}}})}function r(){var t=e.find("#bootstrap-theme");return 0===t.length&&(t=e.find("body")),t.eq(0)}return{open:a}}return e.__name="CalendarFeedsLinkModal",e.$inject=["$document","$uibModal","HOST_URL"],e}),define("leave-absences/calendar-feeds/link-modal/directives/input-with-copy-button.directive",["common/lodash"],function(e){function t(t,n){function a(e,n,a,r){function o(){i(),c()}function s(){l[0].setSelectionRange(0,0),l.blur()}function i(){u(),document.execCommand("copy"),s()}function u(){l.focus(),l[0].setSelectionRange(0,l.val().length)}function c(){f.justCopied=!0,d&&t.cancel(d),d=t(function(){f.justCopied=!1},2e3)}var l,d,f=e.input;f.model=r.model,f.justCopied=!1,f.copy=o,f.selectInputText=u,function(){l=n.find("input")}()}var r=n.sourcePath+"calendar-feeds/link-modal/directives/input-with-copy-button.html";return{controller:e.noop,controllerAs:"input",link:a,restrict:"E",scope:{},templateUrl:r,require:{model:"^ngModel"}}}return t.__name="inputWithCopyButton",t.$inject=["$timeout","shared-settings"],t}),define("leave-absences/calendar-feeds/link-modal/link-modal.core",["common/angular","common/angularBootstrap"],function(e){e.module("calendar-feeds.link-modal.core",["ui.bootstrap"])}),function(e){define("leave-absences/calendar-feeds/link-modal/link-modal.constants",["common/angular"],function(t){"use strict";t.module("calendar-feeds.link-modal.constants",[]).constant("HOST_URL",e.absoluteUrl("/"))})}(Drupal),define("leave-absences/calendar-feeds/link-modal/link-modal.module",["common/angular","leave-absences/calendar-feeds/link-modal/components/calendar-feeds-link-modal.component","leave-absences/calendar-feeds/link-modal/services/calendar-feeds-link-modal.service","leave-absences/calendar-feeds/link-modal/directives/input-with-copy-button.directive","leave-absences/calendar-feeds/calendar-feeds.core","leave-absences/calendar-feeds/link-modal/link-modal.core","leave-absences/calendar-feeds/link-modal/link-modal.constants"],function(e,t,n,a){e.module("calendar-feeds.link-modal",["calendar-feeds.core","calendar-feeds.link-modal.core","calendar-feeds.link-modal.constants"]).component(t.__name,t).directive(a.__name,a).factory(n.__name,n)}),define("leave-absences/calendar-feeds/dropdown-button/dropdown-button.module",["common/angular","leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component","common/services/check-permissions","leave-absences/calendar-feeds/calendar-feeds.core","leave-absences/calendar-feeds/calendar-feeds.models","leave-absences/calendar-feeds/link-modal/link-modal.module"],function(e,t){e.module("calendar-feeds.dropdown-button",["common.services","calendar-feeds.core","calendar-feeds.models","calendar-feeds.link-modal"]).component(t.__name,t)}),define("leave-absences/admin-dashboard/app",["common/angular","common/angularBootstrap","common/angulartics","common/angulartics-google-tag-manager","common/directives/scroll-shadows.directive","common/directives/time-amount-picker.directive","common/directives/timepicker-select.directive","common/filters/angular-date/format-date","common/filters/time-unit-applier.filter","common/modules/dialog","common/services/check-permissions","common/services/crm-ang.service","common/services/angular-date/date-format","leave-absences/shared/ui-router","leave-absences/shared/components/leave-balance-tab.component","leave-absences/shared/components/leave-calendar.component","leave-absences/shared/components/leave-calendar-day.component","leave-absences/shared/components/leave-calendar-legend.component","leave-absences/shared/components/leave-calendar-month.component","leave-absences/shared/components/leave-request-actions.component","leave-absences/shared/components/leave-request-popup-comments-tab.component","leave-absences/shared/components/leave-request-popup-details-tab.component","leave-absences/shared/components/leave-request-popup-files-tab","leave-absences/shared/components/leave-request-record-actions.component","leave-absences/shared/components/manage-leave-requests.component","leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller","leave-absences/shared/modules/shared-settings","leave-absences/shared/services/leave-calendar.service","leave-absences/shared/services/leave-popup.service","leave-absences/admin-dashboard/modules/config","leave-absences/admin-dashboard/components/admin-dashboard-container","leave-absences/calendar-feeds/dropdown-button/dropdown-button.module"],function(e){return e.module("admin-dashboard",["ngAnimate","ngResource","angulartics","angulartics.google.tagmanager","ui.bootstrap","ui.router","ui.select","textAngular","common.angularDate","common.dialog","common.filters","common.mocks","leave-absences.components","leave-absences.controllers","leave-absences.settings","leave-absences.services","admin-dashboard.config","admin-dashboard.components","calendar-feeds.dropdown-button"]).run(["$log","$rootScope","shared-settings","settings",function(e,t,n,a){e.debug("app.run"),t.sharedPathTpl=n.sharedPathTpl,t.settings=a}]),e}),function(e,t){var n=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";t.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":n+"/shared","leave-absences/admin-dashboard":n+"/admin-dashboard"}}),t(["leave-absences/shared/config"],function(){t(["leave-absences/admin-dashboard/app"],function(){document.dispatchEvent("function"==typeof window.CustomEvent?new CustomEvent("adminDashboardReady"):function(){var e=document.createEvent("Event");return e.initEvent("adminDashboardReady",!0,!0),e}())})})}(CRM,require),define("admin-dashboard",function(){}); +!function(e){define("leave-absences/shared/config",[],function(){e.config({paths:{mocks:"../test/mocks"}}),e.config({paths:{mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(n){return n.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/components/leave-balance-tab-filters.component",["common/lodash","common/moment","leave-absences/shared/modules/components"],function(e,n,t){function a(t){function a(e){e.absencePeriods&&u.absencePeriods.length&&(u.filters.period_id=s().id),e.absenceTypes&&u.absenceTypes.length&&(u.filters.type_id=i().id),(e.loggedInContactId||e.userRole)&&(u.filters.managed_by="manager"===u.userRole?u.loggedInContactId:void 0),o()&&u.submitFilters()}function o(){return e.every(u.filters,function(e){return null!==e})}function s(){return e.find(u.absencePeriods,function(e){return e.current})||u.absencePeriods.reduce(function(e,t){return n(e.end_date).isAfter(t.end_date)?e:t})}function i(){return u.absenceTypes.reduce(function(e,n){return e.title.localeCompare(n.title)?e:n})}function r(e){return e.current?"Current Period ("+e.title+")":e.title}function c(){t.$emit("LeaveBalanceFilters::update",u.filters)}var u=this;u.filters={period_id:null,type_id:null,managed_by:null},u.$onChanges=a,u.labelPeriod=r,u.submitFilters=c}t.component("leaveBalanceTabFilters",{controller:a,controllerAs:"balanceFilters",bindings:{absencePeriods:"<",absenceTypes:"<",loggedInContactId:"<",lookupContacts:"<",userRole:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-balance-tab-filters.html"}]}),a.$inject=["$scope"]}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,t){function a(e){var t=n.clone(e),a=t["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(t.remainder=a[0].remainder),delete t["api.LeavePeriodEntitlement.getremainder"],t}function o(e){var t=n.clone(e),a=t["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return t.value=a,delete t["api.LeavePeriodEntitlement.getentitlement"],t}return e.debug("EntitlementAPI"),t.extend({all:function(n,t){return e.debug("EntitlementAPI.all"),n["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},t&&(n["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",n,!1).then(function(e){return e.values}).then(function(e){return e=e.map(o),t&&(e=e.map(a)),e})},breakdown:function(n){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",n).then(function(e){return e.values})},getLeaveBalances:function(n,t,a,o,s){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",n,t,a,o,"getLeaveBalances",s)}})}])}),define("leave-absences/shared/models/leave-balance-report.model",["leave-absences/shared/modules/models","leave-absences/shared/apis/entitlement.api","common/models/model"],function(e){"use strict";e.factory("LeaveBalanceReport",["Model","EntitlementAPI",function(e,n){return e.extend({all:function(e,t,a,o,s){return n.getLeaveBalances(this.processFilters(e),t,a,o,s)}})}])}),define("leave-absences/shared/components/leave-balance-tab.component",["common/angular","common/lodash","leave-absences/shared/modules/components","leave-absences/shared/components/leave-balance-tab-filters.component","leave-absences/shared/models/leave-balance-report.model","common/services/notification.service","common/services/pub-sub"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d,m){function f(){q(),b().then(function(){P.loading.component=!1})}function p(){return o.all({options:{sort:"title ASC"}}).then(function(e){P.absencePeriods=e})}function h(){return s.all().then(s.loadCalculationUnits).then(function(e){P.absenceTypes=e})}function v(){return i.all(null,null,"sort_name ASC").then(function(e){P.lookupContacts=e.list})}function b(){return t.all([p(),h(),v(),g(),C()]).catch(function(e){c.error("Error",e)})}function g(){return l.get().then(function(e){P.loggedInContactId=e.contactId})}function y(){return P.loading.report=!0,r.all(R,P.pagination,void 0,void 0,!1).then(function(e){P.report=_(e.list),P.reportCount=e.total}).catch(function(e){c.error("Error",e.error_message)}).finally(function(){P.loading.report=!1})}function _(t){return t.map(function(t){return t=e.copy(t),t.absence_types=n.indexBy(t.absence_types,function(e){return e.id}),t})}function q(){a.$on("LeaveBalanceFilters::update",A),u.subscribe("LeaveRequest::new",T)}function C(){return m(d.permissions.admin.administer).then(function(e){P.userRole=e?"admin":"manager"})}function T(e){A(e,R)}function A(e,n){R=n,P.pagination.page=1,D(),P.loadReportCurrentPage()}function D(){P.selectedAbsenceTypes=P.absenceTypes.filter(function(e){return+e.id==+R.type_id})}var R={},P=this;P.absencePeriods=[],P.absenceTypes=[],P.loading={component:!0,report:!0},P.loggedInContactId=null,P.lookupContacts=[],P.pagination={page:1,size:50},P.report=[],P.reportCount=0,P.userRole=null,P.$onInit=f,P.loadReportCurrentPage=y}t.component("leaveBalanceTab",{controller:a,controllerAs:"leaveBalanceTab",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-balance-tab.html"}]}),a.$inject=["$q","$rootScope","AbsencePeriod","AbsenceType","Contact","LeaveBalanceReport","notificationService","pubSub","Session","shared-settings","checkPermissions"]}),define("leave-absences/shared/modules/controllers",["common/angular","common/angularBootstrap","leave-absences/shared/modules/models","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){return e.module("leave-absences.controllers",["ui.select","leave-absences.models","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers","common/models/contract","common/services/notification.service"],function(e,n,t){function a(n,t,a,o,s,i,r){function c(){return{loadContacts:function(){return l.loadContactsForAdmin()}}}function u(e){i.info("",["

    When All filter is selected, all staff members with contracts which are active in the selected absence period are displayed.

    ","

    People I approve filter displays only staff members who you approve leave for.

    ","

    People without approver filter displays all staff members with contracts which are active in the selected absence period and who do not have any leave approver assigned.

    "].join(""))}n.debug("LeaveCalendarAdminController");var l,d;return{init:function(n){return d=n,l=r.init(d),d.filters.userSettings.assignedTo=e.find(d.filtersByAssignee,{type:"me"}),d.showContactDetailsLink=!0,d.showContactName=!0,d.showFilters=!0,d.showAdminFilteringHint=u,c()}}}t.controller("LeaveCalendarAdminController",["$log","$q","Contact","ContactInstance","Contract","notificationService","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(n,t,a,o){function s(){return{loadContacts:function(){return i.loadLookUpAndFilteredContacts()}}}n.debug("LeaveCalendarManagerController");var i,r;return{init:function(n){return r=n,i=o.init(r),r.filters.userSettings.assignedTo=e.find(r.filtersByAssignee,{type:"me"}),r.showContactName=!0,r.showFilters=!0,s()}}}t.controller("LeaveCalendarManagerController",["$log","Contact","ContactInstance","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(e,n,t,a){function o(){return{loadContacts:function(){return i.displaySingleContact?s.loadFilteredContacts():"admin"===i.userPermissionRole?s.loadContactsForAdmin():s.loadLookUpAndFilteredContacts()}}}e.debug("LeaveCalendarStaffController");var s,i;return{init:function(e){return i=e,s=a.init(i),i.filters.userSettings.contacts_with_leaves=!0,i.showTheseContacts=[i.contactId],i.showContactName=!0,i.showFilters=!0,i.displaySingleContact&&(i.showFilters=!1,i.lookupContacts=[{id:i.contactId}]),o()}}}t.controller("LeaveCalendarStaffController",["$log","$q","Contact","LeaveCalendarService",a])}),define("leave-absences/shared/components/leave-calendar.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d){function m(){U().then(g).then(b).then(_).then(I).then(function(){return a.all([C(),D(),S(),W.showFilters?R():e.noop])}).then(function(){f(),y(),B()}).then(function(){W.loading.page=!1})}function f(){W.supportData.absenceTypes.push({id:"",title:"Leave",color:"#4D4D68",calculation_unit:e.chain(W.supportData.calculationUnits).find({name:"days"}).get("value").value()})}function p(){for(var e=[],t=n(W.selectedPeriod.start_date).clone().startOf("month"),a=n(W.selectedPeriod.end_date).clone().endOf("month");t.isBefore(a);)e.push(L(t)),t.add(1,"month");W.months=e}function h(){return e.includes(["admin","manager"],W.userPermissionRole)}function v(e){return e.format("YYYY-MM")}function b(){s.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,n){W.supportData.absenceTypesToFilterBy=n,M(!0)})}function g(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(F(),B(),M())})}function y(e){W.injectMonth=!0,N("injected").then(function(){M(e)}).then(function(){W.loading.calendar=!1})}function _(){j=t("LeaveCalendar"+e.capitalize(H)+"Controller").init(W)}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return r.all().then(function(n){W.absencePeriods=e.sortBy(n,"start_date"),W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current})}).then(p).then($)}function T(){return c.all().then(c.loadCalculationUnits)}function A(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function D(){return j.loadContacts().then(function(e){W.contacts=e})}function R(){return l.valuesOf(["hrjc_region","hrjc_location","hrjc_level_type","hrjc_department"]).then(function(e){W.filters.optionValues.regions=e.hrjc_region,W.filters.optionValues.locations=e.hrjc_location,W.filters.optionValues.levelTypes=e.hrjc_level_type,W.filters.optionValues.departments=e.hrjc_department})}function P(){return u.all()}function S(){return a.all([T(),P(),A()]).then(function(n){W.supportData.absenceTypes=n[0],W.supportData.publicHolidays=n[1],W.supportData.calculationUnits=n[2].hrleaveandabsences_absence_type_calculation_unit,W.supportData.dayTypes=n[2].hrleaveandabsences_leave_request_day_type,W.supportData.leaveRequestStatuses=n[2].hrleaveandabsences_leave_request_status,W.supportData.toilAmounts=e.indexBy(n[2].hrleaveandabsences_toil_amounts,"value")})}function I(){var e=a.resolve();return W.injectMonth&&(e=N("destroyed"),W.injectMonth=!1),e}function L(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:n().year(e.year()).month(e.month())}}function w(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&p(),$(),B(),O("month")}function k(e){var t="previous"===e?"subtract":"add";F(n(W.selectedMonth.moment)[t](1,"month")),B(),O("month")}function O(n){n=e.includes(["contacts","period","month"],n)?n:"period",a.resolve().then(I).then("period"===n&&p).then("period"===n&&x).then("contacts"===n&&D).then("month"===n&&B).then(function(){y("contacts"===n)})}function M(e){s.$emit("LeaveCalendar::showMonth",!!e)}function $(){F(n())}function x(){F(W.months[0].moment)}function E(t){var a="previous"===t?"first":"last",o=e[a](W.months),s=n().year(o.year).month(o.month);W.monthPaginatorsAvailability[t]=!W.selectedMonth.moment.isSame(s,"month")}function B(){E("previous"),E("next")}function F(n){n&&(W.selectedMonthIndex=v(n)),W.selectedMonth=e.find(W.months,{index:W.selectedMonthIndex})}function U(){return a.all([d(i.permissions.admin.administer),d(i.permissions.ssp.manage)]).then(function(e){W.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",H=W.roleOverride?W.roleOverride:W.userPermissionRole})}function N(n){return a(function(t){var a=s.$on("LeaveCalendar::month"+e.capitalize(n),function(){a(),t()})})}o.debug("Component: leave-calendar");var j,H,W=this;W.absencePeriods=[],W.contacts=[],W.contactIdsToReduceTo=null,W.injectMonth=!1,W.months=[],W.selectedMonth={},W.selectedMonthIndex="",W.selectedPeriod=null,W.showContactName=!1,W.showFilters=!1,W.userPermissionRole="staff",W.loading={calendar:!0,page:!0},W.filters={hideOnMobile:!0,optionValues:{},userSettings:{contact:null,contacts_with_leaves:!0,department:null,level_type:null,location:null,region:null},absenceTypes:{}},W.filtersByAssignee=[{type:"me",label:"People I approve"},{type:"unassigned",label:"People without approver"},{type:"all",label:"All"}],W.filters.userSettings.assignedTo=W.filtersByAssignee[2],W.monthPaginatorsAvailability={previous:!0,next:!0},W.supportData={absenceTypesToFilterBy:[]},W.$onInit=m,W.canManageRequests=h,W.labelPeriod=q,W.navigateToCurrentMonth=w,W.paginateMonth=k,W.refresh=O}t.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,t={from_date:{to:Q.month.days[Q.month.days.length-1].date+" 23:59:59"},to_date:{from:Q.month.days[0].date+" 00:00:00"},status_id:{IN:k()},contact_id:{IN:Q.contacts.map(function(e){return e.id})},type_id:{IN:n?Q.supportData.absenceTypesToFilterBy:e.pluck(Q.supportData.absenceTypes,"id")}};return y(),i.all(t,null,null,null,!1).then(function(e){return X={},n&&(e.list=q(e.list)),A(e.list)})}function $(){var n=Q.month.days[0].date,t=Q.month.days[Q.month.days.length-1].date;return s.get(Q.contacts.map(function(e){return e.id}),n,t).then(function(n){z=e.indexBy(n,"contact_id")})}function x(){return Q.contactIdsToReduceTo&&(Q.contacts=Q.contacts.filter(function(n){return e.includes(Q.contactIdsToReduceTo,n.contact_id)||e.find(X,function(e){return e.contact_id===n.contact_id})})),a.resolve()}function E(n){var t=L(n);X[n.contact_id]=X[n.contact_id]||{},t.forEach(function(t){e.remove(X[n.contact_id][t.date],function(e){return e.id===n.id})})}function B(){o.$emit("LeaveCalendar::monthDestroyed"),V.map(function(e){e.remove?e.remove():e()})}function F(n,t,o){var s,i;return n.contactsData[t]=n.contactsData[t]||{},i=f(t),s=!0===o?a.resolve():a.all([i.isWeekend(h(n.date)),i.isNonWorkingDay(h(n.date))]).then(function(a){e.assign(n.contactsData[t],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:S(n.date)})}),s.then(function(){return X[t]&&X[t][n.date]?X[t][n.date]:[]}).then(function(a){a=j(a),e.assign(n.contactsData[t],{leaveRequests:a,leaveRequestsToShowInCell:b(a),leaveRequestsAttributes:C(n,a)})})}function U(){return a.all(Q.month.days.map(function(e){return a.all(Q.contacts.map(function(n){return F(e,n.id)}))}))}function N(e,n){Q.currentPage=0,Q.visible=!0,(n||!G)&&O()}function j(t){return e.sortBy(t,function(e){return+n(e.from_date).format("X")+(R("half_day_pm",e,e.from_date)?1:0)})}function H(n){var t=e.find(Q.supportData.absenceTypes,function(e){return e.id===n.type_id});return n.balance_change>0?{borderColor:t.color}:{borderColor:t.color,backgroundColor:t.color}}function W(e){v(e),-1!==k().indexOf(e.status_id)&&l(e)}function Y(e){return a.all(L(e).map(function(n){return F(n,e.contact_id,!0)}))}t.debug("Component: leave-calendar-month");var G=!1,V=[],z={},X={},Q=this;Q.currentPage=0,Q.pageSize=20,Q.visible=!1,Q.showContactName=!!Q.showContactName,Q.showOnlyWithLeaveRequests=!!Q.showOnlyWithLeaveRequests,Q.$onDestroy=B,Q.$onInit=u,Q.contactsList=p,Q.getContactUrl=_}t.component("leaveCalendarMonth",{bindings:{showTheseContacts:"<",contacts:"<",contactIdsToReduceTo:"<",month:"<",period:"<",showContactName:"<",showContactDetailsLink:"<",showOnlyWithLeaveRequests:"<",supportData:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-month.html"}],controllerAs:"month",controller:["$log","$q","$rootScope","Calendar","LeaveRequest","pubSub","shared-settings",a]})}),define("leave-absences/shared/modules/services",["common/angular","common/modules/services"],function(e){"use strict";return e.module("leave-absences.services",["common.services"])}),define("leave-absences/shared/services/leave-request.service",["common/lodash","leave-absences/shared/modules/services"],function(e,n){"use strict";function t(n,t,a){function o(){var n=t.defer();return a.open(e.defaults(s(),{onConfirm:function(){n.resolve(!0)}})),n.promise}function s(){return{title:"Recalculate Balance Change?",copyCancel:"Cancel",copyConfirm:"Yes",classConfirm:"btn-warning",msg:"The leave balance change has updated since this leave request was created. Do you want to recalculate the balance change?"}}return n.debug("LeaveRequest"),{getBalanceChangeRecalculationPromptOptions:s,promptBalanceChangeRecalculation:o}}n.factory("LeaveRequestService",t),t.$inject=["$log","$q","dialog"]}),define("leave-absences/shared/components/leave-request-actions.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/contact","common/models/session.model","common/services/hr-settings","common/services/notification.service","common/services/pub-sub","leave-absences/shared/services/leave-request.service"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d,m){function f(){a.resolve().then(_).then(C).then(function(){return y()&&"admin"!==w.role&&P()}).then(R).finally(function(){w.loading.component=!1})}function p(n){L=w.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===w.leaveRequest.request_type?i.open(q(n)):b(n)}function h(){return"admin"===w.role&&"public_holiday"===w.leaveRequest.request_type}function v(t){var a=w.absenceTypes[w.leaveRequest.type_id].allow_request_cancelation;return"admin"===w.role||("manager"===w.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(w.leaveRequest.from_date):"2"===a)}function b(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return w.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){A(n)}}):q(n)})}})}function g(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function y(){return I===w.leaveRequest.contact_id}function _(){e.isArray(w.leaveRequestStatuses)&&(w.leaveRequestStatuses=e.indexBy(w.leaveRequestStatuses,"value")),e.isArray(w.absenceTypes)&&(w.absenceTypes=e.indexBy(w.absenceTypes,"id"))}function q(e){var n=O[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return w.leaveRequest[e]().then(function(){D(e)}).catch(function(e){d.error("Error:",e)})}}}function C(){return m.get().then(function(e){I=e.contactId})}function T(e,n){e.stopPropagation(),r.openModal(n)}function A(e){r.openModal({leaveRequest:w.leaveRequest,leaveType:w.leaveRequest.request_type,selectedContactId:w.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[M[e]]})}function D(n){var t=e.find(w.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;L===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:w.leaveRequest})}function R(){var n=w.leaveRequestStatuses[w.leaveRequest.status_id].name,t=e.compact(e.map(O,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!v(n)&&e.pull(t,"cancel"),"admin"!==w.role&&e.pull(t,"delete"),"staff"===w.role&&e.pull(t,"approve","reject"),"staff"!==w.role&&S(t),h()&&t.push("delete"),w.allowedActions=e.map(t,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function P(){return g().then(function(e){e&&(w.role="admin")})}function S(n){e.each(n,function(t,a){"edit"===t&&(n[a]="respond"),e.includes(["respond","view"],t)&&(n[a]="edit")})}t.debug("Component: leave-request-action-dropdown");var I,L,w=this,k=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[k.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[k.moreInformationRequired]},view:{label:"View",allowedStatuses:[k.approved,k.rejected,k.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[k.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[k.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[k.awaitingApproval,k.approved,k.rejected,k.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[k.awaitingApproval,k.moreInformationRequired,k.approved,k.rejected,k.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},M={approve:"approved"};w.allowedActions=[],w.loading={component:!0},w.$onInit=f,w.action=p,w.openLeavePopup=T}t.component("leaveRequestActions",{bindings:{leaveRequest:"<",leaveRequestStatuses:"<",absenceTypes:"<",role:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-actions.html"}], +controllerAs:"actions",controller:a}),a.$inject=["$log","$q","$rootScope","Contact","dialog","LeavePopup","LeaveRequestService","pubSub","shared-settings","notificationService","Session"]}),define("leave-absences/shared/components/leave-request-popup-comments-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/models/session.model"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){o.$emit("LeaveRequestPopup::addTab",C),y(),_()}function l(){C.request.comments.push({contact_id:q,leave_request_id:C.request.id,text:C.comment.text}),C.comment.text=""}function d(){return C.comment.text.length>0}function m(e){return!e.comment_id||C.canManage}function f(e){return n.utc(e,i.serverDateTimeFormat).local().format(s.DATE_FORMAT.toUpperCase()+" HH:mm")}function p(){return C.request.comments.filter(function(e){return!e.toBeDeleted})}function h(e){return e===q?"Me":C.comment.contacts[e]?C.comment.contacts[e].display_name:void 0}function v(e){return C.mode===e}function b(){C.comment.text.length&&C.addComment()}function g(){var n=e.indexBy(C.request.comments,"contact_id"),t=Object.keys(n);return r.all({id:{IN:t}},{page:1,size:0}).then(function(n){C.comment.contacts=e.indexBy(n.list,"contact_id")})}function y(){return C.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),C.request.comments.length&&g()})}function _(){return C.loading.component=!0,c.get().then(function(e){q=e.contactId}).then(function(){C.loading.component=!1})}t.debug("Component: leave-request-popup-comments-tab");var q=null,C=this;C.loading={component:!0},C.comment={text:"",contacts:{}},C.$onInit=u,C.addComment=l,C.canRemoveComment=m,C.canSubmit=d,C.formatDateTime=f,C.getActiveComments=p,C.getCommentorName=h,C.isMode=v,C.onBeforeSubmit=b}t.component("leaveRequestPopupCommentsTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-comments-tab.html"}],controllerAs:"commentsCtrl",controller:["$log","$rootScope","$scope","HR_settings","shared-settings","Contact","Session",a]})}),define("leave-absences/shared/apis/work-pattern.api",["common/lodash","leave-absences/shared/modules/apis","common/services/api"],function(e,n){"use strict";n.factory("WorkPatternAPI",["$log","api",function(n,t){function a(n){var t=e.clone(n);return t.workPattern=t["api.WorkPattern.get"].values[0],delete t["api.WorkPattern.get"],t}return n.debug("WorkPatternAPI"),t.extend({assignWorkPattern:function(n,t,a,o,s,i){return this.sendPOST("ContactWorkPattern","create",e.assign({},i,{contact_id:n,pattern_id:t,effective_date:a,effective_end_date:o,change_reason:s})).then(function(e){return e.values})},get:function(e){return this.sendGET("WorkPattern","get",e||{}).then(function(e){return e.values})},getCalendar:function(t,a,o,s){return n.debug("WorkPatternAPI.getCalendar",t,a,o,s),this.sendGET("WorkPattern","getcalendar",e.assign({},s,{contact_id:e.isArray(t)?{IN:t}:t,start_date:a,end_date:o}))},unassignWorkPattern:function(e){return this.sendPOST("ContactWorkPattern","delete",{id:e})},workPatternsOf:function(n,t,o){return this.sendGET("ContactWorkPattern","get",e.assign({},t,{contact_id:n,"api.WorkPattern.get":{id:"$value.pattern_id"}}),o).then(function(e){return e=e.values,e.map(a)})}})}])}),define("leave-absences/shared/instances/calendar.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance"],function(e,n,t){"use strict";t.factory("CalendarInstance",["$log","$q","ModelInstance","shared-settings","OptionGroup",function(t,a,o,s,i){function r(n,t){return u().then(function(a){var o=this.days[c(n).valueOf()];return!!o&&e.find(a,function(e){return e.name===t}).value===o.type}.bind(this))}function c(e){return n(e,s.serverDateFormat).clone()}function u(){return l=l||i.valuesOf("hrleaveandabsences_work_day_type")}var l;return o.extend({defaultCustomData:function(){return{days:[]}},isNonWorkingDay:function(e){return r.call(this,e,"non_working_day")},isWeekend:function(e){return r.call(this,e,"weekend")},isWorkingDay:function(e){return r.call(this,e,"working_day")},transformAttributes:function(n){var t={};return n.calendar.forEach(function(e){t[c(e.date).valueOf()]=e}),e(n).omit("calendar").assign({days:t}).value()}})}])}),define("leave-absences/shared/models/calendar.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/calendar.instance"],function(e,n){"use strict";n.factory("Calendar",["$log","Model","WorkPatternAPI","CalendarInstance",function(n,t,a,o){return n.debug("Calendar"),t.extend({get:function(t,s,i,r){return n.debug("Calendar.get"),a.getCalendar(t,s,i,r).then(function(n){var a=n.values.map(function(e){return o.init(e)});return e.isArray(t)?a:a[0]})}})}])}),define("leave-absences/shared/components/leave-request-popup-details-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/session.model","leave-absences/shared/models/calendar.model"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d,m){function f(){t("RequestModalDetails"+e.capitalize(T(te.leaveType,te.request))+"Controller",{detailsController:te}),te.canManage=te.isRole("manager")||te.isRole("admin"),te.loading.tab=!0,s.$emit("LeaveRequestPopup::addTab",te),I(),te.initChildController().then(function(){return i.all([x(),$()])}).then(!te.isMode("create")&&S).then(Y).then(function(){if(!te.isMode("create"))return i.resolve().then(te.initTimesExtended).then(z)}).then(!te.isMode("create")&&W).then(L).then(G).then(P).then(w).then(!te.isMode("view")&&te.initWatchersExtended).catch(R).then(function(){te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.totalItems=te.balance.change.breakdown.length}).finally(function(){te.loading.tab=!1})}function p(){te.balance.closing=te.balance.opening+te.balance.change.amount}function h(e){return n(e,c.serverDateFormat).toDate()}function v(e){return n(e).format(c.serverDateFormat)}function b(e){var n;return i.resolve().then(function(){j(e),"from"===e&&N(),k("hours")&&(_(e),"from"!==e||te.uiOptions.multipleDays||_("to")),te.loading[e+"DayTypes"]=!0}).then(function(){return C(e)}).then(function(e){if(n=e.id!==te.period.id,n&&(te.period=e),!te.period.id)return i.reject("Please change date as it is not in any absence period")}).then(W).then(function(){if(n)return x()}).then(function(){return te.onDateChangeExtended&&te.onDateChangeExtended(e)}).then(function(){if(z(),!n)return B();o.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(R).finally(q)}function g(){return z(),B()}function y(){return te.uiOptions.toDate=null,j("to"),i.resolve().then(z).then(te.setDaysSelectionModeExtended).then(q).then(!te.uiOptions.multipleDays&&B)}function _(e){te.uiOptions.times[e].loading=!0}function q(){["from","to"].forEach(function(e){te.loading[e+"DayTypes"]=!1,k("hours")&&(te.uiOptions.times[e].loading=!1)})}function C(t){var a=n(te.uiOptions[t+"Date"]).format(te.uiOptions.userDateFormat.toUpperCase());return e.find(te.absencePeriods,function(e){return e.isInPeriod(a)})||{}}function T(){return te.request?te.request.request_type:te.leaveType||null}function A(e){return n().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function D(){return X(),te.loading.balanceChange=!0,te.request.getBalanceChangeBreakdown().then(H).catch(R)}function R(n){o.$broadcast("LeaveRequestPopup::handleError",e.isArray(n)?n:[n]),te.loading.fromDayTypes=!1,te.loading.balanceChange=!1,te.loading.tab=!1,te.loading.toDayTypes=!1}function P(){return te.isMode("create")||te.forceRecalculateBalanceChange?B():D()}function S(){var e=te.request.attributes();return te.uiOptions.fromDate=h(te.request.from_date),te.request.to_date=e.to_date,te.request.to_date_type=e.to_date_type,te.uiOptions.toDate=h(te.request.to_date),te.initDayTypesExtended?te.initDayTypesExtended():i.resolve()}function I(){ne.push(o.$on("LeaveRequestPopup::absenceTypeChanged",function(){J()}),o.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,n){K(n)}),o.$on("LeaveRequestPopup::recalculateBalanceChange",B))}function L(){te.isMode("edit")&&(te.isLeaveStatus(c.statusNames.approved)||te.isLeaveStatus(c.statusNames.adminApproved))&&(ee={absenceTypeId:te.request.type_id,value:te.selectedAbsenceType.remainder-te.request.balance_change})}function w(){o.$watch(function(){return te.uiOptions.times.from.time},function(e,n){e!==n&&(te.uiOptions.multipleDays||(Z(e),z()))})}function k(e){return te.selectedAbsenceType.calculation_unit_name===e}function O(e){return te.request.request_type===e}function M(n){return e.includes(["weekend","non_working_day","public_holiday"],n)}function $(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){te.requestDayTypes=e})}function x(){return u.get(te.request.contact_id,te.period.start_date,te.period.end_date).then(function(e){te.calendar=e})}function E(){var e=(te.pagination.currentPage-1)*te.pagination.numPerPage,n=e+te.pagination.numPerPage;te.pagination.filteredbreakdown=te.balance.change.breakdown.slice(e,n)}function B(){return X(),te.canCalculateChange()?(te.loading.balanceChange=!0,te.request.change_balance=!0,te.calculateBalanceChange().then(H).catch(R).finally(function(){te.loading.balanceChange=!1})):i.resolve()}function F(){te.pagination.totalItems=te.balance.change.breakdown.length,te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.pageChanged()}function U(){return v(te.request.from_date)===v(te.request.to_date)}function N(){te.uiOptions.toDate&&te.uiOptions.fromDate&&te.uiOptions.multipleDays&&n(te.uiOptions.toDate).isSameOrBefore(te.uiOptions.fromDate)&&(te.uiOptions.toDate=null,j("to"))}function j(e){te.resetUIInputsExtended&&te.resetUIInputsExtended(e),z(),X()}function H(e){te.balance.change=e,te.request.balance_change=e.amount,p(),F(),te.loading.balanceChange=!1}function W(){var e,t,a;te.uiOptions.fromDate?(e=n(te.uiOptions.fromDate).add(1,"day").toDate(),a=e,t=e):(a=h(te.period.start_date),t=te.uiOptions.date.to.options.minDate),te.uiOptions.date.to.options.initDate=t,te.uiOptions.date.to.options.minDate=a,te.uiOptions.date.to.options.maxDate=h(te.period.end_date)}function Y(){return!te.isMode("create")&&U()||te.isMode("create")&&(O("sickness")||k("hours"))?te.uiOptions.multipleDays=!1:te.uiOptions.multipleDays=!0,i.resolve().then(te.setDaysSelectionModeExtended)}function G(){ee&&ee.absenceTypeId===te.selectedAbsenceType.id?te.balance.opening=ee.value||0:te.balance.opening=te.selectedAbsenceType.remainder}function V(){te.selectedAbsenceType=e.find(te.absenceTypes,function(e){return e.id===te.request.type_id})}function z(){var e=te.uiOptions,n=e.times;te.request.from_date=e.fromDate?v(e.fromDate):null,te.request.to_date=e.toDate?v(e.toDate):null,!e.multipleDays&&e.fromDate&&(te.request.to_date=te.request.from_date,te.request.to_date_type=te.request.from_date_type),(k("hours")||O("toil"))&&(te.request.from_date=te.request.from_date&&n.from.time?te.request.from_date+" "+n.from.time:null,te.request.to_date=te.request.to_date&&n.to.time?te.request.to_date+" "+n.to.time:null)}function X(){te.uiOptions.showBalance=te.canCalculateChange()}function Q(){e.forEach(ne,function(e){e()})}function J(){var e,n=te.selectedAbsenceType.calculation_unit_name;return V(),e=n!==te.selectedAbsenceType.calculation_unit_name,G(),i.resolve().then(e&&Y).then(e&&te.onAbsenceTypeUpdateExtended).then(e&&z).then(q).then(B)}function K(e){return te.absenceTypes=e,V(),n(te.uiOptions.toDate).isAfter(te.period.end_date)&&(te.uiOptions.toDate=void 0,j("to")),G(),B()}function Z(e){var n=A(e).add(te.uiOptions.time_interval,"minutes");n.isAfter(A(te.uiOptions.times.to.max))||(te.uiOptions.times.to.min=n.format("HH:mm"),n.isAfter(A(te.uiOptions.times.to.time))&&(te.uiOptions.times.to.time=""))}a.debug("Component: leave-request-popup-details-tab");var ee=null,ne=[],te=this;te.canManage=!1,te.calendar={},te.errors=[],te.isRequired=!0,te.requestDayTypes=[],te.statusNames=c.statusNames,te.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},te.pagination={currentPage:1,filteredbreakdown:[],numPerPage:7,totalItems:0,pageChanged:E},te.uiOptions={isChangeExpanded:!1,multipleDays:!0,userDateFormat:r.DATE_FORMAT,showBalance:!1,date:{from:{show:!1,options:{startingDay:1,showWeeks:!1}},to:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}},expiry:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}}},times:{from:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""},to:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""}},time_interval:15},te.$onInit=f,te.convertDateFormatFromServer=h,te.convertDateToServerFormat=v,te.dateChangeHandler=b,te.dateTypeChangeHandler=g,te.daysSelectionModeChangeHandler=y,te.disableAndShowLoadingTimeInput=_,te.getMomentDateWithGivenTime=A,te.handleError=R,te.isCalculationUnit=k,te.isLeaveType=O,te.isNotWorkingDay=M,te.performBalanceChangeCalculation=B,te.setRequestDateTimesAndDateTypes=z,te.updateEndTimeInputMinTime=Z,te.$onDestroy=Q}t.component("leaveRequestPopupDetailsTab",{bindings:{absencePeriods:"<",absenceTypes:"<",balance:"=",request:"<",isLeaveStatus:"<",leaveType:"<",isMode:"<",isSelfRecord:"<",period:"=",isRole:"<",selectedAbsenceType:"=",forceRecalculateBalanceChange:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-details-tab.html"}],controllerAs:"detailsTab",controller:a}),a.$inject=["$controller","$log","$rootScope","$scope","$q","HR_settings","shared-settings","Calendar","OptionGroup","LeaveRequest","$timeout"]}),define("leave-absences/shared/components/leave-request-popup-files-tab",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/file-upload","common/services/file-mime-types","common/services/hr-settings"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l){function d(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",w),y(),a.all([A(),C()]).then(_).finally(function(){w.filesLoaded=!0})}function m(){return w.fileUploader&&w.fileUploader.queue.length>0}function f(){return w.getFilesAmount()0?S.map(function(e){return e.label}).join(", "):""}function C(){return w.request.loadAttachments().then(function(){o.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function T(){return a.all(S.map(function(e){return l.getMimeTypeFor(e.label).then(function(n){L[e.label]=n})})).catch(function(){L=null})}function A(){return c.valuesOf("safe_file_extension").then(function(e){S=e})}function D(e){return!e.attachment_id||w.canManage}function R(){e.forEach(I,function(e){e()})}function P(e,n){w.fileUploader.queue&&w.fileUploader.queue.length>0?w.fileUploader.uploadAll({entityID:w.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var S=[],I=[],L={},w=Object.create(this);return w.filesLoaded=!1,w.fileUploader=null,w.today=Date.now(),w.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",w.userDateFormat=i.DATE_FORMAT,w.$onDestroy=R,w.$onInit=d,w.canRemoveAttachment=D,w.canSubmit=m,w.canUploadMore=f,w.formatDateTime=p,w.getAuthorName=h,w.getFilesAmount=v,w.listFileTypes=q,w}t.component("leaveRequestPopupFilesTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-files-tab.html"}],controllerAs:"filesTab",controller:["$log","$q","$rootScope","$scope","HR_settings","shared-settings","OptionGroup","FileUpload","fileMimeTypes",a]})}),define("leave-absences/shared/components/leave-request-record-actions.component",["leave-absences/shared/modules/components","common/services/hr-settings","common/services/before-hash-query-params.service"],function(e){function n(e,n,t){function a(){s=t.parse(),s.openModal&&o({leaveType:s.openModal,selectedContactId:i.selectedContactId})}function o(e){n.openModal(e)}e.debug("Component: leave-request-record-actions");var s,i=this;i.leaveRequestOptions=[{type:"leave",icon:"briefcase",label:"Leave"},{type:"sickness",icon:"stethoscope",label:"Sickness"}],i.$onInit=a,i.openLeavePopup=o}e.component("leaveRequestRecordActions",{bindings:{contactId:"<",selectedContactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-record-actions.html"}],controllerAs:"vm",controller:["$log","LeavePopup","beforeHashQueryParams",n]})}),define("leave-absences/shared/components/manage-leave-requests.component",["common/lodash","leave-absences/shared/modules/components","common/models/contact","common/services/pub-sub"],function(e,n){function t(n,t,a,o,s,i,r,c,u,l,d,m){"use strict";function f(){s(r.permissions.admin.administer).then(function(e){H.isAdmin=e,t.all([A(),D(),k(),P(),L(),I(),O()]).then(function(){H.loading.page=!1,R()}),N()})}function p(){H.filters.leaveRequest.contact_id=null,H.refresh()}function h(){var e=H.filters.contact;return{department:e.department,level_type:e.level_type,location:e.location,region:e.region}}function v(e){return"all"===e.name||""===e?H.leaveRequests.filter.list.length:H.leaveRequests.filter.list.filter(function(n){return n.status_id===e.value}).length}function b(n){return e.find(H.absenceTypes,{id:n})}function g(e){return new Array(e||0)}function y(n){var t=e.find(H.leaveRequestStatuses,function(e){return e.value===n});return t?t.label:null}function _(e){switch(e){case r.statusNames.approved:return"badge-success";case r.statusNames.rejected:return"badge-danger";case r.statusNames.cancelled:case"all":return"";default:return"badge-primary"}}function q(n){return e.find(H.leaveRequestStatuses,function(e){return e.name===n}).value}function C(n){var t=e.find(H.filteredUsers,function(e){return e.id===n});return t?t.display_name:null}function T(e){return e.current?"Current Period ("+e.title+")":e.title}function A(){return c.all().then(function(n){H.absencePeriods=e.sortBy(n,"start_date"),H.filters.leaveRequest.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current})})}function D(){return u.all().then(u.loadCalculationUnits).then(function(e){H.absenceTypes=e})}function R(e){return(H.isAdmin?o.all(h()):o.leaveManagees(H.contactId,h())).then(function(n){return H.filteredUsers=H.isAdmin?n.list:n,e?S(e):t.all([S("table"),S("filter")])}).then(function(){H.filters.leaveRequest.leaveStatus!==W&&0===H.leaveRequests.table.list.length&&H.refresh(1,!0)})}function P(){return i.valuesOf("hrjc_department").then(function(e){H.departments=e})}function S(e){var n="filter"!==e,t="table"===e?e:"content",a="filter"===e?{size:0}:H.pagination,o="filter"===e?{return:["status_id"]}:{};return H.loading[t]=!0,l.all(w(n),a,"from_date DESC",o,!1).then(function(n){H.leaveRequests[e]=n}).catch(function(){H.leaveRequests[e].list=[]}).finally(function(){H.loading[t]=!1})}function I(){return i.valuesOf("hrjc_level_type").then(function(e){H.levelTypes=e})}function L(){return i.valuesOf("hrjc_location").then(function(e){H.locations=e})}function w(n){var t=H.filters.leaveRequest;return{contact_id:$(),managed_by:H.isAdmin&&"me"!==t.assignedTo.type?void 0:H.contactId,status_id:E(n),type_id:t.selectedAbsenceTypes?t.selectedAbsenceTypes.id:{IN:e.pluck(H.absenceTypes,"id")},from_date:{from:t.selectedPeriod.start_date},to_date:{to:t.selectedPeriod.end_date},unassigned:"unassigned"===t.assignedTo.type||void 0}}function k(){return i.valuesOf("hrjc_region").then(function(e){H.regions=e})}function O(){return i.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){H.leaveRequestStatuses=e.concat(H.leaveRequestStatuses)})}function M(e){d.openModal(e)}function $(){return H.filteredUsers.length>0&&H.filters.leaveRequest.contact_id?H.filters.leaveRequest.contact_id:{IN:H.filteredUsers.map(function(e){return e.id})}}function x(e){var n=[q(r.statusNames.moreInformationRequired),q(r.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(n)),e}function E(e){var n=H.filters.leaveRequest,t=[];if(e&&n.leaveStatus&&n.leaveStatus.value&&t.push(n.leaveStatus.value),n.pending_requests&&(t=x(t)),t.length)return{IN:t}}function B(e,n,t){e="number"==typeof e?e:1,n&&(H.filters.leaveRequest.leaveStatus=W),(e<=H.totalNoOfPages()||0===H.totalNoOfPages())&&(H.pagination.page=e,R(t))}function F(e){H.filters.leaveRequest.leaveStatus=e,H.refresh(1,!1,"table")}function U(e){H.filters.leaveRequest.assignedTo=e,H.refresh()}function N(){m.subscribe("LeaveRequest::updatedByManager",function(){H.refresh()}),m.subscribe("LeaveRequest::new",function(){H.refresh()}),m.subscribe("LeaveRequest::edit",function(){H.refresh()}),m.subscribe("LeaveRequest::delete",function(){H.refresh()}),m.subscribe("LeaveRequest::statusUpdate",function(){H.refresh()})}function j(){return Math.ceil(H.leaveRequests.table.total/H.pagination.size)}n.debug("Component: manage-leave-requests");var H=this,W={name:"all",label:"All"};H.absencePeriods=[],H.absenceTypes=[],H.filteredUsers=[],H.isFilterExpanded=!1,H.isAdmin=!1,H.leaveRequests={table:{list:[]},filter:{list:[]}},H.leaveRequestStatuses=[W],H.loading={content:!0,page:!0,table:!0},H.pagination={page:1,size:7},H.filtersByAssignee=[{type:"me",label:"Assigned To Me"},{type:"unassigned",label:"Unassigned"},{type:"all",label:"All"}],H.filters={contact:{department:null,level_type:null,location:null,region:null},leaveRequest:{leaveStatus:H.leaveRequestStatuses[0],pending_requests:!0,contact_id:null,selectedPeriod:null,selectedAbsenceTypes:null,assignedTo:H.filtersByAssignee[0]}},H.$onInit=f,H.clearStaffSelection=p,H.countLeaveRequestByStatus=v,H.getAbsenceTypeByID=b,H.getArrayOfSize=g,H.getLeaveStatusByValue=y,H.getNavBadge=_,H.getUserNameByID=C,H.labelPeriod=T,H.openLeavePopup=M,H.refresh=B,H.refreshWithFilter=F,H.refreshWithFilterByAssignee=U,H.totalNoOfPages=j}n.component("manageLeaveRequests",{bindings:{contactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/manage-leave-requests.html"}],controllerAs:"vm",controller:t}),t.$inject=["$log","$q","$rootScope","Contact","checkPermissions","OptionGroup","shared-settings","AbsencePeriod","AbsenceType","LeaveRequest","LeavePopup","pubSub"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){return i.request.calculateBalanceChange(i.selectedAbsenceType.calculation_unit_name)}function l(){var e=i.request,n=!!e.from_date&&!!e.to_date,t=i.selectedAbsenceType.calculation_unit_name;return"days"===t?n=n&&!!e.from_date_type&&!!e.to_date_type:"hours"===t&&(n=n&&!isNaN(+e.from_date_amount)&&!isNaN(+e.to_date_amount)),n}function d(){return i.canCalculateChange()}function m(n,t){var a=i.uiOptions.times[n],o=e.clone(t.time_from),s=e.clone(t.time_to);i.uiOptions.multipleDays||("from"===n&&s&&o&&(s=i.getMomentDateWithGivenTime(s).subtract(i.uiOptions.time_interval,"minutes").format("HH:mm")),"to"===n&&o&&s&&(o=i.getMomentDateWithGivenTime(o).add(i.uiOptions.time_interval,"minutes").format("HH:mm"))),a.min=o||"00:00",a.max=s||"00:00",a.time="to"===n?a.max:a.min}function f(n,t){return n?(n=i.convertDateToServerFormat(n),v(n).then(function(t){return t?i.requestDayTypes.filter(function(e){return"public_holiday"===e.name}):p(n,i.requestDayTypes).then(function(n){return n.length?n:i.requestDayTypes.filter(function(n){return e.includes(["all_day","half_day_am","half_day_pm"],n.name)})})}).then(function(e){return S(t,e),e})):o.reject([])}function p(e,t){return e=n(e),o.all([i.calendar.isNonWorkingDay(e),i.calendar.isWeekend(e)]).then(function(e){return e[0]?"non_working_day":e[1]?"weekend":null}).then(function(e){return e?t.filter(function(n){return n.name===e}):[]})}function h(e,t){return n.duration(t).subtract(n.duration(e)).asHours()}function v(e){return c.all({public_holiday:1,contact_id:i.request.contact_id,from_date:{from:e},to_date:{to:e}}).then(function(e){return!!e.list.length})}function b(){return o.resolve()}function g(){return A(i.uiOptions.fromDate,"from").then(function(){return A(i.uiOptions.toDate,"to")})}function y(e){s.$watch(function(){return i.uiOptions.times[e].amount},function(e,n){i.isCalculationUnit("days")||+e==+n||(i.isRole("staff")&&(i.request.change_balance=!0),w(),i.performBalanceChangeCalculation())})}function _(e){var t=n(i.request[e+"_date"]).format("HH:mm"),a=i.uiOptions.times[e];(h(a.min,t)<=0||h(a.max,t)>=0)&&(t="from"===e?a.min:a.max),i.uiOptions.times[e].time=t}function q(){var e=i.uiOptions.multipleDays?["from","to"]:["from"],n=i.uiOptions.times;if(i.isCalculationUnit("hours"))return o.all(e.map(R)).then(function(){["from","to"].forEach(function(e){_(e),L(e),n[e].amount=Math.min(i.request[e+"_date_amount"],n[e].maxAmount).toString()}),i.uiOptions.multipleDays||i.updateEndTimeInputMinTime(i.uiOptions.times.from.time)}).then(w)}function C(){["from","to"].forEach(function(e){y(e),T(e)})}function T(e){s.$watch(function(){return i.uiOptions.times[e].time},function(n,t){i.isCalculationUnit("days")||n===t||(i.setRequestDateTimesAndDateTypes(),n&&L(e,!0))})}function A(e,n){return f(e,n).then(function(){i.loading[n+"DayTypes"]=!1})}function D(e){return A(i.uiOptions[e+"Date"],e).then(function(){if(i.isCalculationUnit("hours"))return R(e).then(function(){L(e,!0)})})}function R(e){var n=i.uiOptions[e+"Date"],t=!i.uiOptions.multipleDays;return n?i.request.getWorkDayForDate(i.convertDateToServerFormat(n)).then(function(n){O[e]=n,m(e,n),t&&"from"===e&&m("to",n)}).catch(function(n){return O[e]={},i.handleError(n)}).finally(function(){i.uiOptions.times[e].loading=!1,t&&(i.uiOptions.times.to.loading=!1)}):o.resolve()}function P(n){var t=i.uiOptions.times[n];i["request"+e.startCase(n)+"DayTypes"]=[],t.time="",t.min="00:00",t.max="00:00",t.amount="0",t.maxAmount="0"}function S(n,t){var a="request"+e.startCase(n)+"DayTypes";i[a]=t,i.isMode("create")&&(i.request[n+"_date_type"]=i[a][0].value)}function I(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?(i.disableAndShowLoadingTimeInput("from"),!i.uiOptions.multipleDays&&i.disableAndShowLoadingTimeInput("to"),R("from").then(function(){L("from",!0)})):o.resolve()}function L(e,n){var t=i.uiOptions,a=t.multipleDays?e:"from",o=t.times[a],s=t.multipleDays&&"to"===a?o.min:t.times.from.time,r=t.multipleDays&&"from"===a?o.max:t.times.to.time,c=O[a].number_of_hours?h(s,r).toString():"0";o.maxAmount=c,n&&(o.amount=o.maxAmount)}function w(){var e=i.uiOptions.times;i.request.from_date_amount=isNaN(+e.from.amount)?null:e.from.amount,i.request.to_date_amount=isNaN(+e.to.amount)?null:e.to.amount}function k(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?R("from").then(function(){L("from",!0)}):o.resolve()}var O={};a.debug("RequestModalDetailsLeaveController"),i.calculateBalanceChange=u,i.canCalculateChange=l,i.canSubmit=d,i.initChildController=b,i.initDayTypesExtended=g,i.initTimesExtended=q,i.initWatchersExtended=C,i.onAbsenceTypeUpdateExtended=k,i.onDateChangeExtended=D,i.resetUIInputsExtended=P,i.setDaysSelectionModeExtended=I}t.controller("RequestModalDetailsLeaveController",a),a.$inject=["$controller","$log","$q","$rootScope","detailsController","PublicHoliday","LeaveRequest"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller",["common/lodash","leave-absences/shared/modules/controllers"],function(e,n){function t(n,t,a,o,s,i,r){function c(){return!(!r.canCalculateChange()||!r.request.sickness_reason)}function u(){return a.all([m(),h(),f(!0)])}function l(n){var t=r.request.getDocumentArray();return!!e.find(t,function(e){return e===n})}function d(n){return!!e.find(r.sicknessDocumentTypes,function(e){return e.value===n})}function m(){return i.valuesOf("hrleaveandabsences_leave_request_required_document").then(function(e){r.sicknessDocumentTypes=e})}function f(n){return i.valuesOf("hrleaveandabsences_sickness_reason",n).then(function(n){r.sicknessReasons=e.indexBy(n,"name")})}function p(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_sickness_reason?reset=1").on("crmUnload",function(){f(!1)})}function h(){r.showSicknessOptionsEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}t.debug("RequestModalDetailsSicknessController"),n("RequestModalDetailsLeaveController",{detailsController:r}),r.canSubmit=c,r.initChildController=u,r.isChecked=l,r.isDocumentInRequest=d,r.openSicknessReasonOptionsEditor=p}n.controller("RequestModalDetailsSicknessController",t),t.$inject=["$controller","$log","$q","$rootScope","crmAngService","api.optionGroup","detailsController"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){return c.balance.change.amount=+c.request.toil_to_accrue,a.resolve(c.balance.change)}function l(){if(!c.request.from_date||!c.request.to_date)return c.uiOptions.max_toil_duration_and_accrual=null,void(c.uiOptions.toil_duration_in_hours=null);c.uiOptions.max_toil_duration_and_accrual=n.duration(n(c.request.to_date).diff(c.request.from_date)).asHours()}function d(){return v().catch(function(e){return e.length&&(c.errors=e),a.reject(e)}).then(function(e){return r.calculateToilExpiryDate(c.request.type_id,e)}).then(function(e){return c.request.toil_expiry_date=e,c.uiOptions.expiryDate=new Date(e),e})}function m(){return!!c.request.toil_to_accrue}function f(){var e=c.uiOptions.multipleDays&&!!c.request.to_date,n=!c.uiOptions.multipleDays&&!!c.request.from_date,t=n||e,a=N.from_date!==c.request.from_date||N.to_date!==c.request.to_date;return c.canDisplayToilExpirationField&&t&&H.hasExpirationFromAdminSettings&&a}function p(){return!!(c.request.from_date&&c.request.to_date&&c.request.toil_duration&&c.request.toil_to_accrue)}function h(){c.request.toil_expiry_date=!1,c.uiOptions.expiryDate=null}function v(){var e=c.uiOptions.multipleDays,n=c.request;return b({hasErrors:e?!n.to_date&&!n.from_date:!n.from_date,label:e?"To Date":"From Date",value:n.to_date})}function b(e){if(e.hasErrors){var t="Please select "+e.label+" to find expiry date";return a.reject([t])}return e.value?a.resolve(n(e.value).format("YYYY-MM-DD")):a.reject([])}function g(){var e=c.isMode("create")&&H.hasExpirationFromAdminSettings,n=H.hasPreviousExpirationDate,t=c.isLeaveType("toil"),a=c.canManage;c.canDisplayToilExpirationField=t&&(a||e||n)}function y(){c.uiOptions.toil_duration_in_hours=c.request.toil_duration/60}function _(){return H.hasPreviousExpirationDate=c.isMode("edit")&&!!c.request.toil_expiry_date,r.canExpire(c.request.type_id).then(function(e){H.hasExpirationFromAdminSettings=e})}function q(){return c.request.to_date_type=c.request.from_date_type="1",_().then(g).then(C).then(S)}function C(){c.canManage&&(c.uiOptions.expiryDate=c.convertDateFormatFromServer(c.request.toil_expiry_date))}function T(){o.$watch(function(){return c.request.toil_to_accrue +},function(e,n){+e!=+n&&c.performBalanceChangeCalculation()})}function A(){o.$watch(function(){return c.uiOptions.toil_duration_in_hours},function(e,n){e!==n&&c.isCalculationUnit("hours")&&k(),c.request.toil_duration=c.uiOptions.toil_duration_in_hours?60*c.uiOptions.toil_duration_in_hours:null})}function D(){var e=c.uiOptions.times;e.from.time=n(c.request.from_date).format("HH:mm"),e.to.time=n(c.request.to_date).format("HH:mm"),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time)}function R(){["from","to"].forEach(function(e){o.$watch(function(){return c.uiOptions.times[e].time},function(e,n){e!==n&&(c.setRequestDateTimesAndDateTypes(),F(),l(),O())})})}function P(){c.isMode("view")||(T(),A(),R())}function S(n){return i.valuesOf("hrleaveandabsences_toil_amounts",n).then(function(n){c.toilAmounts=e.sortBy(n,function(e){return+e.weight})})}function I(){return l(),O(),F()}function L(){return $(),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time),l(),j?j=!1:O(),F()}function w(e){c.uiOptions.times[e].time=""}function k(){c.request.toil_to_accrue=c.uiOptions.toil_duration_in_hours}function O(){c.uiOptions.toil_duration_in_hours=c.uiOptions.max_toil_duration_and_accrual}function M(){N=e.cloneDeep(c.request.attributes())}function $(){c.uiOptions.multipleDays?["from","to"].forEach(function(e){c.uiOptions.times[e].min="00:00",c.uiOptions.times[e].max="23:45"}):(c.uiOptions.times.from.min="00:00",c.uiOptions.times.from.max="23:30",c.uiOptions.times.to.min="00:15",c.uiOptions.times.to.max="23:45")}function x(){c.setRequestDateTimesAndDateTypes(),l(),O(),c.isCalculationUnit("hours")?k():c.request.toil_to_accrue=null}function E(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_toil_amounts?reset=1").on("crmUnload",function(){S(!1)})}function B(){c.showTOILAccrualsOptionEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}function F(){return f()?d().catch(a.resolve):a.resolve()}function U(){c.uiOptions.expiryDate&&(c.request.toil_expiry_date=c.convertDateToServerFormat(c.uiOptions.expiryDate))}t.debug("RequestModalDetailsToilController");var N,j=!c.isMode("create"),H={hasPreviousExpirationDate:null,hasExpirationFromAdminSettings:null};c.canDisplayToilExpirationField=!1,c.calculateBalanceChange=u,c.canCalculateChange=m,c.canSubmit=p,c.clearExpiryDate=h,c.initChildController=q,c.initTimesExtended=D,c.initWatchersExtended=P,c.onAbsenceTypeUpdateExtended=x,c.onDateChangeExtended=I,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=w,c.setDaysSelectionModeExtended=L,c.updateExpiryDate=U,function(){M(),$(),B(),!c.isMode("create")&&y()}()}t.controller("RequestModalDetailsToilController",a),a.$inject=["$log","$q","$rootScope","crmAngService","OptionGroup","AbsenceType","detailsController"]}),define("leave-absences/shared/services/leave-calendar.service",["common/lodash","common/moment","leave-absences/shared/modules/services"],function(e,n,t){"use strict";function a(t,a,o,s){function i(t){function i(){return o.all().then(function(e){return e.list})}function r(){return o.leaveManagees(void 0,{unassigned:!0})}function c(){var n=e.get(t,"filters.userSettings.assignedTo.type","all");return m().then(function(e){return t.lookupContacts=e,a.all([d(),"me"!==n?u():a.resolve(null)])}).then(function(e){var n=e[0];return t.contactIdsToReduceTo=e[1],n})}function u(){return l().then(function(a){var o=a.filter(function(e){var a=e.info.details;return n(a.period_start_date).isSameOrBefore(t.selectedPeriod.end_date)&&(n(a.period_end_date).isSameOrAfter(t.selectedPeriod.start_date)||!a.period_end_date)});return e.uniq(o.map(function(e){return e.contact_id}))})}function l(){return v?a.resolve(v):s.all()}function d(){return o.all(h(),null,"display_name").then(function(e){return e.list})}function m(){var n=e.get(t,"filters.userSettings.assignedTo.type","all");return(0,b[n])()}function f(){return m().then(function(e){t.lookupContacts=e}).then(d)}function p(){return o.leaveManagees(t.contactId)}function h(){var n={department:e.get(t,"filters.userSettings.department.value",null),level_type:e.get(t,"filters.userSettings.level_type.value",null),location:e.get(t,"filters.userSettings.location.value",null),region:e.get(t,"filters.userSettings.region.value",null)},a=!!t.filters.userSettings.contact,o=e.isArray(t.lookupContacts)&&t.lookupContacts.length,s="all"!==e.get(t,"filters.userSettings.assignedTo.type","all");return a?n.id={IN:[t.filters.userSettings.contact.id]}:(s||o)&&(n.id={IN:e.pluck(t.lookupContacts,"id")}),n}var v,b={all:i,me:p,unassigned:r};return{loadContactsForAdmin:c,loadFilteredContacts:d,loadLookUpContacts:m,loadLookUpAndFilteredContacts:f}}return t.debug("LeaveCalendarService"),{init:i}}t.factory("LeaveCalendarService",a),a.$inject=["$log","$q","Contact","Contract"]}),define("leave-absences/shared/instances/absence-period.instance",["leave-absences/shared/modules/models-instances","common/moment","common/models/instances/instance","common/services/hr-settings"],function(e,n){"use strict";e.factory("AbsencePeriodInstance",["$log","ModelInstance","HR_settings",function(e,t,a){return e.debug("AbsencePeriodInstance"),t.extend({defaultCustomData:function(){return{current:!1}},transformAttributes:function(e){var t=n();return e.current=!1,n(e.start_date).isSameOrBefore(t,"day")&&n(e.end_date).isSameOrAfter(t,"day")&&(e.current=!0),e},isInPeriod:function(e){var t=a.DATE_FORMAT.toUpperCase(),o=n(e,t);return n(this.start_date).isSameOrBefore(o)&&n(this.end_date).isSameOrAfter(o)}})}])}),define("leave-absences/shared/apis/absence-period.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("AbsencePeriodAPI",["$log","api",function(e,n){return e.debug("AbsencePeriodAPI"),n.extend({all:function(n){return e.debug("AbsencePeriodAPI"),this.sendGET("AbsencePeriod","get",n).then(function(e){return e.values})}})}])}),define("leave-absences/shared/models/absence-period.model",["leave-absences/shared/modules/models","common/moment","leave-absences/shared/modules/shared-settings","leave-absences/shared/instances/absence-period.instance","leave-absences/shared/apis/absence-period.api","common/models/model","common/services/hr-settings"],function(e,n){"use strict";e.factory("AbsencePeriod",["$log","Model","AbsencePeriodAPI","AbsencePeriodInstance","shared-settings",function(e,t,a,o,s){return e.debug("AbsencePeriod"),t.extend({all:function(e){return a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},current:function(){var e=n().format(s.serverDateFormat),t={start_date:{"<=":e},end_date:{">=":e}};return a.all(t).then(function(e){return e&&e.length?o.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,n,t){"use strict";t.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(t,a,o){return t.debug("AbsenceTypeAPI"),a.extend({all:function(n){return t.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(n||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,s,i){return t.debug("AbsenceTypeAPI.calculateToilExpiryDate"),i=e.assign({},i,{absence_type_id:a,date:n(s).format(o.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",i).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,n){return e.debug("AbsenceTypeInstance"),n.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,n){"use strict";n.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(n,t,a,o,s,i){return n.debug("AbsenceType"),a.extend({all:function(e){return s.all(e).then(function(e){return e.map(function(e){return i.init(e,!0)})})},calculateToilExpiryDate:function(e,n,t){return s.calculateToilExpiryDate(e,n,t)},canExpire:function(e){return s.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(n){return o.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(t){return t=e.indexBy(t,"value"),e.map(n,function(n){return e.assign(n,{calculation_unit_label:t[n.calculation_unit].label,calculation_unit_name:t[n.calculation_unit].name})})})}})}])}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,n){return e.debug("EntitlementLogAPI"),n.extend({all:function(n){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",n,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,n,t){return e.debug("EntitlementInstance"),n.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return t.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,n){"use strict";n.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(n,t,a,o,s){return n.debug("Entitlement"),t.extend({all:function(e,n){return a.all(this.processFilters(e),n).then(function(e){return e.map(function(e){return o.init(e,!0)})})},breakdown:function(n,t){return a.breakdown(n).then(function(n){return t?(t.map(function(t){var a=e.find(n,function(e){return e.id===t.id});return a&&(t.breakdown=a.breakdown),t}),t):n.map(function(e){return o.init(e,!0)})})},logs:function(n){return n=e.cloneDeep(n||{}),n.contact_id&&(n["entitlement_id.contact_id"]=n.contact_id,delete n.contact_id),n.period_id&&(n["entitlement_id.period_id"]=n.period_id,delete n.period_id),n.return=n.return||[],n.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),s.all(n)}})}])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,t,a){return e.debug("LeaveRequestAPI"),t.extend({all:function(n,t,o,s,i){e.debug("LeaveRequestAPI.all");var r=a.defer();return n&&n.contact_id&&n.contact_id.IN&&0===n.contact_id.IN.length?r.resolve({list:[],total:0,allIds:[]}):r.resolve(this.getAll("LeaveRequest",n,t,o,s,"getFull",i)),r.promise},balanceChangeByAbsenceType:function(t){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var o=a.defer();return t.contact_id&&t.period_id||o.reject("contact_id and period_id are mandatory"),t=n.defaults(t,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",t,!1).then(function(e){o.resolve(e.values)}),o.promise},calculateBalanceChange:function(t){return e.debug("LeaveRequestAPI.calculateBalanceChange",t),this.sendPOST("LeaveRequest","calculatebalancechange",t).then(function(e){return e.values.breakdown=n.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,n){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:n.toString()},!1)},create:function(n){return e.debug("LeaveRequestAPI.create",n),this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,attachment_id:t}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,t){return t=n.assign({},t,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",t).then(function(e){return e.values})},find:function(n){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:n},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",t,!1).then(function(e){return e.values})},getComments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",t,!1).then(function(e){return e.values})},isManagedBy:function(n,t){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:n,contact_id:t}).then(function(e){return e.values})},isValid:function(t){e.debug("LeaveRequestAPI.isValid",t);var o=a.defer();return this.sendPOST("LeaveRequest","isValid",t).then(function(e){e.count>0?o.reject(n(e.values).map().flatten().value()):o.resolve(e.values)}),o.promise},saveComment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,text:t.text,contact_id:t.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(n){return e.debug("LeaveRequestAPI.update",n),n.id?this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]}):a.reject("id is mandatory field")}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,n,t){"use strict";t.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(t,a,o,s,i,r,c){function u(e){return p(e).then(function(e){var n=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=n,t.reject(e)}.bind(this))}.bind(this))}function l(){return c.all({id:this.type_id}).then(c.loadCalculationUnits).then(function(e){return t.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return p(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var n=[];return e.forEach(this.files,function(e){e.toBeDeleted&&n.push(r.deleteAttachment(this.id,e.attachment_id))}.bind(this)),t.all(n)}function f(e){return n.duration(e.time_to).subtract(n.duration(e.time_from)).asHours()}function p(n){return o.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){return e.find(t,function(e){return e.name===n})})}function h(n){var a=e.cloneDeep(n),o=a.breakdown.length>1,s=e.first(e.values(a.breakdown)),i=e.last(e.values(a.breakdown));return t.all([this.getWorkDayForDate(s.date),o&&this.getWorkDayForDate(i.date)]).then(function(n){return s.amount=n[0].time_from?Math.min(this.from_date_amount,f(n[0])):0,o&&(i.amount=n[1].time_from?Math.min(this.to_date_amount,f(n[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,n){return e+n.amount},0),a}.bind(this))}function v(){var e=this.id,n=[];return n.push(t.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(n){return function(){return r.saveComment(e,n)}}))),n=n.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return r.deleteComment(e.comment_id)})),t.all(n)}return i.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(n){var t=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===n&&e.pull(t,"from_date_type","to_date_type"),r.calculateBalanceChange(e.pick(this,t)).then(function(e){return"hours"===n?h.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,s.statusNames.cancelled)},approve:function(){return u.call(this,s.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,s.statusNames.rejected)},sendBack:function(){return u.call(this,s.statusNames.moreInformationRequired)},update:function(){return r.update(this.toAPI()).then(function(){return t.all([v.call(this),m.call(this)])}.bind(this))},create:function(){return r.create(this.toAPI()).then(function(e){return this.id=e.id,t.all([v.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(n){if(n.comment_id)return void(n.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return n.created_at===e.created_at&&n.text===e.text})},delete:function(){return r.delete(this.id)},getBalanceChangeBreakdown:function(){return r.getBalanceChangeBreakdown(this.id).then(function(n){return{amount:e.reduce(n.values,function(e,n){return e+parseFloat(n.amount)},0),breakdown:n.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return r.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return t.reject(e)})},isValid:function(){return r.isValid(this.toAPI())},isApproved:function(){return d.call(this,s.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,s.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,s.statusNames.cancelled)},isRejected:function(){return d.call(this,s.statusNames.rejected)},isSentBack:function(){return d.call(this,s.statusNames.moreInformationRequired)},loadComments:function(){return this.id?r.getComments(this.id).then(function(e){this.comments=e}.bind(this)):t.resolve()},roleOf:function(e){return this.contact_id===e?t.resolve("owner"):a(s.permissions.admin.administer).then(function(n){return n?"admin":r.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])},loadAttachments:function(){return this.id?r.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):t.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,n,t,a){return e.debug("LeaveRequest"),n.extend({all:function(e,n,o,s,i){return t.all(this.processFilters(e),n,o,s,i).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return t.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return t.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/apis/public-holiday.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("PublicHolidayAPI",["$log","api",function(e,n){return e.debug("PublicHolidayAPI"),n.extend({all:function(n){return e.debug("PublicHolidayAPI"),this.sendGET("PublicHoliday","get",n).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/public-holiday.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("PublicHolidayInstance",["$log","ModelInstance",function(e,n){return e.debug("PublicHolidayInstance"),n.extend({})}])}),define("leave-absences/shared/models/public-holiday.model",["common/moment","leave-absences/shared/modules/models","common/models/model","common/services/hr-settings","leave-absences/shared/apis/public-holiday.api","leave-absences/shared/instances/public-holiday.instance"],function(e,n){"use strict";n.factory("PublicHoliday",["$log","Model","PublicHolidayAPI","PublicHolidayInstance","shared-settings",function(n,t,a,o,s){return n.debug("PublicHoliday"),t.extend({all:function(e){return n.debug("PublicHoliday.all",e),a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},isPublicHoliday:function(t){n.debug("PublicHoliday.isPublicHoliday",t);var o=e(t).format(s.serverDateFormat),i={date:o};return a.all(i).then(function(e){return!!e.length})}})}])}),define("leave-absences/shared/instances/sickness-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,n){"use strict";n.factory("SicknessRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(n,t){return t.extend({defaultCustomData:function(){var n={sickness_reason:null,sickness_required_documents:"",request_type:"sickness"};return e.assign({},t.defaultCustomData(),n)},getDocumentArray:function(){return this.sickness_required_documents?this.sickness_required_documents.split(","):[]},toggleDocument:function(n){var t=this.getDocumentArray(),a=t.indexOf(n);e.contains(t,n)?t.splice(a,1):t.push(n),this.sickness_required_documents=t.join(",")},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])}})}])}),define("leave-absences/shared/instances/toil-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,n){"use strict";n.factory("TOILRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(n,t){return t.extend({defaultCustomData:function(){var n={from_date_amount:0,to_date_amount:0,request_type:"toil"};return e.assign({},t.defaultCustomData(),n)},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])}})}])}),define("leave-absences/shared/controllers/request.controller",["common/angular","leave-absences/shared/modules/controllers","common/lodash","common/moment","common/models/contact","common/services/api/option-group","common/services/hr-settings","common/services/pub-sub","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/instances/leave-request.instance","leave-absences/shared/instances/sickness-request.instance","leave-absences/shared/instances/toil-request.instance","leave-absences/shared/services/leave-request.service"],function(e,n,t,a){"use strict";function o(n,o,s,i,r,c,u,l,d,m,f,p,h,v,b,g,y,_,q,C){function T(e){"days"===Ue.selectedAbsenceType.calculation_unit_name?delete Ue.request[e+"_date_amount"]:delete Ue.request[e+"_date_type"]}function A(){["from","to"].forEach(T)}function D(){return ke.checkIfSelfLeaveApprover().then(function(e){e&&(Be="admin")})}function R(){var e=Ue.requestStatuses[y.statusNames.awaitingApproval].value;$e.status_id===e&&e!==Ue.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Fe.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return Fe.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return!Ue.loading.entitlements&&(!!le("admin")||!ce("view")&&!(le("manager")&&!ce("create")))}function L(){var e=P();return Ue.isMode("edit")&&(e=e&&(G()||S())),Ue.canManage&&Ue.requestStatuses&&(e=e&&!!Ue.getStatusFromValue(Ue.newStatusOnSave)),(e=e&&!!Ue.period.id)&&!Ue.isMode("view")}function w(){Ue.isSelfRecord&&!Ue.isSelfLeaveApprover?Ue.request.status_id=Ue.requestStatuses[y.statusNames.awaitingApproval].value:Ue.canManage&&(Ue.request.status_id=Ue.newStatusOnSave||Ue.request.status_id)}function k(){if(Ue.isMode("edit")&&!Ue.isRole("staff")&&"toil"!==j())return Ue.request.calculateBalanceChange(Ue.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Ue.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function O(){return"toil"!==j()&&!Ue.request.change_balance}function M(){Ue.errors=[]}function $(){return Ue.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function x(){se()&&!Ue.isRole("staff")&&(Ue.request.change_balance=!0)}function E(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Ue.request.delete().then(function(){Ue.dismissModal(),d.publish("LeaveRequest::delete",Ue.request)})}})}function B(){r.dismiss({$value:"cancel"})}function F(){var e=j();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function U(){return N(Ue.getStatusFromValue(Ue.request.status_id).name)}function N(e){return t.map(Oe[e],function(e){return Ue.requestStatuses[e]})}function j(){return Ue.request?Ue.request.request_type:Ue.leaveType||null}function H(){return!Ue.request||e.equals({},Ue.requestStatuses)?[]:Ue.request.status_id?U():N("none")}function W(e){return t.find(Ue.requestStatuses,function(n){return n.value===e})}function Y(e){Ue.errors=t.isArray(e)?e:[e],Ue.loading.absenceTypes=!1,Ue.submitting=!1}function G(){return!e.equals($e,Ue.request.attributes())||Ue.canManage&&Ue.newStatusOnSave}function V(){return Ue.postContactSelection=!0,Ue.staffMemberSelectionComplete=!1,Ue.request.contact_id?o.resolve().then(me).then(fe).then(_e).then(Ce).then(oe).then(Q).then(Ue.isMode("edit")?Te:t.noop).then(function(){Ue.postContactSelection=!1,Ue.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return o.reject(e)}):o.reject("The contact id was not set")}function z(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];Oe.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],Oe.awaiting_approval=e,Oe.more_information_required=e,Oe.rejected=e,Oe.approved=e,Oe.cancelled=[y.statusNames.awaitingApproval].concat(e)}function X(){Ue.canManage=Ue.isRole("manager")||Ue.isRole("admin")}function Q(){return Ue.canManage?f.find(Ue.request.contact_id).then(function(e){Ue.contactName=e.display_name}):o.resolve()}function J(){Ue.isRole("admin")&&Ue.isSelfRecord&&(Ue.isSelfLeaveApprover=!0)}function K(){var e="my-leave"===s.section,n=+ke.id==+t.get(Ue,"leaveRequest.contact_id"),a=!t.get(Ue,"leaveRequest.id");Ue.isSelfRecord=e&&a||n}function Z(){xe.push(s.$on("LeaveRequestPopup::requestObjectUpdated",Te),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(_e).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Ue.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,n){Y(n)}),s.$on("LeaveRequestPopup::childComponent::register",function(){Me++})),i.$on("$destroy",Se),i.$on("LeaveRequestPopup::addTab",function(e,n){Fe.push(n)})}function ee(){var e,n;Ue.request=Ue.leaveRequest||null,e=j(),n=Ue.initRequestAttributes(),"leave"===e?Ue.request=g.init(n):"sickness"===e?Ue.request=_.init(n):"toil"===e&&(Ue.request=q.init(n))}function ne(){var e={};return Ue.request?e=Ue.request.attributes():Ue.canManage||(e={contact_id:ke.id}),e}function te(){return Be="staff",ae().then(Ue.isSelfRecord&&!Ue.isRole("admin")&&D)}function ae(){return c(y.permissions.admin.administer).then(function(e){e&&(Be="admin")}).then(function(){return"admin"!==Be&&c(y.permissions.ssp.manage)}).then(function(e){e&&(Be="manager")})}function oe(){Ue.defaultStatus?Ue.newStatusOnSave=Ue.requestStatuses[y.statusNames[Ue.defaultStatus]].value:(Ue.isRole("admin")||Ue.isMode("create")&&Ue.isRole("manager"))&&(Ue.newStatusOnSave=Ue.requestStatuses[y.statusNames.approved].value)}function se(){return!Ue.request.status_id||!t.includes(["cancelled","rejected"],W(Ue.request.status_id).name)}function ie(e){var n=Ue.getStatusFromValue(Ue.request.status_id);return!!n&&n.name===e}function re(e){return Ue.request&&Ue.request.request_type===e}function ce(e){return Ue.mode===e}function ue(e,n){var t=a(e.from_date),o=a(e.to_date);return t.isSameOrAfter(n.start_date,"day")&&o.isSameOrBefore(n.end_date,"day")}function le(e){return Be===e}function de(){return p.all().then(function(e){Ue.absencePeriods=e})}function me(){return h.all(F()).then(h.loadCalculationUnits).then(function(e){we={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Ue.loading.entitlements=!0,v.all({contact_id:Ue.request.contact_id,period_id:Ue.period.id,type_id:{IN:we.ids}},!0).finally(function(){Ue.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){ke=e})}function he(){return Ue.selectedContactId?f.find(Ue.selectedContactId).then(function(e){Ue.managedContacts=[e]}):Ue.isRole("admin")?f.all().then(function(e){Ue.managedContacts=e.list}):ke.leaveManagees().then(function(e){Ue.managedContacts=e})}function ve(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Ue.requestStatuses=t.indexBy(e,"name")})}function be(e,n){var a;return t.compact(e.map(function(e){if(a=t.find(n,{type_id:e.id}))return{id:a.type_id,title:e.title+" ( "+a.remainder.current+" ) ",remainder:a.remainder.current,allow_overuse:e.allow_overuse,calculation_unit_name:e.calculation_unit_name}}))}function ge(e){R(),d.publish(e,Ue.request),Ue.errors=[],Ue.dismissModal()}function ye(){["from","to"].forEach(function(e){Ue.request[e+"_date"]=$e[e+"_date"]})}function _e(e){if(Ue.absenceTypes=be(we.types,e),!Ue.absenceTypes.length)return o.reject(Ee)}function qe(){Ue.period=t.find(Ue.absencePeriods,function(e){return Ue.isMode("create")?e.current:ue(Ue.request,e)})}function Ce(){Ue.isMode("create")?(Ue.selectedAbsenceType=Ue.absenceTypes[0],Ue.request.type_id=Ue.selectedAbsenceType.id):Ue.selectedAbsenceType=t.find(Ue.absenceTypes,function(e){return e.id===Ue.request.type_id})}function Te(){$e=e.copy(Ue.request.attributes())}function Ae(){var e;Ue.request.id?(e=[Ue.requestStatuses[y.statusNames.approved].value,Ue.requestStatuses[y.statusNames.adminApproved].value,Ue.requestStatuses[y.statusNames.rejected].value,Ue.requestStatuses[y.statusNames.cancelled].value],Ue.mode="edit",Ue.isRole("staff")&&e.indexOf(Ue.request.status_id)>-1&&(Ue.mode="view")):Ue.mode="create"}function De(){var e=Ue.request.status_id;if(!Ue.isMode("view")&&!Ue.submitting)return Ue.submitting=!0,w(),A(),Ue.request.isValid().then(se()&&k).then(x).then(O()&&ye).then(Re).then(function(){return Ue.isMode("edit")?Le():$()}).catch(function(n){Ue.request.status_id=e,n&&Y(n)}).finally(function(){Ue.submitting=!1})}function Re(){return o.all(Fe.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&t.push(e),++a===Me&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Me>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function Se(){xe.forEach(function(e){e()})} +function Ie(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Le(){return Ue.request.update().then(Pe).then(function(){Ue.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Ue.isRole("staff")||Ue.isRole("admin"))&&ge("LeaveRequest::edit")})}n.debug("RequestCtrl");var we,ke,Oe={},Me=0,$e={},xe=[],Ee="No entitlement",Be="",Fe=[],Ue=t.assign(this,m);Ue.absencePeriods=[],Ue.absenceTypes=[],Ue.canManage=!1,Ue.contactName=null,Ue.errors=[],Ue.isSelfLeaveApprover=!1,Ue.loading={absenceTypes:!0,entitlements:!0},Ue.managedContacts=[],Ue.mode="",Ue.newStatusOnSave=null,Ue.period={},Ue.postContactSelection=!1,Ue.requestStatuses={},Ue.selectedAbsenceType={},Ue.staffMemberSelectionComplete=!1,Ue.submitting=!1,Ue.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Ue.canChangeAbsenceType=I,Ue.canSubmit=L,Ue.closeAlert=M,Ue.deleteLeaveRequest=E,Ue.dismissModal=B,Ue.getStatuses=H,Ue.getStatusFromValue=W,Ue.initAfterContactSelection=V,Ue.initRequestAttributes=ne,Ue.isLeaveStatus=ie,Ue.isLeaveType=re,Ue.isMode=ce,Ue.isRole=le,Ue.submit=De,Ue.updateAbsenceType=Ie,function(){Ue.loading.absenceTypes=!0,z(),Z(),pe().then(K).then(function(){return o.all([te(),de(),ve()])}).then(X).then(J).then(ee).then(Ae).then(qe).then(function(){return Ue.canManage&&!Ue.isMode("edit")&&he()}).then(function(){if(Ue.selectedContactId&&(Ue.request.contact_id=Ue.selectedContactId),Ue.request.contact_id)return Ue.initAfterContactSelection()}).catch(Y).finally(function(){Ue.loading.absenceTypes=!1})}()}n.controller("RequestCtrl",o),o.$inject=["$log","$q","$rootScope","$scope","$uibModalInstance","checkPermissions","api.optionGroup","dialog","pubSub","directiveOptions","Contact","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","LeaveRequestInstance","shared-settings","SicknessRequestInstance","TOILRequestInstance","LeaveRequestService"]}),define("leave-absences/shared/services/leave-popup.service",["common/lodash","common/modules/angular-date","leave-absences/shared/modules/services","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/controllers/request.controller"],function(e,n){"use strict";function t(e,n,t,a,o,s,i,r,c){function u(e){return r.get().then(function(n){return e.roleOf(n.contactId)}).then(function(e){return"none"!==e})}function l(e){a.open({appendTo:n.children().eq(0),templateUrl:s.sharedPathTpl+"components/leave-request-popup/leave-request-popup.html",controller:"RequestCtrl",controllerAs:"$ctrl",windowClass:"chr_leave-request-modal",resolve:{directiveOptions:function(){return e},format:["DateFormat",function(e){return e.getDateFormat()}]}})}function d(e){return c.find(e).then(function(e){return u(e).then(function(n){n?l({leaveRequest:e,leaveType:e.request_type,selectedContactId:e.contact_id}):o.error("Error","You dont have permission to see this leave request")})}).catch(function(e){o.error("Error",e)})}return e.debug("LeavePopup"),{openModal:l,openModalByID:d}}n.factory("LeavePopup",t),t.$inject=["$log","$rootElement","$rootScope","$uibModal","notificationService","shared-settings","DateFormat","Session","LeaveRequest"]}),function(e){define("leave-absences/admin-dashboard/modules/settings",["common/angular"],function(n){return n.module("admin-dashboard.settings",[]).constant("settings",{contactId:e.vars.leaveAndAbsences.loggedInUserId,debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/admin-dashboard/"})})}(CRM),define("leave-absences/admin-dashboard/modules/config",["common/angular","common/lodash","leave-absences/admin-dashboard/modules/settings"],function(e,n){function t(e){e.settings.ga={userId:n.get(CRM,"vars.session.contact_id")},e.withAutoBase(!0)}return e.module("admin-dashboard.config",["admin-dashboard.settings"]).config(["$stateProvider","$resourceProvider","$urlRouterProvider","$httpProvider","$logProvider","$analyticsProvider","settings",function(e,n,a,o,s,i,r){var c={format:["DateFormat",function(e){return e.getDateFormat()}]};n.defaults.stripTrailingSlashes=!1,o.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",t(i),s.debugEnabled(r.debug),a.otherwise("/requests"),e.state("requests",{url:"/requests",template:'',resolve:c}).state("calendar",{url:"/calendar",template:'',resolve:c}).state("leave-balances",{url:"/leave-balances",template:"",resolve:c})}])}),define("leave-absences/admin-dashboard/modules/components",["common/angular"],function(e){return e.module("admin-dashboard.components",[])}),define("leave-absences/admin-dashboard/components/admin-dashboard-container",["leave-absences/admin-dashboard/modules/components"],function(e){function n(e,n){e.debug("Component: admin-dashboard-container"),n.section="admin-dashboard"}e.component("adminDashboardContainer",{templateUrl:["settings",function(e){return e.pathTpl+"components/admin-dashboard-container.html"}],controllerAs:"vm",controller:["$log","$rootScope",n]})}),define("leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component",[],function(){function e(e,n,t,a){function o(){i(),s()}function s(){return t("can administer calendar feeds").then(function(e){c.canCreateNewFeed=!!e})}function i(){return c.loading.feeds=!0,e.all().then(function(e){c.feeds=e}).finally(function(){c.loading.feeds=!1})}function r(e,t){n.open(e,t)}var c=this;c.canCreateNewFeed=!1,c.feeds=[],c.loading={feeds:!1},c.$onInit=o,c.openLinkModal=r}return e.$inject=["CalendarFeed","CalendarFeedsLinkModal","checkPermissions","shared-settings"],{__name:"calendarFeedsDropdownButton",bindings:{dropdownPosition:"@"},controller:e,controllerAs:"dropdownButton",templateUrl:["shared-settings",function(e){return e.sourcePath+"calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.html"}]}}),define("leave-absences/calendar-feeds/calendar-feeds.core",["common/angular","leave-absences/shared/modules/shared-settings"],function(e){e.module("calendar-feeds.core",["leave-absences.settings"])}),define("leave-absences/calendar-feeds/services/apis/calendar-feed.api",["common/lodash"],function(e){"use strict";function n(e,n,t){function a(){return this.sendGET("LeaveRequestCalendarFeedConfig","get",{is_active:!0}).then(function(e){return e.values})}return e.debug("CalendarFeedAPI"),t.extend({all:a})}return n.__name="CalendarFeedAPI",n.$inject=["$log","$q","api"],n}),define("leave-absences/calendar-feeds/services/models/calendar-feed.model",[],function(){"use strict";function e(e,n,t){function a(){return n.all().then(function(e){return e.map(function(e){return t.init(e)})})}return e.extend({all:a})}return e.__name="CalendarFeed",e.$inject=["Model","CalendarFeedAPI","CalendarFeedInstance"],e}),define("leave-absences/calendar-feeds/services/models/calendar-feed.instance",[],function(){"use strict";function e(e){return e.extend({})}return e.__name="CalendarFeedInstance",e.$inject=["ModelInstance"],e}),define("leave-absences/calendar-feeds/calendar-feeds.models",["common/angular","leave-absences/calendar-feeds/services/apis/calendar-feed.api","leave-absences/calendar-feeds/services/models/calendar-feed.model","leave-absences/calendar-feeds/services/models/calendar-feed.instance","common/models/model","common/services/api"],function(e,n,t,a){e.module("calendar-feeds.models",["common.apis","common.models"]).factory(n.__name,n).factory(t.__name,t).factory(a.__name,a)}),define("leave-absences/calendar-feeds/link-modal/components/calendar-feeds-link-modal.component",["common/lodash"],function(e){return{__name:"calendarFeedsLinkModal",bindings:{dismiss:"<",url:"<",title:"<"},controller:e.noop,controllerAs:"linkModal",templateUrl:["shared-settings",function(e){return e.sourcePath+"calendar-feeds/link-modal/components/calendar-feeds-link-modal.html"}]}}),define("leave-absences/calendar-feeds/link-modal/services/calendar-feeds-link-modal.service",[],function(){function e(e,n,t){function a(e,a){var s=o(),i=t+"civicrm/calendar-feed?hash="+a;n.open({controllerAs:"modal",size:"md",template:'',controller:["$uibModalInstance","title","url",function(e,n,t){this.dismiss=e.dismiss,this.title=n,this.url=t}],appendTo:s,resolve:{title:function(){return e},url:function(){return i}}})}function o(){var n=e.find("#bootstrap-theme");return 0===n.length&&(n=e.find("body")),n.eq(0)}return{open:a}}return e.__name="CalendarFeedsLinkModal",e.$inject=["$document","$uibModal","HOST_URL"],e}),define("leave-absences/calendar-feeds/link-modal/directives/input-with-copy-button.directive",["common/lodash"],function(e){function n(n,t){function a(e,t,a,o){function s(){r(),u()}function i(){l[0].setSelectionRange(0,0),l.blur()}function r(){c(),document.execCommand("copy"),i()}function c(){l.focus(),l[0].setSelectionRange(0,l.val().length)}function u(){m.justCopied=!0,d&&n.cancel(d),d=n(function(){m.justCopied=!1},2e3)}var l,d,m=e.input;m.model=o.model,m.justCopied=!1,m.copy=s,m.selectInputText=c,function(){l=t.find("input")}()}var o=t.sourcePath+"calendar-feeds/link-modal/directives/input-with-copy-button.html";return{controller:e.noop,controllerAs:"input",link:a,restrict:"E",scope:{},templateUrl:o,require:{model:"^ngModel"}}}return n.__name="inputWithCopyButton",n.$inject=["$timeout","shared-settings"],n}),define("leave-absences/calendar-feeds/link-modal/link-modal.core",["common/angular","common/angularBootstrap"],function(e){e.module("calendar-feeds.link-modal.core",["ui.bootstrap"])}),function(e){define("leave-absences/calendar-feeds/link-modal/link-modal.constants",["common/angular"],function(n){"use strict";n.module("calendar-feeds.link-modal.constants",[]).constant("HOST_URL",e.absoluteUrl("/"))})}(Drupal),define("leave-absences/calendar-feeds/link-modal/link-modal.module",["common/angular","leave-absences/calendar-feeds/link-modal/components/calendar-feeds-link-modal.component","leave-absences/calendar-feeds/link-modal/services/calendar-feeds-link-modal.service","leave-absences/calendar-feeds/link-modal/directives/input-with-copy-button.directive","leave-absences/calendar-feeds/calendar-feeds.core","leave-absences/calendar-feeds/link-modal/link-modal.core","leave-absences/calendar-feeds/link-modal/link-modal.constants"],function(e,n,t,a){e.module("calendar-feeds.link-modal",["calendar-feeds.core","calendar-feeds.link-modal.core","calendar-feeds.link-modal.constants"]).component(n.__name,n).directive(a.__name,a).factory(t.__name,t)}),define("leave-absences/calendar-feeds/dropdown-button/dropdown-button.module",["common/angular","leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component","common/services/check-permissions","leave-absences/calendar-feeds/calendar-feeds.core","leave-absences/calendar-feeds/calendar-feeds.models","leave-absences/calendar-feeds/link-modal/link-modal.module"],function(e,n){e.module("calendar-feeds.dropdown-button",["common.services","calendar-feeds.core","calendar-feeds.models","calendar-feeds.link-modal"]).component(n.__name,n)}),define("leave-absences/admin-dashboard/app",["common/angular","common/angularBootstrap","common/angulartics","common/angulartics-google-tag-manager","common/angularUiRouter","common/directives/scroll-shadows.directive","common/directives/time-amount-picker.directive","common/directives/timepicker-select.directive","common/filters/angular-date/format-date","common/filters/time-unit-applier.filter","common/modules/dialog","common/services/check-permissions","common/services/crm-ang.service","common/services/angular-date/date-format","leave-absences/shared/components/leave-balance-tab.component","leave-absences/shared/components/leave-calendar.component","leave-absences/shared/components/leave-calendar-day.component","leave-absences/shared/components/leave-calendar-legend.component","leave-absences/shared/components/leave-calendar-month.component","leave-absences/shared/components/leave-request-actions.component","leave-absences/shared/components/leave-request-popup-comments-tab.component","leave-absences/shared/components/leave-request-popup-details-tab.component","leave-absences/shared/components/leave-request-popup-files-tab","leave-absences/shared/components/leave-request-record-actions.component","leave-absences/shared/components/manage-leave-requests.component","leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller","leave-absences/shared/modules/shared-settings","leave-absences/shared/services/leave-calendar.service","leave-absences/shared/services/leave-popup.service","leave-absences/admin-dashboard/modules/config","leave-absences/admin-dashboard/components/admin-dashboard-container","leave-absences/calendar-feeds/dropdown-button/dropdown-button.module"],function(e){return e.module("admin-dashboard",["ngAnimate","ngResource","angulartics","angulartics.google.tagmanager","ui.bootstrap","ui.router","ui.select","textAngular","common.angularDate","common.dialog","common.filters","common.mocks","leave-absences.components","leave-absences.controllers","leave-absences.settings","leave-absences.services","admin-dashboard.config","admin-dashboard.components","calendar-feeds.dropdown-button"]).run(["$log","$rootScope","shared-settings","settings",function(e,n,t,a){e.debug("app.run"),n.sharedPathTpl=t.sharedPathTpl,n.settings=a}]),e}),function(e,n){var t=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";n.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":t+"/shared","leave-absences/admin-dashboard":t+"/admin-dashboard"}}),n(["leave-absences/shared/config"],function(){n(["leave-absences/admin-dashboard/app"],function(){document.dispatchEvent("function"==typeof window.CustomEvent?new CustomEvent("adminDashboardReady"):function(){var e=document.createEvent("Event");return e.initEvent("adminDashboardReady",!0,!0),e}())})})}(CRM,require),define("admin-dashboard",function(){}); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/admin-dashboard.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-leave.min.js index 26891c24bb1..f22ea9ca627 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-leave.min.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-leave.min.js @@ -1,14 +1,5 @@ -/** - * State-based routing for AngularJS - * @version v0.3.2 - * @link http://angular-ui.github.com/ - * @license MIT License, http://www.opensource.org/licenses/MIT - */ - - -!function(e){define("leave-absences/shared/config",[],function(){var t=CRM.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/shared";e.config({paths:{"leave-absences/shared/ui-router":"leave-absences/shared/vendor/angular-ui-router.min",mocks:"../test/mocks"},shim:{"leave-absences/shared/ui-router":{}}}),e.config({paths:{"leave-absences/shared/ui-router":t+"/vendor/angular-ui-router.min",mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/ui-router",[],function(){return function(){"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(e,t,n){"use strict";function a(e,t){return W(new(W(function(){},{prototype:e})),t)}function r(e){return H(arguments,function(t){t!==e&&H(t,function(t,n){e.hasOwnProperty(n)||(e[n]=t)})}),e}function o(e,t){var n=[];for(var a in e.path){if(e.path[a]!==t.path[a])break;n.push(e.path[a])}return n}function s(e){if(Object.keys)return Object.keys(e);var t=[];return H(e,function(e,n){t.push(n)}),t}function i(e,t){if(Array.prototype.indexOf)return e.indexOf(t,Number(arguments[2])||0);var n=e.length>>>0,a=Number(arguments[2])||0;for((a=a<0?Math.ceil(a):Math.floor(a))<0&&(a+=n);a=0||(l.push(r[f]),c[r[f]]=e[r[f]]);return W({},c,t)}function c(e,t,n){if(!n){n=[];for(var a in e)n.push(a)}for(var r=0;r "));if(b[n]=a,F(e))v.push(n,[function(){return t.get(e)}],c);else{var r=t.annotate(e);H(r,function(e){e!==n&&u.hasOwnProperty(e)&&m(u[e],e)}),v.push(n,e,r)}g.pop(),b[n]=o}}function p(e){return N(e)&&e.then&&e.$$promises}if(!N(u))throw new Error("'invocables' must be an object");var h=s(u||{}),v=[],g=[],b={};return H(u,m),u=g=b=null,function(a,o,s){function i(){--y||(_||r(b,o.$$values),m.$$values=b,m.$$promises=m.$$promises||!0,delete m.$$inheritedValues,c.resolve(b))}function u(e){m.$$failure=e,c.reject(e)}if(p(a)&&s===n&&(s=o,o=a,a=null),a){if(!N(a))throw new Error("'locals' must be an object")}else a=l;if(o){if(!p(o))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else o=d;var c=e.defer(),m=c.promise,g=m.$$promises={},b=W({},a),y=1+v.length/3,_=!1;if(B(o.$$failure))return u(o.$$failure),m;o.$$inheritedValues&&r(b,f(o.$$inheritedValues,h)),W(g,o.$$promises),o.$$values?(_=r(b,f(o.$$values,h)),m.$$inheritedValues=f(o.$$values,h),i()):(o.$$inheritedValues&&(m.$$inheritedValues=f(o.$$inheritedValues,h)),o.then(i,u));for(var q=0,$=v.length;q<$;q+=3)a.hasOwnProperty(v[q])?i():function(n,r,o){function c(e){d.reject(e),u(e)}function l(){if(!B(m.$$failure))try{d.resolve(t.invoke(r,s,b)),d.promise.then(function(e){b[n]=e,i()},c)}catch(e){c(e)}}var d=e.defer(),f=0;H(o,function(e){g.hasOwnProperty(e)&&!a.hasOwnProperty(e)&&(f++,g[e].then(function(t){b[e]=t,--f||l()},c))}),f||l(),g[n]=d.promise}(v[q],v[q+1],v[q+2]);return m}},this.resolve=function(e,t,n,a){return this.study(e)(t,n,a)}}function g(e,t,n){this.fromConfig=function(e,t,n){return B(e.template)?this.fromString(e.template,t):B(e.templateUrl)?this.fromUrl(e.templateUrl,t):B(e.templateProvider)?this.fromProvider(e.templateProvider,t,n):null},this.fromString=function(e,t){return j(e)?e(t):e},this.fromUrl=function(n,a){return j(n)&&(n=n(a)),null==n?null:e.get(n,{cache:t,headers:{Accept:"text/html"}}).then(function(e){return e.data})},this.fromProvider=function(e,t,a){return n.invoke(e,null,a||{params:t})}}function b(e,t,r){function o(t,n,a,r){if(v.push(t),p[t])return p[t];if(!/^\w+([-.]+\w+)*(?:\[\])?$/.test(t))throw new Error("Invalid parameter name '"+t+"' in pattern '"+e+"'");if(h[t])throw new Error("Duplicate parameter name '"+t+"' in pattern '"+e+"'");return h[t]=new G.Param(t,n,a,r),h[t]}function s(e,t,n,a){var r=["",""],o=e.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!t)return o;switch(n){case!1:r=["(",")"+(a?"?":"")];break;case!0:o=o.replace(/\/$/,""),r=["(?:/(",")|/)?"];break;default:r=["("+n+"|",")?"]}return o+r[0]+t+r[1]}function i(r,o){var s,i,u,c,l;return s=r[2]||r[3],l=t.params[s],u=e.substring(f,r.index),i=o?r[4]:r[4]||("*"==r[1]?".*":null),i&&(c=G.type(i)||a(G.type("string"),{pattern:new RegExp(i,t.caseInsensitive?"i":n)})),{id:s,regexp:i,segment:u,type:c,cfg:l}}t=W({params:{}},N(t)?t:{});var u,c=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,d="^",f=0,m=this.segments=[],p=r?r.params:{},h=this.params=r?r.params.$$new():new G.ParamSet,v=[];this.source=e;for(var g,b,y;(u=c.exec(e))&&(g=i(u,!1),!(g.segment.indexOf("?")>=0));)b=o(g.id,g.type,g.cfg,"path"),d+=s(g.segment,b.type.pattern.source,b.squash,b.isOptional),m.push(g.segment),f=c.lastIndex;y=e.substring(f);var _=y.indexOf("?");if(_>=0){var q=this.sourceSearch=y.substring(_);if(y=y.substring(0,_),this.sourcePath=e.substring(0,f+_),q.length>0)for(f=0;u=l.exec(q);)g=i(u,!0),b=o(g.id,g.type,g.cfg,"search"),f=c.lastIndex}else this.sourcePath=e,this.sourceSearch="";d+=s(y)+(!1===t.strict?"/?":"")+"$",m.push(y),this.regexp=new RegExp(d,t.caseInsensitive?"i":n),this.prefix=m[0],this.$$paramNames=v}function y(e){W(this,e)}function _(){function e(e){return null!=e?e.toString().replace(/(~|\/)/g,function(e){return{"~":"~~","/":"~2F"}[e]}):e}function r(e){return null!=e?e.toString().replace(/(~~|~2F)/g,function(e){return{"~~":"~","~2F":"/"}[e]}):e}function o(){return{strict:h,caseInsensitive:f}}function u(e){return j(e)||U(e)&&j(e[e.length-1])}function c(){for(;$.length;){var e=$.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");t.extend(g[e.name],d.invoke(e.def))}}function l(e){W(this,e||{})}G=this;var d,f=!1,h=!0,v=!1,g={},q=!0,$=[],C={string:{encode:e,decode:r,is:function(e){return null==e||!B(e)||"string"==typeof e},pattern:/[^\/]*/},int:{encode:e,decode:function(e){return parseInt(e,10)},is:function(e){return B(e)&&this.decode(e.toString())===e},pattern:/\d+/},bool:{encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:function(e){return!0===e||!1===e},pattern:/0|1/},date:{encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):n},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):n},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return this.is(e)&&this.is(t)&&e.toISOString()===t.toISOString()},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:{encode:t.toJson,decode:t.fromJson,is:t.isObject,equals:t.equals,pattern:/[^\/]*/},any:{encode:t.identity,decode:t.identity,equals:t.equals,pattern:/.*/}};_.$$getDefaultValue=function(e){if(!u(e.value))return e.value;if(!d)throw new Error("Injectable functions cannot be called at configuration time");return d.invoke(e.value)},this.caseInsensitive=function(e){return B(e)&&(f=e),f},this.strictMode=function(e){return B(e)&&(h=e),h},this.defaultSquashPolicy=function(e){if(!B(e))return v;if(!0!==e&&!1!==e&&!F(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return v=e,e},this.compile=function(e,t){return new b(e,W(o(),t))},this.isMatcher=function(e){if(!N(e))return!1;var t=!0;return H(b.prototype,function(n,a){j(n)&&(t=t&&B(e[a])&&j(e[a]))}),t},this.type=function(e,t,n){if(!B(t))return g[e];if(g.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return g[e]=new y(W({name:e},t)),n&&($.push({name:e,def:n}),q||c()),this},H(C,function(e,t){g[t]=new y(W({name:t},e))}),g=a(g,{}),this.$get=["$injector",function(e){return d=e,q=!1,c(),H(C,function(e,t){g[t]||(g[t]=new y(e))}),this}],this.Param=function(e,a,r,o){function c(){if(!d)throw new Error("Injectable functions cannot be called at configuration time");var e=d.invoke(r.$$fn);if(null!==e&&e!==n&&!h.type.is(e))throw new Error("Default value ("+e+") for parameter '"+h.id+"' is not an instance of Type ("+h.type.name+")");return e}function l(e){function t(e){return function(t){return t.from===e}}return e=function(e){var n=p(m(h.replace,t(e)),function(e){return e.to});return n.length?n[0]:e}(e),B(e)?h.type.$normalize(e):c()}function f(){return"{Param:"+e+" "+a+" squash: '"+q+"' optional: "+_+"}"}var h=this;r=function(e){var t=N(e)?s(e):[];return-1===i(t,"value")&&-1===i(t,"type")&&-1===i(t,"squash")&&-1===i(t,"array")&&(e={value:e}),e.$$fn=u(e.value)?e.value:function(){return e.value},e}(r),a=function(n,a,r){if(n.type&&a)throw new Error("Param '"+e+"' has two type configurations.");return a||(n.type?t.isString(n.type)?g[n.type]:n.type instanceof y?n.type:new y(n.type):"config"===r?g.any:g.string)}(r,a,o);var b=function(){var t={array:"search"===o&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return W(t,n,r).array}();a=b?a.$asArray(b,"search"===o):a,"string"!==a.name||b||"path"!==o||r.value!==n||(r.value="");var _=r.value!==n,q=function(e,t){var n=e.squash;if(!t||!1===n)return!1;if(!B(n)||null==n)return v;if(!0===n||F(n))return n;throw new Error("Invalid squash policy: '"+n+"'. Valid policies: false, true, or arbitrary string")}(r,_),$=function(e,t,a,r){var o,s,u=[{from:"",to:a||t?n:""},{from:null,to:a||t?n:""}];return o=U(e.replace)?e.replace:[],F(r)&&o.push({from:r,to:n}),s=p(o,function(e){return e.from}),m(u,function(e){return-1===i(s,e.from)}).concat(o)}(r,b,_,q);W(this,{id:e,type:a,location:o,array:b,squash:q,replace:$,isOptional:_,value:l,dynamic:n,config:r,toString:f})},l.prototype={$$new:function(){return a(this,W(new l,{$$parent:this}))},$$keys:function(){for(var e=[],t=[],n=this,a=s(l.prototype);n;)t.push(n),n=n.$$parent;return t.reverse(),H(t,function(t){H(s(t),function(t){-1===i(e,t)&&-1===i(a,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return H(n.$$keys(),function(a){t[a]=n[a].value(e&&e[a])}),t},$$equals:function(e,t){var n=!0,a=this;return H(a.$$keys(),function(r){var o=e&&e[r],s=t&&t[r];a[r].type.equals(o,s)||(n=!1)}),n},$$validates:function(e){var a,r,o,s,i,u=this.$$keys();for(a=0;a=0)throw new Error("State must have a valid name");if(T.hasOwnProperty(n))throw new Error("State '"+n+"' is already defined");var r=-1!==n.indexOf(".")?n.substring(0,n.lastIndexOf(".")):F(t.parent)?t.parent:N(t.parent)&&F(t.parent.name)?t.parent.name:"";if(r&&!T[r])return m(r,t.self);for(var o in S)j(S[o])&&(t[o]=S[o](t,S.$delegates[o]));return T[n]=t,!t[D]&&t.url&&e.when(t.url,["$match","$stateParams",function(e,n){w.$current.navigable==t&&c(e,n)||w.transitionTo(t,e,{inherit:!0,location:!1})}]),v(n),t}function b(e){return e.indexOf("*")>-1}function y(e){for(var t=e.split("."),n=w.$current.name.split("."),a=0,r=t.length;a=T;a--)s=p[a],s.self.onExit&&i.invoke(s.self.onExit,s.self,s.locals.globals),s.locals=null;for(a=T;a<_.length;a++)r=_[a],r.locals=L[a],r.self.onEnter&&i.invoke(r.self.onEnter,r.self,r.locals.globals);return w.transition!==j?(e.$broadcast("$stateChangeCancel",t.self,n,c.self,d),S):(w.$current=t,w.current=t.self,w.params=n,V(w.params,m),w.transition=null,o.location&&t.navigable&&v.push(t.navigable.url,t.navigable.locals.globals.$stateParams,{$$avoidResync:!0,replace:"replace"===o.location}),o.notify&&e.$broadcast("$stateChangeSuccess",t.self,n,c.self,d),v.update(!0),w.current)}).then(null,function(a){return a===P?S:w.transition!==j?(e.$broadcast("$stateChangeCancel",t.self,n,c.self,d),S):(w.transition=null,s=e.$broadcast("$stateChangeError",t.self,n,c.self,d,a),s.defaultPrevented||v.update(),r.reject(a))});return j},w.is=function(e,t,a){a=W({relative:w.$current},a||{});var r=f(e,a.relative);return B(r)?w.$current===r&&(!t||c(r.params.$$values(t),m)):n},w.includes=function(e,t,a){if(a=W({relative:w.$current},a||{}),F(e)&&b(e)){if(!y(e))return!1;e=w.$current.name}var r=f(e,a.relative);if(!B(r))return n;if(!B(w.$current.includes[r.name]))return!1;if(!t)return!0;for(var o=s(t),i=0;i2?c.enter(e,null,n).then(a):c.enter(e,null,n,a)},leave:function(e,n){t.version.minor>2?c.leave(e).then(n):c.leave(e,n)}};if(u){var a=u&&u(n,e);return{enter:function(e,t,n){a.enter(e,null,t),n()},leave:function(e,t){a.leave(e),t()}}}return function(){return{enter:function(e,t,n){t.after(e),n()},leave:function(e,t){e.remove(),t()}}}()}var i=function(){return n.has?function(e){return n.has(e)?n.get(e):null}:function(e){try{return n.get(e)}catch(e){return null}}}(),u=i("$animator"),c=i("$animate");return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(n,i,u){return function(n,i,c){function l(){if(f&&(f.remove(),f=null),p&&(p.$destroy(),p=null),m){var e=m.data("$uiViewAnim");b.leave(m,function(){e.$$animLeave.resolve(),f=null}),f=m,m=null}}function d(s){var d,f=P(n,c,i,r),y=f&&e.$current&&e.$current.locals[f];if(s||y!==h){d=n.$new(),h=e.$current.locals[f],d.$emit("$viewContentLoading",f);var _=u(d,function(e){var r=o.defer(),s=o.defer(),u={$animEnter:r.promise,$animLeave:s.promise,$$animLeave:s};e.data("$uiViewAnim",u),b.enter(e,i,function(){r.resolve(),p&&p.$emit("$viewContentAnimationEnded"),(t.isDefined(g)&&!g||n.$eval(g))&&a(e)}),l()});m=_,p=d,p.$emit("$viewContentLoaded",f),p.$eval(v)}}var f,m,p,h,v=c.onload||"",g=c.autoscroll,b=s(c,n);i.inheritedData("$uiView"),n.$on("$stateChangeSuccess",function(){d(!1)}),d(!0)}}}}function T(e,n,a,r){return{restrict:"ECA",priority:-400,compile:function(o){var s=o.html();return function(o,i,u){var c=a.$current,l=P(o,u,i,r),d=c&&c.locals[l];if(d){i.data("$uiView",{name:l,state:d.$$state}),i.html(d.$template?d.$template:s);var f=t.extend({},d);o[d.$$resolveAs]=f;var m=e(i.contents());if(d.$$controller){d.$scope=o,d.$element=i;var p=n(d.$$controller,d);d.$$controllerAs&&(o[d.$$controllerAs]=p,o[d.$$controllerAs][d.$$resolveAs]=f),j(p.$onInit)&&p.$onInit(),i.data("$ngControllerController",p),i.children().data("$ngControllerController",p)}m(o)}}}}}function P(e,t,n,a){var r=a(t.uiView||t.name||"")(e),o=n.inheritedData("$uiView");return r.indexOf("@")>=0?r:r+"@"+(o?o.state.name:"")}function D(e,t){var n,a=e.match(/^\s*({[^}]*})\s*$/);if(a&&(e=t+"("+a[1]+")"),!(n=e.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/))||4!==n.length)throw new Error("Invalid state ref '"+e+"'");return{state:n[1],paramExpr:n[3]||null}}function S(e){var t=e.parent().inheritedData("$uiView");if(t&&t.state&&t.state.name)return t.state}function R(e){var t="[object SVGAnimatedString]"===Object.prototype.toString.call(e.prop("href")),n="FORM"===e[0].nodeName;return{attr:n?"action":t?"xlink:href":"href",isAnchor:"A"===e.prop("tagName").toUpperCase(),clickable:!n}}function O(e,t,n,a,r){return function(o){var s=o.which||o.button,i=r();if(!(s>1||o.ctrlKey||o.metaKey||o.shiftKey||e.attr("target"))){var u=n(function(){t.go(i.state,i.params,i.options)});o.preventDefault();var c=a.isAnchor&&!i.href?1:0;o.preventDefault=function(){c--<=0&&n.cancel(u)}}}}function I(e,t){return{relative:S(e)||t.$current,inherit:!0}}function x(e,n){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(a,r,o,s){var i,u=D(o.uiSref,e.current.name),c={state:u.state,href:null,params:null},l=R(r),d=s[1]||s[0],f=null;c.options=W(I(r,e),o.uiSrefOpts?a.$eval(o.uiSrefOpts):{});var m=function(n){n&&(c.params=t.copy(n)),c.href=e.href(u.state,c.params,c.options),f&&f(),d&&(f=d.$$addStateInfo(u.state,c.params)),null!==c.href&&o.$set(l.attr,c.href)};u.paramExpr&&(a.$watch(u.paramExpr,function(e){e!==c.params&&m(e)},!0),c.params=t.copy(a.$eval(u.paramExpr))),m(),l.clickable&&(i=O(r,e,n,l,function(){return c}),r[r.on?"on":"bind"]("click",i),a.$on("$destroy",function(){r[r.off?"off":"unbind"]("click",i)}))}}}function L(e,t){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,a,r,o){function s(t){f.state=t[0],f.params=t[1],f.options=t[2],f.href=e.href(f.state,f.params,f.options),m&&m(),c&&(m=c.$$addStateInfo(f.state,f.params)),f.href&&r.$set(u.attr,f.href)}var i,u=R(a),c=o[1]||o[0],l=[r.uiState,r.uiStateParams||null,r.uiStateOpts||null],d="["+l.map(function(e){return e||"null"}).join(", ")+"]",f={state:null,params:null,options:null,href:null},m=null;n.$watch(d,s,!0),s(n.$eval(d)),u.clickable&&(i=O(a,e,t,u,function(){return f}),a[a.on?"on":"bind"]("click",i),n.$on("$destroy",function(){a[a.off?"off":"unbind"]("click",i)}))}}}function M(e,t,n){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(t,a,r,o){function s(t,n,r){var o=e.get(t,S(a)),s=i(t,n),u={state:o||{name:t},params:n,hash:s};return h.push(u),v[s]=r,function(){var e=h.indexOf(u);-1!==e&&h.splice(e,1)}}function i(e,n){if(!F(e))throw new Error("state should be a string");return N(n)?e+Y(n):(n=t.$eval(n),N(n)?e+Y(n):e)}function u(){for(var e=0;e0)){var n=s(e,t,p);return u(),n}},t.$on("$stateChangeSuccess",u),u()}]}}function E(e){var t=function(t,n){return e.is(t,n)};return t.$stateful=!0,t}function k(e){var t=function(t,n,a){return e.includes(t,n,a)};return t.$stateful=!0,t}var B=t.isDefined,j=t.isFunction,F=t.isString,N=t.isObject,U=t.isArray,H=t.forEach,W=t.extend,V=t.copy,Y=t.toJson;t.module("ui.router.util",["ng"]),t.module("ui.router.router",["ui.router.util"]),t.module("ui.router.state",["ui.router.router","ui.router.util"]),t.module("ui.router",["ui.router.state"]),t.module("ui.router.compat",["ui.router"]),v.$inject=["$q","$injector"],t.module("ui.router.util").service("$resolve",v),g.$inject=["$http","$templateCache","$injector"],t.module("ui.router.util").service("$templateFactory",g);var G;b.prototype.concat=function(e,t){var n={caseInsensitive:G.caseInsensitive(),strict:G.strictMode(),squash:G.defaultSquashPolicy()};return new b(this.sourcePath+e+this.sourceSearch,W(n,t),this)},b.prototype.toString=function(){return this.source},b.prototype.exec=function(e,t){var n=this.regexp.exec(e);if(!n)return null;t=t||{};var a,r,o,s=this.parameters(),i=s.length,u=this.segments.length-1,c={};if(u!==n.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var l,d;for(a=0;a=":e}};return a.all(n).then(function(e){return e&&e.length?r.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,t,n){"use strict";n.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(n,a,r){return n.debug("AbsenceTypeAPI"),a.extend({all:function(t){return n.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(t||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,o,s){return n.debug("AbsenceTypeAPI.calculateToilExpiryDate"),s=e.assign({},s,{absence_type_id:a,date:t(o).format(r.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",s).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,t){return e.debug("AbsenceTypeInstance"),t.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,t){"use strict";t.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(t,n,a,r,o,s){return t.debug("AbsenceType"),a.extend({all:function(e){return o.all(e).then(function(e){return e.map(function(e){return s.init(e,!0)})})},calculateToilExpiryDate:function(e,t,n){return o.calculateToilExpiryDate(e,t,n)},canExpire:function(e){return o.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(t){return r.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(n){return n=e.indexBy(n,"value"),e.map(t,function(t){return e.assign(t,{calculation_unit_label:n[t.calculation_unit].label,calculation_unit_name:n[t.calculation_unit].name})})})}})}])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/components/leave-balance-tab-filters.component",["common/lodash","common/moment","leave-absences/shared/modules/components"],function(e,t,n){function a(n){function a(e){e.absencePeriods&&c.absencePeriods.length&&(c.filters.period_id=o().id),e.absenceTypes&&c.absenceTypes.length&&(c.filters.type_id=s().id),(e.loggedInContactId||e.userRole)&&(c.filters.managed_by="manager"===c.userRole?c.loggedInContactId:void 0),r()&&c.submitFilters()}function r(){return e.every(c.filters,function(e){return null!==e})}function o(){return e.find(c.absencePeriods,function(e){return e.current})||c.absencePeriods.reduce(function(e,n){return t(e.end_date).isAfter(n.end_date)?e:n})}function s(){return c.absenceTypes.reduce(function(e,t){return e.title.localeCompare(t.title)?e:t})}function i(e){return e.current?"Current Period ("+e.title+")":e.title}function u(){n.$emit("LeaveBalanceFilters::update",c.filters)}var c=this;c.filters={period_id:null,type_id:null,managed_by:null},c.$onChanges=a,c.labelPeriod=i,c.submitFilters=u}n.component("leaveBalanceTabFilters",{controller:a,controllerAs:"balanceFilters",bindings:{absencePeriods:"<",absenceTypes:"<",loggedInContactId:"<",lookupContacts:"<",userRole:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-balance-tab-filters.html"}]}),a.$inject=["$scope"]}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,n){function a(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(n.remainder=a[0].remainder),delete n["api.LeavePeriodEntitlement.getremainder"],n}function r(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return n.value=a,delete n["api.LeavePeriodEntitlement.getentitlement"],n}return e.debug("EntitlementAPI"),n.extend({all:function(t,n){return e.debug("EntitlementAPI.all"),t["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},n&&(t["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",t,!1).then(function(e){return e.values}).then(function(e){return e=e.map(r),n&&(e=e.map(a)),e})},breakdown:function(t){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",t).then(function(e){return e.values})},getLeaveBalances:function(t,n,a,r,o){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",t,n,a,r,"getLeaveBalances",o)}})}])}),define("leave-absences/shared/models/leave-balance-report.model",["leave-absences/shared/modules/models","leave-absences/shared/apis/entitlement.api","common/models/model"],function(e){"use strict";e.factory("LeaveBalanceReport",["Model","EntitlementAPI",function(e,t){return e.extend({all:function(e,n,a,r,o){return t.getLeaveBalances(this.processFilters(e),n,a,r,o)}})}])}),define("leave-absences/shared/components/leave-balance-tab.component",["common/angular","common/lodash","leave-absences/shared/modules/components","leave-absences/shared/components/leave-balance-tab-filters.component","leave-absences/shared/models/leave-balance-report.model","common/services/notification.service","common/services/pub-sub"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l,d,f){function m(){return r.all({options:{sort:"title ASC"}}).then(function(e){T.absencePeriods=e})}function p(){return o.all().then(o.loadCalculationUnits).then(function(e){T.absenceTypes=e})}function h(){return s.all(null,null,"sort_name ASC").then(function(e){T.lookupContacts=e.list})}function v(){return n.all([m(),p(),h(),g(),q()]).catch(function(e){u.error("Error",e)})}function g(){return l.get().then(function(e){T.loggedInContactId=e.contactId})}function b(){return T.loading.report=!0,i.all(w,T.pagination,void 0,void 0,!1).then(function(e){T.report=y(e.list),T.reportCount=e.total}).catch(function(e){u.error("Error",e.error_message)}).finally(function(){T.loading.report=!1})}function y(n){return n.map(function(n){return n=e.copy(n),n.absence_types=t.indexBy(n.absence_types,function(e){return e.id}),n})}function _(){a.$on("LeaveBalanceFilters::update",C),c.subscribe("LeaveRequest::new",$)}function q(){return f(d.permissions.admin.administer).then(function(e){T.userRole=e?"admin":"manager"})}function $(e){C(e,w)}function C(e,t){w=t,T.pagination.page=1,A(),T.loadReportCurrentPage()}function A(){T.selectedAbsenceTypes=T.absenceTypes.filter(function(e){return+e.id==+w.type_id})}var w={},T=this;T.absencePeriods=[],T.absenceTypes=[],T.loading={component:!0,report:!0},T.loggedInContactId=null,T.lookupContacts=[],T.pagination={page:1,size:50},T.report=[],T.reportCount=0,T.userRole=null,T.loadReportCurrentPage=b,function(){_(),v().then(function(){T.loading.component=!1})}()}n.component("leaveBalanceTab",{controller:a,controllerAs:"leaveBalanceTab",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-balance-tab.html"}]}),a.$inject=["$q","$rootScope","AbsencePeriod","AbsenceType","Contact","LeaveBalanceReport","notificationService","pubSub","Session","shared-settings","checkPermissions"]}),define("leave-absences/shared/modules/controllers",["common/angular","common/angularBootstrap","leave-absences/shared/modules/models","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){return e.module("leave-absences.controllers",["ui.select","leave-absences.models","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers","common/models/contract","common/services/notification.service"],function(e,t,n){function a(t,n,a,r,o,s,i){function u(){return{loadContacts:function(){return l.loadContactsForAdmin()}}}function c(e){s.info("",["

    When All filter is selected, all staff members with contracts which are active in the selected absence period are displayed.

    ","

    People I approve filter displays only staff members who you approve leave for.

    ","

    People without approver filter displays all staff members with contracts which are active in the selected absence period and who do not have any leave approver assigned.

    "].join(""))}t.debug("LeaveCalendarAdminController");var l,d;return{init:function(t){return d=t,l=i.init(d),d.filters.userSettings.assignedTo=e.find(d.filtersByAssignee,{type:"me"}),d.showContactDetailsLink=!0,d.showContactName=!0,d.showFilters=!0,d.showAdminFilteringHint=c,u()}}}n.controller("LeaveCalendarAdminController",["$log","$q","Contact","ContactInstance","Contract","notificationService","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(t,n,a,r){function o(){return{loadContacts:function(){return s.loadLookUpAndFilteredContacts()}}}t.debug("LeaveCalendarManagerController");var s,i;return{init:function(t){return i=t,s=r.init(i),i.filters.userSettings.assignedTo=e.find(i.filtersByAssignee,{type:"me"}),i.showContactName=!0,i.showFilters=!0,o()}}}n.controller("LeaveCalendarManagerController",["$log","Contact","ContactInstance","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(e,t,n,a){function r(){return{loadContacts:function(){return s.displaySingleContact?o.loadFilteredContacts():"admin"===s.userPermissionRole?o.loadContactsForAdmin():o.loadLookUpAndFilteredContacts()}}}e.debug("LeaveCalendarStaffController");var o,s;return{init:function(e){return s=e,o=a.init(s),s.filters.userSettings.contacts_with_leaves=!0,s.showTheseContacts=[s.contactId],s.showContactName=!0,s.showFilters=!0,s.displaySingleContact&&(s.showFilters=!1,s.lookupContacts=[{id:s.contactId}]),r()}}}n.controller("LeaveCalendarStaffController",["$log","$q","Contact","LeaveCalendarService",a])}),define("leave-absences/shared/components/leave-calendar.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l,d){function f(){H.supportData.absenceTypes.push({id:"",title:"Leave",color:"#4D4D68",calculation_unit:e.chain(H.supportData.calculationUnits).find({name:"days"}).get("value").value()})}function m(){for(var e=[],n=t(H.selectedPeriod.start_date).clone().startOf("month"),a=t(H.selectedPeriod.end_date).clone().endOf("month");n.isBefore(a);)e.push(S(n)),n.add(1,"month");H.months=e}function p(){return e.includes(["admin","manager"],H.userPermissionRole)}function h(e){return e.format("YYYY-MM")}function v(){o.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){H.supportData.absenceTypesToFilterBy=t,x(!0)})}function g(){o.$new().$watch(function(){return H.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(B(),k(),x())})}function b(e){H.injectMonth=!0,F("injected").then(function(){x(e)}).then(function(){H.loading.calendar=!1})}function y(){N=n("LeaveCalendar"+e.capitalize(U)+"Controller").init(H)}function _(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return i.all().then(function(t){H.absencePeriods=e.sortBy(t,"start_date"),H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current})}).then(m).then(L)}function $(){return u.all().then(u.loadCalculationUnits)}function C(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function A(){return N.loadContacts().then(function(e){H.contacts=e})}function w(){return l.valuesOf(["hrjc_region","hrjc_location","hrjc_level_type","hrjc_department"]).then(function(e){H.filters.optionValues.regions=e.hrjc_region,H.filters.optionValues.locations=e.hrjc_location,H.filters.optionValues.levelTypes=e.hrjc_level_type,H.filters.optionValues.departments=e.hrjc_department})}function T(){return c.all()}function P(){return a.all([$(),T(),C()]).then(function(t){H.supportData.absenceTypes=t[0],H.supportData.publicHolidays=t[1],H.supportData.calculationUnits=t[2].hrleaveandabsences_absence_type_calculation_unit,H.supportData.dayTypes=t[2].hrleaveandabsences_leave_request_day_type,H.supportData.leaveRequestStatuses=t[2].hrleaveandabsences_leave_request_status,H.supportData.toilAmounts=e.indexBy(t[2].hrleaveandabsences_toil_amounts,"value")})}function D(){var e=a.resolve();return H.injectMonth&&(e=F("destroyed"),H.injectMonth=!1),e}function S(e){return{index:h(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:t().year(e.year()).month(e.month())}}function R(){var t=H.selectedPeriod.id;H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current}),t!==H.selectedPeriod.id&&m(),L(),k(),I("month")}function O(e){var n="previous"===e?"subtract":"add";B(t(H.selectedMonth.moment)[n](1,"month")),k(),I("month")}function I(t){t=e.includes(["contacts","period","month"],t)?t:"period",a.resolve().then(D).then("period"===t&&m).then("period"===t&&M).then("contacts"===t&&A).then("month"===t&&k).then(function(){b("contacts"===t)})}function x(e){o.$emit("LeaveCalendar::showMonth",!!e)}function L(){B(t())}function M(){B(H.months[0].moment)}function E(n){var a="previous"===n?"first":"last",r=e[a](H.months),o=t().year(r.year).month(r.month);H.monthPaginatorsAvailability[n]=!H.selectedMonth.moment.isSame(o,"month")}function k(){E("previous"),E("next")}function B(t){t&&(H.selectedMonthIndex=h(t)),H.selectedMonth=e.find(H.months,{index:H.selectedMonthIndex})}function j(){return a.all([d(s.permissions.admin.administer),d(s.permissions.ssp.manage)]).then(function(e){H.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",U=H.roleOverride?H.roleOverride:H.userPermissionRole})}function F(t){return a(function(n){var a=o.$on("LeaveCalendar::month"+e.capitalize(t),function(){a(),n()})})}r.debug("Component: leave-calendar");var N,U,H=this;H.absencePeriods=[],H.contacts=[],H.contactIdsToReduceTo=null,H.injectMonth=!1,H.months=[],H.selectedMonth={},H.selectedMonthIndex="",H.selectedPeriod=null,H.showContactName=!1,H.showFilters=!1,H.userPermissionRole="staff",H.loading={calendar:!0,page:!0},H.filters={hideOnMobile:!0,optionValues:{},userSettings:{contact:null,contacts_with_leaves:!0,department:null,level_type:null,location:null,region:null},absenceTypes:{}},H.filtersByAssignee=[{type:"me",label:"People I approve"},{type:"unassigned",label:"People without approver"},{type:"all",label:"All"}],H.filters.userSettings.assignedTo=H.filtersByAssignee[2],H.monthPaginatorsAvailability={previous:!0,next:!0},H.supportData={absenceTypesToFilterBy:[]},H.canManageRequests=p,H.labelPeriod=_,H.navigateToCurrentMonth=R,H.paginateMonth=O,H.refresh=I,function(){j().then(g).then(v).then(y).then(D).then(function(){return a.all([q(),A(),P(),H.showFilters?w():e.noop])}).then(function(){f(),b(),k()}).then(function(){H.loading.page=!1})}()}n.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,n={from_date:{to:X.month.days[X.month.days.length-1].date+" 23:59:59"},to_date:{from:X.month.days[0].date+" 00:00:00"},status_id:{IN:O()},contact_id:{IN:X.contacts.map(function(e){return e.id})},type_id:{IN:t?X.supportData.absenceTypesToFilterBy:e.pluck(X.supportData.absenceTypes,"id")}};return b(),s.all(n,null,null,null,!1).then(function(e){return z={},t&&(e.list=_(e.list)),C(e.list)})}function L(){var t=X.month.days[0].date,n=X.month.days[X.month.days.length-1].date;return o.get(X.contacts.map(function(e){return e.id}),t,n).then(function(t){G=e.indexBy(t,"contact_id")})}function M(){return X.contactIdsToReduceTo&&(X.contacts=X.contacts.filter(function(t){return e.includes(X.contactIdsToReduceTo,t.contact_id)||e.find(z,function(e){return e.contact_id===t.contact_id})})),a.resolve()}function E(t){var n=S(t);z[t.contact_id]=z[t.contact_id]||{},n.forEach(function(n){e.remove(z[t.contact_id][n.date],function(e){return e.id===t.id})})}function k(){r.$emit("LeaveCalendar::monthDestroyed"),Y.map(function(e){e.remove?e.remove():e()})}function B(t,n,r){var o,s;return t.contactsData[n]=t.contactsData[n]||{},s=f(n),o=!0===r?a.resolve():a.all([s.isWeekend(p(t.date)),s.isNonWorkingDay(p(t.date))]).then(function(a){e.assign(t.contactsData[n],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:P(t.date)})}),o.then(function(){return z[n]&&z[n][t.date]?z[n][t.date]:[]}).then(function(a){a=N(a),e.assign(t.contactsData[n],{leaveRequests:a,leaveRequestsToShowInCell:v(a),leaveRequestsAttributes:q(t,a)})})}function j(){return a.all(X.month.days.map(function(e){return a.all(X.contacts.map(function(t){return B(e,t.id)}))}))}function F(e,t){X.currentPage=0,X.visible=!0,(t||!V)&&I()}function N(n){return e.sortBy(n,function(e){return+t(e.from_date).format("X")+(w("half_day_pm",e,e.from_date)?1:0)})}function U(t){var n=e.find(X.supportData.absenceTypes,function(e){return e.id===t.type_id});return t.balance_change>0?{borderColor:n.color}:{borderColor:n.color,backgroundColor:n.color}}function H(e){h(e),-1!==O().indexOf(e.status_id)&&c(e)}function W(e){return a.all(S(e).map(function(t){return B(t,e.contact_id,!0)}))}n.debug("Component: leave-calendar-month");var V=!1,Y=[],G={},z={},X=this;X.currentPage=0,X.pageSize=20,X.visible=!1,X.showContactName=!!X.showContactName,X.showOnlyWithLeaveRequests=!!X.showOnlyWithLeaveRequests,X.$onDestroy=k,X.contactsList=m,X.getContactUrl=y,function(){var e=t().month(X.month.month).year(X.month.year);$(),A(),X.month=l(e),r.$emit("LeaveCalendar::monthInjected")}()}n.component("leaveCalendarMonth",{bindings:{showTheseContacts:"<",contacts:"<",contactIdsToReduceTo:"<",month:"<",period:"<", -showContactName:"<",showContactDetailsLink:"<",showOnlyWithLeaveRequests:"<",supportData:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-month.html"}],controllerAs:"month",controller:["$log","$q","$rootScope","Calendar","LeaveRequest","pubSub","shared-settings",a]})}),define("leave-absences/shared/modules/services",["common/angular","common/modules/services"],function(e){"use strict";return e.module("leave-absences.services",["common.services"])}),define("leave-absences/shared/services/leave-request.service",["common/lodash","leave-absences/shared/modules/services"],function(e,t){"use strict";function n(t,n,a){function r(){var t=n.defer();return a.open(e.defaults(o(),{onConfirm:function(){t.resolve(!0)}})),t.promise}function o(){return{title:"Recalculate Balance Change?",copyCancel:"Cancel",copyConfirm:"Yes",classConfirm:"btn-warning",msg:"The leave balance change has updated since this leave request was created. Do you want to recalculate the balance change?"}}return t.debug("LeaveRequest"),{getBalanceChangeRecalculationPromptOptions:o,promptBalanceChangeRecalculation:r}}t.factory("LeaveRequestService",n),n.$inject=["$log","$q","dialog"]}),define("leave-absences/shared/components/leave-request-actions.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/services/notification.service","common/services/pub-sub","leave-absences/shared/services/leave-request.service"],function(e,t,n){function a(n,a,r,o,s,i,u,c){function l(t){q=$.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===$.leaveRequest.request_type?r.open(h(t)):m(t)}function d(){return"admin"===$.role&&"public_holiday"===$.leaveRequest.request_type}function f(n){var a=$.absenceTypes[$.leaveRequest.type_id].allow_request_cancelation;return"admin"===$.role||("manager"===$.role?e.includes([C.awaitingApproval,C.moreInformationRequired],n):"3"===a?t().isBefore($.leaveRequest.from_date):"2"===a)}function m(t){r.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return $.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(s.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){g(t)}}):h(t)})}})}function p(){e.isArray($.leaveRequestStatuses)&&($.leaveRequestStatuses=e.indexBy($.leaveRequestStatuses,"value")),e.isArray($.absenceTypes)&&($.absenceTypes=e.indexBy($.absenceTypes,"id"))}function h(e){var t=A[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return $.leaveRequest[e]().then(function(){b(e)}).catch(function(e){c.error("Error:",e)})}}}function v(e,t){e.stopPropagation(),o.openModal(t)}function g(e){o.openModal({leaveRequest:$.leaveRequest,leaveType:$.leaveRequest.request_type,selectedContactId:$.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:u.statusNames[w[e]]})}function b(t){var n=e.find($.leaveRequestStatuses,function(e){return e.name===u.statusNames.awaitingApproval}).value;q===n&&i.publish("ManagerBadge:: Update Count"),i.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:$.leaveRequest})}function y(){var t=$.leaveRequestStatuses[$.leaveRequest.status_id].name,n=e.compact(e.map(A,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!f(t)&&e.pull(n,"cancel"),"admin"!==$.role&&e.pull(n,"delete"),"staff"===$.role&&e.pull(n,"approve","reject"),"staff"!==$.role&&_(n),d()&&n.push("delete"),$.allowedActions=e.map(n,function(e){return{key:e,label:A[e].label,isDirectAction:A[e].isDirectAction}})}function _(t){e.each(t,function(n,a){"edit"===n&&(t[a]="respond"),e.includes(["respond","view"],n)&&(t[a]="edit")})}n.debug("Component: leave-request-action-dropdown");var q,$=this,C=u.statusNames,A={edit:{label:"Edit",allowedStatuses:[C.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[C.moreInformationRequired]},view:{label:"View",allowedStatuses:[C.approved,C.rejected,C.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[C.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[C.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[C.awaitingApproval,C.approved,C.rejected,C.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[C.awaitingApproval,C.moreInformationRequired,C.approved,C.rejected,C.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},w={approve:"approved"};$.allowedActions=[],$.action=l,$.openLeavePopup=v,function(){p(),y()}()}n.component("leaveRequestActions",{bindings:{leaveRequest:"<",leaveRequestStatuses:"<",absenceTypes:"<",role:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-actions.html"}],controllerAs:"actions",controller:a}),a.$inject=["$log","$rootScope","dialog","LeavePopup","LeaveRequestService","pubSub","shared-settings","notificationService"]}),define("leave-absences/shared/components/leave-request-popup-comments-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/models/session.model"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){q.request.comments.push({contact_id:_,leave_request_id:q.request.id,text:q.comment.text}),q.comment.text=""}function l(){return q.comment.text.length>0}function d(e){return!e.comment_id||q.canManage}function f(e){return t.utc(e,s.serverDateTimeFormat).local().format(o.DATE_FORMAT.toUpperCase()+" HH:mm")}function m(){return q.request.comments.filter(function(e){return!e.toBeDeleted})}function p(e){return e===_?"Me":q.comment.contacts[e]?q.comment.contacts[e].display_name:void 0}function h(e){return q.mode===e}function v(){q.comment.text.length&&q.addComment()}function g(){var t=e.indexBy(q.request.comments,"contact_id"),n=Object.keys(t);return i.all({id:{IN:n}},{page:1,size:0}).then(function(t){q.comment.contacts=e.indexBy(t.list,"contact_id")})}function b(){return q.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),q.request.comments.length&&g()})}function y(){return q.loading.component=!0,u.get().then(function(e){_=e.contactId}).then(function(){q.loading.component=!1})}n.debug("Component: leave-request-popup-comments-tab");var _=null,q=this;q.loading={component:!0},q.comment={text:"",contacts:{}},q.addComment=c,q.canRemoveComment=d,q.canSubmit=l,q.formatDateTime=f,q.getActiveComments=m,q.getCommentorName=p,q.isMode=h,q.onBeforeSubmit=v,function(){r.$emit("LeaveRequestPopup::addTab",q),b(),y()}()}n.component("leaveRequestPopupCommentsTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-comments-tab.html"}],controllerAs:"commentsCtrl",controller:["$log","$rootScope","$scope","HR_settings","shared-settings","Contact","Session",a]})}),define("leave-absences/shared/apis/work-pattern.api",["common/lodash","leave-absences/shared/modules/apis","common/services/api"],function(e,t){"use strict";t.factory("WorkPatternAPI",["$log","api",function(t,n){function a(t){var n=e.clone(t);return n.workPattern=n["api.WorkPattern.get"].values[0],delete n["api.WorkPattern.get"],n}return t.debug("WorkPatternAPI"),n.extend({assignWorkPattern:function(t,n,a,r,o,s){return this.sendPOST("ContactWorkPattern","create",e.assign({},s,{contact_id:t,pattern_id:n,effective_date:a,effective_end_date:r,change_reason:o})).then(function(e){return e.values})},get:function(e){return this.sendGET("WorkPattern","get",e||{}).then(function(e){return e.values})},getCalendar:function(n,a,r,o){return t.debug("WorkPatternAPI.getCalendar",n,a,r,o),this.sendGET("WorkPattern","getcalendar",e.assign({},o,{contact_id:e.isArray(n)?{IN:n}:n,start_date:a,end_date:r}))},unassignWorkPattern:function(e){return this.sendPOST("ContactWorkPattern","delete",{id:e})},workPatternsOf:function(t,n,r){return this.sendGET("ContactWorkPattern","get",e.assign({},n,{contact_id:t,"api.WorkPattern.get":{id:"$value.pattern_id"}}),r).then(function(e){return e=e.values,e.map(a)})}})}])}),define("leave-absences/shared/instances/calendar.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance"],function(e,t,n){"use strict";n.factory("CalendarInstance",["$log","$q","ModelInstance","shared-settings","OptionGroup",function(n,a,r,o,s){function i(t,n){return c().then(function(a){var r=this.days[u(t).valueOf()];return!!r&&e.find(a,function(e){return e.name===n}).value===r.type}.bind(this))}function u(e){return t(e,o.serverDateFormat).clone()}function c(){return l=l||s.valuesOf("hrleaveandabsences_work_day_type")}var l;return r.extend({defaultCustomData:function(){return{days:[]}},isNonWorkingDay:function(e){return i.call(this,e,"non_working_day")},isWeekend:function(e){return i.call(this,e,"weekend")},isWorkingDay:function(e){return i.call(this,e,"working_day")},transformAttributes:function(t){var n={};return t.calendar.forEach(function(e){n[u(e.date).valueOf()]=e}),e(t).omit("calendar").assign({days:n}).value()}})}])}),define("leave-absences/shared/models/calendar.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/calendar.instance"],function(e,t){"use strict";t.factory("Calendar",["$log","Model","WorkPatternAPI","CalendarInstance",function(t,n,a,r){return t.debug("Calendar"),n.extend({get:function(n,o,s,i){return t.debug("Calendar.get"),a.getCalendar(n,o,s,i).then(function(t){var a=t.values.map(function(e){return r.init(e)});return e.isArray(n)?a:a[0]})}})}])}),define("leave-absences/shared/components/leave-request-popup-details-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/session.model","leave-absences/shared/models/calendar.model"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l,d,f){function m(){te.balance.closing=te.balance.opening+te.balance.change.amount}function p(e){return t(e,u.serverDateFormat).toDate()}function h(e){return t(e).format(u.serverDateFormat)}function v(e){var t;return s.resolve().then(function(){N(e),"from"===e&&F(),O("hours")&&(y(e),"from"!==e||te.uiOptions.multipleDays||y("to")),te.loading[e+"DayTypes"]=!0}).then(function(){return q(e)}).then(function(e){if(t=e.id!==te.period.id,t&&(te.period=e),!te.period.id)return s.reject("Please change date as it is not in any absence period")}).then(H).then(function(){if(t)return M()}).then(function(){return te.onDateChangeExtended&&te.onDateChangeExtended(e)}).then(function(){if(G(),!t)return k();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(w).finally(_)}function g(){return G(),k()}function b(){return te.uiOptions.toDate=null,N("to"),s.resolve().then(G).then(te.setDaysSelectionModeExtended).then(_).then(!te.uiOptions.multipleDays&&k)}function y(e){te.uiOptions.times[e].loading=!0}function _(){["from","to"].forEach(function(e){te.loading[e+"DayTypes"]=!1,O("hours")&&(te.uiOptions.times[e].loading=!1)})}function q(n){var a=t(te.uiOptions[n+"Date"]).format(te.uiOptions.userDateFormat.toUpperCase());return e.find(te.absencePeriods,function(e){return e.isInPeriod(a)})||{}}function $(){return te.request?te.request.request_type:te.leaveType||null}function C(e){return t().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function A(){return z(),te.loading.balanceChange=!0,te.request.getBalanceChangeBreakdown().then(U).catch(w)}function w(t){r.$broadcast("LeaveRequestPopup::handleError",e.isArray(t)?t:[t]),te.loading.fromDayTypes=!1,te.loading.balanceChange=!1,te.loading.tab=!1,te.loading.toDayTypes=!1}function T(){return te.isMode("create")||te.forceRecalculateBalanceChange?k():A()}function P(){var e=te.request.attributes();return te.uiOptions.fromDate=p(te.request.from_date),te.request.to_date=e.to_date,te.request.to_date_type=e.to_date_type,te.uiOptions.toDate=p(te.request.to_date),te.initDayTypesExtended?te.initDayTypesExtended():s.resolve()}function D(){ee.push(r.$on("LeaveRequestPopup::absenceTypeChanged",function(){J()}),r.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,t){K(t)}),r.$on("LeaveRequestPopup::recalculateBalanceChange",k))}function S(){te.isMode("edit")&&(te.isLeaveStatus(u.statusNames.approved)||te.isLeaveStatus(u.statusNames.adminApproved))&&(Z={absenceTypeId:te.request.type_id,value:te.selectedAbsenceType.remainder-te.request.balance_change})}function R(){r.$watch(function(){return te.uiOptions.times.from.time},function(e,t){e!==t&&(te.uiOptions.multipleDays||(Q(e),G()))})}function O(e){return te.selectedAbsenceType.calculation_unit_name===e}function I(e){return te.request.request_type===e}function x(t){return e.includes(["weekend","non_working_day","public_holiday"],t)}function L(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){te.requestDayTypes=e})}function M(){return c.get(te.request.contact_id,te.period.start_date,te.period.end_date).then(function(e){te.calendar=e})}function E(){var e=(te.pagination.currentPage-1)*te.pagination.numPerPage,t=e+te.pagination.numPerPage;te.pagination.filteredbreakdown=te.balance.change.breakdown.slice(e,t)}function k(){return z(),te.canCalculateChange()?(te.loading.balanceChange=!0,te.request.change_balance=!0,te.calculateBalanceChange().then(U).catch(w).finally(function(){te.loading.balanceChange=!1})):s.resolve()}function B(){te.pagination.totalItems=te.balance.change.breakdown.length,te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.pageChanged()}function j(){return h(te.request.from_date)===h(te.request.to_date)}function F(){te.uiOptions.toDate&&te.uiOptions.fromDate&&te.uiOptions.multipleDays&&t(te.uiOptions.toDate).isSameOrBefore(te.uiOptions.fromDate)&&(te.uiOptions.toDate=null,N("to"))}function N(e){te.resetUIInputsExtended&&te.resetUIInputsExtended(e),G(),z()}function U(e){te.balance.change=e,te.request.balance_change=e.amount,m(),B(),te.loading.balanceChange=!1}function H(){var e,n,a;te.uiOptions.fromDate?(e=t(te.uiOptions.fromDate).add(1,"day").toDate(),a=e,n=e):(a=p(te.period.start_date),n=te.uiOptions.date.to.options.minDate),te.uiOptions.date.to.options.initDate=n,te.uiOptions.date.to.options.minDate=a,te.uiOptions.date.to.options.maxDate=p(te.period.end_date)}function W(){return!te.isMode("create")&&j()||te.isMode("create")&&(I("sickness")||O("hours"))?te.uiOptions.multipleDays=!1:te.uiOptions.multipleDays=!0,s.resolve().then(te.setDaysSelectionModeExtended)}function V(){Z&&Z.absenceTypeId===te.selectedAbsenceType.id?te.balance.opening=Z.value||0:te.balance.opening=te.selectedAbsenceType.remainder}function Y(){te.selectedAbsenceType=e.find(te.absenceTypes,function(e){return e.id===te.request.type_id})}function G(){var e=te.uiOptions,t=e.times;te.request.from_date=e.fromDate?h(e.fromDate):null,te.request.to_date=e.toDate?h(e.toDate):null,!e.multipleDays&&e.fromDate&&(te.request.to_date=te.request.from_date,te.request.to_date_type=te.request.from_date_type),(O("hours")||I("toil"))&&(te.request.from_date=te.request.from_date&&t.from.time?te.request.from_date+" "+t.from.time:null,te.request.to_date=te.request.to_date&&t.to.time?te.request.to_date+" "+t.to.time:null)}function z(){te.uiOptions.showBalance=te.canCalculateChange()}function X(){e.forEach(ee,function(e){e()})}function J(){var e,t=te.selectedAbsenceType.calculation_unit_name;return Y(),e=t!==te.selectedAbsenceType.calculation_unit_name,V(),s.resolve().then(e&&W).then(e&&te.onAbsenceTypeUpdateExtended).then(e&&G).then(_).then(k)}function K(e){return te.absenceTypes=e,Y(),t(te.uiOptions.toDate).isAfter(te.period.end_date)&&(te.uiOptions.toDate=void 0,N("to")),V(),k()}function Q(e){var t=C(e).add(te.uiOptions.time_interval,"minutes");t.isAfter(C(te.uiOptions.times.to.max))||(te.uiOptions.times.to.min=t.format("HH:mm"),t.isAfter(C(te.uiOptions.times.to.time))&&(te.uiOptions.times.to.time=""))}a.debug("Component: leave-request-popup-details-tab");var Z=null,ee=[],te=this;te.canManage=!1,te.calendar={},te.errors=[],te.isRequired=!0,te.requestDayTypes=[],te.statusNames=u.statusNames,te.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},te.pagination={currentPage:1,filteredbreakdown:te.balance.change.breakdown,numPerPage:7,totalItems:te.balance.change.breakdown.length,pageChanged:E},te.uiOptions={isChangeExpanded:!1,multipleDays:!0,userDateFormat:i.DATE_FORMAT,showBalance:!1,date:{from:{show:!1,options:{startingDay:1,showWeeks:!1}},to:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}},expiry:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}}},times:{from:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""},to:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""}},time_interval:15},te.convertDateFormatFromServer=p,te.convertDateToServerFormat=h,te.dateChangeHandler=v,te.dateTypeChangeHandler=g,te.daysSelectionModeChangeHandler=b,te.disableAndShowLoadingTimeInput=y,te.getMomentDateWithGivenTime=C,te.handleError=w,te.isCalculationUnit=O,te.isLeaveType=I,te.isNotWorkingDay=x,te.performBalanceChangeCalculation=k,te.setRequestDateTimesAndDateTypes=G,te.updateEndTimeInputMinTime=Q,te.$onDestroy=X,function(){n("RequestModalDetails"+e.capitalize($(te.leaveType,te.request))+"Controller",{detailsController:te}),te.canManage=te.isRole("manager")||te.isRole("admin"),te.loading.tab=!0,o.$emit("LeaveRequestPopup::addTab",te),D(),te.initChildController().then(function(){return s.all([M(),L()])}).then(!te.isMode("create")&&P).then(W).then(function(){if(!te.isMode("create"))return s.resolve().then(te.initTimesExtended).then(G)}).then(!te.isMode("create")&&H).then(S).then(V).then(T).then(R).then(!te.isMode("view")&&te.initWatchersExtended).catch(w).finally(function(){te.loading.tab=!1})}()}n.component("leaveRequestPopupDetailsTab",{bindings:{absencePeriods:"<",absenceTypes:"<",balance:"=",request:"<",isLeaveStatus:"<",leaveType:"<",isMode:"<",isSelfRecord:"<",period:"=",isRole:"<",selectedAbsenceType:"=",forceRecalculateBalanceChange:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-details-tab.html"}],controllerAs:"detailsTab",controller:a}),a.$inject=["$controller","$log","$rootScope","$scope","$q","HR_settings","shared-settings","Calendar","OptionGroup","LeaveRequest","$timeout"]}),define("leave-absences/shared/components/leave-request-popup-files-tab",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/file-upload","common/services/file-mime-types","common/services/hr-settings"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l){function d(){return R.fileUploader&&R.fileUploader.queue.length>0}function f(){return R.getFilesAmount()0?P.map(function(e){return e.label}).join(", "):""}function q(){return R.request.loadAttachments().then(function(){r.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function $(){return a.all(P.map(function(e){return l.getMimeTypeFor(e.label).then(function(t){S[e.label]=t})})).catch(function(){S=null})}function C(){return u.valuesOf("safe_file_extension").then(function(e){P=e})}function A(e){return!e.attachment_id||R.canManage}function w(){e.forEach(D,function(e){e()})}function T(e,t){R.fileUploader.queue&&R.fileUploader.queue.length>0?R.fileUploader.uploadAll({entityID:R.request.id}).then(function(){t()}).catch(t):t()}n.debug("Component: leave-request-popup-files-tab");var P=[],D=[],S={},R=Object.create(this);return R.filesLoaded=!1,R.fileUploader=null,R.today=Date.now(),R.userDateFormatWithTime=s.DATE_FORMAT+" HH:mm",R.userDateFormat=s.DATE_FORMAT,R.$onDestroy=w,R.canRemoveAttachment=A,R.canSubmit=d,R.canUploadMore=f,R.formatDateTime=m,R.getAuthorName=p,R.getFilesAmount=h,R.listFileTypes=_,function(){r.$broadcast("LeaveRequestPopup::childComponent::register"),o.$emit("LeaveRequestPopup::addTab",R),b(),a.all([C(),q()]).then(y).finally(function(){R.filesLoaded=!0})}(),R}n.component("leaveRequestPopupFilesTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-files-tab.html"}],controllerAs:"filesTab",controller:["$log","$q","$rootScope","$scope","HR_settings","shared-settings","OptionGroup","FileUpload","fileMimeTypes",a]})}),define("leave-absences/shared/components/leave-request-record-actions.component",["leave-absences/shared/modules/components","common/services/hr-settings","common/services/before-hash-query-params.service"],function(e){function t(e,t,n){function a(e){t.openModal(e)}e.debug("Component: leave-request-record-actions");var r,o=this;o.leaveRequestOptions=[{type:"leave",icon:"briefcase",label:"Leave"},{type:"sickness",icon:"stethoscope",label:"Sickness"}],o.openLeavePopup=a,function(){r=n.parse(),r.openModal&&a({leaveType:r.openModal,selectedContactId:o.selectedContactId})}()}e.component("leaveRequestRecordActions",{bindings:{contactId:"<",selectedContactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-record-actions.html"}],controllerAs:"vm",controller:["$log","LeavePopup","beforeHashQueryParams",t]})}),define("leave-absences/shared/components/manage-leave-requests.component",["common/lodash","leave-absences/shared/modules/components","common/models/contact","common/services/pub-sub"],function(e,t){function n(t,n,a,r,o,s,i,u,c,l,d,f){"use strict";function m(){U.filters.leaveRequest.contact_id=null,U.refresh()}function p(){var e=U.filters.contact;return{department:e.department,level_type:e.level_type,location:e.location,region:e.region}}function h(e){return"all"===e.name||""===e?U.leaveRequests.filter.list.length:U.leaveRequests.filter.list.filter(function(t){return t.status_id===e.value}).length}function v(t){return e.find(U.absenceTypes,{id:t})}function g(e){return new Array(e||0)}function b(t){var n=e.find(U.leaveRequestStatuses,function(e){return e.value===t});return n?n.label:null}function y(e){switch(e){case i.statusNames.approved:return"badge-success";case i.statusNames.rejected:return"badge-danger";case i.statusNames.cancelled:case"all":return"";default:return"badge-primary"}}function _(t){return e.find(U.leaveRequestStatuses,function(e){return e.name===t}).value}function q(t){var n=e.find(U.filteredUsers,function(e){return e.id===t});return n?n.display_name:null}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return u.all().then(function(t){U.absencePeriods=e.sortBy(t,"start_date"),U.filters.leaveRequest.selectedPeriod=e.find(U.absencePeriods,function(e){return!!e.current})})}function A(){return c.all().then(c.loadCalculationUnits).then(function(e){U.absenceTypes=e})}function w(e){return(U.isAdmin?r.all(p()):r.leaveManagees(U.contactId,p())).then(function(t){return U.filteredUsers=U.isAdmin?t.list:t,e?P(e):n.all([P("table"),P("filter")])}).then(function(){U.filters.leaveRequest.leaveStatus!==H&&0===U.leaveRequests.table.list.length&&U.refresh(1,!0)})}function T(){return s.valuesOf("hrjc_department").then(function(e){U.departments=e})}function P(e){var t="filter"!==e,n="table"===e?e:"content",a="filter"===e?{size:0}:U.pagination,r="filter"===e?{return:["status_id"]}:{};return U.loading[n]=!0,l.all(R(t),a,"from_date DESC",r,!1).then(function(t){U.leaveRequests[e]=t}).catch(function(){U.leaveRequests[e].list=[]}).finally(function(){U.loading[n]=!1})}function D(){return s.valuesOf("hrjc_level_type").then(function(e){U.levelTypes=e})}function S(){return s.valuesOf("hrjc_location").then(function(e){U.locations=e})}function R(t){var n=U.filters.leaveRequest;return{contact_id:L(),managed_by:U.isAdmin&&"me"!==n.assignedTo.type?void 0:U.contactId,status_id:E(t),type_id:n.selectedAbsenceTypes?n.selectedAbsenceTypes.id:{IN:e.pluck(U.absenceTypes,"id")},from_date:{from:n.selectedPeriod.start_date},to_date:{to:n.selectedPeriod.end_date},unassigned:"unassigned"===n.assignedTo.type||void 0}}function O(){return s.valuesOf("hrjc_region").then(function(e){U.regions=e})}function I(){return s.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){U.leaveRequestStatuses=e.concat(U.leaveRequestStatuses)})}function x(e){d.openModal(e)}function L(){return U.filteredUsers.length>0&&U.filters.leaveRequest.contact_id?U.filters.leaveRequest.contact_id:{IN:U.filteredUsers.map(function(e){return e.id})}}function M(e){var t=[_(i.statusNames.moreInformationRequired),_(i.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function E(e){var t=U.filters.leaveRequest,n=[];if(e&&t.leaveStatus&&t.leaveStatus.value&&n.push(t.leaveStatus.value),t.pending_requests&&(n=M(n)),n.length)return{IN:n}}function k(e,t,n){e="number"==typeof e?e:1,t&&(U.filters.leaveRequest.leaveStatus=H),(e<=U.totalNoOfPages()||0===U.totalNoOfPages())&&(U.pagination.page=e,w(n))}function B(e){U.filters.leaveRequest.leaveStatus=e,U.refresh(1,!1,"table")}function j(e){U.filters.leaveRequest.assignedTo=e,U.refresh()}function F(){f.subscribe("LeaveRequest::updatedByManager",function(){U.refresh()}),f.subscribe("LeaveRequest::new",function(){U.refresh()}),f.subscribe("LeaveRequest::edit",function(){U.refresh()}),f.subscribe("LeaveRequest::delete",function(){U.refresh()}),f.subscribe("LeaveRequest::statusUpdate",function(){U.refresh()})}function N(){return Math.ceil(U.leaveRequests.table.total/U.pagination.size)}t.debug("Component: manage-leave-requests");var U=this,H={name:"all",label:"All"};U.absencePeriods=[],U.absenceTypes=[],U.filteredUsers=[],U.isFilterExpanded=!1,U.isAdmin=!1,U.leaveRequests={table:{list:[]},filter:{list:[]}},U.leaveRequestStatuses=[H],U.loading={content:!0,page:!0,table:!0},U.pagination={page:1,size:7},U.filtersByAssignee=[{type:"me",label:"Assigned To Me"},{type:"unassigned",label:"Unassigned"},{type:"all",label:"All"}],U.filters={contact:{department:null,level_type:null,location:null,region:null},leaveRequest:{leaveStatus:U.leaveRequestStatuses[0],pending_requests:!0,contact_id:null,selectedPeriod:null,selectedAbsenceTypes:null,assignedTo:U.filtersByAssignee[0]}},U.clearStaffSelection=m,U.countLeaveRequestByStatus=h,U.getAbsenceTypeByID=v,U.getArrayOfSize=g,U.getLeaveStatusByValue=b,U.getNavBadge=y,U.getUserNameByID=q,U.labelPeriod=$,U.openLeavePopup=x,U.refresh=k,U.refreshWithFilter=B,U.refreshWithFilterByAssignee=j,U.totalNoOfPages=N,function(){o(i.permissions.admin.administer).then(function(e){U.isAdmin=e,n.all([C(),A(),O(),T(),S(),D(),I()]).then(function(){U.loading.page=!1,w()}),F()})}()}t.component("manageLeaveRequests",{bindings:{contactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/manage-leave-requests.html"}],controllerAs:"vm",controller:n}),n.$inject=["$log","$q","$rootScope","Contact","checkPermissions","OptionGroup","shared-settings","AbsencePeriod","AbsenceType","LeaveRequest","LeavePopup","pubSub"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){return s.request.calculateBalanceChange(s.selectedAbsenceType.calculation_unit_name)}function l(){var e=s.request,t=!!e.from_date&&!!e.to_date,n=s.selectedAbsenceType.calculation_unit_name;return"days"===n?t=t&&!!e.from_date_type&&!!e.to_date_type:"hours"===n&&(t=t&&!isNaN(+e.from_date_amount)&&!isNaN(+e.to_date_amount)),t}function d(){return s.canCalculateChange()}function f(t,n){var a=s.uiOptions.times[t],r=e.clone(n.time_from),o=e.clone(n.time_to);s.uiOptions.multipleDays||("from"===t&&o&&r&&(o=s.getMomentDateWithGivenTime(o).subtract(s.uiOptions.time_interval,"minutes").format("HH:mm")),"to"===t&&r&&o&&(r=s.getMomentDateWithGivenTime(r).add(s.uiOptions.time_interval,"minutes").format("HH:mm"))),a.min=r||"00:00",a.max=o||"00:00",a.time="to"===t?a.max:a.min}function m(t,n){return t?(t=s.convertDateToServerFormat(t),v(t).then(function(n){return n?s.requestDayTypes.filter(function(e){return"public_holiday"===e.name}):p(t,s.requestDayTypes).then(function(t){return t.length?t:s.requestDayTypes.filter(function(t){return e.includes(["all_day","half_day_am","half_day_pm"],t.name)})})}).then(function(e){return D(n,e),e})):r.reject([])}function p(e,n){return e=t(e),r.all([s.calendar.isNonWorkingDay(e),s.calendar.isWeekend(e)]).then(function(e){return e[0]?"non_working_day":e[1]?"weekend":null}).then(function(e){return e?n.filter(function(t){return t.name===e}):[]})}function h(e,n){return t.duration(n).subtract(t.duration(e)).asHours()}function v(e){return u.all({public_holiday:1,contact_id:s.request.contact_id,from_date:{from:e},to_date:{to:e}}).then(function(e){return!!e.list.length})}function g(){return r.resolve()}function b(){return A(s.uiOptions.fromDate,"from").then(function(){return A(s.uiOptions.toDate,"to")})}function y(e){o.$watch(function(){return s.uiOptions.times[e].amount},function(e,t){s.isCalculationUnit("days")||+e==+t||(s.isRole("staff")&&(s.request.change_balance=!0),O(),s.performBalanceChangeCalculation())})}function _(e){var n=t(s.request[e+"_date"]).format("HH:mm"),a=s.uiOptions.times[e];(h(a.min,n)<=0||h(a.max,n)>=0)&&(n="from"===e?a.min:a.max),s.uiOptions.times[e].time=n}function q(){var e=s.uiOptions.multipleDays?["from","to"]:["from"],t=s.uiOptions.times;if(s.isCalculationUnit("hours"))return r.all(e.map(T)).then(function(){["from","to"].forEach(function(e){_(e),R(e),t[e].amount=Math.min(s.request[e+"_date_amount"],t[e].maxAmount).toString()}),s.uiOptions.multipleDays||s.updateEndTimeInputMinTime(s.uiOptions.times.from.time)}).then(O)}function $(){["from","to"].forEach(function(e){y(e),C(e)})}function C(e){o.$watch(function(){return s.uiOptions.times[e].time},function(t,n){s.isCalculationUnit("days")||t===n||(s.setRequestDateTimesAndDateTypes(),t&&R(e,!0))})}function A(e,t){return m(e,t).then(function(){s.loading[t+"DayTypes"]=!1})}function w(e){return A(s.uiOptions[e+"Date"],e).then(function(){if(s.isCalculationUnit("hours"))return T(e).then(function(){R(e,!0)})})}function T(e){var t=s.uiOptions[e+"Date"],n=!s.uiOptions.multipleDays;return t?s.request.getWorkDayForDate(s.convertDateToServerFormat(t)).then(function(t){x[e]=t,f(e,t),n&&"from"===e&&f("to",t)}).catch(function(t){return x[e]={},s.handleError(t)}).finally(function(){s.uiOptions.times[e].loading=!1,n&&(s.uiOptions.times.to.loading=!1)}):r.resolve()}function P(t){var n=s.uiOptions.times[t];s["request"+e.startCase(t)+"DayTypes"]=[],n.time="",n.min="00:00",n.max="00:00",n.amount="0",n.maxAmount="0"}function D(t,n){var a="request"+e.startCase(t)+"DayTypes";s[a]=n,s.isMode("create")&&(s.request[t+"_date_type"]=s[a][0].value)} -function S(){return s.isCalculationUnit("hours")&&s.uiOptions.fromDate?(s.disableAndShowLoadingTimeInput("from"),!s.uiOptions.multipleDays&&s.disableAndShowLoadingTimeInput("to"),T("from").then(function(){R("from",!0)})):r.resolve()}function R(e,t){var n=s.uiOptions,a=n.multipleDays?e:"from",r=n.times[a],o=n.multipleDays&&"to"===a?r.min:n.times.from.time,i=n.multipleDays&&"from"===a?r.max:n.times.to.time,u=x[a].number_of_hours?h(o,i).toString():"0";r.maxAmount=u,t&&(r.amount=r.maxAmount)}function O(){var e=s.uiOptions.times;s.request.from_date_amount=isNaN(+e.from.amount)?null:e.from.amount,s.request.to_date_amount=isNaN(+e.to.amount)?null:e.to.amount}function I(){return s.isCalculationUnit("hours")&&s.uiOptions.fromDate?T("from").then(function(){R("from",!0)}):r.resolve()}var x={};a.debug("RequestModalDetailsLeaveController"),s.calculateBalanceChange=c,s.canCalculateChange=l,s.canSubmit=d,s.initChildController=g,s.initDayTypesExtended=b,s.initTimesExtended=q,s.initWatchersExtended=$,s.onAbsenceTypeUpdateExtended=I,s.onDateChangeExtended=w,s.resetUIInputsExtended=P,s.setDaysSelectionModeExtended=S}n.controller("RequestModalDetailsLeaveController",a),a.$inject=["$controller","$log","$q","$rootScope","detailsController","PublicHoliday","LeaveRequest"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller",["common/lodash","leave-absences/shared/modules/controllers"],function(e,t){function n(t,n,a,r,o,s,i){function u(){return!(!i.canCalculateChange()||!i.request.sickness_reason)}function c(){return a.all([f(),h(),m(!0)])}function l(t){var n=i.request.getDocumentArray();return!!e.find(n,function(e){return e===t})}function d(t){return!!e.find(i.sicknessDocumentTypes,function(e){return e.value===t})}function f(){return s.valuesOf("hrleaveandabsences_leave_request_required_document").then(function(e){i.sicknessDocumentTypes=e})}function m(t){return s.valuesOf("hrleaveandabsences_sickness_reason",t).then(function(t){i.sicknessReasons=e.indexBy(t,"name")})}function p(){o.loadForm("/civicrm/admin/options/hrleaveandabsences_sickness_reason?reset=1").on("crmUnload",function(){m(!1)})}function h(){i.showSicknessOptionsEditorIcon=e.includes(["admin-dashboard","absence-tab"],r.section)}n.debug("RequestModalDetailsSicknessController"),t("RequestModalDetailsLeaveController",{detailsController:i}),i.canSubmit=u,i.initChildController=c,i.isChecked=l,i.isDocumentInRequest=d,i.openSicknessReasonOptionsEditor=p}t.controller("RequestModalDetailsSicknessController",n),n.$inject=["$controller","$log","$q","$rootScope","crmAngService","api.optionGroup","detailsController"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){return u.balance.change.amount=+u.request.toil_to_accrue,a.resolve(u.balance.change)}function l(){if(!u.request.from_date||!u.request.to_date)return u.uiOptions.max_toil_duration_and_accrual=null,void(u.uiOptions.toil_duration_in_hours=null);u.uiOptions.max_toil_duration_and_accrual=t.duration(t(u.request.to_date).diff(u.request.from_date)).asHours()}function d(){return v().catch(function(e){return e.length&&(u.errors=e),a.reject(e)}).then(function(e){return i.calculateToilExpiryDate(u.request.type_id,e)}).then(function(e){return u.request.toil_expiry_date=e,u.uiOptions.expiryDate=new Date(e),e})}function f(){return!!u.request.toil_to_accrue}function m(){var e=u.uiOptions.multipleDays&&!!u.request.to_date,t=!u.uiOptions.multipleDays&&!!u.request.from_date,n=t||e,a=N.from_date!==u.request.from_date||N.to_date!==u.request.to_date;return u.canDisplayToilExpirationField&&n&&H.hasExpirationFromAdminSettings&&a}function p(){return!!(u.request.from_date&&u.request.to_date&&u.request.toil_duration&&u.request.toil_to_accrue)}function h(){u.request.toil_expiry_date=!1,u.uiOptions.expiryDate=null}function v(){var e=u.uiOptions.multipleDays,t=u.request;return g({hasErrors:e?!t.to_date&&!t.from_date:!t.from_date,label:e?"To Date":"From Date",value:t.to_date})}function g(e){if(e.hasErrors){var n="Please select "+e.label+" to find expiry date";return a.reject([n])}return e.value?a.resolve(t(e.value).format("YYYY-MM-DD")):a.reject([])}function b(){var e=u.isMode("create")&&H.hasExpirationFromAdminSettings,t=H.hasPreviousExpirationDate,n=u.isLeaveType("toil"),a=u.canManage;u.canDisplayToilExpirationField=n&&(a||e||t)}function y(){u.uiOptions.toil_duration_in_hours=u.request.toil_duration/60}function _(){return H.hasPreviousExpirationDate=u.isMode("edit")&&!!u.request.toil_expiry_date,i.canExpire(u.request.type_id).then(function(e){H.hasExpirationFromAdminSettings=e})}function q(){return u.request.to_date_type=u.request.from_date_type="1",_().then(b).then($).then(D)}function $(){u.canManage&&(u.uiOptions.expiryDate=u.convertDateFormatFromServer(u.request.toil_expiry_date))}function C(){r.$watch(function(){return u.request.toil_to_accrue},function(e,t){+e!=+t&&u.performBalanceChangeCalculation()})}function A(){r.$watch(function(){return u.uiOptions.toil_duration_in_hours},function(e,t){e!==t&&u.isCalculationUnit("hours")&&I(),u.request.toil_duration=u.uiOptions.toil_duration_in_hours?60*u.uiOptions.toil_duration_in_hours:null})}function w(){var e=u.uiOptions.times;e.from.time=t(u.request.from_date).format("HH:mm"),e.to.time=t(u.request.to_date).format("HH:mm"),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time)}function T(){["from","to"].forEach(function(e){r.$watch(function(){return u.uiOptions.times[e].time},function(e,t){e!==t&&(u.setRequestDateTimesAndDateTypes(),j(),l(),x())})})}function P(){u.isMode("view")||(C(),A(),T())}function D(t){return s.valuesOf("hrleaveandabsences_toil_amounts",t).then(function(t){u.toilAmounts=e.sortBy(t,function(e){return+e.weight})})}function S(){return l(),x(),j()}function R(){return M(),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time),l(),U?U=!1:x(),j()}function O(e){u.uiOptions.times[e].time=""}function I(){u.request.toil_to_accrue=u.uiOptions.toil_duration_in_hours}function x(){u.uiOptions.toil_duration_in_hours=u.uiOptions.max_toil_duration_and_accrual}function L(){N=e.cloneDeep(u.request.attributes())}function M(){u.uiOptions.multipleDays?["from","to"].forEach(function(e){u.uiOptions.times[e].min="00:00",u.uiOptions.times[e].max="23:45"}):(u.uiOptions.times.from.min="00:00",u.uiOptions.times.from.max="23:30",u.uiOptions.times.to.min="00:15",u.uiOptions.times.to.max="23:45")}function E(){u.setRequestDateTimesAndDateTypes(),l(),x(),u.isCalculationUnit("hours")?I():u.request.toil_to_accrue=null}function k(){o.loadForm("/civicrm/admin/options/hrleaveandabsences_toil_amounts?reset=1").on("crmUnload",function(){D(!1)})}function B(){u.showTOILAccrualsOptionEditorIcon=e.includes(["admin-dashboard","absence-tab"],r.section)}function j(){return m()?d().catch(a.resolve):a.resolve()}function F(){u.uiOptions.expiryDate&&(u.request.toil_expiry_date=u.convertDateToServerFormat(u.uiOptions.expiryDate))}n.debug("RequestModalDetailsToilController");var N,U=!u.isMode("create"),H={hasPreviousExpirationDate:null,hasExpirationFromAdminSettings:null};u.canDisplayToilExpirationField=!1,u.calculateBalanceChange=c,u.canCalculateChange=f,u.canSubmit=p,u.clearExpiryDate=h,u.initChildController=q,u.initTimesExtended=w,u.initWatchersExtended=P,u.onAbsenceTypeUpdateExtended=E,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=k,u.resetUIInputsExtended=O,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){L(),M(),B(),!u.isMode("create")&&y()}()}n.controller("RequestModalDetailsToilController",a),a.$inject=["$log","$q","$rootScope","crmAngService","OptionGroup","AbsenceType","detailsController"]}),define("leave-absences/shared/services/leave-calendar.service",["common/lodash","common/moment","leave-absences/shared/modules/services"],function(e,t,n){"use strict";function a(n,a,r,o){function s(n){function s(){return r.all().then(function(e){return e.list})}function i(){return r.leaveManagees(void 0,{unassigned:!0})}function u(){var t=e.get(n,"filters.userSettings.assignedTo.type","all");return f().then(function(e){return n.lookupContacts=e,a.all([d(),"me"!==t?c():a.resolve(null)])}).then(function(e){var t=e[0];return n.contactIdsToReduceTo=e[1],t})}function c(){return l().then(function(a){var r=a.filter(function(e){var a=e.info.details;return t(a.period_start_date).isSameOrBefore(n.selectedPeriod.end_date)&&(t(a.period_end_date).isSameOrAfter(n.selectedPeriod.start_date)||!a.period_end_date)});return e.uniq(r.map(function(e){return e.contact_id}))})}function l(){return v?a.resolve(v):o.all()}function d(){return r.all(h(),null,"display_name").then(function(e){return e.list})}function f(){var t=e.get(n,"filters.userSettings.assignedTo.type","all");return(0,g[t])()}function m(){return f().then(function(e){n.lookupContacts=e}).then(d)}function p(){return r.leaveManagees(n.contactId)}function h(){var t={department:e.get(n,"filters.userSettings.department.value",null),level_type:e.get(n,"filters.userSettings.level_type.value",null),location:e.get(n,"filters.userSettings.location.value",null),region:e.get(n,"filters.userSettings.region.value",null)},a=!!n.filters.userSettings.contact,r=e.isArray(n.lookupContacts)&&n.lookupContacts.length,o="all"!==e.get(n,"filters.userSettings.assignedTo.type","all");return a?t.id={IN:[n.filters.userSettings.contact.id]}:(o||r)&&(t.id={IN:e.pluck(n.lookupContacts,"id")}),t}var v,g={all:s,me:p,unassigned:i};return{loadContactsForAdmin:u,loadFilteredContacts:d,loadLookUpContacts:f,loadLookUpAndFilteredContacts:m}}return n.debug("LeaveCalendarService"),{init:s}}n.factory("LeaveCalendarService",a),a.$inject=["$log","$q","Contact","Contract"]}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,t){return e.debug("EntitlementLogAPI"),t.extend({all:function(t){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",t,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,t,n){return e.debug("EntitlementInstance"),t.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return n.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,t){"use strict";t.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(t,n,a,r,o){return t.debug("Entitlement"),n.extend({all:function(e,t){return a.all(this.processFilters(e),t).then(function(e){return e.map(function(e){return r.init(e,!0)})})},breakdown:function(t,n){return a.breakdown(t).then(function(t){return n?(n.map(function(n){var a=e.find(t,function(e){return e.id===n.id});return a&&(n.breakdown=a.breakdown),n}),n):t.map(function(e){return r.init(e,!0)})})},logs:function(t){return t=e.cloneDeep(t||{}),t.contact_id&&(t["entitlement_id.contact_id"]=t.contact_id,delete t.contact_id),t.period_id&&(t["entitlement_id.period_id"]=t.period_id,delete t.period_id),t.return=t.return||[],t.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),o.all(t)}})}])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,n,a){return e.debug("LeaveRequestAPI"),n.extend({all:function(t,n,r,o,s){e.debug("LeaveRequestAPI.all");var i=a.defer();return t&&t.contact_id&&t.contact_id.IN&&0===t.contact_id.IN.length?i.resolve({list:[],total:0,allIds:[]}):i.resolve(this.getAll("LeaveRequest",t,n,r,o,"getFull",s)),i.promise},balanceChangeByAbsenceType:function(n){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var r=a.defer();return n.contact_id&&n.period_id||r.reject("contact_id and period_id are mandatory"),n=t.defaults(n,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",n,!1).then(function(e){r.resolve(e.values)}),r.promise},calculateBalanceChange:function(n){return e.debug("LeaveRequestAPI.calculateBalanceChange",n),this.sendPOST("LeaveRequest","calculatebalancechange",n).then(function(e){return e.values.breakdown=t.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,t){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:t.toString()},!1)},create:function(t){return e.debug("LeaveRequestAPI.create",t),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,attachment_id:n}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,n){return n=t.assign({},n,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",n).then(function(e){return e.values})},find:function(t){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:t},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",n,!1).then(function(e){return e.values})},getComments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",n,!1).then(function(e){return e.values})},isManagedBy:function(t,n){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:t,contact_id:n}).then(function(e){return e.values})},isValid:function(n){e.debug("LeaveRequestAPI.isValid",n);var r=a.defer();return this.sendPOST("LeaveRequest","isValid",n).then(function(e){e.count>0?r.reject(t(e.values).map().flatten().value()):r.resolve(e.values)}),r.promise},saveComment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,text:n.text,contact_id:n.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(t){e.debug("LeaveRequestAPI.update",t);var n=a.defer();return t.id||n.reject("id is mandatory field"),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,t,n){"use strict";n.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(n,a,r,o,s,i,u){function c(e){return p(e).then(function(e){var t=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=t,n.reject(e)}.bind(this))}.bind(this))}function l(){return u.all({id:this.type_id}).then(u.loadCalculationUnits).then(function(e){return n.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return p(e).then(function(e){return this.status_id===e.value}.bind(this))}function f(){var t=[];return e.forEach(this.files,function(e){e.toBeDeleted&&t.push(i.deleteAttachment(this.id,e.attachment_id))}.bind(this)),n.all(t)}function m(e){return t.duration(e.time_to).subtract(t.duration(e.time_from)).asHours()}function p(t){return r.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){return e.find(n,function(e){return e.name===t})})}function h(t){var a=e.cloneDeep(t),r=a.breakdown.length>1,o=e.first(e.values(a.breakdown)),s=e.last(e.values(a.breakdown));return n.all([this.getWorkDayForDate(o.date),r&&this.getWorkDayForDate(s.date)]).then(function(t){return o.amount=t[0].time_from?Math.min(this.from_date_amount,m(t[0])):0,r&&(s.amount=t[1].time_from?Math.min(this.to_date_amount,m(t[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,t){return e+t.amount},0),a}.bind(this))}function v(){var e=this.id,t=[];return t.push(n.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(t){return function(){return i.saveComment(e,t)}}))),t=t.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return i.deleteComment(e.comment_id)})),n.all(t)}return s.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(t){var n=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===t&&e.pull(n,"from_date_type","to_date_type"),i.calculateBalanceChange(e.pick(this,n)).then(function(e){return"hours"===t?h.call(this,e):e}.bind(this))},cancel:function(){return c.call(this,o.statusNames.cancelled)},approve:function(){return c.call(this,o.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return c.call(this,o.statusNames.rejected)},sendBack:function(){return c.call(this,o.statusNames.moreInformationRequired)},update:function(){return i.update(this.toAPI()).then(function(){return n.all([v.call(this),f.call(this)])}.bind(this))},create:function(){return i.create(this.toAPI()).then(function(e){return this.id=e.id,n.all([v.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(t){if(t.comment_id)return void(t.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return t.created_at===e.created_at&&t.text===e.text})},delete:function(){return i.delete(this.id)},getBalanceChangeBreakdown:function(){return i.getBalanceChangeBreakdown(this.id).then(function(t){return{amount:e.reduce(t.values,function(e,t){return e+parseFloat(t.amount)},0),breakdown:t.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return i.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return n.reject(e)})},isValid:function(){return i.isValid(this.toAPI())},isApproved:function(){return d.call(this,o.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,o.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,o.statusNames.cancelled)},isRejected:function(){return d.call(this,o.statusNames.rejected)},isSentBack:function(){return d.call(this,o.statusNames.moreInformationRequired)},loadComments:function(){return this.id?i.getComments(this.id).then(function(e){this.comments=e}.bind(this)):n.resolve()},roleOf:function(e){return this.contact_id===e?n.resolve("owner"):a(o.permissions.admin.administer).then(function(t){return t?"admin":i.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])},loadAttachments:function(){return this.id?i.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):n.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,t,n,a){return e.debug("LeaveRequest"),t.extend({all:function(e,t,r,o,s){return n.all(this.processFilters(e),t,r,o,s).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return n.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return n.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/apis/public-holiday.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("PublicHolidayAPI",["$log","api",function(e,t){return e.debug("PublicHolidayAPI"),t.extend({all:function(t){return e.debug("PublicHolidayAPI"),this.sendGET("PublicHoliday","get",t).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/public-holiday.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("PublicHolidayInstance",["$log","ModelInstance",function(e,t){return e.debug("PublicHolidayInstance"),t.extend({})}])}),define("leave-absences/shared/models/public-holiday.model",["common/moment","leave-absences/shared/modules/models","common/models/model","common/services/hr-settings","leave-absences/shared/apis/public-holiday.api","leave-absences/shared/instances/public-holiday.instance"],function(e,t){"use strict";t.factory("PublicHoliday",["$log","Model","PublicHolidayAPI","PublicHolidayInstance","shared-settings",function(t,n,a,r,o){return t.debug("PublicHoliday"),n.extend({all:function(e){return t.debug("PublicHoliday.all",e),a.all(e).then(function(e){return e.map(function(e){return r.init(e,!0)})})},isPublicHoliday:function(n){t.debug("PublicHoliday.isPublicHoliday",n);var r=e(n).format(o.serverDateFormat),s={date:r};return a.all(s).then(function(e){return!!e.length})}})}])}),define("leave-absences/shared/instances/sickness-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,t){"use strict";t.factory("SicknessRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(t,n){return n.extend({defaultCustomData:function(){var t={sickness_reason:null,sickness_required_documents:"",request_type:"sickness"};return e.assign({},n.defaultCustomData(),t)},getDocumentArray:function(){return this.sickness_required_documents?this.sickness_required_documents.split(","):[]},toggleDocument:function(t){var n=this.getDocumentArray(),a=n.indexOf(t);e.contains(n,t)?n.splice(a,1):n.push(t),this.sickness_required_documents=n.join(",")},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])}})}])}),define("leave-absences/shared/instances/toil-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,t){"use strict";t.factory("TOILRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(t,n){return n.extend({defaultCustomData:function(){var t={from_date_amount:0,to_date_amount:0,request_type:"toil"};return e.assign({},n.defaultCustomData(),t)},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])}})}])}),define("leave-absences/shared/controllers/request.controller",["common/angular","leave-absences/shared/modules/controllers","common/lodash","common/moment","common/models/contact","common/models/session.model","common/services/api/option-group","common/services/hr-settings","common/services/pub-sub","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/instances/leave-request.instance","leave-absences/shared/instances/sickness-request.instance","leave-absences/shared/instances/toil-request.instance","leave-absences/shared/services/leave-request.service"],function(e,t,n,a){"use strict";function r(t,r,o,s,i,u,c,l,d,f,m,p,h,v,g,b,y,_,q,$,C){function A(e){"days"===ke.selectedAbsenceType.calculation_unit_name?delete ke.request[e+"_date_amount"]:delete ke.request[e+"_date_type"]}function w(){["from","to"].forEach(A)}function T(){var e=ke.requestStatuses[_.statusNames.awaitingApproval].value;Oe.status_id===e&&e!==ke.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Ee.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Ee.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!ke.loading.entitlements&&(!!ie("admin")||!oe("view")&&!(ie("manager")&&!oe("create")))}function R(){var e=P();return ke.isMode("edit")&&(e=e&&(Y()||D())),ke.canManage&&ke.requestStatuses&&(e=e&&!!ke.getStatusFromValue(ke.newStatusOnSave)),(e=e&&!!ke.period.id)&&!ke.isMode("view")}function O(){ke.isSelfRecord?ke.request.status_id=ke.requestStatuses[_.statusNames.awaitingApproval].value:ke.canManage&&(ke.request.status_id=ke.newStatusOnSave||ke.request.status_id)}function I(){if(ke.isMode("edit")&&!ke.isRole("staff")&&"toil"!==U())return ke.request.calculateBalanceChange(ke.selectedAbsenceType.calculation_unit_name).then(function(e){if(+ke.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function x(){return"toil"!==U()&&!ke.request.change_balance}function L(){ke.errors=[]}function M(){return ke.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function E(){ne()&&!ke.isRole("staff")&&(ke.request.change_balance=!0)}function k(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return ke.request.delete().then(function(){ke.dismissModal(),d.publish("LeaveRequest::delete",ke.request)})}})}function B(){i.dismiss({$value:"cancel"})}function j(){var e=U();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function F(){return N(ke.getStatusFromValue(ke.request.status_id).name)}function N(e){return n.map(Se[e],function(e){return ke.requestStatuses[e]})}function U(){return ke.request?ke.request.request_type:ke.leaveType||null}function H(){return!ke.request||e.equals({},ke.requestStatuses)?[]:ke.request.status_id?F():N("none")}function W(e){return n.find(ke.requestStatuses,function(t){return t.value===e})}function V(e){ke.errors=n.isArray(e)?e:[e],ke.loading.absenceTypes=!1,ke.submitting=!1}function Y(){return!e.equals(Oe,ke.request.attributes())||ke.canManage&&ke.newStatusOnSave}function G(){return ke.postContactSelection=!0,ke.staffMemberSelectionComplete=!1,ke.request.contact_id?r.resolve().then(ce).then(le).then(ge).then(ye).then(te).then(X).then(ke.isMode("edit")?_e:n.noop).then(function(){ke.postContactSelection=!1,ke.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Le)return r.reject(e)}):r.reject("The contact id was not set")}function z(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];Se.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Se.awaiting_approval=e,Se.more_information_required=e,Se.rejected=e,Se.approved=e,Se.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){return ke.canManage?m.find(ke.request.contact_id).then(function(e){ke.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+xe==+n.get(ke,"leaveRequest.contact_id"),a=!n.get(ke,"leaveRequest.id");ke.isSelfRecord=e&&(t||a)}function K(){Ie.push(o.$on("LeaveRequestPopup::requestObjectUpdated",_e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){le().then(ge).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",ke.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Re++})),s.$on("$destroy",we),s.$on("LeaveRequestPopup::addTab",function(e,t){Ee.push(t)})}function Q(){var e,t;ke.request=ke.leaveRequest||null,e=U(),t=ke.initRequestAttributes(),"leave"===e?ke.request=y.init(t):"sickness"===e?ke.request=q.init(t):"toil"===e&&(ke.request=$.init(t))}function Z(){var e={};return ke.request?e=ke.request.attributes():ke.canManage||(e={contact_id:xe}),e}function ee(){if(Me="staff",!ke.isSelfRecord)return u(_.permissions.admin.administer).then(function(e){e&&(Me="admin")}).then(function(){return"staff"===Me&&u(_.permissions.ssp.manage).then(function(e){e&&(Me="manager")})}).finally(function(){ke.canManage=ke.isRole("manager")||ke.isRole("admin")})}function te(){ke.defaultStatus?ke.newStatusOnSave=ke.requestStatuses[_.statusNames[ke.defaultStatus]].value:(ke.isRole("admin")||ke.isMode("create")&&ke.isRole("manager"))&&(ke.newStatusOnSave=ke.requestStatuses[_.statusNames.approved].value)}function ne(){return!ke.request.status_id||!n.includes(["cancelled","rejected"],W(ke.request.status_id).name)}function ae(e){var t=ke.getStatusFromValue(ke.request.status_id);return!!t&&t.name===e}function re(e){return ke.request&&ke.request.request_type===e}function oe(e){return ke.mode===e}function se(e,t){var n=a(e.from_date),r=a(e.to_date);return n.isSameOrAfter(t.start_date,"day")&&r.isSameOrBefore(t.end_date,"day")}function ie(e){return Me===e}function ue(){return h.all().then(function(e){ke.absencePeriods=e})}function ce(){return v.all(j()).then(v.loadCalculationUnits).then(function(e){De={types:e,ids:e.map(function(e){return e.id})}})}function le(){return ke.loading.entitlements=!0,g.all({contact_id:ke.request.contact_id,period_id:ke.period.id,type_id:{IN:De.ids}},!0).finally(function(){ke.loading.entitlements=!1})}function de(){return p.get().then(function(e){xe=e.contactId})}function fe(){return ke.selectedContactId?m.find(ke.selectedContactId).then(function(e){ke.managedContacts=[e]}):ke.isRole("admin")?m.all().then(function(e){ke.managedContacts=n.remove(e.list,function(e){return e.id!==xe})}):m.find(xe).then(function(e){return e.leaveManagees()}).then(function(e){ke.managedContacts=e})}function me(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){ke.requestStatuses=n.indexBy(e,"name")})}function pe(e,t){var a;return n.compact(e.map(function(e){if(a=n.find(t,{type_id:e.id}))return{id:a.type_id,title:e.title+" ( "+a.remainder.current+" ) ",remainder:a.remainder.current,allow_overuse:e.allow_overuse,calculation_unit_name:e.calculation_unit_name}}))}function he(e){T(),d.publish(e,ke.request),ke.errors=[],ke.dismissModal()}function ve(){["from","to"].forEach(function(e){ke.request[e+"_date"]=Oe[e+"_date"]})}function ge(e){if(ke.absenceTypes=pe(De.types,e),!ke.absenceTypes.length)return r.reject(Le)}function be(){ke.period=n.find(ke.absencePeriods,function(e){return ke.isMode("create")?e.current:se(ke.request,e)})}function ye(){ke.isMode("create")?(ke.selectedAbsenceType=ke.absenceTypes[0],ke.request.type_id=ke.selectedAbsenceType.id):ke.selectedAbsenceType=n.find(ke.absenceTypes,function(e){return e.id===ke.request.type_id})}function _e(){Oe=e.copy(ke.request.attributes())}function qe(){var e -;ke.request.id?(e=[ke.requestStatuses[_.statusNames.approved].value,ke.requestStatuses[_.statusNames.adminApproved].value,ke.requestStatuses[_.statusNames.rejected].value,ke.requestStatuses[_.statusNames.cancelled].value],ke.mode="edit",ke.isRole("staff")&&e.indexOf(ke.request.status_id)>-1&&(ke.mode="view")):ke.mode="create"}function $e(){var e=ke.request.status_id;if(!ke.isMode("view")&&!ke.submitting)return ke.submitting=!0,O(),w(),ke.request.isValid().then(ne()&&I).then(E).then(x()&&ve).then(Ce).then(function(){return ke.isMode("edit")?Pe():M()}).catch(function(t){ke.request.status_id=e,t&&V(t)}).finally(function(){ke.submitting=!1})}function Ce(){return r.all(Ee.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Ae(){function e(e){e&&n.push(e),++a===Re&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Re>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function we(){Ie.forEach(function(e){e()})}function Te(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Pe(){return ke.request.update().then(Ae).then(function(){ke.isRole("manager")?he("LeaveRequest::updatedByManager"):(ke.isRole("staff")||ke.isRole("admin"))&&he("LeaveRequest::edit")})}t.debug("RequestCtrl");var De,Se={},Re=0,Oe={},Ie=[],xe="",Le="No entitlement",Me="",Ee=[],ke=n.assign(this,f);ke.absencePeriods=[],ke.absenceTypes=[],ke.canManage=!1,ke.contactName=null,ke.errors=[],ke.loading={absenceTypes:!0,entitlements:!0},ke.managedContacts=[],ke.mode="",ke.newStatusOnSave=null,ke.period={},ke.postContactSelection=!1,ke.requestStatuses={},ke.selectedAbsenceType={},ke.staffMemberSelectionComplete=!1,ke.submitting=!1,ke.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},ke.canChangeAbsenceType=S,ke.canSubmit=R,ke.closeAlert=L,ke.deleteLeaveRequest=k,ke.dismissModal=B,ke.getStatuses=H,ke.getStatusFromValue=W,ke.initAfterContactSelection=G,ke.initRequestAttributes=Z,ke.isLeaveStatus=ae,ke.isLeaveType=re,ke.isMode=oe,ke.isRole=ie,ke.submit=$e,ke.updateAbsenceType=Te,function(){ke.loading.absenceTypes=!0,z(),K(),de().then(J).then(function(){return r.all([ee(),ue(),me()])}).then(Q).then(qe).then(be).then(function(){return ke.canManage&&!ke.isMode("edit")&&fe()}).then(function(){if(ke.selectedContactId&&(ke.request.contact_id=ke.selectedContactId),ke.request.contact_id)return ke.initAfterContactSelection()}).catch(V).finally(function(){ke.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$inject=["$log","$q","$rootScope","$scope","$uibModalInstance","checkPermissions","api.optionGroup","dialog","pubSub","directiveOptions","Contact","Session","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","LeaveRequestInstance","shared-settings","SicknessRequestInstance","TOILRequestInstance","LeaveRequestService"]}),define("leave-absences/shared/services/leave-popup.service",["common/lodash","common/modules/angular-date","leave-absences/shared/modules/services","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/controllers/request.controller"],function(e,t){"use strict";function n(e,t,n,a,r,o,s,i,u){function c(e){return i.get().then(function(t){return e.roleOf(t.contactId)}).then(function(e){return"none"!==e})}function l(e){a.open({appendTo:t.children().eq(0),templateUrl:o.sharedPathTpl+"components/leave-request-popup/leave-request-popup.html",controller:"RequestCtrl",controllerAs:"$ctrl",windowClass:"chr_leave-request-modal",resolve:{directiveOptions:function(){return e},format:["DateFormat",function(e){return e.getDateFormat()}]}})}function d(e){return u.find(e).then(function(e){return c(e).then(function(t){t?l({leaveRequest:e,leaveType:e.request_type,selectedContactId:e.contact_id}):r.error("Error","You dont have permission to see this leave request")})}).catch(function(e){r.error("Error",e)})}return e.debug("LeavePopup"),{openModal:l,openModalByID:d}}t.factory("LeavePopup",n),n.$inject=["$log","$rootElement","$rootScope","$uibModal","notificationService","shared-settings","DateFormat","Session","LeaveRequest"]}),define("leave-absences/manager-leave/modules/components",["common/angular"],function(e){return e.module("manager-leave.components",[])}),define("leave-absences/manager-leave/components/manager-leave-container",["leave-absences/manager-leave/modules/components"],function(e){e.component("managerLeaveContainer",{bindings:{contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/manager-leave-container.html"}],controller:["$log","$rootScope","$state",function(e,t,n){function a(){n.go(r.tabName)}e.debug("Component: manager-leave-container"),t.section="manager-leave";var r=this;r.tabName=n.current.name,r.changeTab=a}],controllerAs:"managerLeave"})}),function(e){define("leave-absences/manager-leave/modules/settings",["common/angular"],function(t){return t.module("manager-leave.settings",[]).constant("settings",{debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/"})})}(CRM),function(e,t){define("leave-absences/manager-leave/modules/config",["common/angular","common/lodash","leave-absences/manager-leave/modules/settings"],function(t,n){function a(t){t.withAutoBase(!0),t.settings.ga={userId:n.get(e,"vars.session.contact_id")}}return t.module("manager-leave.config",["manager-leave.settings"]).config(["$stateProvider","$resourceProvider","$urlRouterProvider","$httpProvider","$logProvider","$analyticsProvider","settings",function(t,n,r,o,s,i,u){o.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",n.defaults.stripTrailingSlashes=!1,r.otherwise("/manager-leave/requests"),a(i),s.debugEnabled(u.debug),t.state("manager-leave",{abstract:!0,url:"/manager-leave",template:'',resolve:{contactId:function(){return e.vars.leaveAndAbsences.contactId},format:["DateFormat",function(e){return e.getDateFormat()}]}}).state("manager-leave.requests",{url:"/requests?leave-request-id",template:'',onEnter:["$stateParams","LeavePopup",function(e,t){e["leave-request-id"]&&t.openModalByID(e["leave-request-id"])}]}).state("manager-leave.calendar",{url:"/calendar",template:''}).state("manager-leave.leave-balances",{url:"/leave-balances",template:""})}])})}(CRM,Drupal),define("leave-absences/manager-leave/app",["common/angular","common/angularBootstrap","common/angulartics","common/angulartics-google-tag-manager","common/text-angular","common/directives/loading","common/directives/scroll-shadows.directive","common/directives/time-amount-picker.directive","common/directives/timepicker-select.directive","common/filters/angular-date/format-date","common/filters/time-unit-applier.filter","common/modules/dialog","common/services/angular-date/date-format","common/services/check-permissions","common/services/crm-ang.service","leave-absences/shared/ui-router","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/components/leave-balance-tab.component","leave-absences/shared/components/leave-calendar.component","leave-absences/shared/components/leave-calendar-day.component","leave-absences/shared/components/leave-calendar-legend.component","leave-absences/shared/components/leave-calendar-month.component","leave-absences/shared/components/leave-request-actions.component","leave-absences/shared/components/leave-request-popup-comments-tab.component","leave-absences/shared/components/leave-request-popup-details-tab.component","leave-absences/shared/components/leave-request-popup-files-tab","leave-absences/shared/components/leave-request-record-actions.component","leave-absences/shared/components/manage-leave-requests.component","leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/services/leave-calendar.service","leave-absences/shared/services/leave-popup.service","leave-absences/manager-leave/components/manager-leave-container","leave-absences/manager-leave/modules/config"],function(e){return e.module("manager-leave",["ngResource","ngAnimate","angulartics","angulartics.google.tagmanager","ui.bootstrap","ui.router","ui.select","textAngular","common.angularDate","common.dialog","common.filters","common.models","common.directives","common.mocks","leave-absences.models","leave-absences.components","leave-absences.controllers","leave-absences.models","leave-absences.services","manager-leave.config","manager-leave.components"]).run(["$log","$rootScope","shared-settings","settings",function(e,t,n,a){e.debug("app.run"),t.sharedPathTpl=n.sharedPathTpl,t.settings=a}]),e}),function(e,t){var n=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";t.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":n+"/shared","leave-absences/manager-leave":n+"/manager-leave"}}),t(["leave-absences/shared/config"],function(){t(["leave-absences/manager-leave/app","leave-absences/shared/models/leave-request.model"],function(e){e.bootstrap(document.querySelector("[data-leave-absences-manager-leave]"),["manager-leave"])})})}(CRM,require),define("manager-leave",function(){}); +!function(e){define("leave-absences/shared/config",[],function(){e.config({paths:{mocks:"../test/mocks"}}),e.config({paths:{mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(t){return t.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/instances/absence-period.instance",["leave-absences/shared/modules/models-instances","common/moment","common/models/instances/instance","common/services/hr-settings"],function(e,t){"use strict";e.factory("AbsencePeriodInstance",["$log","ModelInstance","HR_settings",function(e,n,a){return e.debug("AbsencePeriodInstance"),n.extend({defaultCustomData:function(){return{current:!1}},transformAttributes:function(e){var n=t();return e.current=!1,t(e.start_date).isSameOrBefore(n,"day")&&t(e.end_date).isSameOrAfter(n,"day")&&(e.current=!0),e},isInPeriod:function(e){var n=a.DATE_FORMAT.toUpperCase(),o=t(e,n);return t(this.start_date).isSameOrBefore(o)&&t(this.end_date).isSameOrAfter(o)}})}])}),define("leave-absences/shared/apis/absence-period.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("AbsencePeriodAPI",["$log","api",function(e,t){return e.debug("AbsencePeriodAPI"),t.extend({all:function(t){return e.debug("AbsencePeriodAPI"),this.sendGET("AbsencePeriod","get",t).then(function(e){return e.values})}})}])}),define("leave-absences/shared/models/absence-period.model",["leave-absences/shared/modules/models","common/moment","leave-absences/shared/modules/shared-settings","leave-absences/shared/instances/absence-period.instance","leave-absences/shared/apis/absence-period.api","common/models/model","common/services/hr-settings"],function(e,t){"use strict";e.factory("AbsencePeriod",["$log","Model","AbsencePeriodAPI","AbsencePeriodInstance","shared-settings",function(e,n,a,o,s){return e.debug("AbsencePeriod"),n.extend({all:function(e){return a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},current:function(){var e=t().format(s.serverDateFormat),n={start_date:{"<=":e},end_date:{">=":e}};return a.all(n).then(function(e){return e&&e.length?o.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,t,n){"use strict";n.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(n,a,o){return n.debug("AbsenceTypeAPI"),a.extend({all:function(t){return n.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(t||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,s,i){return n.debug("AbsenceTypeAPI.calculateToilExpiryDate"),i=e.assign({},i,{absence_type_id:a,date:t(s).format(o.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",i).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,t){return e.debug("AbsenceTypeInstance"),t.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,t){"use strict";t.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(t,n,a,o,s,i){return t.debug("AbsenceType"),a.extend({all:function(e){return s.all(e).then(function(e){return e.map(function(e){return i.init(e,!0)})})},calculateToilExpiryDate:function(e,t,n){return s.calculateToilExpiryDate(e,t,n)},canExpire:function(e){return s.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(t){return o.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(n){return n=e.indexBy(n,"value"),e.map(t,function(t){return e.assign(t,{calculation_unit_label:n[t.calculation_unit].label,calculation_unit_name:n[t.calculation_unit].name})})})}})}])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/components/leave-balance-tab-filters.component",["common/lodash","common/moment","leave-absences/shared/modules/components"],function(e,t,n){function a(n){function a(e){e.absencePeriods&&u.absencePeriods.length&&(u.filters.period_id=s().id),e.absenceTypes&&u.absenceTypes.length&&(u.filters.type_id=i().id),(e.loggedInContactId||e.userRole)&&(u.filters.managed_by="manager"===u.userRole?u.loggedInContactId:void 0),o()&&u.submitFilters()}function o(){return e.every(u.filters,function(e){return null!==e})}function s(){return e.find(u.absencePeriods,function(e){return e.current})||u.absencePeriods.reduce(function(e,n){return t(e.end_date).isAfter(n.end_date)?e:n})}function i(){return u.absenceTypes.reduce(function(e,t){return e.title.localeCompare(t.title)?e:t})}function r(e){return e.current?"Current Period ("+e.title+")":e.title}function c(){n.$emit("LeaveBalanceFilters::update",u.filters)}var u=this;u.filters={period_id:null,type_id:null,managed_by:null},u.$onChanges=a,u.labelPeriod=r,u.submitFilters=c}n.component("leaveBalanceTabFilters",{controller:a,controllerAs:"balanceFilters",bindings:{absencePeriods:"<",absenceTypes:"<",loggedInContactId:"<",lookupContacts:"<",userRole:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-balance-tab-filters.html"}]}),a.$inject=["$scope"]}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,n){function a(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(n.remainder=a[0].remainder),delete n["api.LeavePeriodEntitlement.getremainder"],n}function o(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return n.value=a,delete n["api.LeavePeriodEntitlement.getentitlement"],n}return e.debug("EntitlementAPI"),n.extend({all:function(t,n){return e.debug("EntitlementAPI.all"),t["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},n&&(t["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",t,!1).then(function(e){return e.values}).then(function(e){return e=e.map(o),n&&(e=e.map(a)),e})},breakdown:function(t){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",t).then(function(e){return e.values})},getLeaveBalances:function(t,n,a,o,s){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",t,n,a,o,"getLeaveBalances",s)}})}])}),define("leave-absences/shared/models/leave-balance-report.model",["leave-absences/shared/modules/models","leave-absences/shared/apis/entitlement.api","common/models/model"],function(e){"use strict";e.factory("LeaveBalanceReport",["Model","EntitlementAPI",function(e,t){return e.extend({all:function(e,n,a,o,s){return t.getLeaveBalances(this.processFilters(e),n,a,o,s)}})}])}),define("leave-absences/shared/components/leave-balance-tab.component",["common/angular","common/lodash","leave-absences/shared/modules/components","leave-absences/shared/components/leave-balance-tab-filters.component","leave-absences/shared/models/leave-balance-report.model","common/services/notification.service","common/services/pub-sub"],function(e,t,n){function a(n,a,o,s,i,r,c,u,l,d,m){function f(){q(),b().then(function(){P.loading.component=!1})}function p(){return o.all({options:{sort:"title ASC"}}).then(function(e){P.absencePeriods=e})}function v(){return s.all().then(s.loadCalculationUnits).then(function(e){P.absenceTypes=e})}function h(){return i.all(null,null,"sort_name ASC").then(function(e){P.lookupContacts=e.list})}function b(){return n.all([p(),v(),h(),g(),C()]).catch(function(e){c.error("Error",e)})}function g(){return l.get().then(function(e){P.loggedInContactId=e.contactId})}function y(){return P.loading.report=!0,r.all(R,P.pagination,void 0,void 0,!1).then(function(e){P.report=_(e.list),P.reportCount=e.total}).catch(function(e){c.error("Error",e.error_message)}).finally(function(){P.loading.report=!1})}function _(n){return n.map(function(n){return n=e.copy(n),n.absence_types=t.indexBy(n.absence_types,function(e){return e.id}),n})}function q(){a.$on("LeaveBalanceFilters::update",A),u.subscribe("LeaveRequest::new",T)}function C(){return m(d.permissions.admin.administer).then(function(e){P.userRole=e?"admin":"manager"})}function T(e){A(e,R)}function A(e,t){R=t,P.pagination.page=1,D(),P.loadReportCurrentPage()}function D(){P.selectedAbsenceTypes=P.absenceTypes.filter(function(e){return+e.id==+R.type_id})}var R={},P=this;P.absencePeriods=[],P.absenceTypes=[],P.loading={component:!0,report:!0},P.loggedInContactId=null,P.lookupContacts=[],P.pagination={page:1,size:50},P.report=[],P.reportCount=0,P.userRole=null,P.$onInit=f,P.loadReportCurrentPage=y}n.component("leaveBalanceTab",{controller:a,controllerAs:"leaveBalanceTab",templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-balance-tab.html"}]}),a.$inject=["$q","$rootScope","AbsencePeriod","AbsenceType","Contact","LeaveBalanceReport","notificationService","pubSub","Session","shared-settings","checkPermissions"]}),define("leave-absences/shared/modules/controllers",["common/angular","common/angularBootstrap","leave-absences/shared/modules/models","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){return e.module("leave-absences.controllers",["ui.select","leave-absences.models","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers","common/models/contract","common/services/notification.service"],function(e,t,n){function a(t,n,a,o,s,i,r){function c(){return{loadContacts:function(){return l.loadContactsForAdmin()}}}function u(e){i.info("",["

    When All filter is selected, all staff members with contracts which are active in the selected absence period are displayed.

    ","

    People I approve filter displays only staff members who you approve leave for.

    ","

    People without approver filter displays all staff members with contracts which are active in the selected absence period and who do not have any leave approver assigned.

    "].join(""))}t.debug("LeaveCalendarAdminController");var l,d;return{init:function(t){return d=t,l=r.init(d),d.filters.userSettings.assignedTo=e.find(d.filtersByAssignee,{type:"me"}),d.showContactDetailsLink=!0,d.showContactName=!0,d.showFilters=!0,d.showAdminFilteringHint=u,c()}}}n.controller("LeaveCalendarAdminController",["$log","$q","Contact","ContactInstance","Contract","notificationService","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(t,n,a,o){function s(){return{loadContacts:function(){return i.loadLookUpAndFilteredContacts()}}}t.debug("LeaveCalendarManagerController");var i,r;return{init:function(t){return r=t,i=o.init(r),r.filters.userSettings.assignedTo=e.find(r.filtersByAssignee,{type:"me"}),r.showContactName=!0,r.showFilters=!0,s()}}}n.controller("LeaveCalendarManagerController",["$log","Contact","ContactInstance","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(e,t,n,a){function o(){return{loadContacts:function(){return i.displaySingleContact?s.loadFilteredContacts():"admin"===i.userPermissionRole?s.loadContactsForAdmin():s.loadLookUpAndFilteredContacts()}}}e.debug("LeaveCalendarStaffController");var s,i;return{init:function(e){return i=e,s=a.init(i),i.filters.userSettings.contacts_with_leaves=!0,i.showTheseContacts=[i.contactId],i.showContactName=!0,i.showFilters=!0,i.displaySingleContact&&(i.showFilters=!1,i.lookupContacts=[{id:i.contactId}]),o()}}}n.controller("LeaveCalendarStaffController",["$log","$q","Contact","LeaveCalendarService",a])}),define("leave-absences/shared/components/leave-calendar.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller"],function(e,t,n){function a(n,a,o,s,i,r,c,u,l,d){function m(){N().then(g).then(b).then(_).then(I).then(function(){return a.all([C(),D(),S(),W.showFilters?R():e.noop])}).then(function(){f(),y(),E()}).then(function(){W.loading.page=!1})}function f(){W.supportData.absenceTypes.push({id:"",title:"Leave",color:"#4D4D68",calculation_unit:e.chain(W.supportData.calculationUnits).find({name:"days"}).get("value").value()})}function p(){for(var e=[],n=t(W.selectedPeriod.start_date).clone().startOf("month"),a=t(W.selectedPeriod.end_date).clone().endOf("month");n.isBefore(a);)e.push(L(n)),n.add(1,"month");W.months=e}function v(){return e.includes(["admin","manager"],W.userPermissionRole)}function h(e){return e.format("YYYY-MM")}function b(){s.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){W.supportData.absenceTypesToFilterBy=t,$(!0)})}function g(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(F(),E(),$())})}function y(e){W.injectMonth=!0,U("injected").then(function(){$(e)}).then(function(){W.loading.calendar=!1})}function _(){j=n("LeaveCalendar"+e.capitalize(H)+"Controller").init(W)}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return r.all().then(function(t){W.absencePeriods=e.sortBy(t,"start_date"),W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current})}).then(p).then(k)}function T(){return c.all().then(c.loadCalculationUnits)}function A(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function D(){return j.loadContacts().then(function(e){W.contacts=e})}function R(){return l.valuesOf(["hrjc_region","hrjc_location","hrjc_level_type","hrjc_department"]).then(function(e){W.filters.optionValues.regions=e.hrjc_region,W.filters.optionValues.locations=e.hrjc_location,W.filters.optionValues.levelTypes=e.hrjc_level_type,W.filters.optionValues.departments=e.hrjc_department})}function P(){return u.all()}function S(){return a.all([T(),P(),A()]).then(function(t){W.supportData.absenceTypes=t[0],W.supportData.publicHolidays=t[1],W.supportData.calculationUnits=t[2].hrleaveandabsences_absence_type_calculation_unit,W.supportData.dayTypes=t[2].hrleaveandabsences_leave_request_day_type,W.supportData.leaveRequestStatuses=t[2].hrleaveandabsences_leave_request_status,W.supportData.toilAmounts=e.indexBy(t[2].hrleaveandabsences_toil_amounts,"value")})}function I(){var e=a.resolve();return W.injectMonth&&(e=U("destroyed"),W.injectMonth=!1),e}function L(e){return{index:h(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:t().year(e.year()).month(e.month())}}function O(){var t=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),t!==W.selectedPeriod.id&&p(),k(),E(),w("month")}function M(e){var n="previous"===e?"subtract":"add";F(t(W.selectedMonth.moment)[n](1,"month")),E(),w("month")}function w(t){t=e.includes(["contacts","period","month"],t)?t:"period",a.resolve().then(I).then("period"===t&&p).then("period"===t&&x).then("contacts"===t&&D).then("month"===t&&E).then(function(){y("contacts"===t)})}function $(e){s.$emit("LeaveCalendar::showMonth",!!e)}function k(){F(t())}function x(){F(W.months[0].moment)}function B(n){var a="previous"===n?"first":"last",o=e[a](W.months),s=t().year(o.year).month(o.month);W.monthPaginatorsAvailability[n]=!W.selectedMonth.moment.isSame(s,"month")}function E(){B("previous"),B("next")}function F(t){t&&(W.selectedMonthIndex=h(t)),W.selectedMonth=e.find(W.months,{index:W.selectedMonthIndex})}function N(){return a.all([d(i.permissions.admin.administer),d(i.permissions.ssp.manage)]).then(function(e){W.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",H=W.roleOverride?W.roleOverride:W.userPermissionRole})}function U(t){return a(function(n){var a=s.$on("LeaveCalendar::month"+e.capitalize(t),function(){a(),n()})})}o.debug("Component: leave-calendar");var j,H,W=this;W.absencePeriods=[],W.contacts=[],W.contactIdsToReduceTo=null,W.injectMonth=!1,W.months=[],W.selectedMonth={},W.selectedMonthIndex="",W.selectedPeriod=null,W.showContactName=!1,W.showFilters=!1,W.userPermissionRole="staff",W.loading={calendar:!0,page:!0},W.filters={hideOnMobile:!0,optionValues:{},userSettings:{contact:null,contacts_with_leaves:!0,department:null,level_type:null,location:null,region:null},absenceTypes:{}},W.filtersByAssignee=[{type:"me",label:"People I approve"},{type:"unassigned",label:"People without approver"},{type:"all",label:"All"}],W.filters.userSettings.assignedTo=W.filtersByAssignee[2],W.monthPaginatorsAvailability={previous:!0,next:!0},W.supportData={absenceTypesToFilterBy:[]},W.$onInit=m,W.canManageRequests=v,W.labelPeriod=q,W.navigateToCurrentMonth=O,W.paginateMonth=M,W.refresh=w}n.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,n={from_date:{to:Q.month.days[Q.month.days.length-1].date+" 23:59:59"},to_date:{from:Q.month.days[0].date+" 00:00:00"},status_id:{IN:M()},contact_id:{IN:Q.contacts.map(function(e){return e.id})},type_id:{IN:t?Q.supportData.absenceTypesToFilterBy:e.pluck(Q.supportData.absenceTypes,"id")}};return y(),i.all(n,null,null,null,!1).then(function(e){return X={},t&&(e.list=q(e.list)),A(e.list)})}function k(){var t=Q.month.days[0].date,n=Q.month.days[Q.month.days.length-1].date;return s.get(Q.contacts.map(function(e){return e.id}),t,n).then(function(t){z=e.indexBy(t,"contact_id")})}function x(){return Q.contactIdsToReduceTo&&(Q.contacts=Q.contacts.filter(function(t){return e.includes(Q.contactIdsToReduceTo,t.contact_id)||e.find(X,function(e){return e.contact_id===t.contact_id})})),a.resolve()}function B(t){var n=L(t);X[t.contact_id]=X[t.contact_id]||{},n.forEach(function(n){e.remove(X[t.contact_id][n.date],function(e){return e.id===t.id})})}function E(){o.$emit("LeaveCalendar::monthDestroyed"),V.map(function(e){e.remove?e.remove():e()})}function F(t,n,o){var s,i;return t.contactsData[n]=t.contactsData[n]||{},i=f(n),s=!0===o?a.resolve():a.all([i.isWeekend(v(t.date)),i.isNonWorkingDay(v(t.date))]).then(function(a){e.assign(t.contactsData[n],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:S(t.date)})}),s.then(function(){return X[n]&&X[n][t.date]?X[n][t.date]:[]}).then(function(a){a=j(a),e.assign(t.contactsData[n],{leaveRequests:a,leaveRequestsToShowInCell:b(a),leaveRequestsAttributes:C(t,a)})})}function N(){return a.all(Q.month.days.map(function(e){return a.all(Q.contacts.map(function(t){return F(e,t.id)}))}))}function U(e,t){Q.currentPage=0,Q.visible=!0,(t||!G)&&w()}function j(n){return e.sortBy(n,function(e){return+t(e.from_date).format("X")+(R("half_day_pm",e,e.from_date)?1:0)})}function H(t){var n=e.find(Q.supportData.absenceTypes,function(e){return e.id===t.type_id});return t.balance_change>0?{borderColor:n.color}:{borderColor:n.color,backgroundColor:n.color}}function W(e){h(e),-1!==M().indexOf(e.status_id)&&l(e)}function Y(e){return a.all(L(e).map(function(t){return F(t,e.contact_id,!0)}))}n.debug("Component: leave-calendar-month");var G=!1,V=[],z={},X={},Q=this;Q.currentPage=0,Q.pageSize=20,Q.visible=!1,Q.showContactName=!!Q.showContactName,Q.showOnlyWithLeaveRequests=!!Q.showOnlyWithLeaveRequests,Q.$onDestroy=E,Q.$onInit=u,Q.contactsList=p,Q.getContactUrl=_}n.component("leaveCalendarMonth",{bindings:{showTheseContacts:"<",contacts:"<",contactIdsToReduceTo:"<",month:"<",period:"<",showContactName:"<",showContactDetailsLink:"<",showOnlyWithLeaveRequests:"<",supportData:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-month.html"}],controllerAs:"month",controller:["$log","$q","$rootScope","Calendar","LeaveRequest","pubSub","shared-settings",a]})}),define("leave-absences/shared/modules/services",["common/angular","common/modules/services"],function(e){"use strict";return e.module("leave-absences.services",["common.services"])}),define("leave-absences/shared/services/leave-request.service",["common/lodash","leave-absences/shared/modules/services"],function(e,t){"use strict";function n(t,n,a){function o(){var t=n.defer();return a.open(e.defaults(s(),{onConfirm:function(){t.resolve(!0)}})),t.promise}function s(){return{title:"Recalculate Balance Change?",copyCancel:"Cancel",copyConfirm:"Yes",classConfirm:"btn-warning",msg:"The leave balance change has updated since this leave request was created. Do you want to recalculate the balance change?"}}return t.debug("LeaveRequest"),{getBalanceChangeRecalculationPromptOptions:s,promptBalanceChangeRecalculation:o}}t.factory("LeaveRequestService",n),n.$inject=["$log","$q","dialog"]}), +define("leave-absences/shared/components/leave-request-actions.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/contact","common/models/session.model","common/services/hr-settings","common/services/notification.service","common/services/pub-sub","leave-absences/shared/services/leave-request.service"],function(e,t,n){function a(n,a,o,s,i,r,c,u,l,d,m){function f(){a.resolve().then(_).then(C).then(function(){return y()&&"admin"!==O.role&&P()}).then(R).finally(function(){O.loading.component=!1})}function p(t){L=O.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===O.leaveRequest.request_type?i.open(q(t)):b(t)}function v(){return"admin"===O.role&&"public_holiday"===O.leaveRequest.request_type}function h(n){var a=O.absenceTypes[O.leaveRequest.type_id].allow_request_cancelation;return"admin"===O.role||("manager"===O.role?e.includes([M.awaitingApproval,M.moreInformationRequired],n):"3"===a?t().isBefore(O.leaveRequest.from_date):"2"===a)}function b(t){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return O.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){A(t)}}):q(t)})}})}function g(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function y(){return I===O.leaveRequest.contact_id}function _(){e.isArray(O.leaveRequestStatuses)&&(O.leaveRequestStatuses=e.indexBy(O.leaveRequestStatuses,"value")),e.isArray(O.absenceTypes)&&(O.absenceTypes=e.indexBy(O.absenceTypes,"id"))}function q(e){var t=w[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return O.leaveRequest[e]().then(function(){D(e)}).catch(function(e){d.error("Error:",e)})}}}function C(){return m.get().then(function(e){I=e.contactId})}function T(e,t){e.stopPropagation(),r.openModal(t)}function A(e){r.openModal({leaveRequest:O.leaveRequest,leaveType:O.leaveRequest.request_type,selectedContactId:O.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[$[e]]})}function D(t){var n=e.find(O.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;L===n&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:O.leaveRequest})}function R(){var t=O.leaveRequestStatuses[O.leaveRequest.status_id].name,n=e.compact(e.map(w,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==O.role&&e.pull(n,"delete"),"staff"===O.role&&e.pull(n,"approve","reject"),"staff"!==O.role&&S(n),v()&&n.push("delete"),O.allowedActions=e.map(n,function(e){return{key:e,label:w[e].label,isDirectAction:w[e].isDirectAction}})}function P(){return g().then(function(e){e&&(O.role="admin")})}function S(t){e.each(t,function(n,a){"edit"===n&&(t[a]="respond"),e.includes(["respond","view"],n)&&(t[a]="edit")})}n.debug("Component: leave-request-action-dropdown");var I,L,O=this,M=l.statusNames,w={edit:{label:"Edit",allowedStatuses:[M.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[M.moreInformationRequired]},view:{label:"View",allowedStatuses:[M.approved,M.rejected,M.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[M.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[M.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[M.awaitingApproval,M.approved,M.rejected,M.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[M.awaitingApproval,M.moreInformationRequired,M.approved,M.rejected,M.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},$={approve:"approved"};O.allowedActions=[],O.loading={component:!0},O.$onInit=f,O.action=p,O.openLeavePopup=T}n.component("leaveRequestActions",{bindings:{leaveRequest:"<",leaveRequestStatuses:"<",absenceTypes:"<",role:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-actions.html"}],controllerAs:"actions",controller:a}),a.$inject=["$log","$q","$rootScope","Contact","dialog","LeavePopup","LeaveRequestService","pubSub","shared-settings","notificationService","Session"]}),define("leave-absences/shared/components/leave-request-popup-comments-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/models/session.model"],function(e,t,n){function a(n,a,o,s,i,r,c){function u(){o.$emit("LeaveRequestPopup::addTab",C),y(),_()}function l(){C.request.comments.push({contact_id:q,leave_request_id:C.request.id,text:C.comment.text}),C.comment.text=""}function d(){return C.comment.text.length>0}function m(e){return!e.comment_id||C.canManage}function f(e){return t.utc(e,i.serverDateTimeFormat).local().format(s.DATE_FORMAT.toUpperCase()+" HH:mm")}function p(){return C.request.comments.filter(function(e){return!e.toBeDeleted})}function v(e){return e===q?"Me":C.comment.contacts[e]?C.comment.contacts[e].display_name:void 0}function h(e){return C.mode===e}function b(){C.comment.text.length&&C.addComment()}function g(){var t=e.indexBy(C.request.comments,"contact_id"),n=Object.keys(t);return r.all({id:{IN:n}},{page:1,size:0}).then(function(t){C.comment.contacts=e.indexBy(t.list,"contact_id")})}function y(){return C.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),C.request.comments.length&&g()})}function _(){return C.loading.component=!0,c.get().then(function(e){q=e.contactId}).then(function(){C.loading.component=!1})}n.debug("Component: leave-request-popup-comments-tab");var q=null,C=this;C.loading={component:!0},C.comment={text:"",contacts:{}},C.$onInit=u,C.addComment=l,C.canRemoveComment=m,C.canSubmit=d,C.formatDateTime=f,C.getActiveComments=p,C.getCommentorName=v,C.isMode=h,C.onBeforeSubmit=b}n.component("leaveRequestPopupCommentsTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-comments-tab.html"}],controllerAs:"commentsCtrl",controller:["$log","$rootScope","$scope","HR_settings","shared-settings","Contact","Session",a]})}),define("leave-absences/shared/apis/work-pattern.api",["common/lodash","leave-absences/shared/modules/apis","common/services/api"],function(e,t){"use strict";t.factory("WorkPatternAPI",["$log","api",function(t,n){function a(t){var n=e.clone(t);return n.workPattern=n["api.WorkPattern.get"].values[0],delete n["api.WorkPattern.get"],n}return t.debug("WorkPatternAPI"),n.extend({assignWorkPattern:function(t,n,a,o,s,i){return this.sendPOST("ContactWorkPattern","create",e.assign({},i,{contact_id:t,pattern_id:n,effective_date:a,effective_end_date:o,change_reason:s})).then(function(e){return e.values})},get:function(e){return this.sendGET("WorkPattern","get",e||{}).then(function(e){return e.values})},getCalendar:function(n,a,o,s){return t.debug("WorkPatternAPI.getCalendar",n,a,o,s),this.sendGET("WorkPattern","getcalendar",e.assign({},s,{contact_id:e.isArray(n)?{IN:n}:n,start_date:a,end_date:o}))},unassignWorkPattern:function(e){return this.sendPOST("ContactWorkPattern","delete",{id:e})},workPatternsOf:function(t,n,o){return this.sendGET("ContactWorkPattern","get",e.assign({},n,{contact_id:t,"api.WorkPattern.get":{id:"$value.pattern_id"}}),o).then(function(e){return e=e.values,e.map(a)})}})}])}),define("leave-absences/shared/instances/calendar.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance"],function(e,t,n){"use strict";n.factory("CalendarInstance",["$log","$q","ModelInstance","shared-settings","OptionGroup",function(n,a,o,s,i){function r(t,n){return u().then(function(a){var o=this.days[c(t).valueOf()];return!!o&&e.find(a,function(e){return e.name===n}).value===o.type}.bind(this))}function c(e){return t(e,s.serverDateFormat).clone()}function u(){return l=l||i.valuesOf("hrleaveandabsences_work_day_type")}var l;return o.extend({defaultCustomData:function(){return{days:[]}},isNonWorkingDay:function(e){return r.call(this,e,"non_working_day")},isWeekend:function(e){return r.call(this,e,"weekend")},isWorkingDay:function(e){return r.call(this,e,"working_day")},transformAttributes:function(t){var n={};return t.calendar.forEach(function(e){n[c(e.date).valueOf()]=e}),e(t).omit("calendar").assign({days:n}).value()}})}])}),define("leave-absences/shared/models/calendar.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/calendar.instance"],function(e,t){"use strict";t.factory("Calendar",["$log","Model","WorkPatternAPI","CalendarInstance",function(t,n,a,o){return t.debug("Calendar"),n.extend({get:function(n,s,i,r){return t.debug("Calendar.get"),a.getCalendar(n,s,i,r).then(function(t){var a=t.values.map(function(e){return o.init(e)});return e.isArray(n)?a:a[0]})}})}])}),define("leave-absences/shared/components/leave-request-popup-details-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/session.model","leave-absences/shared/models/calendar.model"],function(e,t,n){function a(n,a,o,s,i,r,c,u,l,d,m){function f(){n("RequestModalDetails"+e.capitalize(T(ne.leaveType,ne.request))+"Controller",{detailsController:ne}),ne.canManage=ne.isRole("manager")||ne.isRole("admin"),ne.loading.tab=!0,s.$emit("LeaveRequestPopup::addTab",ne),I(),ne.initChildController().then(function(){return i.all([x(),k()])}).then(!ne.isMode("create")&&S).then(Y).then(function(){if(!ne.isMode("create"))return i.resolve().then(ne.initTimesExtended).then(z)}).then(!ne.isMode("create")&&W).then(L).then(G).then(P).then(O).then(!ne.isMode("view")&&ne.initWatchersExtended).catch(R).then(function(){ne.pagination.filteredbreakdown=ne.balance.change.breakdown,ne.pagination.totalItems=ne.balance.change.breakdown.length}).finally(function(){ne.loading.tab=!1})}function p(){ne.balance.closing=ne.balance.opening+ne.balance.change.amount}function v(e){return t(e,c.serverDateFormat).toDate()}function h(e){return t(e).format(c.serverDateFormat)}function b(e){var t;return i.resolve().then(function(){j(e),"from"===e&&U(),M("hours")&&(_(e),"from"!==e||ne.uiOptions.multipleDays||_("to")),ne.loading[e+"DayTypes"]=!0}).then(function(){return C(e)}).then(function(e){if(t=e.id!==ne.period.id,t&&(ne.period=e),!ne.period.id)return i.reject("Please change date as it is not in any absence period")}).then(W).then(function(){if(t)return x()}).then(function(){return ne.onDateChangeExtended&&ne.onDateChangeExtended(e)}).then(function(){if(z(),!t)return E();o.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(R).finally(q)}function g(){return z(),E()}function y(){return ne.uiOptions.toDate=null,j("to"),i.resolve().then(z).then(ne.setDaysSelectionModeExtended).then(q).then(!ne.uiOptions.multipleDays&&E)}function _(e){ne.uiOptions.times[e].loading=!0}function q(){["from","to"].forEach(function(e){ne.loading[e+"DayTypes"]=!1,M("hours")&&(ne.uiOptions.times[e].loading=!1)})}function C(n){var a=t(ne.uiOptions[n+"Date"]).format(ne.uiOptions.userDateFormat.toUpperCase());return e.find(ne.absencePeriods,function(e){return e.isInPeriod(a)})||{}}function T(){return ne.request?ne.request.request_type:ne.leaveType||null}function A(e){return t().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function D(){return X(),ne.loading.balanceChange=!0,ne.request.getBalanceChangeBreakdown().then(H).catch(R)}function R(t){o.$broadcast("LeaveRequestPopup::handleError",e.isArray(t)?t:[t]),ne.loading.fromDayTypes=!1,ne.loading.balanceChange=!1,ne.loading.tab=!1,ne.loading.toDayTypes=!1}function P(){return ne.isMode("create")||ne.forceRecalculateBalanceChange?E():D()}function S(){var e=ne.request.attributes();return ne.uiOptions.fromDate=v(ne.request.from_date),ne.request.to_date=e.to_date,ne.request.to_date_type=e.to_date_type,ne.uiOptions.toDate=v(ne.request.to_date),ne.initDayTypesExtended?ne.initDayTypesExtended():i.resolve()}function I(){te.push(o.$on("LeaveRequestPopup::absenceTypeChanged",function(){J()}),o.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,t){K(t)}),o.$on("LeaveRequestPopup::recalculateBalanceChange",E))}function L(){ne.isMode("edit")&&(ne.isLeaveStatus(c.statusNames.approved)||ne.isLeaveStatus(c.statusNames.adminApproved))&&(ee={absenceTypeId:ne.request.type_id,value:ne.selectedAbsenceType.remainder-ne.request.balance_change})}function O(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,t){e!==t&&(ne.uiOptions.multipleDays||(Z(e),z()))})}function M(e){return ne.selectedAbsenceType.calculation_unit_name===e}function w(e){return ne.request.request_type===e}function $(t){return e.includes(["weekend","non_working_day","public_holiday"],t)}function k(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){ne.requestDayTypes=e})}function x(){return u.get(ne.request.contact_id,ne.period.start_date,ne.period.end_date).then(function(e){ne.calendar=e})}function B(){var e=(ne.pagination.currentPage-1)*ne.pagination.numPerPage,t=e+ne.pagination.numPerPage;ne.pagination.filteredbreakdown=ne.balance.change.breakdown.slice(e,t)}function E(){return X(),ne.canCalculateChange()?(ne.loading.balanceChange=!0,ne.request.change_balance=!0,ne.calculateBalanceChange().then(H).catch(R).finally(function(){ne.loading.balanceChange=!1})):i.resolve()}function F(){ne.pagination.totalItems=ne.balance.change.breakdown.length,ne.pagination.filteredbreakdown=ne.balance.change.breakdown,ne.pagination.pageChanged()}function N(){return h(ne.request.from_date)===h(ne.request.to_date)}function U(){ne.uiOptions.toDate&&ne.uiOptions.fromDate&&ne.uiOptions.multipleDays&&t(ne.uiOptions.toDate).isSameOrBefore(ne.uiOptions.fromDate)&&(ne.uiOptions.toDate=null,j("to"))}function j(e){ne.resetUIInputsExtended&&ne.resetUIInputsExtended(e),z(),X()}function H(e){ne.balance.change=e,ne.request.balance_change=e.amount,p(),F(),ne.loading.balanceChange=!1}function W(){var e,n,a;ne.uiOptions.fromDate?(e=t(ne.uiOptions.fromDate).add(1,"day").toDate(),a=e,n=e):(a=v(ne.period.start_date),n=ne.uiOptions.date.to.options.minDate),ne.uiOptions.date.to.options.initDate=n,ne.uiOptions.date.to.options.minDate=a,ne.uiOptions.date.to.options.maxDate=v(ne.period.end_date)}function Y(){return!ne.isMode("create")&&N()||ne.isMode("create")&&(w("sickness")||M("hours"))?ne.uiOptions.multipleDays=!1:ne.uiOptions.multipleDays=!0,i.resolve().then(ne.setDaysSelectionModeExtended)}function G(){ee&&ee.absenceTypeId===ne.selectedAbsenceType.id?ne.balance.opening=ee.value||0:ne.balance.opening=ne.selectedAbsenceType.remainder}function V(){ne.selectedAbsenceType=e.find(ne.absenceTypes,function(e){return e.id===ne.request.type_id})}function z(){var e=ne.uiOptions,t=e.times;ne.request.from_date=e.fromDate?h(e.fromDate):null,ne.request.to_date=e.toDate?h(e.toDate):null,!e.multipleDays&&e.fromDate&&(ne.request.to_date=ne.request.from_date,ne.request.to_date_type=ne.request.from_date_type),(M("hours")||w("toil"))&&(ne.request.from_date=ne.request.from_date&&t.from.time?ne.request.from_date+" "+t.from.time:null,ne.request.to_date=ne.request.to_date&&t.to.time?ne.request.to_date+" "+t.to.time:null)}function X(){ne.uiOptions.showBalance=ne.canCalculateChange()}function Q(){e.forEach(te,function(e){e()})}function J(){var e,t=ne.selectedAbsenceType.calculation_unit_name;return V(),e=t!==ne.selectedAbsenceType.calculation_unit_name,G(),i.resolve().then(e&&Y).then(e&&ne.onAbsenceTypeUpdateExtended).then(e&&z).then(q).then(E)}function K(e){return ne.absenceTypes=e,V(),t(ne.uiOptions.toDate).isAfter(ne.period.end_date)&&(ne.uiOptions.toDate=void 0,j("to")),G(),E()}function Z(e){var t=A(e).add(ne.uiOptions.time_interval,"minutes");t.isAfter(A(ne.uiOptions.times.to.max))||(ne.uiOptions.times.to.min=t.format("HH:mm"),t.isAfter(A(ne.uiOptions.times.to.time))&&(ne.uiOptions.times.to.time=""))}a.debug("Component: leave-request-popup-details-tab");var ee=null,te=[],ne=this;ne.canManage=!1,ne.calendar={},ne.errors=[],ne.isRequired=!0,ne.requestDayTypes=[],ne.statusNames=c.statusNames,ne.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},ne.pagination={currentPage:1,filteredbreakdown:[],numPerPage:7,totalItems:0,pageChanged:B},ne.uiOptions={isChangeExpanded:!1,multipleDays:!0,userDateFormat:r.DATE_FORMAT,showBalance:!1,date:{from:{show:!1,options:{startingDay:1,showWeeks:!1}},to:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}},expiry:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}}},times:{from:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""},to:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""}},time_interval:15},ne.$onInit=f,ne.convertDateFormatFromServer=v,ne.convertDateToServerFormat=h,ne.dateChangeHandler=b,ne.dateTypeChangeHandler=g,ne.daysSelectionModeChangeHandler=y,ne.disableAndShowLoadingTimeInput=_,ne.getMomentDateWithGivenTime=A,ne.handleError=R,ne.isCalculationUnit=M,ne.isLeaveType=w,ne.isNotWorkingDay=$,ne.performBalanceChangeCalculation=E,ne.setRequestDateTimesAndDateTypes=z,ne.updateEndTimeInputMinTime=Z,ne.$onDestroy=Q}n.component("leaveRequestPopupDetailsTab",{bindings:{absencePeriods:"<",absenceTypes:"<",balance:"=",request:"<",isLeaveStatus:"<",leaveType:"<",isMode:"<",isSelfRecord:"<",period:"=",isRole:"<",selectedAbsenceType:"=",forceRecalculateBalanceChange:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-details-tab.html"}],controllerAs:"detailsTab",controller:a}),a.$inject=["$controller","$log","$rootScope","$scope","$q","HR_settings","shared-settings","Calendar","OptionGroup","LeaveRequest","$timeout"]}),define("leave-absences/shared/components/leave-request-popup-files-tab",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/file-upload","common/services/file-mime-types","common/services/hr-settings"],function(e,t,n){function a(n,a,o,s,i,r,c,u,l){function d(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",O),y(),a.all([A(),C()]).then(_).finally(function(){O.filesLoaded=!0})}function m(){return O.fileUploader&&O.fileUploader.queue.length>0}function f(){return O.getFilesAmount()0?S.map(function(e){return e.label}).join(", "):""}function C(){return O.request.loadAttachments().then(function(){o.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function T(){return a.all(S.map(function(e){return l.getMimeTypeFor(e.label).then(function(t){L[e.label]=t})})).catch(function(){L=null})}function A(){return c.valuesOf("safe_file_extension").then(function(e){S=e})}function D(e){return!e.attachment_id||O.canManage}function R(){e.forEach(I,function(e){e()})}function P(e,t){O.fileUploader.queue&&O.fileUploader.queue.length>0?O.fileUploader.uploadAll({entityID:O.request.id}).then(function(){t()}).catch(t):t()}n.debug("Component: leave-request-popup-files-tab");var S=[],I=[],L={},O=Object.create(this);return O.filesLoaded=!1,O.fileUploader=null,O.today=Date.now(),O.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",O.userDateFormat=i.DATE_FORMAT,O.$onDestroy=R,O.$onInit=d,O.canRemoveAttachment=D,O.canSubmit=m,O.canUploadMore=f,O.formatDateTime=p,O.getAuthorName=v,O.getFilesAmount=h,O.listFileTypes=q,O}n.component("leaveRequestPopupFilesTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-files-tab.html"}],controllerAs:"filesTab",controller:["$log","$q","$rootScope","$scope","HR_settings","shared-settings","OptionGroup","FileUpload","fileMimeTypes",a]})}),define("leave-absences/shared/components/leave-request-record-actions.component",["leave-absences/shared/modules/components","common/services/hr-settings","common/services/before-hash-query-params.service"],function(e){function t(e,t,n){function a(){s=n.parse(),s.openModal&&o({leaveType:s.openModal,selectedContactId:i.selectedContactId})}function o(e){t.openModal(e)}e.debug("Component: leave-request-record-actions");var s,i=this;i.leaveRequestOptions=[{type:"leave",icon:"briefcase",label:"Leave"},{type:"sickness",icon:"stethoscope",label:"Sickness"}],i.$onInit=a,i.openLeavePopup=o}e.component("leaveRequestRecordActions",{bindings:{contactId:"<",selectedContactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-record-actions.html"}],controllerAs:"vm",controller:["$log","LeavePopup","beforeHashQueryParams",t]})}),define("leave-absences/shared/components/manage-leave-requests.component",["common/lodash","leave-absences/shared/modules/components","common/models/contact","common/services/pub-sub"],function(e,t){function n(t,n,a,o,s,i,r,c,u,l,d,m){"use strict";function f(){s(r.permissions.admin.administer).then(function(e){H.isAdmin=e,n.all([A(),D(),M(),P(),L(),I(),w()]).then(function(){H.loading.page=!1,R()}),U()})}function p(){H.filters.leaveRequest.contact_id=null,H.refresh()}function v(){var e=H.filters.contact;return{department:e.department,level_type:e.level_type,location:e.location,region:e.region}}function h(e){return"all"===e.name||""===e?H.leaveRequests.filter.list.length:H.leaveRequests.filter.list.filter(function(t){return t.status_id===e.value}).length}function b(t){return e.find(H.absenceTypes,{id:t})}function g(e){return new Array(e||0)}function y(t){var n=e.find(H.leaveRequestStatuses,function(e){return e.value===t});return n?n.label:null}function _(e){switch(e){case r.statusNames.approved:return"badge-success";case r.statusNames.rejected:return"badge-danger";case r.statusNames.cancelled:case"all":return"";default:return"badge-primary"}}function q(t){return e.find(H.leaveRequestStatuses,function(e){return e.name===t}).value}function C(t){var n=e.find(H.filteredUsers,function(e){return e.id===t});return n?n.display_name:null}function T(e){return e.current?"Current Period ("+e.title+")":e.title}function A(){return c.all().then(function(t){H.absencePeriods=e.sortBy(t,"start_date"),H.filters.leaveRequest.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current})})}function D(){return u.all().then(u.loadCalculationUnits).then(function(e){H.absenceTypes=e})}function R(e){return(H.isAdmin?o.all(v()):o.leaveManagees(H.contactId,v())).then(function(t){return H.filteredUsers=H.isAdmin?t.list:t,e?S(e):n.all([S("table"),S("filter")])}).then(function(){H.filters.leaveRequest.leaveStatus!==W&&0===H.leaveRequests.table.list.length&&H.refresh(1,!0)})}function P(){return i.valuesOf("hrjc_department").then(function(e){H.departments=e})}function S(e){var t="filter"!==e,n="table"===e?e:"content",a="filter"===e?{size:0}:H.pagination,o="filter"===e?{return:["status_id"]}:{};return H.loading[n]=!0,l.all(O(t),a,"from_date DESC",o,!1).then(function(t){H.leaveRequests[e]=t}).catch(function(){H.leaveRequests[e].list=[]}).finally(function(){H.loading[n]=!1})}function I(){return i.valuesOf("hrjc_level_type").then(function(e){H.levelTypes=e})}function L(){return i.valuesOf("hrjc_location").then(function(e){H.locations=e})}function O(t){var n=H.filters.leaveRequest;return{contact_id:k(),managed_by:H.isAdmin&&"me"!==n.assignedTo.type?void 0:H.contactId,status_id:B(t),type_id:n.selectedAbsenceTypes?n.selectedAbsenceTypes.id:{IN:e.pluck(H.absenceTypes,"id")},from_date:{from:n.selectedPeriod.start_date},to_date:{to:n.selectedPeriod.end_date},unassigned:"unassigned"===n.assignedTo.type||void 0}}function M(){return i.valuesOf("hrjc_region").then(function(e){H.regions=e})}function w(){return i.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){H.leaveRequestStatuses=e.concat(H.leaveRequestStatuses)})}function $(e){d.openModal(e)}function k(){return H.filteredUsers.length>0&&H.filters.leaveRequest.contact_id?H.filters.leaveRequest.contact_id:{IN:H.filteredUsers.map(function(e){return e.id})}}function x(e){var t=[q(r.statusNames.moreInformationRequired),q(r.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function B(e){var t=H.filters.leaveRequest,n=[];if(e&&t.leaveStatus&&t.leaveStatus.value&&n.push(t.leaveStatus.value),t.pending_requests&&(n=x(n)),n.length)return{IN:n}}function E(e,t,n){e="number"==typeof e?e:1,t&&(H.filters.leaveRequest.leaveStatus=W),(e<=H.totalNoOfPages()||0===H.totalNoOfPages())&&(H.pagination.page=e,R(n))}function F(e){H.filters.leaveRequest.leaveStatus=e,H.refresh(1,!1,"table")}function N(e){H.filters.leaveRequest.assignedTo=e,H.refresh()}function U(){m.subscribe("LeaveRequest::updatedByManager",function(){H.refresh()}),m.subscribe("LeaveRequest::new",function(){H.refresh()}),m.subscribe("LeaveRequest::edit",function(){H.refresh()}),m.subscribe("LeaveRequest::delete",function(){H.refresh()}),m.subscribe("LeaveRequest::statusUpdate",function(){H.refresh()})}function j(){return Math.ceil(H.leaveRequests.table.total/H.pagination.size)}t.debug("Component: manage-leave-requests");var H=this,W={name:"all",label:"All"};H.absencePeriods=[],H.absenceTypes=[],H.filteredUsers=[],H.isFilterExpanded=!1,H.isAdmin=!1,H.leaveRequests={table:{list:[]},filter:{list:[]}},H.leaveRequestStatuses=[W],H.loading={content:!0,page:!0,table:!0},H.pagination={page:1,size:7},H.filtersByAssignee=[{type:"me",label:"Assigned To Me"},{type:"unassigned",label:"Unassigned"},{type:"all",label:"All"}],H.filters={contact:{department:null,level_type:null,location:null,region:null},leaveRequest:{leaveStatus:H.leaveRequestStatuses[0],pending_requests:!0,contact_id:null,selectedPeriod:null,selectedAbsenceTypes:null,assignedTo:H.filtersByAssignee[0]}},H.$onInit=f,H.clearStaffSelection=p,H.countLeaveRequestByStatus=h,H.getAbsenceTypeByID=b,H.getArrayOfSize=g,H.getLeaveStatusByValue=y,H.getNavBadge=_,H.getUserNameByID=C,H.labelPeriod=T,H.openLeavePopup=$,H.refresh=E,H.refreshWithFilter=F,H.refreshWithFilterByAssignee=N,H.totalNoOfPages=j}t.component("manageLeaveRequests",{bindings:{contactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/manage-leave-requests.html"}],controllerAs:"vm",controller:n}),n.$inject=["$log","$q","$rootScope","Contact","checkPermissions","OptionGroup","shared-settings","AbsencePeriod","AbsenceType","LeaveRequest","LeavePopup","pubSub"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(n,a,o,s,i,r,c){function u(){return i.request.calculateBalanceChange(i.selectedAbsenceType.calculation_unit_name)}function l(){var e=i.request,t=!!e.from_date&&!!e.to_date,n=i.selectedAbsenceType.calculation_unit_name;return"days"===n?t=t&&!!e.from_date_type&&!!e.to_date_type:"hours"===n&&(t=t&&!isNaN(+e.from_date_amount)&&!isNaN(+e.to_date_amount)),t}function d(){return i.canCalculateChange()}function m(t,n){var a=i.uiOptions.times[t],o=e.clone(n.time_from),s=e.clone(n.time_to);i.uiOptions.multipleDays||("from"===t&&s&&o&&(s=i.getMomentDateWithGivenTime(s).subtract(i.uiOptions.time_interval,"minutes").format("HH:mm")),"to"===t&&o&&s&&(o=i.getMomentDateWithGivenTime(o).add(i.uiOptions.time_interval,"minutes").format("HH:mm"))),a.min=o||"00:00",a.max=s||"00:00",a.time="to"===t?a.max:a.min}function f(t,n){return t?(t=i.convertDateToServerFormat(t),h(t).then(function(n){return n?i.requestDayTypes.filter(function(e){return"public_holiday"===e.name}):p(t,i.requestDayTypes).then(function(t){return t.length?t:i.requestDayTypes.filter(function(t){return e.includes(["all_day","half_day_am","half_day_pm"],t.name)})})}).then(function(e){return S(n,e),e})):o.reject([])}function p(e,n){return e=t(e),o.all([i.calendar.isNonWorkingDay(e),i.calendar.isWeekend(e)]).then(function(e){return e[0]?"non_working_day":e[1]?"weekend":null}).then(function(e){return e?n.filter(function(t){return t.name===e}):[]})}function v(e,n){return t.duration(n).subtract(t.duration(e)).asHours()}function h(e){return c.all({public_holiday:1,contact_id:i.request.contact_id,from_date:{from:e},to_date:{to:e}}).then(function(e){return!!e.list.length})}function b(){return o.resolve()}function g(){return A(i.uiOptions.fromDate,"from").then(function(){return A(i.uiOptions.toDate,"to")})}function y(e){s.$watch(function(){return i.uiOptions.times[e].amount},function(e,t){i.isCalculationUnit("days")||+e==+t||(i.isRole("staff")&&(i.request.change_balance=!0),O(),i.performBalanceChangeCalculation())})}function _(e){var n=t(i.request[e+"_date"]).format("HH:mm"),a=i.uiOptions.times[e];(v(a.min,n)<=0||v(a.max,n)>=0)&&(n="from"===e?a.min:a.max),i.uiOptions.times[e].time=n}function q(){var e=i.uiOptions.multipleDays?["from","to"]:["from"],t=i.uiOptions.times;if(i.isCalculationUnit("hours"))return o.all(e.map(R)).then(function(){["from","to"].forEach(function(e){_(e),L(e),t[e].amount=Math.min(i.request[e+"_date_amount"],t[e].maxAmount).toString()}),i.uiOptions.multipleDays||i.updateEndTimeInputMinTime(i.uiOptions.times.from.time)}).then(O)}function C(){["from","to"].forEach(function(e){y(e),T(e)})}function T(e){s.$watch(function(){return i.uiOptions.times[e].time},function(t,n){i.isCalculationUnit("days")||t===n||(i.setRequestDateTimesAndDateTypes(),t&&L(e,!0))})}function A(e,t){return f(e,t).then(function(){i.loading[t+"DayTypes"]=!1})}function D(e){return A(i.uiOptions[e+"Date"],e).then(function(){if(i.isCalculationUnit("hours"))return R(e).then(function(){L(e,!0)})})}function R(e){var t=i.uiOptions[e+"Date"],n=!i.uiOptions.multipleDays;return t?i.request.getWorkDayForDate(i.convertDateToServerFormat(t)).then(function(t){w[e]=t,m(e,t),n&&"from"===e&&m("to",t)}).catch(function(t){return w[e]={},i.handleError(t)}).finally(function(){i.uiOptions.times[e].loading=!1,n&&(i.uiOptions.times.to.loading=!1)}):o.resolve()}function P(t){var n=i.uiOptions.times[t];i["request"+e.startCase(t)+"DayTypes"]=[],n.time="",n.min="00:00",n.max="00:00",n.amount="0",n.maxAmount="0"}function S(t,n){var a="request"+e.startCase(t)+"DayTypes";i[a]=n,i.isMode("create")&&(i.request[t+"_date_type"]=i[a][0].value)}function I(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?(i.disableAndShowLoadingTimeInput("from"),!i.uiOptions.multipleDays&&i.disableAndShowLoadingTimeInput("to"),R("from").then(function(){L("from",!0)})):o.resolve()}function L(e,t){var n=i.uiOptions,a=n.multipleDays?e:"from",o=n.times[a],s=n.multipleDays&&"to"===a?o.min:n.times.from.time,r=n.multipleDays&&"from"===a?o.max:n.times.to.time,c=w[a].number_of_hours?v(s,r).toString():"0";o.maxAmount=c,t&&(o.amount=o.maxAmount)}function O(){var e=i.uiOptions.times +;i.request.from_date_amount=isNaN(+e.from.amount)?null:e.from.amount,i.request.to_date_amount=isNaN(+e.to.amount)?null:e.to.amount}function M(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?R("from").then(function(){L("from",!0)}):o.resolve()}var w={};a.debug("RequestModalDetailsLeaveController"),i.calculateBalanceChange=u,i.canCalculateChange=l,i.canSubmit=d,i.initChildController=b,i.initDayTypesExtended=g,i.initTimesExtended=q,i.initWatchersExtended=C,i.onAbsenceTypeUpdateExtended=M,i.onDateChangeExtended=D,i.resetUIInputsExtended=P,i.setDaysSelectionModeExtended=I}n.controller("RequestModalDetailsLeaveController",a),a.$inject=["$controller","$log","$q","$rootScope","detailsController","PublicHoliday","LeaveRequest"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller",["common/lodash","leave-absences/shared/modules/controllers"],function(e,t){function n(t,n,a,o,s,i,r){function c(){return!(!r.canCalculateChange()||!r.request.sickness_reason)}function u(){return a.all([m(),v(),f(!0)])}function l(t){var n=r.request.getDocumentArray();return!!e.find(n,function(e){return e===t})}function d(t){return!!e.find(r.sicknessDocumentTypes,function(e){return e.value===t})}function m(){return i.valuesOf("hrleaveandabsences_leave_request_required_document").then(function(e){r.sicknessDocumentTypes=e})}function f(t){return i.valuesOf("hrleaveandabsences_sickness_reason",t).then(function(t){r.sicknessReasons=e.indexBy(t,"name")})}function p(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_sickness_reason?reset=1").on("crmUnload",function(){f(!1)})}function v(){r.showSicknessOptionsEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}n.debug("RequestModalDetailsSicknessController"),t("RequestModalDetailsLeaveController",{detailsController:r}),r.canSubmit=c,r.initChildController=u,r.isChecked=l,r.isDocumentInRequest=d,r.openSicknessReasonOptionsEditor=p}t.controller("RequestModalDetailsSicknessController",n),n.$inject=["$controller","$log","$q","$rootScope","crmAngService","api.optionGroup","detailsController"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(n,a,o,s,i,r,c){function u(){return c.balance.change.amount=+c.request.toil_to_accrue,a.resolve(c.balance.change)}function l(){if(!c.request.from_date||!c.request.to_date)return c.uiOptions.max_toil_duration_and_accrual=null,void(c.uiOptions.toil_duration_in_hours=null);c.uiOptions.max_toil_duration_and_accrual=t.duration(t(c.request.to_date).diff(c.request.from_date)).asHours()}function d(){return h().catch(function(e){return e.length&&(c.errors=e),a.reject(e)}).then(function(e){return r.calculateToilExpiryDate(c.request.type_id,e)}).then(function(e){return c.request.toil_expiry_date=e,c.uiOptions.expiryDate=new Date(e),e})}function m(){return!!c.request.toil_to_accrue}function f(){var e=c.uiOptions.multipleDays&&!!c.request.to_date,t=!c.uiOptions.multipleDays&&!!c.request.from_date,n=t||e,a=U.from_date!==c.request.from_date||U.to_date!==c.request.to_date;return c.canDisplayToilExpirationField&&n&&H.hasExpirationFromAdminSettings&&a}function p(){return!!(c.request.from_date&&c.request.to_date&&c.request.toil_duration&&c.request.toil_to_accrue)}function v(){c.request.toil_expiry_date=!1,c.uiOptions.expiryDate=null}function h(){var e=c.uiOptions.multipleDays,t=c.request;return b({hasErrors:e?!t.to_date&&!t.from_date:!t.from_date,label:e?"To Date":"From Date",value:t.to_date})}function b(e){if(e.hasErrors){var n="Please select "+e.label+" to find expiry date";return a.reject([n])}return e.value?a.resolve(t(e.value).format("YYYY-MM-DD")):a.reject([])}function g(){var e=c.isMode("create")&&H.hasExpirationFromAdminSettings,t=H.hasPreviousExpirationDate,n=c.isLeaveType("toil"),a=c.canManage;c.canDisplayToilExpirationField=n&&(a||e||t)}function y(){c.uiOptions.toil_duration_in_hours=c.request.toil_duration/60}function _(){return H.hasPreviousExpirationDate=c.isMode("edit")&&!!c.request.toil_expiry_date,r.canExpire(c.request.type_id).then(function(e){H.hasExpirationFromAdminSettings=e})}function q(){return c.request.to_date_type=c.request.from_date_type="1",_().then(g).then(C).then(S)}function C(){c.canManage&&(c.uiOptions.expiryDate=c.convertDateFormatFromServer(c.request.toil_expiry_date))}function T(){o.$watch(function(){return c.request.toil_to_accrue},function(e,t){+e!=+t&&c.performBalanceChangeCalculation()})}function A(){o.$watch(function(){return c.uiOptions.toil_duration_in_hours},function(e,t){e!==t&&c.isCalculationUnit("hours")&&M(),c.request.toil_duration=c.uiOptions.toil_duration_in_hours?60*c.uiOptions.toil_duration_in_hours:null})}function D(){var e=c.uiOptions.times;e.from.time=t(c.request.from_date).format("HH:mm"),e.to.time=t(c.request.to_date).format("HH:mm"),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time)}function R(){["from","to"].forEach(function(e){o.$watch(function(){return c.uiOptions.times[e].time},function(e,t){e!==t&&(c.setRequestDateTimesAndDateTypes(),F(),l(),w())})})}function P(){c.isMode("view")||(T(),A(),R())}function S(t){return i.valuesOf("hrleaveandabsences_toil_amounts",t).then(function(t){c.toilAmounts=e.sortBy(t,function(e){return+e.weight})})}function I(){return l(),w(),F()}function L(){return k(),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time),l(),j?j=!1:w(),F()}function O(e){c.uiOptions.times[e].time=""}function M(){c.request.toil_to_accrue=c.uiOptions.toil_duration_in_hours}function w(){c.uiOptions.toil_duration_in_hours=c.uiOptions.max_toil_duration_and_accrual}function $(){U=e.cloneDeep(c.request.attributes())}function k(){c.uiOptions.multipleDays?["from","to"].forEach(function(e){c.uiOptions.times[e].min="00:00",c.uiOptions.times[e].max="23:45"}):(c.uiOptions.times.from.min="00:00",c.uiOptions.times.from.max="23:30",c.uiOptions.times.to.min="00:15",c.uiOptions.times.to.max="23:45")}function x(){c.setRequestDateTimesAndDateTypes(),l(),w(),c.isCalculationUnit("hours")?M():c.request.toil_to_accrue=null}function B(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_toil_amounts?reset=1").on("crmUnload",function(){S(!1)})}function E(){c.showTOILAccrualsOptionEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}function F(){return f()?d().catch(a.resolve):a.resolve()}function N(){c.uiOptions.expiryDate&&(c.request.toil_expiry_date=c.convertDateToServerFormat(c.uiOptions.expiryDate))}n.debug("RequestModalDetailsToilController");var U,j=!c.isMode("create"),H={hasPreviousExpirationDate:null,hasExpirationFromAdminSettings:null};c.canDisplayToilExpirationField=!1,c.calculateBalanceChange=u,c.canCalculateChange=m,c.canSubmit=p,c.clearExpiryDate=v,c.initChildController=q,c.initTimesExtended=D,c.initWatchersExtended=P,c.onAbsenceTypeUpdateExtended=x,c.onDateChangeExtended=I,c.openToilInDaysAccrualOptionsEditor=B,c.resetUIInputsExtended=O,c.setDaysSelectionModeExtended=L,c.updateExpiryDate=N,function(){$(),k(),E(),!c.isMode("create")&&y()}()}n.controller("RequestModalDetailsToilController",a),a.$inject=["$log","$q","$rootScope","crmAngService","OptionGroup","AbsenceType","detailsController"]}),define("leave-absences/shared/services/leave-calendar.service",["common/lodash","common/moment","leave-absences/shared/modules/services"],function(e,t,n){"use strict";function a(n,a,o,s){function i(n){function i(){return o.all().then(function(e){return e.list})}function r(){return o.leaveManagees(void 0,{unassigned:!0})}function c(){var t=e.get(n,"filters.userSettings.assignedTo.type","all");return m().then(function(e){return n.lookupContacts=e,a.all([d(),"me"!==t?u():a.resolve(null)])}).then(function(e){var t=e[0];return n.contactIdsToReduceTo=e[1],t})}function u(){return l().then(function(a){var o=a.filter(function(e){var a=e.info.details;return t(a.period_start_date).isSameOrBefore(n.selectedPeriod.end_date)&&(t(a.period_end_date).isSameOrAfter(n.selectedPeriod.start_date)||!a.period_end_date)});return e.uniq(o.map(function(e){return e.contact_id}))})}function l(){return h?a.resolve(h):s.all()}function d(){return o.all(v(),null,"display_name").then(function(e){return e.list})}function m(){var t=e.get(n,"filters.userSettings.assignedTo.type","all");return(0,b[t])()}function f(){return m().then(function(e){n.lookupContacts=e}).then(d)}function p(){return o.leaveManagees(n.contactId)}function v(){var t={department:e.get(n,"filters.userSettings.department.value",null),level_type:e.get(n,"filters.userSettings.level_type.value",null),location:e.get(n,"filters.userSettings.location.value",null),region:e.get(n,"filters.userSettings.region.value",null)},a=!!n.filters.userSettings.contact,o=e.isArray(n.lookupContacts)&&n.lookupContacts.length,s="all"!==e.get(n,"filters.userSettings.assignedTo.type","all");return a?t.id={IN:[n.filters.userSettings.contact.id]}:(s||o)&&(t.id={IN:e.pluck(n.lookupContacts,"id")}),t}var h,b={all:i,me:p,unassigned:r};return{loadContactsForAdmin:c,loadFilteredContacts:d,loadLookUpContacts:m,loadLookUpAndFilteredContacts:f}}return n.debug("LeaveCalendarService"),{init:i}}n.factory("LeaveCalendarService",a),a.$inject=["$log","$q","Contact","Contract"]}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,t){return e.debug("EntitlementLogAPI"),t.extend({all:function(t){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",t,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,t,n){return e.debug("EntitlementInstance"),t.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return n.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,t){"use strict";t.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(t,n,a,o,s){return t.debug("Entitlement"),n.extend({all:function(e,t){return a.all(this.processFilters(e),t).then(function(e){return e.map(function(e){return o.init(e,!0)})})},breakdown:function(t,n){return a.breakdown(t).then(function(t){return n?(n.map(function(n){var a=e.find(t,function(e){return e.id===n.id});return a&&(n.breakdown=a.breakdown),n}),n):t.map(function(e){return o.init(e,!0)})})},logs:function(t){return t=e.cloneDeep(t||{}),t.contact_id&&(t["entitlement_id.contact_id"]=t.contact_id,delete t.contact_id),t.period_id&&(t["entitlement_id.period_id"]=t.period_id,delete t.period_id),t.return=t.return||[],t.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),s.all(t)}})}])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,n,a){return e.debug("LeaveRequestAPI"),n.extend({all:function(t,n,o,s,i){e.debug("LeaveRequestAPI.all");var r=a.defer();return t&&t.contact_id&&t.contact_id.IN&&0===t.contact_id.IN.length?r.resolve({list:[],total:0,allIds:[]}):r.resolve(this.getAll("LeaveRequest",t,n,o,s,"getFull",i)),r.promise},balanceChangeByAbsenceType:function(n){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var o=a.defer();return n.contact_id&&n.period_id||o.reject("contact_id and period_id are mandatory"),n=t.defaults(n,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",n,!1).then(function(e){o.resolve(e.values)}),o.promise},calculateBalanceChange:function(n){return e.debug("LeaveRequestAPI.calculateBalanceChange",n),this.sendPOST("LeaveRequest","calculatebalancechange",n).then(function(e){return e.values.breakdown=t.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,t){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:t.toString()},!1)},create:function(t){return e.debug("LeaveRequestAPI.create",t),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,attachment_id:n}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,n){return n=t.assign({},n,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",n).then(function(e){return e.values})},find:function(t){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:t},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",n,!1).then(function(e){return e.values})},getComments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",n,!1).then(function(e){return e.values})},isManagedBy:function(t,n){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:t,contact_id:n}).then(function(e){return e.values})},isValid:function(n){e.debug("LeaveRequestAPI.isValid",n);var o=a.defer();return this.sendPOST("LeaveRequest","isValid",n).then(function(e){e.count>0?o.reject(t(e.values).map().flatten().value()):o.resolve(e.values)}),o.promise},saveComment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,text:n.text,contact_id:n.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(t){return e.debug("LeaveRequestAPI.update",t),t.id?this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]}):a.reject("id is mandatory field")}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,t,n){"use strict";n.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(n,a,o,s,i,r,c){function u(e){return p(e).then(function(e){var t=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=t,n.reject(e)}.bind(this))}.bind(this))}function l(){return c.all({id:this.type_id}).then(c.loadCalculationUnits).then(function(e){return n.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return p(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var t=[];return e.forEach(this.files,function(e){e.toBeDeleted&&t.push(r.deleteAttachment(this.id,e.attachment_id))}.bind(this)),n.all(t)}function f(e){return t.duration(e.time_to).subtract(t.duration(e.time_from)).asHours()}function p(t){return o.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){return e.find(n,function(e){return e.name===t})})}function v(t){var a=e.cloneDeep(t),o=a.breakdown.length>1,s=e.first(e.values(a.breakdown)),i=e.last(e.values(a.breakdown));return n.all([this.getWorkDayForDate(s.date),o&&this.getWorkDayForDate(i.date)]).then(function(t){return s.amount=t[0].time_from?Math.min(this.from_date_amount,f(t[0])):0,o&&(i.amount=t[1].time_from?Math.min(this.to_date_amount,f(t[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,t){return e+t.amount},0),a}.bind(this))}function h(){var e=this.id,t=[];return t.push(n.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(t){return function(){return r.saveComment(e,t)}}))),t=t.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return r.deleteComment(e.comment_id)})),n.all(t)}return i.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(t){var n=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===t&&e.pull(n,"from_date_type","to_date_type"),r.calculateBalanceChange(e.pick(this,n)).then(function(e){return"hours"===t?v.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,s.statusNames.cancelled)},approve:function(){return u.call(this,s.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,s.statusNames.rejected)},sendBack:function(){return u.call(this,s.statusNames.moreInformationRequired)},update:function(){return r.update(this.toAPI()).then(function(){return n.all([h.call(this),m.call(this)])}.bind(this))},create:function(){return r.create(this.toAPI()).then(function(e){return this.id=e.id,n.all([h.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(t){if(t.comment_id)return void(t.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return t.created_at===e.created_at&&t.text===e.text})},delete:function(){return r.delete(this.id)},getBalanceChangeBreakdown:function(){return r.getBalanceChangeBreakdown(this.id).then(function(t){return{amount:e.reduce(t.values,function(e,t){return e+parseFloat(t.amount)},0),breakdown:t.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return r.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return n.reject(e)})},isValid:function(){return r.isValid(this.toAPI())},isApproved:function(){return d.call(this,s.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,s.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,s.statusNames.cancelled)},isRejected:function(){return d.call(this,s.statusNames.rejected)},isSentBack:function(){return d.call(this,s.statusNames.moreInformationRequired)},loadComments:function(){return this.id?r.getComments(this.id).then(function(e){this.comments=e}.bind(this)):n.resolve()},roleOf:function(e){return this.contact_id===e?n.resolve("owner"):a(s.permissions.admin.administer).then(function(t){return t?"admin":r.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])},loadAttachments:function(){return this.id?r.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):n.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,t,n,a){return e.debug("LeaveRequest"),t.extend({all:function(e,t,o,s,i){return n.all(this.processFilters(e),t,o,s,i).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return n.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return n.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/apis/public-holiday.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("PublicHolidayAPI",["$log","api",function(e,t){return e.debug("PublicHolidayAPI"),t.extend({all:function(t){return e.debug("PublicHolidayAPI"),this.sendGET("PublicHoliday","get",t).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/public-holiday.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("PublicHolidayInstance",["$log","ModelInstance",function(e,t){return e.debug("PublicHolidayInstance"),t.extend({})}])}),define("leave-absences/shared/models/public-holiday.model",["common/moment","leave-absences/shared/modules/models","common/models/model","common/services/hr-settings","leave-absences/shared/apis/public-holiday.api","leave-absences/shared/instances/public-holiday.instance"],function(e,t){"use strict";t.factory("PublicHoliday",["$log","Model","PublicHolidayAPI","PublicHolidayInstance","shared-settings",function(t,n,a,o,s){return t.debug("PublicHoliday"),n.extend({all:function(e){return t.debug("PublicHoliday.all",e),a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},isPublicHoliday:function(n){t.debug("PublicHoliday.isPublicHoliday",n);var o=e(n).format(s.serverDateFormat),i={date:o};return a.all(i).then(function(e){return!!e.length})}})}])}),define("leave-absences/shared/instances/sickness-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,t){"use strict";t.factory("SicknessRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(t,n){return n.extend({defaultCustomData:function(){var t={sickness_reason:null,sickness_required_documents:"",request_type:"sickness"};return e.assign({},n.defaultCustomData(),t)},getDocumentArray:function(){return this.sickness_required_documents?this.sickness_required_documents.split(","):[]},toggleDocument:function(t){var n=this.getDocumentArray(),a=n.indexOf(t);e.contains(n,t)?n.splice(a,1):n.push(t),this.sickness_required_documents=n.join(",")},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])}})}])}),define("leave-absences/shared/instances/toil-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,t){"use strict";t.factory("TOILRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(t,n){return n.extend({defaultCustomData:function(){var t={from_date_amount:0,to_date_amount:0,request_type:"toil"};return e.assign({},n.defaultCustomData(),t)},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])}})}])}),define("leave-absences/shared/controllers/request.controller",["common/angular","leave-absences/shared/modules/controllers","common/lodash","common/moment","common/models/contact","common/services/api/option-group","common/services/hr-settings","common/services/pub-sub","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/instances/leave-request.instance","leave-absences/shared/instances/sickness-request.instance","leave-absences/shared/instances/toil-request.instance","leave-absences/shared/services/leave-request.service"],function(e,t,n,a){"use strict";function o(t,o,s,i,r,c,u,l,d,m,f,p,v,h,b,g,y,_,q,C){function T(e){"days"===Ne.selectedAbsenceType.calculation_unit_name?delete Ne.request[e+"_date_amount"]:delete Ne.request[e+"_date_type"]}function A(){["from","to"].forEach(T)}function D(){return Me.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin")})}function R(){var e=Ne.requestStatuses[y.statusNames.awaitingApproval].value;ke.status_id===e&&e!==Ne.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Fe.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return Fe.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return!Ne.loading.entitlements&&(!!le("admin")||!ce("view")&&!(le("manager")&&!ce("create")))}function L(){var e=P();return Ne.isMode("edit")&&(e=e&&(G()||S())),Ne.canManage&&Ne.requestStatuses&&(e=e&&!!Ne.getStatusFromValue(Ne.newStatusOnSave)),(e=e&&!!Ne.period.id)&&!Ne.isMode("view")}function O(){Ne.isSelfRecord&&!Ne.isSelfLeaveApprover?Ne.request.status_id=Ne.requestStatuses[y.statusNames.awaitingApproval].value:Ne.canManage&&(Ne.request.status_id=Ne.newStatusOnSave||Ne.request.status_id)}function M(){if(Ne.isMode("edit")&&!Ne.isRole("staff")&&"toil"!==j())return Ne.request.calculateBalanceChange(Ne.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Ne.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function w(){return"toil"!==j()&&!Ne.request.change_balance}function $(){Ne.errors=[]}function k(){return Ne.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function x(){se()&&!Ne.isRole("staff")&&(Ne.request.change_balance=!0)}function B(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Ne.request.delete().then(function(){Ne.dismissModal(),d.publish("LeaveRequest::delete",Ne.request)})}})}function E(){r.dismiss({$value:"cancel"})}function F(){var e=j();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function N(){return U(Ne.getStatusFromValue(Ne.request.status_id).name)}function U(e){return n.map(we[e],function(e){return Ne.requestStatuses[e]})}function j(){return Ne.request?Ne.request.request_type:Ne.leaveType||null}function H(){return!Ne.request||e.equals({},Ne.requestStatuses)?[]:Ne.request.status_id?N():U("none")}function W(e){return n.find(Ne.requestStatuses,function(t){return t.value===e})}function Y(e){Ne.errors=n.isArray(e)?e:[e],Ne.loading.absenceTypes=!1,Ne.submitting=!1}function G(){return!e.equals(ke,Ne.request.attributes())||Ne.canManage&&Ne.newStatusOnSave}function V(){return Ne.postContactSelection=!0,Ne.staffMemberSelectionComplete=!1,Ne.request.contact_id?o.resolve().then(me).then(fe).then(_e).then(Ce).then(oe).then(Q).then(Ne.isMode("edit")?Te:n.noop).then(function(){Ne.postContactSelection=!1,Ne.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Be)return o.reject(e)}):o.reject("The contact id was not set")}function z(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];we.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],we.awaiting_approval=e,we.more_information_required=e,we.rejected=e,we.approved=e,we.cancelled=[y.statusNames.awaitingApproval].concat(e)}function X(){Ne.canManage=Ne.isRole("manager")||Ne.isRole("admin")}function Q(){return Ne.canManage?f.find(Ne.request.contact_id).then(function(e){Ne.contactName=e.display_name}):o.resolve()}function J(){Ne.isRole("admin")&&Ne.isSelfRecord&&(Ne.isSelfLeaveApprover=!0)}function K(){var e="my-leave"===s.section,t=+Me.id==+n.get(Ne,"leaveRequest.contact_id"),a=!n.get(Ne,"leaveRequest.id");Ne.isSelfRecord=e&&a||t}function Z(){xe.push(s.$on("LeaveRequestPopup::requestObjectUpdated",Te),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(_e).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Ne.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,t){Y(t)}),s.$on("LeaveRequestPopup::childComponent::register",function(){$e++})),i.$on("$destroy",Se),i.$on("LeaveRequestPopup::addTab",function(e,t){Fe.push(t)})}function ee(){var e,t;Ne.request=Ne.leaveRequest||null,e=j(),t=Ne.initRequestAttributes(),"leave"===e?Ne.request=g.init(t):"sickness"===e?Ne.request=_.init(t):"toil"===e&&(Ne.request=q.init(t))}function te(){var e={};return Ne.request?e=Ne.request.attributes():Ne.canManage||(e={contact_id:Me.id}),e}function ne(){return Ee="staff",ae().then(Ne.isSelfRecord&&!Ne.isRole("admin")&&D)}function ae(){return c(y.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&c(y.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function oe(){Ne.defaultStatus?Ne.newStatusOnSave=Ne.requestStatuses[y.statusNames[Ne.defaultStatus]].value:(Ne.isRole("admin")||Ne.isMode("create")&&Ne.isRole("manager"))&&(Ne.newStatusOnSave=Ne.requestStatuses[y.statusNames.approved].value)}function se(){return!Ne.request.status_id||!n.includes(["cancelled","rejected"],W(Ne.request.status_id).name)}function ie(e){var t=Ne.getStatusFromValue(Ne.request.status_id);return!!t&&t.name===e}function re(e){return Ne.request&&Ne.request.request_type===e}function ce(e){return Ne.mode===e}function ue(e,t){var n=a(e.from_date),o=a(e.to_date);return n.isSameOrAfter(t.start_date,"day")&&o.isSameOrBefore(t.end_date,"day")}function le(e){return Ee===e}function de(){return p.all().then(function(e){Ne.absencePeriods=e})}function me(){return v.all(F()).then(v.loadCalculationUnits).then(function(e){Oe={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Ne.loading.entitlements=!0,h.all({contact_id:Ne.request.contact_id,period_id:Ne.period.id,type_id:{IN:Oe.ids}},!0).finally(function(){Ne.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){Me=e})}function ve(){return Ne.selectedContactId?f.find(Ne.selectedContactId).then(function(e){Ne.managedContacts=[e]}):Ne.isRole("admin")?f.all().then(function(e){Ne.managedContacts=e.list}):Me.leaveManagees().then(function(e){Ne.managedContacts=e})}function he(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Ne.requestStatuses=n.indexBy(e,"name")})}function be(e,t){var a;return n.compact(e.map(function(e){if(a=n.find(t,{type_id:e.id}))return{id:a.type_id,title:e.title+" ( "+a.remainder.current+" ) ",remainder:a.remainder.current,allow_overuse:e.allow_overuse,calculation_unit_name:e.calculation_unit_name}}))}function ge(e){R(),d.publish(e,Ne.request),Ne.errors=[],Ne.dismissModal()}function ye(){["from","to"].forEach(function(e){Ne.request[e+"_date"]=ke[e+"_date"]})}function _e(e){if(Ne.absenceTypes=be(Oe.types,e),!Ne.absenceTypes.length)return o.reject(Be)}function qe(){Ne.period=n.find(Ne.absencePeriods,function(e){return Ne.isMode("create")?e.current:ue(Ne.request,e)})}function Ce(){Ne.isMode("create")?(Ne.selectedAbsenceType=Ne.absenceTypes[0],Ne.request.type_id=Ne.selectedAbsenceType.id):Ne.selectedAbsenceType=n.find(Ne.absenceTypes,function(e){return e.id===Ne.request.type_id})}function Te(){ke=e.copy(Ne.request.attributes())}function Ae(){var e;Ne.request.id?(e=[Ne.requestStatuses[y.statusNames.approved].value,Ne.requestStatuses[y.statusNames.adminApproved].value,Ne.requestStatuses[y.statusNames.rejected].value,Ne.requestStatuses[y.statusNames.cancelled].value],Ne.mode="edit",Ne.isRole("staff")&&e.indexOf(Ne.request.status_id)>-1&&(Ne.mode="view")):Ne.mode="create"}function De(){var e=Ne.request.status_id;if(!Ne.isMode("view")&&!Ne.submitting)return Ne.submitting=!0,O(),A(),Ne.request.isValid().then(se()&&M).then(x).then(w()&&ye).then(Re).then(function(){return Ne.isMode("edit")?Le():k()}).catch(function(t){Ne.request.status_id=e, +t&&Y(t)}).finally(function(){Ne.submitting=!1})}function Re(){return o.all(Fe.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&n.push(e),++a===$e&&(n.length>0?t.reject(n):t.resolve())}var t=o.defer(),n=[],a=0;return $e>0?s.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Se(){xe.forEach(function(e){e()})}function Ie(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Le(){return Ne.request.update().then(Pe).then(function(){Ne.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Ne.isRole("staff")||Ne.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Oe,Me,we={},$e=0,ke={},xe=[],Be="No entitlement",Ee="",Fe=[],Ne=n.assign(this,m);Ne.absencePeriods=[],Ne.absenceTypes=[],Ne.canManage=!1,Ne.contactName=null,Ne.errors=[],Ne.isSelfLeaveApprover=!1,Ne.loading={absenceTypes:!0,entitlements:!0},Ne.managedContacts=[],Ne.mode="",Ne.newStatusOnSave=null,Ne.period={},Ne.postContactSelection=!1,Ne.requestStatuses={},Ne.selectedAbsenceType={},Ne.staffMemberSelectionComplete=!1,Ne.submitting=!1,Ne.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Ne.canChangeAbsenceType=I,Ne.canSubmit=L,Ne.closeAlert=$,Ne.deleteLeaveRequest=B,Ne.dismissModal=E,Ne.getStatuses=H,Ne.getStatusFromValue=W,Ne.initAfterContactSelection=V,Ne.initRequestAttributes=te,Ne.isLeaveStatus=ie,Ne.isLeaveType=re,Ne.isMode=ce,Ne.isRole=le,Ne.submit=De,Ne.updateAbsenceType=Ie,function(){Ne.loading.absenceTypes=!0,z(),Z(),pe().then(K).then(function(){return o.all([ne(),de(),he()])}).then(X).then(J).then(ee).then(Ae).then(qe).then(function(){return Ne.canManage&&!Ne.isMode("edit")&&ve()}).then(function(){if(Ne.selectedContactId&&(Ne.request.contact_id=Ne.selectedContactId),Ne.request.contact_id)return Ne.initAfterContactSelection()}).catch(Y).finally(function(){Ne.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",o),o.$inject=["$log","$q","$rootScope","$scope","$uibModalInstance","checkPermissions","api.optionGroup","dialog","pubSub","directiveOptions","Contact","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","LeaveRequestInstance","shared-settings","SicknessRequestInstance","TOILRequestInstance","LeaveRequestService"]}),define("leave-absences/shared/services/leave-popup.service",["common/lodash","common/modules/angular-date","leave-absences/shared/modules/services","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/controllers/request.controller"],function(e,t){"use strict";function n(e,t,n,a,o,s,i,r,c){function u(e){return r.get().then(function(t){return e.roleOf(t.contactId)}).then(function(e){return"none"!==e})}function l(e){a.open({appendTo:t.children().eq(0),templateUrl:s.sharedPathTpl+"components/leave-request-popup/leave-request-popup.html",controller:"RequestCtrl",controllerAs:"$ctrl",windowClass:"chr_leave-request-modal",resolve:{directiveOptions:function(){return e},format:["DateFormat",function(e){return e.getDateFormat()}]}})}function d(e){return c.find(e).then(function(e){return u(e).then(function(t){t?l({leaveRequest:e,leaveType:e.request_type,selectedContactId:e.contact_id}):o.error("Error","You dont have permission to see this leave request")})}).catch(function(e){o.error("Error",e)})}return e.debug("LeavePopup"),{openModal:l,openModalByID:d}}t.factory("LeavePopup",n),n.$inject=["$log","$rootElement","$rootScope","$uibModal","notificationService","shared-settings","DateFormat","Session","LeaveRequest"]}),define("leave-absences/manager-leave/modules/components",["common/angular"],function(e){return e.module("manager-leave.components",[])}),define("leave-absences/manager-leave/components/manager-leave-container",["leave-absences/manager-leave/modules/components"],function(e){e.component("managerLeaveContainer",{bindings:{contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/manager-leave-container.html"}],controller:["$log","$rootScope","$state",function(e,t,n){function a(){n.go(o.tabName)}e.debug("Component: manager-leave-container"),t.section="manager-leave";var o=this;o.tabName=n.current.name,o.changeTab=a}],controllerAs:"managerLeave"})}),function(e){define("leave-absences/manager-leave/modules/settings",["common/angular"],function(t){return t.module("manager-leave.settings",[]).constant("settings",{debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/"})})}(CRM),function(e,t){define("leave-absences/manager-leave/modules/config",["common/angular","common/lodash","leave-absences/manager-leave/modules/settings"],function(t,n){function a(t){t.withAutoBase(!0),t.settings.ga={userId:n.get(e,"vars.session.contact_id")}}return t.module("manager-leave.config",["manager-leave.settings"]).config(["$stateProvider","$resourceProvider","$urlRouterProvider","$httpProvider","$logProvider","$analyticsProvider","settings",function(t,n,o,s,i,r,c){s.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",n.defaults.stripTrailingSlashes=!1,o.otherwise("/manager-leave/requests"),a(r),i.debugEnabled(c.debug),t.state("manager-leave",{abstract:!0,url:"/manager-leave",template:'',resolve:{contactId:function(){return e.vars.leaveAndAbsences.contactId},format:["DateFormat",function(e){return e.getDateFormat()}]}}).state("manager-leave.requests",{url:"/requests?leave-request-id",template:'',onEnter:["$stateParams","LeavePopup",function(e,t){e["leave-request-id"]&&t.openModalByID(e["leave-request-id"])}]}).state("manager-leave.calendar",{url:"/calendar",template:''}).state("manager-leave.leave-balances",{url:"/leave-balances",template:""})}])})}(CRM,Drupal),define("leave-absences/manager-leave/app",["common/angular","common/angularBootstrap","common/angulartics","common/angulartics-google-tag-manager","common/angularUiRouter","common/text-angular","common/directives/loading","common/directives/scroll-shadows.directive","common/directives/time-amount-picker.directive","common/directives/timepicker-select.directive","common/filters/angular-date/format-date","common/filters/time-unit-applier.filter","common/modules/dialog","common/services/angular-date/date-format","common/services/check-permissions","common/services/crm-ang.service","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/components/leave-balance-tab.component","leave-absences/shared/components/leave-calendar.component","leave-absences/shared/components/leave-calendar-day.component","leave-absences/shared/components/leave-calendar-legend.component","leave-absences/shared/components/leave-calendar-month.component","leave-absences/shared/components/leave-request-actions.component","leave-absences/shared/components/leave-request-popup-comments-tab.component","leave-absences/shared/components/leave-request-popup-details-tab.component","leave-absences/shared/components/leave-request-popup-files-tab","leave-absences/shared/components/leave-request-record-actions.component","leave-absences/shared/components/manage-leave-requests.component","leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/services/leave-calendar.service","leave-absences/shared/services/leave-popup.service","leave-absences/manager-leave/components/manager-leave-container","leave-absences/manager-leave/modules/config"],function(e){return e.module("manager-leave",["ngResource","ngAnimate","angulartics","angulartics.google.tagmanager","ui.bootstrap","ui.router","ui.select","textAngular","common.angularDate","common.dialog","common.filters","common.models","common.directives","common.mocks","leave-absences.models","leave-absences.components","leave-absences.controllers","leave-absences.models","leave-absences.services","manager-leave.config","manager-leave.components"]).run(["$log","$rootScope","shared-settings","settings",function(e,t,n,a){e.debug("app.run"),t.sharedPathTpl=n.sharedPathTpl,t.settings=a}]),e}),function(e,t){var n=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";t.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":n+"/shared","leave-absences/manager-leave":n+"/manager-leave"}}),t(["leave-absences/shared/config"],function(){t(["leave-absences/manager-leave/app","leave-absences/shared/models/leave-request.model"],function(e){e.bootstrap(document.querySelector("[data-leave-absences-manager-leave]"),["manager-leave"])})})}(CRM,require),define("manager-leave",function(){}); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-leave.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-notification-badge.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-notification-badge.min.js index 3618ef86de9..0bcd6120b6e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-notification-badge.min.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-notification-badge.min.js @@ -1,2 +1,2 @@ -!function(e){define("leave-absences/shared/config",[],function(){var n=CRM.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/shared";e.config({paths:{"leave-absences/shared/ui-router":"leave-absences/shared/vendor/angular-ui-router.min",mocks:"../test/mocks"},shim:{"leave-absences/shared/ui-router":{}}}),e.config({paths:{"leave-absences/shared/ui-router":n+"/vendor/angular-ui-router.min",mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(n){return n.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,t,a){return e.debug("LeaveRequestAPI"),t.extend({all:function(n,t,s,i,o){e.debug("LeaveRequestAPI.all");var c=a.defer();return n&&n.contact_id&&n.contact_id.IN&&0===n.contact_id.IN.length?c.resolve({list:[],total:0,allIds:[]}):c.resolve(this.getAll("LeaveRequest",n,t,s,i,"getFull",o)),c.promise},balanceChangeByAbsenceType:function(t){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var s=a.defer();return t.contact_id&&t.period_id||s.reject("contact_id and period_id are mandatory"),t=n.defaults(t,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",t,!1).then(function(e){s.resolve(e.values)}),s.promise},calculateBalanceChange:function(t){return e.debug("LeaveRequestAPI.calculateBalanceChange",t),this.sendPOST("LeaveRequest","calculatebalancechange",t).then(function(e){return e.values.breakdown=n.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,n){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:n.toString()},!1)},create:function(n){return e.debug("LeaveRequestAPI.create",n),this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,attachment_id:t}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,t){return t=n.assign({},t,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",t).then(function(e){return e.values})},find:function(n){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:n},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",t,!1).then(function(e){return e.values})},getComments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",t,!1).then(function(e){return e.values})},isManagedBy:function(n,t){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:n,contact_id:t}).then(function(e){return e.values})},isValid:function(t){e.debug("LeaveRequestAPI.isValid",t);var s=a.defer();return this.sendPOST("LeaveRequest","isValid",t).then(function(e){e.count>0?s.reject(n(e.values).map().flatten().value()):s.resolve(e.values)}),s.promise},saveComment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,text:t.text,contact_id:t.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(n){e.debug("LeaveRequestAPI.update",n);var t=a.defer();return n.id||t.reject("id is mandatory field"),this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,n,t){"use strict";t.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(t,a,s){return t.debug("AbsenceTypeAPI"),a.extend({all:function(n){return t.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(n||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,i,o){return t.debug("AbsenceTypeAPI.calculateToilExpiryDate"),o=e.assign({},o,{absence_type_id:a,date:n(i).format(s.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",o).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,n){return e.debug("AbsenceTypeInstance"),n.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,n){"use strict";n.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(n,t,a,s,i,o){return n.debug("AbsenceType"),a.extend({all:function(e){return i.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},calculateToilExpiryDate:function(e,n,t){return i.calculateToilExpiryDate(e,n,t)},canExpire:function(e){return i.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(n){return s.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(t){return t=e.indexBy(t,"value"),e.map(n,function(n){return e.assign(n,{calculation_unit_label:t[n.calculation_unit].label,calculation_unit_name:t[n.calculation_unit].name})})})}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,n,t){"use strict";t.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(t,a,s,i,o,c,r){function u(e){return h(e).then(function(e){var n=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=n,t.reject(e)}.bind(this))}.bind(this))}function l(){return r.all({id:this.type_id}).then(r.loadCalculationUnits).then(function(e){return t.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return h(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var n=[];return e.forEach(this.files,function(e){e.toBeDeleted&&n.push(c.deleteAttachment(this.id,e.attachment_id))}.bind(this)),t.all(n)}function f(e){return n.duration(e.time_to).subtract(n.duration(e.time_from)).asHours()}function h(n){return s.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){return e.find(t,function(e){return e.name===n})})}function v(n){var a=e.cloneDeep(n),s=a.breakdown.length>1,i=e.first(e.values(a.breakdown)),o=e.last(e.values(a.breakdown));return t.all([this.getWorkDayForDate(i.date),s&&this.getWorkDayForDate(o.date)]).then(function(n){return i.amount=n[0].time_from?Math.min(this.from_date_amount,f(n[0])):0,s&&(o.amount=n[1].time_from?Math.min(this.to_date_amount,f(n[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,n){return e+n.amount},0),a}.bind(this))}function g(){var e=this.id,n=[];return n.push(t.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(n){return function(){return c.saveComment(e,n)}}))),n=n.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return c.deleteComment(e.comment_id)})),t.all(n)}return o.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(n){var t=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===n&&e.pull(t,"from_date_type","to_date_type"),c.calculateBalanceChange(e.pick(this,t)).then(function(e){return"hours"===n?v.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,i.statusNames.cancelled)},approve:function(){return u.call(this,i.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,i.statusNames.rejected)},sendBack:function(){return u.call(this,i.statusNames.moreInformationRequired)},update:function(){return c.update(this.toAPI()).then(function(){return t.all([g.call(this),m.call(this)])}.bind(this))},create:function(){return c.create(this.toAPI()).then(function(e){return this.id=e.id,t.all([g.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(n){if(n.comment_id)return void(n.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return n.created_at===e.created_at&&n.text===e.text})},delete:function(){return c.delete(this.id)},getBalanceChangeBreakdown:function(){return c.getBalanceChangeBreakdown(this.id).then(function(n){return{amount:e.reduce(n.values,function(e,n){return e+parseFloat(n.amount)},0),breakdown:n.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return c.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return t.reject(e)})},isValid:function(){return c.isValid(this.toAPI())},isApproved:function(){return d.call(this,i.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,i.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,i.statusNames.cancelled)},isRejected:function(){return d.call(this,i.statusNames.rejected)},isSentBack:function(){return d.call(this,i.statusNames.moreInformationRequired)},loadComments:function(){return this.id?c.getComments(this.id).then(function(e){this.comments=e}.bind(this)):t.resolve()},roleOf:function(e){return this.contact_id===e?t.resolve("owner"):a(i.permissions.admin.administer).then(function(n){return n?"admin":c.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])},loadAttachments:function(){return this.id?c.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):t.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,n,t,a){return e.debug("LeaveRequest"),n.extend({all:function(e,n,s,i,o){return t.all(this.processFilters(e),n,s,i,o).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return t.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return t.find(e).then(function(e){return a.init(e,!0)})}})}])}),function(e){define("leave-absences/manager-notification-badge/modules/settings",["common/angular"],function(n){return n.module("manager-notification-badge.settings",[]).constant("settings",{debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-notification-badge/"})})}(CRM),function(e){define("leave-absences/manager-notification-badge/modules/config",["common/angular","leave-absences/manager-notification-badge/modules/settings"],function(e){return e.module("manager-notification-badge.config",["manager-notification-badge.settings"]).config(["$resourceProvider","$httpProvider","$logProvider","settings",function(e,n,t,a){t.debugEnabled(a.debug),e.defaults.stripTrailingSlashes=!1,n.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}])})}(CRM),define("leave-absences/manager-notification-badge/modules/components",["common/angular"],function(e){return e.module("manager-notification-badge.components",[])}),define("leave-absences/manager-notification-badge/components/manager-notification-badge.component",["common/lodash","leave-absences/manager-notification-badge/modules/components"],function(e,n){function t(n,t,a,s,i){function o(){return a.get().then(function(e){l.params.managed_by=e.contactId})}function c(){return r().then(function(n){l.params.status_id=e.find(n,function(e){return e.name===i.statusNames.awaitingApproval}).value})}function r(){return s.valuesOf("hrleaveandabsences_leave_request_status")}n.debug("Component: manager-notification-badge");var u=this,l={apiName:"LeaveRequest",params:{}};u.refreshCountEventName="ManagerBadge:: Update Count",function(){t.all([o(),c()]).then(function(){u.filters=[l]})}()}n.component("managerNotificationBadge",{templateUrl:["settings",function(e){return e.pathTpl+"components/manager-notification-badge.html"}],controllerAs:"managerNotificationBadge",controller:t}),t.$inject=["$log","$q","Session","OptionGroup","shared-settings"]}),define("leave-absences/manager-notification-badge/app",["common/angular","common/models/session.model","common/modules/templates","common/services/pub-sub","common/components/notification-badge.component","leave-absences/shared/modules/shared-settings","leave-absences/shared/models/leave-request.model","leave-absences/manager-notification-badge/modules/config","leave-absences/manager-notification-badge/components/manager-notification-badge.component"],function(e){return e.module("manager-notification-badge",["ngResource","common.components","common.templates","leave-absences.settings","leave-absences.models","manager-notification-badge.components","manager-notification-badge.config"]).run(["$log",function(e){e.debug("app.run")}]),e}),function(e,n){var t=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";n.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":t+"/shared","leave-absences/manager-notification-badge":t+"/manager-notification-badge"}}),n(["leave-absences/shared/config"],function(){n(["leave-absences/manager-notification-badge/app"],function(e){e.bootstrap(document.querySelector("[data-leave-absences-manager-notification-badge]"),["manager-notification-badge"])})})}(CRM,require),define("manager-notification-badge",function(){}); +!function(e){define("leave-absences/shared/config",[],function(){e.config({paths:{mocks:"../test/mocks"}}),e.config({paths:{mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(n){return n.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,t,a){return e.debug("LeaveRequestAPI"),t.extend({all:function(n,t,s,i,o){e.debug("LeaveRequestAPI.all");var c=a.defer();return n&&n.contact_id&&n.contact_id.IN&&0===n.contact_id.IN.length?c.resolve({list:[],total:0,allIds:[]}):c.resolve(this.getAll("LeaveRequest",n,t,s,i,"getFull",o)),c.promise},balanceChangeByAbsenceType:function(t){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var s=a.defer();return t.contact_id&&t.period_id||s.reject("contact_id and period_id are mandatory"),t=n.defaults(t,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",t,!1).then(function(e){s.resolve(e.values)}),s.promise},calculateBalanceChange:function(t){return e.debug("LeaveRequestAPI.calculateBalanceChange",t),this.sendPOST("LeaveRequest","calculatebalancechange",t).then(function(e){return e.values.breakdown=n.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,n){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:n.toString()},!1)},create:function(n){return e.debug("LeaveRequestAPI.create",n),this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,attachment_id:t}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,t){return t=n.assign({},t,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",t).then(function(e){return e.values})},find:function(n){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:n},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",t,!1).then(function(e){return e.values})},getComments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",t,!1).then(function(e){return e.values})},isManagedBy:function(n,t){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:n,contact_id:t}).then(function(e){return e.values})},isValid:function(t){e.debug("LeaveRequestAPI.isValid",t);var s=a.defer();return this.sendPOST("LeaveRequest","isValid",t).then(function(e){e.count>0?s.reject(n(e.values).map().flatten().value()):s.resolve(e.values)}),s.promise},saveComment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,text:t.text,contact_id:t.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(n){return e.debug("LeaveRequestAPI.update",n),n.id?this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]}):a.reject("id is mandatory field")}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,n,t){"use strict";t.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(t,a,s){return t.debug("AbsenceTypeAPI"),a.extend({all:function(n){return t.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(n||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,i,o){return t.debug("AbsenceTypeAPI.calculateToilExpiryDate"),o=e.assign({},o,{absence_type_id:a,date:n(i).format(s.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",o).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,n){return e.debug("AbsenceTypeInstance"),n.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,n){"use strict";n.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(n,t,a,s,i,o){return n.debug("AbsenceType"),a.extend({all:function(e){return i.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},calculateToilExpiryDate:function(e,n,t){return i.calculateToilExpiryDate(e,n,t)},canExpire:function(e){return i.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(n){return s.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(t){return t=e.indexBy(t,"value"),e.map(n,function(n){return e.assign(n,{calculation_unit_label:t[n.calculation_unit].label,calculation_unit_name:t[n.calculation_unit].name})})})}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,n,t){"use strict";t.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(t,a,s,i,o,c,r){function u(e){return h(e).then(function(e){var n=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=n,t.reject(e)}.bind(this))}.bind(this))}function l(){return r.all({id:this.type_id}).then(r.loadCalculationUnits).then(function(e){return t.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return h(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var n=[];return e.forEach(this.files,function(e){e.toBeDeleted&&n.push(c.deleteAttachment(this.id,e.attachment_id))}.bind(this)),t.all(n)}function f(e){return n.duration(e.time_to).subtract(n.duration(e.time_from)).asHours()}function h(n){return s.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){return e.find(t,function(e){return e.name===n})})}function v(n){var a=e.cloneDeep(n),s=a.breakdown.length>1,i=e.first(e.values(a.breakdown)),o=e.last(e.values(a.breakdown));return t.all([this.getWorkDayForDate(i.date),s&&this.getWorkDayForDate(o.date)]).then(function(n){return i.amount=n[0].time_from?Math.min(this.from_date_amount,f(n[0])):0,s&&(o.amount=n[1].time_from?Math.min(this.to_date_amount,f(n[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,n){return e+n.amount},0),a}.bind(this))}function g(){var e=this.id,n=[];return n.push(t.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(n){return function(){return c.saveComment(e,n)}}))),n=n.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return c.deleteComment(e.comment_id)})),t.all(n)}return o.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(n){var t=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===n&&e.pull(t,"from_date_type","to_date_type"),c.calculateBalanceChange(e.pick(this,t)).then(function(e){return"hours"===n?v.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,i.statusNames.cancelled)},approve:function(){return u.call(this,i.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,i.statusNames.rejected)},sendBack:function(){return u.call(this,i.statusNames.moreInformationRequired)},update:function(){return c.update(this.toAPI()).then(function(){return t.all([g.call(this),m.call(this)])}.bind(this))},create:function(){return c.create(this.toAPI()).then(function(e){return this.id=e.id,t.all([g.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(n){if(n.comment_id)return void(n.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return n.created_at===e.created_at&&n.text===e.text})},delete:function(){return c.delete(this.id)},getBalanceChangeBreakdown:function(){return c.getBalanceChangeBreakdown(this.id).then(function(n){return{amount:e.reduce(n.values,function(e,n){return e+parseFloat(n.amount)},0),breakdown:n.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return c.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return t.reject(e)})},isValid:function(){return c.isValid(this.toAPI())},isApproved:function(){return d.call(this,i.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,i.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,i.statusNames.cancelled)},isRejected:function(){return d.call(this,i.statusNames.rejected)},isSentBack:function(){return d.call(this,i.statusNames.moreInformationRequired)},loadComments:function(){return this.id?c.getComments(this.id).then(function(e){this.comments=e}.bind(this)):t.resolve()},roleOf:function(e){return this.contact_id===e?t.resolve("owner"):a(i.permissions.admin.administer).then(function(n){return n?"admin":c.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])},loadAttachments:function(){return this.id?c.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):t.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,n,t,a){return e.debug("LeaveRequest"),n.extend({all:function(e,n,s,i,o){return t.all(this.processFilters(e),n,s,i,o).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return t.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return t.find(e).then(function(e){return a.init(e,!0)})}})}])}),function(e){define("leave-absences/manager-notification-badge/modules/settings",["common/angular"],function(n){return n.module("manager-notification-badge.settings",[]).constant("settings",{debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-notification-badge/"})})}(CRM),function(e){define("leave-absences/manager-notification-badge/modules/config",["common/angular","leave-absences/manager-notification-badge/modules/settings"],function(e){return e.module("manager-notification-badge.config",["manager-notification-badge.settings"]).config(["$resourceProvider","$httpProvider","$logProvider","settings",function(e,n,t,a){t.debugEnabled(a.debug),e.defaults.stripTrailingSlashes=!1,n.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}])})}(CRM),define("leave-absences/manager-notification-badge/modules/components",["common/angular"],function(e){return e.module("manager-notification-badge.components",[])}),define("leave-absences/manager-notification-badge/components/manager-notification-badge.component",["common/lodash","leave-absences/manager-notification-badge/modules/components"],function(e,n){function t(n,t,a,s,i){function o(){t.all([c(),r()]).then(function(){l.filters=[d]})}function c(){return a.get().then(function(e){d.params.managed_by=e.contactId})}function r(){return u().then(function(n){d.params.status_id=e.find(n,function(e){return e.name===i.statusNames.awaitingApproval}).value})}function u(){return s.valuesOf("hrleaveandabsences_leave_request_status")}n.debug("Component: manager-notification-badge");var l=this,d={apiName:"LeaveRequest",params:{}};l.refreshCountEventName="ManagerBadge:: Update Count",l.$onInit=o}n.component("managerNotificationBadge",{templateUrl:["settings",function(e){return e.pathTpl+"components/manager-notification-badge.html"}],controllerAs:"managerNotificationBadge",controller:t}),t.$inject=["$log","$q","Session","OptionGroup","shared-settings"]}),define("leave-absences/manager-notification-badge/app",["common/angular","common/models/session.model","common/modules/templates","common/services/pub-sub","common/components/notification-badge.component","leave-absences/shared/modules/shared-settings","leave-absences/shared/models/leave-request.model","leave-absences/manager-notification-badge/modules/config","leave-absences/manager-notification-badge/components/manager-notification-badge.component"],function(e){return e.module("manager-notification-badge",["ngResource","common.components","common.templates","leave-absences.settings","leave-absences.models","manager-notification-badge.components","manager-notification-badge.config"]).run(["$log",function(e){e.debug("app.run")}]),e}),function(e,n){var t=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";n.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":t+"/shared","leave-absences/manager-notification-badge":t+"/manager-notification-badge"}}),n(["leave-absences/shared/config"],function(){n(["leave-absences/manager-notification-badge/app"],function(e){e.bootstrap(document.querySelector("[data-leave-absences-manager-notification-badge]"),["manager-notification-badge"])})})}(CRM,require),define("manager-notification-badge",function(){}); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-notification-badge.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index 56b86983c1c..b59c41367d2 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js @@ -1,14 +1,5 @@ -/** - * State-based routing for AngularJS - * @version v0.3.2 - * @link http://angular-ui.github.com/ - * @license MIT License, http://www.opensource.org/licenses/MIT - */ - - -!function(e){define("leave-absences/shared/config",[],function(){var t=CRM.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/shared";e.config({paths:{"leave-absences/shared/ui-router":"leave-absences/shared/vendor/angular-ui-router.min",mocks:"../test/mocks"},shim:{"leave-absences/shared/ui-router":{}}}),e.config({paths:{"leave-absences/shared/ui-router":t+"/vendor/angular-ui-router.min",mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/ui-router",[],function(){return function(){"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(e,t,n){"use strict";function a(e,t){return W(new(W(function(){},{prototype:e})),t)}function r(e){return H(arguments,function(t){t!==e&&H(t,function(t,n){e.hasOwnProperty(n)||(e[n]=t)})}),e}function o(e,t){var n=[];for(var a in e.path){if(e.path[a]!==t.path[a])break;n.push(e.path[a])}return n}function s(e){if(Object.keys)return Object.keys(e);var t=[];return H(e,function(e,n){t.push(n)}),t}function i(e,t){if(Array.prototype.indexOf)return e.indexOf(t,Number(arguments[2])||0);var n=e.length>>>0,a=Number(arguments[2])||0;for((a=a<0?Math.ceil(a):Math.floor(a))<0&&(a+=n);a=0||(l.push(r[m]),c[r[m]]=e[r[m]]);return W({},c,t)}function c(e,t,n){if(!n){n=[];for(var a in e)n.push(a)}for(var r=0;r "));if(g[n]=a,F(e))v.push(n,[function(){return t.get(e)}],c);else{var r=t.annotate(e);H(r,function(e){e!==n&&u.hasOwnProperty(e)&&f(u[e],e)}),v.push(n,e,r)}b.pop(),g[n]=o}}function p(e){return N(e)&&e.then&&e.$$promises}if(!N(u))throw new Error("'invocables' must be an object");var h=s(u||{}),v=[],b=[],g={};return H(u,f),u=b=g=null,function(a,o,s){function i(){--y||(_||r(g,o.$$values),f.$$values=g,f.$$promises=f.$$promises||!0,delete f.$$inheritedValues,c.resolve(g))}function u(e){f.$$failure=e,c.reject(e)}if(p(a)&&s===n&&(s=o,o=a,a=null),a){if(!N(a))throw new Error("'locals' must be an object")}else a=l;if(o){if(!p(o))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else o=d;var c=e.defer(),f=c.promise,b=f.$$promises={},g=W({},a),y=1+v.length/3,_=!1;if(j(o.$$failure))return u(o.$$failure),f;o.$$inheritedValues&&r(g,m(o.$$inheritedValues,h)),W(b,o.$$promises),o.$$values?(_=r(g,m(o.$$values,h)),f.$$inheritedValues=m(o.$$values,h),i()):(o.$$inheritedValues&&(f.$$inheritedValues=m(o.$$inheritedValues,h)),o.then(i,u));for(var $=0,q=v.length;$=0));)g=o(b.id,b.type,b.cfg,"path"),d+=s(b.segment,g.type.pattern.source,g.squash,g.isOptional),f.push(b.segment),m=c.lastIndex;y=e.substring(m);var _=y.indexOf("?");if(_>=0){var $=this.sourceSearch=y.substring(_);if(y=y.substring(0,_),this.sourcePath=e.substring(0,m+_),$.length>0)for(m=0;u=l.exec($);)b=i(u,!0),g=o(b.id,b.type,b.cfg,"search"),m=c.lastIndex}else this.sourcePath=e,this.sourceSearch="";d+=s(y)+(!1===t.strict?"/?":"")+"$",f.push(y),this.regexp=new RegExp(d,t.caseInsensitive?"i":n),this.prefix=f[0],this.$$paramNames=v}function y(e){W(this,e)}function _(){function e(e){return null!=e?e.toString().replace(/(~|\/)/g,function(e){return{"~":"~~","/":"~2F"}[e]}):e}function r(e){return null!=e?e.toString().replace(/(~~|~2F)/g,function(e){return{"~~":"~","~2F":"/"}[e]}):e}function o(){return{strict:h,caseInsensitive:m}}function u(e){return B(e)||U(e)&&B(e[e.length-1])}function c(){for(;q.length;){var e=q.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");t.extend(b[e.name],d.invoke(e.def))}}function l(e){W(this,e||{})}G=this;var d,m=!1,h=!0,v=!1,b={},$=!0,q=[],C={string:{encode:e,decode:r,is:function(e){return null==e||!j(e)||"string"==typeof e},pattern:/[^\/]*/},int:{encode:e,decode:function(e){return parseInt(e,10)},is:function(e){return j(e)&&this.decode(e.toString())===e},pattern:/\d+/},bool:{encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:function(e){return!0===e||!1===e},pattern:/0|1/},date:{encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):n},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):n},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return this.is(e)&&this.is(t)&&e.toISOString()===t.toISOString()},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:{encode:t.toJson,decode:t.fromJson,is:t.isObject,equals:t.equals,pattern:/[^\/]*/},any:{encode:t.identity,decode:t.identity,equals:t.equals,pattern:/.*/}};_.$$getDefaultValue=function(e){if(!u(e.value))return e.value;if(!d)throw new Error("Injectable functions cannot be called at configuration time");return d.invoke(e.value)},this.caseInsensitive=function(e){return j(e)&&(m=e),m},this.strictMode=function(e){return j(e)&&(h=e),h},this.defaultSquashPolicy=function(e){if(!j(e))return v;if(!0!==e&&!1!==e&&!F(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return v=e,e},this.compile=function(e,t){return new g(e,W(o(),t))},this.isMatcher=function(e){if(!N(e))return!1;var t=!0;return H(g.prototype,function(n,a){B(n)&&(t=t&&j(e[a])&&B(e[a]))}),t},this.type=function(e,t,n){if(!j(t))return b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new y(W({name:e},t)),n&&(q.push({name:e,def:n}),$||c()),this},H(C,function(e,t){b[t]=new y(W({name:t},e))}),b=a(b,{}),this.$get=["$injector",function(e){return d=e,$=!1,c(),H(C,function(e,t){b[t]||(b[t]=new y(e))}),this}],this.Param=function(e,a,r,o){function c(){if(!d)throw new Error("Injectable functions cannot be called at configuration time");var e=d.invoke(r.$$fn);if(null!==e&&e!==n&&!h.type.is(e))throw new Error("Default value ("+e+") for parameter '"+h.id+"' is not an instance of Type ("+h.type.name+")");return e}function l(e){function t(e){return function(t){return t.from===e}}return e=function(e){var n=p(f(h.replace,t(e)),function(e){return e.to});return n.length?n[0]:e}(e),j(e)?h.type.$normalize(e):c()}function m(){return"{Param:"+e+" "+a+" squash: '"+$+"' optional: "+_+"}"}var h=this;r=function(e){var t=N(e)?s(e):[];return-1===i(t,"value")&&-1===i(t,"type")&&-1===i(t,"squash")&&-1===i(t,"array")&&(e={value:e}),e.$$fn=u(e.value)?e.value:function(){return e.value},e}(r),a=function(n,a,r){if(n.type&&a)throw new Error("Param '"+e+"' has two type configurations.");return a||(n.type?t.isString(n.type)?b[n.type]:n.type instanceof y?n.type:new y(n.type):"config"===r?b.any:b.string)}(r,a,o);var g=function(){var t={array:"search"===o&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return W(t,n,r).array}();a=g?a.$asArray(g,"search"===o):a,"string"!==a.name||g||"path"!==o||r.value!==n||(r.value="");var _=r.value!==n,$=function(e,t){var n=e.squash;if(!t||!1===n)return!1;if(!j(n)||null==n)return v;if(!0===n||F(n))return n;throw new Error("Invalid squash policy: '"+n+"'. Valid policies: false, true, or arbitrary string")}(r,_),q=function(e,t,a,r){var o,s,u=[{from:"",to:a||t?n:""},{from:null,to:a||t?n:""}];return o=U(e.replace)?e.replace:[],F(r)&&o.push({from:r,to:n}),s=p(o,function(e){return e.from}),f(u,function(e){return-1===i(s,e.from)}).concat(o)}(r,g,_,$);W(this,{id:e,type:a,location:o,array:g,squash:$,replace:q,isOptional:_,value:l,dynamic:n,config:r,toString:m})},l.prototype={$$new:function(){return a(this,W(new l,{$$parent:this}))},$$keys:function(){for(var e=[],t=[],n=this,a=s(l.prototype);n;)t.push(n),n=n.$$parent;return t.reverse(),H(t,function(t){H(s(t),function(t){-1===i(e,t)&&-1===i(a,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return H(n.$$keys(),function(a){t[a]=n[a].value(e&&e[a])}),t},$$equals:function(e,t){var n=!0,a=this;return H(a.$$keys(),function(r){var o=e&&e[r],s=t&&t[r];a[r].type.equals(o,s)||(n=!1)}),n},$$validates:function(e){var a,r,o,s,i,u=this.$$keys();for(a=0;a=0)throw new Error("State must have a valid name");if(T.hasOwnProperty(n))throw new Error("State '"+n+"' is already defined");var r=-1!==n.indexOf(".")?n.substring(0,n.lastIndexOf(".")):F(t.parent)?t.parent:N(t.parent)&&F(t.parent.name)?t.parent.name:"";if(r&&!T[r])return f(r,t.self);for(var o in S)B(S[o])&&(t[o]=S[o](t,S.$delegates[o]));return T[n]=t,!t[D]&&t.url&&e.when(t.url,["$match","$stateParams",function(e,n){A.$current.navigable==t&&c(e,n)||A.transitionTo(t,e,{inherit:!0,location:!1})}]),v(n),t}function g(e){return e.indexOf("*")>-1}function y(e){for(var t=e.split("."),n=A.$current.name.split("."),a=0,r=t.length;a=T;a--)s=p[a],s.self.onExit&&i.invoke(s.self.onExit,s.self,s.locals.globals),s.locals=null;for(a=T;a<_.length;a++)r=_[a],r.locals=k[a],r.self.onEnter&&i.invoke(r.self.onEnter,r.self,r.locals.globals);return A.transition!==B?(e.$broadcast("$stateChangeCancel",t.self,n,c.self,d),S):(A.$current=t,A.current=t.self,A.params=n,V(A.params,f),A.transition=null,o.location&&t.navigable&&v.push(t.navigable.url,t.navigable.locals.globals.$stateParams,{$$avoidResync:!0,replace:"replace"===o.location}),o.notify&&e.$broadcast("$stateChangeSuccess",t.self,n,c.self,d),v.update(!0),A.current)}).then(null,function(a){return a===P?S:A.transition!==B?(e.$broadcast("$stateChangeCancel",t.self,n,c.self,d),S):(A.transition=null,s=e.$broadcast("$stateChangeError",t.self,n,c.self,d,a),s.defaultPrevented||v.update(),r.reject(a))});return B},A.is=function(e,t,a){a=W({relative:A.$current},a||{});var r=m(e,a.relative);return j(r)?A.$current===r&&(!t||c(r.params.$$values(t),f)):n},A.includes=function(e,t,a){if(a=W({relative:A.$current},a||{}),F(e)&&g(e)){if(!y(e))return!1;e=A.$current.name}var r=m(e,a.relative);if(!j(r))return n;if(!j(A.$current.includes[r.name]))return!1;if(!t)return!0;for(var o=s(t),i=0;i2?c.enter(e,null,n).then(a):c.enter(e,null,n,a)},leave:function(e,n){t.version.minor>2?c.leave(e).then(n):c.leave(e,n)}};if(u){var a=u&&u(n,e);return{enter:function(e,t,n){a.enter(e,null,t),n()},leave:function(e,t){a.leave(e),t()}}}return function(){return{enter:function(e,t,n){t.after(e),n()},leave:function(e,t){e.remove(),t()}}}()}var i=function(){return n.has?function(e){return n.has(e)?n.get(e):null}:function(e){try{return n.get(e)}catch(e){return null}}}(),u=i("$animator"),c=i("$animate");return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(n,i,u){return function(n,i,c){function l(){if(m&&(m.remove(),m=null),p&&(p.$destroy(),p=null),f){var e=f.data("$uiViewAnim");g.leave(f,function(){e.$$animLeave.resolve(),m=null}),m=f,f=null}}function d(s){var d,m=P(n,c,i,r),y=m&&e.$current&&e.$current.locals[m];if(s||y!==h){d=n.$new(),h=e.$current.locals[m],d.$emit("$viewContentLoading",m);var _=u(d,function(e){var r=o.defer(),s=o.defer(),u={$animEnter:r.promise,$animLeave:s.promise,$$animLeave:s};e.data("$uiViewAnim",u),g.enter(e,i,function(){r.resolve(),p&&p.$emit("$viewContentAnimationEnded"),(t.isDefined(b)&&!b||n.$eval(b))&&a(e)}),l()});f=_,p=d,p.$emit("$viewContentLoaded",m),p.$eval(v)}}var m,f,p,h,v=c.onload||"",b=c.autoscroll,g=s(c,n);i.inheritedData("$uiView"),n.$on("$stateChangeSuccess",function(){d(!1)}),d(!0)}}}}function T(e,n,a,r){return{restrict:"ECA",priority:-400,compile:function(o){var s=o.html();return function(o,i,u){var c=a.$current,l=P(o,u,i,r),d=c&&c.locals[l];if(d){i.data("$uiView",{name:l,state:d.$$state}),i.html(d.$template?d.$template:s);var m=t.extend({},d);o[d.$$resolveAs]=m;var f=e(i.contents());if(d.$$controller){d.$scope=o,d.$element=i;var p=n(d.$$controller,d);d.$$controllerAs&&(o[d.$$controllerAs]=p,o[d.$$controllerAs][d.$$resolveAs]=m),B(p.$onInit)&&p.$onInit(),i.data("$ngControllerController",p),i.children().data("$ngControllerController",p)}f(o)}}}}}function P(e,t,n,a){var r=a(t.uiView||t.name||"")(e),o=n.inheritedData("$uiView");return r.indexOf("@")>=0?r:r+"@"+(o?o.state.name:"")}function D(e,t){var n,a=e.match(/^\s*({[^}]*})\s*$/);if(a&&(e=t+"("+a[1]+")"),!(n=e.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/))||4!==n.length)throw new Error("Invalid state ref '"+e+"'");return{state:n[1],paramExpr:n[3]||null}}function S(e){var t=e.parent().inheritedData("$uiView");if(t&&t.state&&t.state.name)return t.state}function R(e){var t="[object SVGAnimatedString]"===Object.prototype.toString.call(e.prop("href")),n="FORM"===e[0].nodeName;return{attr:n?"action":t?"xlink:href":"href",isAnchor:"A"===e.prop("tagName").toUpperCase(),clickable:!n}}function I(e,t,n,a,r){return function(o){var s=o.which||o.button,i=r();if(!(s>1||o.ctrlKey||o.metaKey||o.shiftKey||e.attr("target"))){var u=n(function(){t.go(i.state,i.params,i.options)});o.preventDefault();var c=a.isAnchor&&!i.href?1:0;o.preventDefault=function(){c--<=0&&n.cancel(u)}}}}function x(e,t){return{relative:S(e)||t.$current,inherit:!0}}function O(e,n){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(a,r,o,s){var i,u=D(o.uiSref,e.current.name),c={state:u.state,href:null,params:null},l=R(r),d=s[1]||s[0],m=null;c.options=W(x(r,e),o.uiSrefOpts?a.$eval(o.uiSrefOpts):{});var f=function(n){n&&(c.params=t.copy(n)),c.href=e.href(u.state,c.params,c.options),m&&m(),d&&(m=d.$$addStateInfo(u.state,c.params)),null!==c.href&&o.$set(l.attr,c.href)};u.paramExpr&&(a.$watch(u.paramExpr,function(e){e!==c.params&&f(e)},!0),c.params=t.copy(a.$eval(u.paramExpr))),f(),l.clickable&&(i=I(r,e,n,l,function(){return c}),r[r.on?"on":"bind"]("click",i),a.$on("$destroy",function(){r[r.off?"off":"unbind"]("click",i)}))}}}function k(e,t){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(n,a,r,o){function s(t){m.state=t[0],m.params=t[1],m.options=t[2],m.href=e.href(m.state,m.params,m.options),f&&f(),c&&(f=c.$$addStateInfo(m.state,m.params)),m.href&&r.$set(u.attr,m.href)}var i,u=R(a),c=o[1]||o[0],l=[r.uiState,r.uiStateParams||null,r.uiStateOpts||null],d="["+l.map(function(e){return e||"null"}).join(", ")+"]",m={state:null,params:null,options:null,href:null},f=null;n.$watch(d,s,!0),s(n.$eval(d)),u.clickable&&(i=I(a,e,t,u,function(){return m}),a[a.on?"on":"bind"]("click",i),n.$on("$destroy",function(){a[a.off?"off":"unbind"]("click",i)}))}}}function L(e,t,n){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(t,a,r,o){function s(t,n,r){var o=e.get(t,S(a)),s=i(t,n),u={state:o||{name:t},params:n,hash:s};return h.push(u),v[s]=r,function(){var e=h.indexOf(u);-1!==e&&h.splice(e,1)}}function i(e,n){if(!F(e))throw new Error("state should be a string");return N(n)?e+Y(n):(n=t.$eval(n),N(n)?e+Y(n):e)}function u(){for(var e=0;e0)){var n=s(e,t,p);return u(),n}},t.$on("$stateChangeSuccess",u),u()}]}}function M(e){var t=function(t,n){return e.is(t,n)};return t.$stateful=!0,t}function E(e){var t=function(t,n,a){return e.includes(t,n,a)};return t.$stateful=!0,t}var j=t.isDefined,B=t.isFunction,F=t.isString,N=t.isObject,U=t.isArray,H=t.forEach,W=t.extend,V=t.copy,Y=t.toJson;t.module("ui.router.util",["ng"]),t.module("ui.router.router",["ui.router.util"]),t.module("ui.router.state",["ui.router.router","ui.router.util"]),t.module("ui.router",["ui.router.state"]),t.module("ui.router.compat",["ui.router"]),v.$inject=["$q","$injector"],t.module("ui.router.util").service("$resolve",v),b.$inject=["$http","$templateCache","$injector"],t.module("ui.router.util").service("$templateFactory",b);var G;g.prototype.concat=function(e,t){var n={caseInsensitive:G.caseInsensitive(),strict:G.strictMode(),squash:G.defaultSquashPolicy()};return new g(this.sourcePath+e+this.sourceSearch,W(n,t),this)},g.prototype.toString=function(){return this.source},g.prototype.exec=function(e,t){var n=this.regexp.exec(e);if(!n)return null;t=t||{};var a,r,o,s=this.parameters(),i=s.length,u=this.segments.length-1,c={};if(u!==n.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var l,d;for(a=0;a=":e}};return a.all(n).then(function(e){return e&&e.length?r.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,t,n){"use strict";n.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(n,a,r){return n.debug("AbsenceTypeAPI"),a.extend({all:function(t){return n.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(t||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,o,s){return n.debug("AbsenceTypeAPI.calculateToilExpiryDate"),s=e.assign({},s,{absence_type_id:a,date:t(o).format(r.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",s).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,t){return e.debug("AbsenceTypeInstance"),t.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,t){"use strict";t.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(t,n,a,r,o,s){return t.debug("AbsenceType"),a.extend({all:function(e){return o.all(e).then(function(e){return e.map(function(e){return s.init(e,!0)})})},calculateToilExpiryDate:function(e,t,n){return o.calculateToilExpiryDate(e,t,n)},canExpire:function(e){return o.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(t){return r.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(n){return n=e.indexBy(n,"value"),e.map(t,function(t){return e.assign(t,{calculation_unit_label:n[t.calculation_unit].label,calculation_unit_name:n[t.calculation_unit].name})})})}})}])}),define("leave-absences/shared/apis/work-pattern.api",["common/lodash","leave-absences/shared/modules/apis","common/services/api"],function(e,t){"use strict";t.factory("WorkPatternAPI",["$log","api",function(t,n){function a(t){var n=e.clone(t);return n.workPattern=n["api.WorkPattern.get"].values[0],delete n["api.WorkPattern.get"],n}return t.debug("WorkPatternAPI"),n.extend({assignWorkPattern:function(t,n,a,r,o,s){return this.sendPOST("ContactWorkPattern","create",e.assign({},s,{contact_id:t,pattern_id:n,effective_date:a,effective_end_date:r,change_reason:o})).then(function(e){return e.values})},get:function(e){return this.sendGET("WorkPattern","get",e||{}).then(function(e){return e.values})},getCalendar:function(n,a,r,o){return t.debug("WorkPatternAPI.getCalendar",n,a,r,o),this.sendGET("WorkPattern","getcalendar",e.assign({},o,{contact_id:e.isArray(n)?{IN:n}:n,start_date:a,end_date:r}))},unassignWorkPattern:function(e){return this.sendPOST("ContactWorkPattern","delete",{id:e})},workPatternsOf:function(t,n,r){return this.sendGET("ContactWorkPattern","get",e.assign({},n,{contact_id:t,"api.WorkPattern.get":{id:"$value.pattern_id"}}),r).then(function(e){return e=e.values,e.map(a)})}})}])}),define("leave-absences/shared/instances/calendar.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance"],function(e,t,n){"use strict";n.factory("CalendarInstance",["$log","$q","ModelInstance","shared-settings","OptionGroup",function(n,a,r,o,s){function i(t,n){return c().then(function(a){var r=this.days[u(t).valueOf()];return!!r&&e.find(a,function(e){return e.name===n}).value===r.type}.bind(this))}function u(e){return t(e,o.serverDateFormat).clone()}function c(){return l=l||s.valuesOf("hrleaveandabsences_work_day_type")}var l;return r.extend({defaultCustomData:function(){return{days:[]}},isNonWorkingDay:function(e){return i.call(this,e,"non_working_day")},isWeekend:function(e){return i.call(this,e,"weekend")},isWorkingDay:function(e){return i.call(this,e,"working_day")},transformAttributes:function(t){var n={};return t.calendar.forEach(function(e){n[u(e.date).valueOf()]=e}),e(t).omit("calendar").assign({days:n}).value()}})}])}),define("leave-absences/shared/models/calendar.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/calendar.instance"],function(e,t){"use strict";t.factory("Calendar",["$log","Model","WorkPatternAPI","CalendarInstance",function(t,n,a,r){return t.debug("Calendar"),n.extend({get:function(n,o,s,i){return t.debug("Calendar.get"),a.getCalendar(n,o,s,i).then(function(t){var a=t.values.map(function(e){return r.init(e)});return e.isArray(n)?a:a[0]})}})}])}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,n){function a(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(n.remainder=a[0].remainder),delete n["api.LeavePeriodEntitlement.getremainder"],n}function r(e){var n=t.clone(e),a=n["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return n.value=a,delete n["api.LeavePeriodEntitlement.getentitlement"],n}return e.debug("EntitlementAPI"),n.extend({all:function(t,n){return e.debug("EntitlementAPI.all"),t["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},n&&(t["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",t,!1).then(function(e){return e.values}).then(function(e){return e=e.map(r),n&&(e=e.map(a)),e})},breakdown:function(t){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",t).then(function(e){return e.values})},getLeaveBalances:function(t,n,a,r,o){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",t,n,a,r,"getLeaveBalances",o)}})}])}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,t){return e.debug("EntitlementLogAPI"),t.extend({all:function(t){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",t,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,t,n){return e.debug("EntitlementInstance"),t.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return n.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,t){"use strict";t.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(t,n,a,r,o){return t.debug("Entitlement"),n.extend({all:function(e,t){return a.all(this.processFilters(e),t).then(function(e){return e.map(function(e){return r.init(e,!0)})})},breakdown:function(t,n){return a.breakdown(t).then(function(t){return n?(n.map(function(n){var a=e.find(t,function(e){return e.id===n.id});return a&&(n.breakdown=a.breakdown),n}),n):t.map(function(e){return r.init(e,!0)})})},logs:function(t){return t=e.cloneDeep(t||{}),t.contact_id&&(t["entitlement_id.contact_id"]=t.contact_id,delete t.contact_id),t.period_id&&(t["entitlement_id.period_id"]=t.period_id,delete t.period_id),t.return=t.return||[],t.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),o.all(t)}})}])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,t){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,n,a){return e.debug("LeaveRequestAPI"),n.extend({all:function(t,n,r,o,s){e.debug("LeaveRequestAPI.all");var i=a.defer();return t&&t.contact_id&&t.contact_id.IN&&0===t.contact_id.IN.length?i.resolve({list:[],total:0,allIds:[]}):i.resolve(this.getAll("LeaveRequest",t,n,r,o,"getFull",s)),i.promise},balanceChangeByAbsenceType:function(n){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var r=a.defer();return n.contact_id&&n.period_id||r.reject("contact_id and period_id are mandatory"),n=t.defaults(n,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",n,!1).then(function(e){r.resolve(e.values)}),r.promise},calculateBalanceChange:function(n){return e.debug("LeaveRequestAPI.calculateBalanceChange",n),this.sendPOST("LeaveRequest","calculatebalancechange",n).then(function(e){return e.values.breakdown=t.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,t){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:t.toString()},!1)},create:function(t){return e.debug("LeaveRequestAPI.create",t),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,attachment_id:n}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,n){return n=t.assign({},n,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",n).then(function(e){return e.values})},find:function(t){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:t},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",n,!1).then(function(e){return e.values})},getComments:function(e,n){return n=t.assign({},n,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",n,!1).then(function(e){return e.values})},isManagedBy:function(t,n){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:t,contact_id:n}).then(function(e){return e.values})},isValid:function(n){e.debug("LeaveRequestAPI.isValid",n);var r=a.defer();return this.sendPOST("LeaveRequest","isValid",n).then(function(e){e.count>0?r.reject(t(e.values).map().flatten().value()):r.resolve(e.values)}),r.promise},saveComment:function(e,n,a){return a=t.assign({},a,{leave_request_id:e,text:n.text,contact_id:n.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(t){e.debug("LeaveRequestAPI.update",t);var n=a.defer();return t.id||n.reject("id is mandatory field"),this.sendPOST("LeaveRequest","create",t).then(function(e){return e.values[0]})}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,t,n){"use strict";n.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(n,a,r,o,s,i,u){function c(e){return p(e).then(function(e){var t=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=t,n.reject(e)}.bind(this))}.bind(this))}function l(){return u.all({id:this.type_id}).then(u.loadCalculationUnits).then(function(e){return n.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return p(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var t=[];return e.forEach(this.files,function(e){e.toBeDeleted&&t.push(i.deleteAttachment(this.id,e.attachment_id))}.bind(this)),n.all(t)}function f(e){return t.duration(e.time_to).subtract(t.duration(e.time_from)).asHours()}function p(t){return r.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){return e.find(n,function(e){return e.name===t})})}function h(t){var a=e.cloneDeep(t),r=a.breakdown.length>1,o=e.first(e.values(a.breakdown)),s=e.last(e.values(a.breakdown));return n.all([this.getWorkDayForDate(o.date),r&&this.getWorkDayForDate(s.date)]).then(function(t){return o.amount=t[0].time_from?Math.min(this.from_date_amount,f(t[0])):0,r&&(s.amount=t[1].time_from?Math.min(this.to_date_amount,f(t[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,t){return e+t.amount},0),a}.bind(this))}function v(){var e=this.id,t=[];return t.push(n.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(t){return function(){return i.saveComment(e,t)}}))),t=t.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return i.deleteComment(e.comment_id)})),n.all(t)}return s.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(t){var n=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===t&&e.pull(n,"from_date_type","to_date_type"),i.calculateBalanceChange(e.pick(this,n)).then(function(e){return"hours"===t?h.call(this,e):e}.bind(this))},cancel:function(){return c.call(this,o.statusNames.cancelled)},approve:function(){return c.call(this,o.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return c.call(this,o.statusNames.rejected)},sendBack:function(){return c.call(this,o.statusNames.moreInformationRequired)},update:function(){return i.update(this.toAPI()).then(function(){return n.all([v.call(this),m.call(this)])}.bind(this))},create:function(){return i.create(this.toAPI()).then(function(e){return this.id=e.id,n.all([v.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(t){if(t.comment_id)return void(t.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return t.created_at===e.created_at&&t.text===e.text})},delete:function(){return i.delete(this.id)},getBalanceChangeBreakdown:function(){return i.getBalanceChangeBreakdown(this.id).then(function(t){return{amount:e.reduce(t.values,function(e,t){return e+parseFloat(t.amount)},0),breakdown:t.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return i.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return n.reject(e)})},isValid:function(){return i.isValid(this.toAPI())},isApproved:function(){return d.call(this,o.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,o.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,o.statusNames.cancelled)},isRejected:function(){return d.call(this,o.statusNames.rejected)},isSentBack:function(){return d.call(this,o.statusNames.moreInformationRequired)},loadComments:function(){return this.id?i.getComments(this.id).then(function(e){this.comments=e}.bind(this)):n.resolve()},roleOf:function(e){return this.contact_id===e?n.resolve("owner"):a(o.permissions.admin.administer).then(function(t){return t?"admin":i.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])},loadAttachments:function(){return this.id?i.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):n.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,t,n,a){return e.debug("LeaveRequest"),t.extend({all:function(e,t,r,o,s){return n.all(this.processFilters(e),t,r,o,s).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return n.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return n.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/apis/public-holiday.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("PublicHolidayAPI",["$log","api",function(e,t){return e.debug("PublicHolidayAPI"),t.extend({all:function(t){return e.debug("PublicHolidayAPI"),this.sendGET("PublicHoliday","get",t).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/public-holiday.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("PublicHolidayInstance",["$log","ModelInstance",function(e,t){return e.debug("PublicHolidayInstance"),t.extend({})}])}),define("leave-absences/shared/models/public-holiday.model",["common/moment","leave-absences/shared/modules/models","common/models/model","common/services/hr-settings","leave-absences/shared/apis/public-holiday.api","leave-absences/shared/instances/public-holiday.instance"],function(e,t){"use strict";t.factory("PublicHoliday",["$log","Model","PublicHolidayAPI","PublicHolidayInstance","shared-settings",function(t,n,a,r,o){return t.debug("PublicHoliday"),n.extend({all:function(e){return t.debug("PublicHoliday.all",e),a.all(e).then(function(e){return e.map(function(e){return r.init(e,!0)})})},isPublicHoliday:function(n){t.debug("PublicHoliday.isPublicHoliday",n);var r=e(n).format(o.serverDateFormat),s={date:r};return a.all(s).then(function(e){return!!e.length})}})}])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/modules/controllers",["common/angular","common/angularBootstrap","leave-absences/shared/modules/models","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){return e.module("leave-absences.controllers",["ui.select","leave-absences.models","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers","common/models/contract","common/services/notification.service"],function(e,t,n){function a(t,n,a,r,o,s,i){function u(){return{loadContacts:function(){return l.loadContactsForAdmin()}}}function c(e){s.info("",["

    When All filter is selected, all staff members with contracts which are active in the selected absence period are displayed.

    ","

    People I approve filter displays only staff members who you approve leave for.

    ","

    People without approver filter displays all staff members with contracts which are active in the selected absence period and who do not have any leave approver assigned.

    "].join(""))}t.debug("LeaveCalendarAdminController");var l,d;return{init:function(t){return d=t,l=i.init(d),d.filters.userSettings.assignedTo=e.find(d.filtersByAssignee,{type:"me"}),d.showContactDetailsLink=!0,d.showContactName=!0,d.showFilters=!0,d.showAdminFilteringHint=c,u()}}}n.controller("LeaveCalendarAdminController",["$log","$q","Contact","ContactInstance","Contract","notificationService","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(t,n,a,r){function o(){return{loadContacts:function(){return s.loadLookUpAndFilteredContacts()}}}t.debug("LeaveCalendarManagerController");var s,i;return{init:function(t){return i=t,s=r.init(i),i.filters.userSettings.assignedTo=e.find(i.filtersByAssignee,{type:"me"}),i.showContactName=!0,i.showFilters=!0,o()}}}n.controller("LeaveCalendarManagerController",["$log","Contact","ContactInstance","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(e,t,n,a){function r(){return{loadContacts:function(){return s.displaySingleContact?o.loadFilteredContacts():"admin"===s.userPermissionRole?o.loadContactsForAdmin():o.loadLookUpAndFilteredContacts()}}}e.debug("LeaveCalendarStaffController");var o,s;return{init:function(e){return s=e,o=a.init(s),s.filters.userSettings.contacts_with_leaves=!0,s.showTheseContacts=[s.contactId],s.showContactName=!0,s.showFilters=!0,s.displaySingleContact&&(s.showFilters=!1,s.lookupContacts=[{id:s.contactId}]),r()}}}n.controller("LeaveCalendarStaffController",["$log","$q","Contact","LeaveCalendarService",a])}),define("leave-absences/shared/components/leave-calendar.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l,d){function m(){H.supportData.absenceTypes.push({id:"",title:"Leave",color:"#4D4D68",calculation_unit:e.chain(H.supportData.calculationUnits).find({name:"days"}).get("value").value()})}function f(){for(var e=[],n=t(H.selectedPeriod.start_date).clone().startOf("month"),a=t(H.selectedPeriod.end_date).clone().endOf("month");n.isBefore(a);)e.push(S(n)),n.add(1,"month");H.months=e}function p(){return e.includes(["admin","manager"],H.userPermissionRole)}function h(e){return e.format("YYYY-MM")}function v(){o.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){H.supportData.absenceTypesToFilterBy=t,O(!0)})}function b(){o.$new().$watch(function(){return H.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(j(),E(),O())})}function g(e){H.injectMonth=!0,F("injected").then(function(){O(e)}).then(function(){H.loading.calendar=!1})}function y(){N=n("LeaveCalendar"+e.capitalize(U)+"Controller").init(H)}function _(e){return e.current?"Current Period ("+e.title+")":e.title}function $(){return i.all().then(function(t){H.absencePeriods=e.sortBy(t,"start_date"),H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current})}).then(f).then(k)}function q(){return u.all().then(u.loadCalculationUnits)}function C(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function w(){return N.loadContacts().then(function(e){H.contacts=e})}function A(){return l.valuesOf(["hrjc_region","hrjc_location","hrjc_level_type","hrjc_department"]).then(function(e){H.filters.optionValues.regions=e.hrjc_region,H.filters.optionValues.locations=e.hrjc_location,H.filters.optionValues.levelTypes=e.hrjc_level_type,H.filters.optionValues.departments=e.hrjc_department})}function T(){return c.all()}function P(){return a.all([q(),T(),C()]).then(function(t){H.supportData.absenceTypes=t[0],H.supportData.publicHolidays=t[1],H.supportData.calculationUnits=t[2].hrleaveandabsences_absence_type_calculation_unit,H.supportData.dayTypes=t[2].hrleaveandabsences_leave_request_day_type,H.supportData.leaveRequestStatuses=t[2].hrleaveandabsences_leave_request_status,H.supportData.toilAmounts=e.indexBy(t[2].hrleaveandabsences_toil_amounts,"value")})}function D(){var e=a.resolve();return H.injectMonth&&(e=F("destroyed"),H.injectMonth=!1),e}function S(e){return{index:h(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:t().year(e.year()).month(e.month())}}function R(){var t=H.selectedPeriod.id;H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current}),t!==H.selectedPeriod.id&&f(),k(),E(),x("month")}function I(e){var n="previous"===e?"subtract":"add";j(t(H.selectedMonth.moment)[n](1,"month")),E(),x("month")}function x(t){t=e.includes(["contacts","period","month"],t)?t:"period",a.resolve().then(D).then("period"===t&&f).then("period"===t&&L).then("contacts"===t&&w).then("month"===t&&E).then(function(){g("contacts"===t)})}function O(e){o.$emit("LeaveCalendar::showMonth",!!e)}function k(){j(t())}function L(){j(H.months[0].moment)}function M(n){var a="previous"===n?"first":"last",r=e[a](H.months),o=t().year(r.year).month(r.month);H.monthPaginatorsAvailability[n]=!H.selectedMonth.moment.isSame(o,"month")}function E(){M("previous"),M("next")}function j(t){t&&(H.selectedMonthIndex=h(t)),H.selectedMonth=e.find(H.months,{index:H.selectedMonthIndex})}function B(){return a.all([d(s.permissions.admin.administer),d(s.permissions.ssp.manage)]).then(function(e){H.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff", -U=H.roleOverride?H.roleOverride:H.userPermissionRole})}function F(t){return a(function(n){var a=o.$on("LeaveCalendar::month"+e.capitalize(t),function(){a(),n()})})}r.debug("Component: leave-calendar");var N,U,H=this;H.absencePeriods=[],H.contacts=[],H.contactIdsToReduceTo=null,H.injectMonth=!1,H.months=[],H.selectedMonth={},H.selectedMonthIndex="",H.selectedPeriod=null,H.showContactName=!1,H.showFilters=!1,H.userPermissionRole="staff",H.loading={calendar:!0,page:!0},H.filters={hideOnMobile:!0,optionValues:{},userSettings:{contact:null,contacts_with_leaves:!0,department:null,level_type:null,location:null,region:null},absenceTypes:{}},H.filtersByAssignee=[{type:"me",label:"People I approve"},{type:"unassigned",label:"People without approver"},{type:"all",label:"All"}],H.filters.userSettings.assignedTo=H.filtersByAssignee[2],H.monthPaginatorsAvailability={previous:!0,next:!0},H.supportData={absenceTypesToFilterBy:[]},H.canManageRequests=p,H.labelPeriod=_,H.navigateToCurrentMonth=R,H.paginateMonth=I,H.refresh=x,function(){B().then(b).then(v).then(y).then(D).then(function(){return a.all([$(),w(),P(),H.showFilters?A():e.noop])}).then(function(){m(),g(),E()}).then(function(){H.loading.page=!1})}()}n.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,n={from_date:{to:X.month.days[X.month.days.length-1].date+" 23:59:59"},to_date:{from:X.month.days[0].date+" 00:00:00"},status_id:{IN:I()},contact_id:{IN:X.contacts.map(function(e){return e.id})},type_id:{IN:t?X.supportData.absenceTypesToFilterBy:e.pluck(X.supportData.absenceTypes,"id")}};return g(),s.all(n,null,null,null,!1).then(function(e){return z={},t&&(e.list=_(e.list)),C(e.list)})}function k(){var t=X.month.days[0].date,n=X.month.days[X.month.days.length-1].date;return o.get(X.contacts.map(function(e){return e.id}),t,n).then(function(t){G=e.indexBy(t,"contact_id")})}function L(){return X.contactIdsToReduceTo&&(X.contacts=X.contacts.filter(function(t){return e.includes(X.contactIdsToReduceTo,t.contact_id)||e.find(z,function(e){return e.contact_id===t.contact_id})})),a.resolve()}function M(t){var n=S(t);z[t.contact_id]=z[t.contact_id]||{},n.forEach(function(n){e.remove(z[t.contact_id][n.date],function(e){return e.id===t.id})})}function E(){r.$emit("LeaveCalendar::monthDestroyed"),Y.map(function(e){e.remove?e.remove():e()})}function j(t,n,r){var o,s;return t.contactsData[n]=t.contactsData[n]||{},s=m(n),o=!0===r?a.resolve():a.all([s.isWeekend(p(t.date)),s.isNonWorkingDay(p(t.date))]).then(function(a){e.assign(t.contactsData[n],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:P(t.date)})}),o.then(function(){return z[n]&&z[n][t.date]?z[n][t.date]:[]}).then(function(a){a=N(a),e.assign(t.contactsData[n],{leaveRequests:a,leaveRequestsToShowInCell:v(a),leaveRequestsAttributes:$(t,a)})})}function B(){return a.all(X.month.days.map(function(e){return a.all(X.contacts.map(function(t){return j(e,t.id)}))}))}function F(e,t){X.currentPage=0,X.visible=!0,(t||!V)&&x()}function N(n){return e.sortBy(n,function(e){return+t(e.from_date).format("X")+(A("half_day_pm",e,e.from_date)?1:0)})}function U(t){var n=e.find(X.supportData.absenceTypes,function(e){return e.id===t.type_id});return t.balance_change>0?{borderColor:n.color}:{borderColor:n.color,backgroundColor:n.color}}function H(e){h(e),-1!==I().indexOf(e.status_id)&&c(e)}function W(e){return a.all(S(e).map(function(t){return j(t,e.contact_id,!0)}))}n.debug("Component: leave-calendar-month");var V=!1,Y=[],G={},z={},X=this;X.currentPage=0,X.pageSize=20,X.visible=!1,X.showContactName=!!X.showContactName,X.showOnlyWithLeaveRequests=!!X.showOnlyWithLeaveRequests,X.$onDestroy=E,X.contactsList=f,X.getContactUrl=y,function(){var e=t().month(X.month.month).year(X.month.year);q(),w(),X.month=l(e),r.$emit("LeaveCalendar::monthInjected")}()}n.component("leaveCalendarMonth",{bindings:{showTheseContacts:"<",contacts:"<",contactIdsToReduceTo:"<",month:"<",period:"<",showContactName:"<",showContactDetailsLink:"<",showOnlyWithLeaveRequests:"<",supportData:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-month.html"}],controllerAs:"month",controller:["$log","$q","$rootScope","Calendar","LeaveRequest","pubSub","shared-settings",a]})}),define("leave-absences/shared/modules/services",["common/angular","common/modules/services"],function(e){"use strict";return e.module("leave-absences.services",["common.services"])}),define("leave-absences/shared/services/leave-request.service",["common/lodash","leave-absences/shared/modules/services"],function(e,t){"use strict";function n(t,n,a){function r(){var t=n.defer();return a.open(e.defaults(o(),{onConfirm:function(){t.resolve(!0)}})),t.promise}function o(){return{title:"Recalculate Balance Change?",copyCancel:"Cancel",copyConfirm:"Yes",classConfirm:"btn-warning",msg:"The leave balance change has updated since this leave request was created. Do you want to recalculate the balance change?"}}return t.debug("LeaveRequest"),{getBalanceChangeRecalculationPromptOptions:o,promptBalanceChangeRecalculation:r}}t.factory("LeaveRequestService",n),n.$inject=["$log","$q","dialog"]}),define("leave-absences/shared/components/leave-request-actions.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/services/notification.service","common/services/pub-sub","leave-absences/shared/services/leave-request.service"],function(e,t,n){function a(n,a,r,o,s,i,u,c){function l(t){$=q.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===q.leaveRequest.request_type?r.open(h(t)):f(t)}function d(){return"admin"===q.role&&"public_holiday"===q.leaveRequest.request_type}function m(n){var a=q.absenceTypes[q.leaveRequest.type_id].allow_request_cancelation;return"admin"===q.role||("manager"===q.role?e.includes([C.awaitingApproval,C.moreInformationRequired],n):"3"===a?t().isBefore(q.leaveRequest.from_date):"2"===a)}function f(t){r.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return q.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(s.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){b(t)}}):h(t)})}})}function p(){e.isArray(q.leaveRequestStatuses)&&(q.leaveRequestStatuses=e.indexBy(q.leaveRequestStatuses,"value")),e.isArray(q.absenceTypes)&&(q.absenceTypes=e.indexBy(q.absenceTypes,"id"))}function h(e){var t=w[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return q.leaveRequest[e]().then(function(){g(e)}).catch(function(e){c.error("Error:",e)})}}}function v(e,t){e.stopPropagation(),o.openModal(t)}function b(e){o.openModal({leaveRequest:q.leaveRequest,leaveType:q.leaveRequest.request_type,selectedContactId:q.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:u.statusNames[A[e]]})}function g(t){var n=e.find(q.leaveRequestStatuses,function(e){return e.name===u.statusNames.awaitingApproval}).value;$===n&&i.publish("ManagerBadge:: Update Count"),i.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:q.leaveRequest})}function y(){var t=q.leaveRequestStatuses[q.leaveRequest.status_id].name,n=e.compact(e.map(w,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!m(t)&&e.pull(n,"cancel"),"admin"!==q.role&&e.pull(n,"delete"),"staff"===q.role&&e.pull(n,"approve","reject"),"staff"!==q.role&&_(n),d()&&n.push("delete"),q.allowedActions=e.map(n,function(e){return{key:e,label:w[e].label,isDirectAction:w[e].isDirectAction}})}function _(t){e.each(t,function(n,a){"edit"===n&&(t[a]="respond"),e.includes(["respond","view"],n)&&(t[a]="edit")})}n.debug("Component: leave-request-action-dropdown");var $,q=this,C=u.statusNames,w={edit:{label:"Edit",allowedStatuses:[C.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[C.moreInformationRequired]},view:{label:"View",allowedStatuses:[C.approved,C.rejected,C.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[C.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[C.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[C.awaitingApproval,C.approved,C.rejected,C.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[C.awaitingApproval,C.moreInformationRequired,C.approved,C.rejected,C.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},A={approve:"approved"};q.allowedActions=[],q.action=l,q.openLeavePopup=v,function(){p(),y()}()}n.component("leaveRequestActions",{bindings:{leaveRequest:"<",leaveRequestStatuses:"<",absenceTypes:"<",role:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-actions.html"}],controllerAs:"actions",controller:a}),a.$inject=["$log","$rootScope","dialog","LeavePopup","LeaveRequestService","pubSub","shared-settings","notificationService"]}),define("leave-absences/shared/components/leave-request-popup-comments-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/models/session.model"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){$.request.comments.push({contact_id:_,leave_request_id:$.request.id,text:$.comment.text}),$.comment.text=""}function l(){return $.comment.text.length>0}function d(e){return!e.comment_id||$.canManage}function m(e){return t.utc(e,s.serverDateTimeFormat).local().format(o.DATE_FORMAT.toUpperCase()+" HH:mm")}function f(){return $.request.comments.filter(function(e){return!e.toBeDeleted})}function p(e){return e===_?"Me":$.comment.contacts[e]?$.comment.contacts[e].display_name:void 0}function h(e){return $.mode===e}function v(){$.comment.text.length&&$.addComment()}function b(){var t=e.indexBy($.request.comments,"contact_id"),n=Object.keys(t);return i.all({id:{IN:n}},{page:1,size:0}).then(function(t){$.comment.contacts=e.indexBy(t.list,"contact_id")})}function g(){return $.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),$.request.comments.length&&b()})}function y(){return $.loading.component=!0,u.get().then(function(e){_=e.contactId}).then(function(){$.loading.component=!1})}n.debug("Component: leave-request-popup-comments-tab");var _=null,$=this;$.loading={component:!0},$.comment={text:"",contacts:{}},$.addComment=c,$.canRemoveComment=d,$.canSubmit=l,$.formatDateTime=m,$.getActiveComments=f,$.getCommentorName=p,$.isMode=h,$.onBeforeSubmit=v,function(){r.$emit("LeaveRequestPopup::addTab",$),g(),y()}()}n.component("leaveRequestPopupCommentsTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-comments-tab.html"}],controllerAs:"commentsCtrl",controller:["$log","$rootScope","$scope","HR_settings","shared-settings","Contact","Session",a]})}),define("leave-absences/shared/components/leave-request-popup-details-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/session.model","leave-absences/shared/models/calendar.model"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l,d,m){function f(){te.balance.closing=te.balance.opening+te.balance.change.amount}function p(e){return t(e,u.serverDateFormat).toDate()}function h(e){return t(e).format(u.serverDateFormat)}function v(e){var t;return s.resolve().then(function(){N(e),"from"===e&&F(),I("hours")&&(y(e),"from"!==e||te.uiOptions.multipleDays||y("to")),te.loading[e+"DayTypes"]=!0}).then(function(){return $(e)}).then(function(e){if(t=e.id!==te.period.id,t&&(te.period=e),!te.period.id)return s.reject("Please change date as it is not in any absence period")}).then(H).then(function(){if(t)return L()}).then(function(){return te.onDateChangeExtended&&te.onDateChangeExtended(e)}).then(function(){if(G(),!t)return E();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(A).finally(_)}function b(){return G(),E()}function g(){return te.uiOptions.toDate=null,N("to"),s.resolve().then(G).then(te.setDaysSelectionModeExtended).then(_).then(!te.uiOptions.multipleDays&&E)}function y(e){te.uiOptions.times[e].loading=!0}function _(){["from","to"].forEach(function(e){te.loading[e+"DayTypes"]=!1,I("hours")&&(te.uiOptions.times[e].loading=!1)})}function $(n){var a=t(te.uiOptions[n+"Date"]).format(te.uiOptions.userDateFormat.toUpperCase());return e.find(te.absencePeriods,function(e){return e.isInPeriod(a)})||{}}function q(){return te.request?te.request.request_type:te.leaveType||null}function C(e){return t().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function w(){return z(),te.loading.balanceChange=!0,te.request.getBalanceChangeBreakdown().then(U).catch(A)}function A(t){r.$broadcast("LeaveRequestPopup::handleError",e.isArray(t)?t:[t]),te.loading.fromDayTypes=!1,te.loading.balanceChange=!1,te.loading.tab=!1,te.loading.toDayTypes=!1}function T(){return te.isMode("create")||te.forceRecalculateBalanceChange?E():w()}function P(){var e=te.request.attributes();return te.uiOptions.fromDate=p(te.request.from_date),te.request.to_date=e.to_date,te.request.to_date_type=e.to_date_type,te.uiOptions.toDate=p(te.request.to_date),te.initDayTypesExtended?te.initDayTypesExtended():s.resolve()}function D(){ee.push(r.$on("LeaveRequestPopup::absenceTypeChanged",function(){J()}),r.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,t){K(t)}),r.$on("LeaveRequestPopup::recalculateBalanceChange",E))}function S(){te.isMode("edit")&&(te.isLeaveStatus(u.statusNames.approved)||te.isLeaveStatus(u.statusNames.adminApproved))&&(Z={absenceTypeId:te.request.type_id,value:te.selectedAbsenceType.remainder-te.request.balance_change})}function R(){r.$watch(function(){return te.uiOptions.times.from.time},function(e,t){e!==t&&(te.uiOptions.multipleDays||(Q(e),G()))})}function I(e){return te.selectedAbsenceType.calculation_unit_name===e}function x(e){return te.request.request_type===e}function O(t){return e.includes(["weekend","non_working_day","public_holiday"],t)}function k(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){te.requestDayTypes=e})}function L(){return c.get(te.request.contact_id,te.period.start_date,te.period.end_date).then(function(e){te.calendar=e})}function M(){var e=(te.pagination.currentPage-1)*te.pagination.numPerPage,t=e+te.pagination.numPerPage;te.pagination.filteredbreakdown=te.balance.change.breakdown.slice(e,t)}function E(){return z(),te.canCalculateChange()?(te.loading.balanceChange=!0,te.request.change_balance=!0,te.calculateBalanceChange().then(U).catch(A).finally(function(){te.loading.balanceChange=!1})):s.resolve()}function j(){te.pagination.totalItems=te.balance.change.breakdown.length,te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.pageChanged()}function B(){return h(te.request.from_date)===h(te.request.to_date)}function F(){te.uiOptions.toDate&&te.uiOptions.fromDate&&te.uiOptions.multipleDays&&t(te.uiOptions.toDate).isSameOrBefore(te.uiOptions.fromDate)&&(te.uiOptions.toDate=null,N("to"))}function N(e){te.resetUIInputsExtended&&te.resetUIInputsExtended(e),G(),z()}function U(e){te.balance.change=e,te.request.balance_change=e.amount,f(),j(),te.loading.balanceChange=!1}function H(){var e,n,a;te.uiOptions.fromDate?(e=t(te.uiOptions.fromDate).add(1,"day").toDate(),a=e,n=e):(a=p(te.period.start_date),n=te.uiOptions.date.to.options.minDate),te.uiOptions.date.to.options.initDate=n,te.uiOptions.date.to.options.minDate=a,te.uiOptions.date.to.options.maxDate=p(te.period.end_date)}function W(){return!te.isMode("create")&&B()||te.isMode("create")&&(x("sickness")||I("hours"))?te.uiOptions.multipleDays=!1:te.uiOptions.multipleDays=!0,s.resolve().then(te.setDaysSelectionModeExtended)}function V(){Z&&Z.absenceTypeId===te.selectedAbsenceType.id?te.balance.opening=Z.value||0:te.balance.opening=te.selectedAbsenceType.remainder}function Y(){te.selectedAbsenceType=e.find(te.absenceTypes,function(e){return e.id===te.request.type_id})}function G(){var e=te.uiOptions,t=e.times;te.request.from_date=e.fromDate?h(e.fromDate):null,te.request.to_date=e.toDate?h(e.toDate):null,!e.multipleDays&&e.fromDate&&(te.request.to_date=te.request.from_date,te.request.to_date_type=te.request.from_date_type),(I("hours")||x("toil"))&&(te.request.from_date=te.request.from_date&&t.from.time?te.request.from_date+" "+t.from.time:null,te.request.to_date=te.request.to_date&&t.to.time?te.request.to_date+" "+t.to.time:null)}function z(){te.uiOptions.showBalance=te.canCalculateChange()}function X(){e.forEach(ee,function(e){e()})}function J(){var e,t=te.selectedAbsenceType.calculation_unit_name;return Y(),e=t!==te.selectedAbsenceType.calculation_unit_name,V(),s.resolve().then(e&&W).then(e&&te.onAbsenceTypeUpdateExtended).then(e&&G).then(_).then(E)}function K(e){return te.absenceTypes=e,Y(),t(te.uiOptions.toDate).isAfter(te.period.end_date)&&(te.uiOptions.toDate=void 0,N("to")),V(),E()}function Q(e){var t=C(e).add(te.uiOptions.time_interval,"minutes");t.isAfter(C(te.uiOptions.times.to.max))||(te.uiOptions.times.to.min=t.format("HH:mm"),t.isAfter(C(te.uiOptions.times.to.time))&&(te.uiOptions.times.to.time=""))}a.debug("Component: leave-request-popup-details-tab");var Z=null,ee=[],te=this;te.canManage=!1,te.calendar={},te.errors=[],te.isRequired=!0,te.requestDayTypes=[],te.statusNames=u.statusNames,te.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},te.pagination={currentPage:1,filteredbreakdown:te.balance.change.breakdown,numPerPage:7,totalItems:te.balance.change.breakdown.length,pageChanged:M},te.uiOptions={isChangeExpanded:!1,multipleDays:!0,userDateFormat:i.DATE_FORMAT,showBalance:!1,date:{from:{show:!1,options:{startingDay:1,showWeeks:!1}},to:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}},expiry:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}}},times:{from:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""},to:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""}},time_interval:15},te.convertDateFormatFromServer=p,te.convertDateToServerFormat=h,te.dateChangeHandler=v,te.dateTypeChangeHandler=b,te.daysSelectionModeChangeHandler=g,te.disableAndShowLoadingTimeInput=y,te.getMomentDateWithGivenTime=C,te.handleError=A,te.isCalculationUnit=I,te.isLeaveType=x,te.isNotWorkingDay=O,te.performBalanceChangeCalculation=E,te.setRequestDateTimesAndDateTypes=G,te.updateEndTimeInputMinTime=Q,te.$onDestroy=X,function(){n("RequestModalDetails"+e.capitalize(q(te.leaveType,te.request))+"Controller",{detailsController:te}),te.canManage=te.isRole("manager")||te.isRole("admin"),te.loading.tab=!0,o.$emit("LeaveRequestPopup::addTab",te),D(),te.initChildController().then(function(){return s.all([L(),k()])}).then(!te.isMode("create")&&P).then(W).then(function(){if(!te.isMode("create"))return s.resolve().then(te.initTimesExtended).then(G)}).then(!te.isMode("create")&&H).then(S).then(V).then(T).then(R).then(!te.isMode("view")&&te.initWatchersExtended).catch(A).finally(function(){te.loading.tab=!1})}()}n.component("leaveRequestPopupDetailsTab",{bindings:{absencePeriods:"<",absenceTypes:"<",balance:"=",request:"<",isLeaveStatus:"<",leaveType:"<",isMode:"<",isSelfRecord:"<",period:"=",isRole:"<",selectedAbsenceType:"=",forceRecalculateBalanceChange:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-details-tab.html"}],controllerAs:"detailsTab",controller:a}),a.$inject=["$controller","$log","$rootScope","$scope","$q","HR_settings","shared-settings","Calendar","OptionGroup","LeaveRequest","$timeout"]}),define("leave-absences/shared/components/leave-request-popup-files-tab",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/file-upload","common/services/file-mime-types","common/services/hr-settings"],function(e,t,n){function a(n,a,r,o,s,i,u,c,l){function d(){return R.fileUploader&&R.fileUploader.queue.length>0}function m(){return R.getFilesAmount()0?P.map(function(e){return e.label}).join(", "):""}function $(){return R.request.loadAttachments().then(function(){r.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function q(){return a.all(P.map(function(e){return l.getMimeTypeFor(e.label).then(function(t){S[e.label]=t})})).catch(function(){S=null})}function C(){return u.valuesOf("safe_file_extension").then(function(e){P=e})}function w(e){return!e.attachment_id||R.canManage}function A(){e.forEach(D,function(e){e()})}function T(e,t){R.fileUploader.queue&&R.fileUploader.queue.length>0?R.fileUploader.uploadAll({entityID:R.request.id}).then(function(){t()}).catch(t):t()}n.debug("Component: leave-request-popup-files-tab");var P=[],D=[],S={},R=Object.create(this);return R.filesLoaded=!1,R.fileUploader=null,R.today=Date.now(),R.userDateFormatWithTime=s.DATE_FORMAT+" HH:mm",R.userDateFormat=s.DATE_FORMAT,R.$onDestroy=A,R.canRemoveAttachment=w,R.canSubmit=d,R.canUploadMore=m,R.formatDateTime=f,R.getAuthorName=p,R.getFilesAmount=h,R.listFileTypes=_,function(){r.$broadcast("LeaveRequestPopup::childComponent::register"),o.$emit("LeaveRequestPopup::addTab",R),g(),a.all([C(),$()]).then(y).finally(function(){R.filesLoaded=!0})}(),R}n.component("leaveRequestPopupFilesTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-files-tab.html"}],controllerAs:"filesTab",controller:["$log","$q","$rootScope","$scope","HR_settings","shared-settings","OptionGroup","FileUpload","fileMimeTypes",a]})}),define("leave-absences/shared/components/leave-request-record-actions.component",["leave-absences/shared/modules/components","common/services/hr-settings","common/services/before-hash-query-params.service"],function(e){function t(e,t,n){function a(e){t.openModal(e)}e.debug("Component: leave-request-record-actions");var r,o=this;o.leaveRequestOptions=[{type:"leave",icon:"briefcase",label:"Leave"},{type:"sickness",icon:"stethoscope",label:"Sickness"}],o.openLeavePopup=a,function(){r=n.parse(),r.openModal&&a({leaveType:r.openModal,selectedContactId:o.selectedContactId})}()}e.component("leaveRequestRecordActions",{bindings:{contactId:"<",selectedContactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-record-actions.html"}],controllerAs:"vm",controller:["$log","LeavePopup","beforeHashQueryParams",t]})}),define("leave-absences/shared/components/staff-leave-report.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/pub-sub"],function(e,t,n){function a(t,n,a,r,o,s,i,u,c,l,d,m){function f(e,t){t.data.push(e),t.dataIndex[e.id]=e}function p(){Y.absenceTypes=Y.absenceTypes.map(function(t){var n=e.find(Y.entitlements,function(e){return e.type_id===t.id});return t.entitlement=n?n.value:0,t.remainder=n?n.remainder:{current:0,future:0},t})}function h(e){F(e),Y.sections.other.open&&f(e,Y.sections.other)}function v(){Object.values(Y.sections).forEach(function(e){e.data=[]})}function b(){Y.absenceTypesFiltered=Y.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function g(e){var t=V[e.status];t?t(e.leaveRequest):Y.refresh()}function y(t){t.dataIndex=e.indexBy(t.data,"id")}function _(e){return e.current?"Current Period ("+e.title+")":e.title}function $(){ -return o.all().then(function(t){Y.absencePeriods=e.sortBy(t,"start_date"),Y.selectedPeriod=e.find(Y.absencePeriods,function(e){return!0===e.current})})}function q(){return s.all().then(s.loadCalculationUnits).then(function(t){Y.absenceTypes=t,Y.absenceTypesIndexed=e.indexBy(t,"id")})}function C(){return S("approved",{status_id:W(m.statusNames.approved)})}function w(){var t={contact_id:Y.contactId,period_id:Y.selectedPeriod.id};return n.all([u.balanceChangeByAbsenceType(e.assign({},t,{public_holiday:!0})),u.balanceChangeByAbsenceType(e.assign({},t,{expired:!0})),u.balanceChangeByAbsenceType(e.assign({},t,{statuses:{in:[W(m.statusNames.approved)]}})),u.balanceChangeByAbsenceType(e.assign({},t,{statuses:{in:[W(m.statusNames.awaitingApproval),W(m.statusNames.moreInformationRequired)]}}))]).then(function(e){Y.absenceTypes.forEach(function(t){t.balanceChanges={holidays:e[0][t.id],expired:e[1][t.id],approved:e[2][t.id],pending:e[3][t.id]}})})}function A(){return i.all({contact_id:Y.contactId,period_id:Y.selectedPeriod.id},!0).then(function(e){Y.entitlements=e})}function T(){return i.breakdown({contact_id:Y.contactId,period_id:Y.selectedPeriod.id},Y.entitlements).then(function(){return E(Y.entitlements)}).then(function(e){Y.sections.entitlements.data=e})}function P(){return n.all([i.breakdown({contact_id:Y.contactId,period_id:Y.selectedPeriod.id,expired:!0}),D({request_type:"toil",expired:!0})]).then(function(e){return n.all({expiredBalanceChangesFlatten:E(e[0]),expiredTOILS:j(e[1].list)})}).then(function(t){Y.sections.expired.data=t.expiredBalanceChangesFlatten.concat(t.expiredTOILS),Y.sections.expired.data=e.sortBy(Y.sections.expired.data,"expiry_date")})}function D(t){return u.all(e.assign({contact_id:Y.contactId,from_date:{from:Y.selectedPeriod.start_date},to_date:{to:Y.selectedPeriod.end_date},type_id:{IN:Y.absenceTypes.map(function(e){return e.id})}},t),null,"from_date ASC",null,!1)}function S(e,t){return D(t).then(function(t){Y.sections[e].data=t.list})}function R(){return n.all(Object.values(Y.sections).filter(function(e){return e.open}).map(k))}function I(){return S("other",{status_id:{in:[W(m.statusNames.rejected),W(m.statusNames.cancelled)]}})}function x(){return S("pending",{status_id:{in:[W(m.statusNames.awaitingApproval),W(m.statusNames.moreInformationRequired)]}})}function O(){return S("holidays",{public_holiday:!0})}function k(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function L(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){Y.leaveRequestStatuses=e.indexBy(t,"value")})}function M(){p(),b()}function E(t){return n.resolve().then(function(){return t.map(function(t){var n=e.find(Y.entitlements,function(e){return e.id===t.id});return t.breakdown.map(function(t){return e.assign(e.clone(t),{type_id:n.type_id})})})}).then(function(e){return Array.prototype.concat.apply([],e)})}function j(t){return n.resolve().then(function(){return t.map(function(t){return e.assign({},t,{expiry_date:t.toil_expiry_date,amount:t.toil_to_accrue,type:{label:"Accrued TOIL"}})})})}function B(){l.subscribe("LeaveRequest::new",function(){Y.refresh()}),l.subscribe("LeaveRequest::edit",function(){Y.refresh()}),l.subscribe("LeaveRequest::statusUpdate",g),l.subscribe("LeaveRequest::delete",function(e){F(e)})}function F(t){e.forEach(Y.sections,function(n,a){n.dataIndex[t.id]&&(e.remove(n.data,function(e){return e.id===t.id}),delete n.dataIndex[t.id],"other"!==a&&N(t,a))})}function N(t,n){var a=["future","current"],r=Y.absenceTypesIndexed[t.type_id];"pending"===n&&e.pull(a,"current"),r.balanceChanges[n]-=t.balance_change,a.forEach(function(e){r.remainder[e]-=t.balance_change})}function U(){Y.loading.content=!0,n.all([A(),w()]).then(M).then(function(){Y.loading.content=!1}).then(function(){return n.all([R(),v()])})}function H(e){var t=Y.sections[e];t.open=!t.open,t.open&&!t.data.length&&k(t)}function W(t){return e.find(Y.leaveRequestStatuses,function(e){return e.name===t}).value}t.debug("Component: staff-leave-report");var V={delete:F,cancel:h},Y=this;Y.absencePeriods=[],Y.absenceTypes=[],Y.absenceTypesFiltered=[],Y.absenceTypesIndexed={},Y.dateFormat=d.DATE_FORMAT,Y.leaveRequestStatuses={},Y.selectedPeriod=null,Y.role="absence-tab"===a.section?"admin":"staff",Y.loading={content:!0,page:!0},Y.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:C},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:T},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:x},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I}},Y.labelPeriod=_,Y.refresh=U,Y.toggleSection=H,function(){n.all([L(),q(),$()]).then(function(){Y.loading.page=!1}).then(function(){return n.all([A(),w()])}).then(M).then(function(){Y.loading.content=!1}),B()}()}n.component("staffLeaveReport",{bindings:{contactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/staff-leave-report.html"}],controllerAs:"report",controller:["$log","$q","$rootScope","checkPermissions","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","OptionGroup","pubSub","HR_settings","shared-settings",a]})}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){return s.request.calculateBalanceChange(s.selectedAbsenceType.calculation_unit_name)}function l(){var e=s.request,t=!!e.from_date&&!!e.to_date,n=s.selectedAbsenceType.calculation_unit_name;return"days"===n?t=t&&!!e.from_date_type&&!!e.to_date_type:"hours"===n&&(t=t&&!isNaN(+e.from_date_amount)&&!isNaN(+e.to_date_amount)),t}function d(){return s.canCalculateChange()}function m(t,n){var a=s.uiOptions.times[t],r=e.clone(n.time_from),o=e.clone(n.time_to);s.uiOptions.multipleDays||("from"===t&&o&&r&&(o=s.getMomentDateWithGivenTime(o).subtract(s.uiOptions.time_interval,"minutes").format("HH:mm")),"to"===t&&r&&o&&(r=s.getMomentDateWithGivenTime(r).add(s.uiOptions.time_interval,"minutes").format("HH:mm"))),a.min=r||"00:00",a.max=o||"00:00",a.time="to"===t?a.max:a.min}function f(t,n){return t?(t=s.convertDateToServerFormat(t),v(t).then(function(n){return n?s.requestDayTypes.filter(function(e){return"public_holiday"===e.name}):p(t,s.requestDayTypes).then(function(t){return t.length?t:s.requestDayTypes.filter(function(t){return e.includes(["all_day","half_day_am","half_day_pm"],t.name)})})}).then(function(e){return D(n,e),e})):r.reject([])}function p(e,n){return e=t(e),r.all([s.calendar.isNonWorkingDay(e),s.calendar.isWeekend(e)]).then(function(e){return e[0]?"non_working_day":e[1]?"weekend":null}).then(function(e){return e?n.filter(function(t){return t.name===e}):[]})}function h(e,n){return t.duration(n).subtract(t.duration(e)).asHours()}function v(e){return u.all({public_holiday:1,contact_id:s.request.contact_id,from_date:{from:e},to_date:{to:e}}).then(function(e){return!!e.list.length})}function b(){return r.resolve()}function g(){return w(s.uiOptions.fromDate,"from").then(function(){return w(s.uiOptions.toDate,"to")})}function y(e){o.$watch(function(){return s.uiOptions.times[e].amount},function(e,t){s.isCalculationUnit("days")||+e==+t||(s.isRole("staff")&&(s.request.change_balance=!0),I(),s.performBalanceChangeCalculation())})}function _(e){var n=t(s.request[e+"_date"]).format("HH:mm"),a=s.uiOptions.times[e];(h(a.min,n)<=0||h(a.max,n)>=0)&&(n="from"===e?a.min:a.max),s.uiOptions.times[e].time=n}function $(){var e=s.uiOptions.multipleDays?["from","to"]:["from"],t=s.uiOptions.times;if(s.isCalculationUnit("hours"))return r.all(e.map(T)).then(function(){["from","to"].forEach(function(e){_(e),R(e),t[e].amount=Math.min(s.request[e+"_date_amount"],t[e].maxAmount).toString()}),s.uiOptions.multipleDays||s.updateEndTimeInputMinTime(s.uiOptions.times.from.time)}).then(I)}function q(){["from","to"].forEach(function(e){y(e),C(e)})}function C(e){o.$watch(function(){return s.uiOptions.times[e].time},function(t,n){s.isCalculationUnit("days")||t===n||(s.setRequestDateTimesAndDateTypes(),t&&R(e,!0))})}function w(e,t){return f(e,t).then(function(){s.loading[t+"DayTypes"]=!1})}function A(e){return w(s.uiOptions[e+"Date"],e).then(function(){if(s.isCalculationUnit("hours"))return T(e).then(function(){R(e,!0)})})}function T(e){var t=s.uiOptions[e+"Date"],n=!s.uiOptions.multipleDays;return t?s.request.getWorkDayForDate(s.convertDateToServerFormat(t)).then(function(t){O[e]=t,m(e,t),n&&"from"===e&&m("to",t)}).catch(function(t){return O[e]={},s.handleError(t)}).finally(function(){s.uiOptions.times[e].loading=!1,n&&(s.uiOptions.times.to.loading=!1)}):r.resolve()}function P(t){var n=s.uiOptions.times[t];s["request"+e.startCase(t)+"DayTypes"]=[],n.time="",n.min="00:00",n.max="00:00",n.amount="0",n.maxAmount="0"}function D(t,n){var a="request"+e.startCase(t)+"DayTypes";s[a]=n,s.isMode("create")&&(s.request[t+"_date_type"]=s[a][0].value)}function S(){return s.isCalculationUnit("hours")&&s.uiOptions.fromDate?(s.disableAndShowLoadingTimeInput("from"),!s.uiOptions.multipleDays&&s.disableAndShowLoadingTimeInput("to"),T("from").then(function(){R("from",!0)})):r.resolve()}function R(e,t){var n=s.uiOptions,a=n.multipleDays?e:"from",r=n.times[a],o=n.multipleDays&&"to"===a?r.min:n.times.from.time,i=n.multipleDays&&"from"===a?r.max:n.times.to.time,u=O[a].number_of_hours?h(o,i).toString():"0";r.maxAmount=u,t&&(r.amount=r.maxAmount)}function I(){var e=s.uiOptions.times;s.request.from_date_amount=isNaN(+e.from.amount)?null:e.from.amount,s.request.to_date_amount=isNaN(+e.to.amount)?null:e.to.amount}function x(){return s.isCalculationUnit("hours")&&s.uiOptions.fromDate?T("from").then(function(){R("from",!0)}):r.resolve()}var O={};a.debug("RequestModalDetailsLeaveController"),s.calculateBalanceChange=c,s.canCalculateChange=l,s.canSubmit=d,s.initChildController=b,s.initDayTypesExtended=g,s.initTimesExtended=$,s.initWatchersExtended=q,s.onAbsenceTypeUpdateExtended=x,s.onDateChangeExtended=A,s.resetUIInputsExtended=P,s.setDaysSelectionModeExtended=S}n.controller("RequestModalDetailsLeaveController",a),a.$inject=["$controller","$log","$q","$rootScope","detailsController","PublicHoliday","LeaveRequest"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller",["common/lodash","leave-absences/shared/modules/controllers"],function(e,t){function n(t,n,a,r,o,s,i){function u(){return!(!i.canCalculateChange()||!i.request.sickness_reason)}function c(){return a.all([m(),h(),f(!0)])}function l(t){var n=i.request.getDocumentArray();return!!e.find(n,function(e){return e===t})}function d(t){return!!e.find(i.sicknessDocumentTypes,function(e){return e.value===t})}function m(){return s.valuesOf("hrleaveandabsences_leave_request_required_document").then(function(e){i.sicknessDocumentTypes=e})}function f(t){return s.valuesOf("hrleaveandabsences_sickness_reason",t).then(function(t){i.sicknessReasons=e.indexBy(t,"name")})}function p(){o.loadForm("/civicrm/admin/options/hrleaveandabsences_sickness_reason?reset=1").on("crmUnload",function(){f(!1)})}function h(){i.showSicknessOptionsEditorIcon=e.includes(["admin-dashboard","absence-tab"],r.section)}n.debug("RequestModalDetailsSicknessController"),t("RequestModalDetailsLeaveController",{detailsController:i}),i.canSubmit=u,i.initChildController=c,i.isChecked=l,i.isDocumentInRequest=d,i.openSicknessReasonOptionsEditor=p}t.controller("RequestModalDetailsSicknessController",n),n.$inject=["$controller","$log","$q","$rootScope","crmAngService","api.optionGroup","detailsController"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,t,n){function a(n,a,r,o,s,i,u){function c(){return u.balance.change.amount=+u.request.toil_to_accrue,a.resolve(u.balance.change)}function l(){if(!u.request.from_date||!u.request.to_date)return u.uiOptions.max_toil_duration_and_accrual=null,void(u.uiOptions.toil_duration_in_hours=null);u.uiOptions.max_toil_duration_and_accrual=t.duration(t(u.request.to_date).diff(u.request.from_date)).asHours()}function d(){return v().catch(function(e){return e.length&&(u.errors=e),a.reject(e)}).then(function(e){return i.calculateToilExpiryDate(u.request.type_id,e)}).then(function(e){return u.request.toil_expiry_date=e,u.uiOptions.expiryDate=new Date(e),e})}function m(){return!!u.request.toil_to_accrue}function f(){var e=u.uiOptions.multipleDays&&!!u.request.to_date,t=!u.uiOptions.multipleDays&&!!u.request.from_date,n=t||e,a=N.from_date!==u.request.from_date||N.to_date!==u.request.to_date;return u.canDisplayToilExpirationField&&n&&H.hasExpirationFromAdminSettings&&a}function p(){return!!(u.request.from_date&&u.request.to_date&&u.request.toil_duration&&u.request.toil_to_accrue)}function h(){u.request.toil_expiry_date=!1,u.uiOptions.expiryDate=null}function v(){var e=u.uiOptions.multipleDays,t=u.request;return b({hasErrors:e?!t.to_date&&!t.from_date:!t.from_date,label:e?"To Date":"From Date",value:t.to_date})}function b(e){if(e.hasErrors){var n="Please select "+e.label+" to find expiry date";return a.reject([n])}return e.value?a.resolve(t(e.value).format("YYYY-MM-DD")):a.reject([])}function g(){var e=u.isMode("create")&&H.hasExpirationFromAdminSettings,t=H.hasPreviousExpirationDate,n=u.isLeaveType("toil"),a=u.canManage;u.canDisplayToilExpirationField=n&&(a||e||t)}function y(){u.uiOptions.toil_duration_in_hours=u.request.toil_duration/60}function _(){return H.hasPreviousExpirationDate=u.isMode("edit")&&!!u.request.toil_expiry_date,i.canExpire(u.request.type_id).then(function(e){H.hasExpirationFromAdminSettings=e})}function $(){return u.request.to_date_type=u.request.from_date_type="1",_().then(g).then(q).then(D)}function q(){u.canManage&&(u.uiOptions.expiryDate=u.convertDateFormatFromServer(u.request.toil_expiry_date))}function C(){r.$watch(function(){return u.request.toil_to_accrue},function(e,t){+e!=+t&&u.performBalanceChangeCalculation()})}function w(){r.$watch(function(){return u.uiOptions.toil_duration_in_hours},function(e,t){e!==t&&u.isCalculationUnit("hours")&&x(),u.request.toil_duration=u.uiOptions.toil_duration_in_hours?60*u.uiOptions.toil_duration_in_hours:null})}function A(){var e=u.uiOptions.times;e.from.time=t(u.request.from_date).format("HH:mm"),e.to.time=t(u.request.to_date).format("HH:mm"),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time)}function T(){["from","to"].forEach(function(e){r.$watch(function(){return u.uiOptions.times[e].time},function(e,t){e!==t&&(u.setRequestDateTimesAndDateTypes(),B(),l(),O())})})}function P(){u.isMode("view")||(C(),w(),T())}function D(t){return s.valuesOf("hrleaveandabsences_toil_amounts",t).then(function(t){u.toilAmounts=e.sortBy(t,function(e){return+e.weight})})}function S(){return l(),O(),B()}function R(){return L(),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time),l(),U?U=!1:O(),B()}function I(e){u.uiOptions.times[e].time=""}function x(){u.request.toil_to_accrue=u.uiOptions.toil_duration_in_hours}function O(){u.uiOptions.toil_duration_in_hours=u.uiOptions.max_toil_duration_and_accrual}function k(){N=e.cloneDeep(u.request.attributes())}function L(){u.uiOptions.multipleDays?["from","to"].forEach(function(e){u.uiOptions.times[e].min="00:00",u.uiOptions.times[e].max="23:45"}):(u.uiOptions.times.from.min="00:00",u.uiOptions.times.from.max="23:30",u.uiOptions.times.to.min="00:15",u.uiOptions.times.to.max="23:45")}function M(){u.setRequestDateTimesAndDateTypes(),l(),O(),u.isCalculationUnit("hours")?x():u.request.toil_to_accrue=null}function E(){o.loadForm("/civicrm/admin/options/hrleaveandabsences_toil_amounts?reset=1").on("crmUnload",function(){D(!1)})}function j(){u.showTOILAccrualsOptionEditorIcon=e.includes(["admin-dashboard","absence-tab"],r.section)}function B(){return f()?d().catch(a.resolve):a.resolve()}function F(){u.uiOptions.expiryDate&&(u.request.toil_expiry_date=u.convertDateToServerFormat(u.uiOptions.expiryDate))}n.debug("RequestModalDetailsToilController");var N,U=!u.isMode("create"),H={hasPreviousExpirationDate:null,hasExpirationFromAdminSettings:null};u.canDisplayToilExpirationField=!1,u.calculateBalanceChange=c,u.canCalculateChange=m,u.canSubmit=p,u.clearExpiryDate=h,u.initChildController=$,u.initTimesExtended=A,u.initWatchersExtended=P,u.onAbsenceTypeUpdateExtended=M,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=I,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){k(),L(),j(),!u.isMode("create")&&y()}()}n.controller("RequestModalDetailsToilController",a),a.$inject=["$log","$q","$rootScope","crmAngService","OptionGroup","AbsenceType","detailsController"]}),define("leave-absences/shared/services/leave-calendar.service",["common/lodash","common/moment","leave-absences/shared/modules/services"],function(e,t,n){"use strict";function a(n,a,r,o){function s(n){function s(){return r.all().then(function(e){return e.list})}function i(){return r.leaveManagees(void 0,{unassigned:!0})}function u(){var t=e.get(n,"filters.userSettings.assignedTo.type","all");return m().then(function(e){return n.lookupContacts=e,a.all([d(),"me"!==t?c():a.resolve(null)])}).then(function(e){var t=e[0];return n.contactIdsToReduceTo=e[1],t})}function c(){return l().then(function(a){var r=a.filter(function(e){var a=e.info.details;return t(a.period_start_date).isSameOrBefore(n.selectedPeriod.end_date)&&(t(a.period_end_date).isSameOrAfter(n.selectedPeriod.start_date)||!a.period_end_date)});return e.uniq(r.map(function(e){return e.contact_id}))})}function l(){return v?a.resolve(v):o.all()}function d(){return r.all(h(),null,"display_name").then(function(e){return e.list})}function m(){var t=e.get(n,"filters.userSettings.assignedTo.type","all");return(0,b[t])()}function f(){return m().then(function(e){n.lookupContacts=e}).then(d)}function p(){return r.leaveManagees(n.contactId)}function h(){var t={department:e.get(n,"filters.userSettings.department.value",null),level_type:e.get(n,"filters.userSettings.level_type.value",null),location:e.get(n,"filters.userSettings.location.value",null),region:e.get(n,"filters.userSettings.region.value",null)},a=!!n.filters.userSettings.contact,r=e.isArray(n.lookupContacts)&&n.lookupContacts.length,o="all"!==e.get(n,"filters.userSettings.assignedTo.type","all");return a?t.id={IN:[n.filters.userSettings.contact.id]}:(o||r)&&(t.id={IN:e.pluck(n.lookupContacts,"id")}),t}var v,b={all:s,me:p,unassigned:i};return{loadContactsForAdmin:u,loadFilteredContacts:d,loadLookUpContacts:m,loadLookUpAndFilteredContacts:f}}return n.debug("LeaveCalendarService"),{init:s}}n.factory("LeaveCalendarService",a),a.$inject=["$log","$q","Contact","Contract"]}),define("leave-absences/shared/instances/sickness-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,t){"use strict";t.factory("SicknessRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(t,n){return n.extend({defaultCustomData:function(){var t={sickness_reason:null,sickness_required_documents:"",request_type:"sickness"};return e.assign({},n.defaultCustomData(),t)},getDocumentArray:function(){return this.sickness_required_documents?this.sickness_required_documents.split(","):[]},toggleDocument:function(t){var n=this.getDocumentArray(),a=n.indexOf(t);e.contains(n,t)?n.splice(a,1):n.push(t),this.sickness_required_documents=n.join(",")},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])}})}])}),define("leave-absences/shared/instances/toil-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,t){"use strict";t.factory("TOILRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(t,n){return n.extend({defaultCustomData:function(){var t={from_date_amount:0,to_date_amount:0,request_type:"toil"};return e.assign({},n.defaultCustomData(),t)},toAPIFilter:function(t,n,a){e.includes(["balance_change","dates","comments","files"],a)||(t[a]=this[a])}})}])}),define("leave-absences/shared/controllers/request.controller",["common/angular","leave-absences/shared/modules/controllers","common/lodash","common/moment","common/models/contact","common/models/session.model","common/services/api/option-group","common/services/hr-settings","common/services/pub-sub","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/instances/leave-request.instance","leave-absences/shared/instances/sickness-request.instance","leave-absences/shared/instances/toil-request.instance","leave-absences/shared/services/leave-request.service"],function(e,t,n,a){"use strict";function r(t,r,o,s,i,u,c,l,d,m,f,p,h,v,b,g,y,_,$,q,C){function w(e){"days"===Ee.selectedAbsenceType.calculation_unit_name?delete Ee.request[e+"_date_amount"]:delete Ee.request[e+"_date_type"]}function A(){["from","to"].forEach(w)}function T(){var e=Ee.requestStatuses[_.statusNames.awaitingApproval].value;Ie.status_id===e&&e!==Ee.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Me.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Me.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Ee.loading.entitlements&&(!!ie("admin")||!oe("view")&&!(ie("manager")&&!oe("create")))}function R(){var e=P();return Ee.isMode("edit")&&(e=e&&(Y()||D())),Ee.canManage&&Ee.requestStatuses&&(e=e&&!!Ee.getStatusFromValue(Ee.newStatusOnSave)),(e=e&&!!Ee.period.id)&&!Ee.isMode("view")}function I(){Ee.isSelfRecord?Ee.request.status_id=Ee.requestStatuses[_.statusNames.awaitingApproval].value:Ee.canManage&&(Ee.request.status_id=Ee.newStatusOnSave||Ee.request.status_id)}function x(){if(Ee.isMode("edit")&&!Ee.isRole("staff")&&"toil"!==U())return Ee.request.calculateBalanceChange(Ee.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Ee.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==U()&&!Ee.request.change_balance}function k(){Ee.errors=[]}function L(){return Ee.request.create().then(we).then(function(){he("LeaveRequest::new")})}function M(){ne()&&!Ee.isRole("staff")&&(Ee.request.change_balance=!0)}function E(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Ee.request.delete().then(function(){Ee.dismissModal(),d.publish("LeaveRequest::delete",Ee.request)})}})}function j(){i.dismiss({$value:"cancel"})}function B(){var e=U();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function F(){return N(Ee.getStatusFromValue(Ee.request.status_id).name)}function N(e){return n.map(Se[e],function(e){return Ee.requestStatuses[e]})}function U(){return Ee.request?Ee.request.request_type:Ee.leaveType||null}function H(){return!Ee.request||e.equals({},Ee.requestStatuses)?[]:Ee.request.status_id?F():N("none")}function W(e){return n.find(Ee.requestStatuses,function(t){return t.value===e})}function V(e){Ee.errors=n.isArray(e)?e:[e],Ee.loading.absenceTypes=!1,Ee.submitting=!1}function Y(){return!e.equals(Ie,Ee.request.attributes())||Ee.canManage&&Ee.newStatusOnSave}function G(){return Ee.postContactSelection=!0,Ee.staffMemberSelectionComplete=!1,Ee.request.contact_id?r.resolve().then(ce).then(le).then(be).then(ye).then(te).then(X).then(Ee.isMode("edit")?_e:n.noop).then(function(){Ee.postContactSelection=!1,Ee.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==ke)return r.reject(e)}):r.reject("The contact id was not set")}function z(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];Se.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Se.awaiting_approval=e,Se.more_information_required=e,Se.rejected=e,Se.approved=e,Se.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){return Ee.canManage?f.find(Ee.request.contact_id).then(function(e){Ee.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Oe==+n.get(Ee,"leaveRequest.contact_id"),a=!n.get(Ee,"leaveRequest.id");Ee.isSelfRecord=e&&(t||a)}function K(){xe.push(o.$on("LeaveRequestPopup::requestObjectUpdated",_e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){le().then(be).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Ee.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Re++})),s.$on("$destroy",Ae),s.$on("LeaveRequestPopup::addTab",function(e,t){Me.push(t)})}function Q(){var e,t;Ee.request=Ee.leaveRequest||null,e=U(),t=Ee.initRequestAttributes(),"leave"===e?Ee.request=y.init(t):"sickness"===e?Ee.request=$.init(t):"toil"===e&&(Ee.request=q.init(t))}function Z(){var e={};return Ee.request?e=Ee.request.attributes():Ee.canManage||(e={contact_id:Oe}),e}function ee(){if(Le="staff",!Ee.isSelfRecord)return u(_.permissions.admin.administer).then(function(e){e&&(Le="admin")}).then(function(){return"staff"===Le&&u(_.permissions.ssp.manage).then(function(e){e&&(Le="manager")})}).finally(function(){Ee.canManage=Ee.isRole("manager")||Ee.isRole("admin")})}function te(){Ee.defaultStatus?Ee.newStatusOnSave=Ee.requestStatuses[_.statusNames[Ee.defaultStatus]].value:(Ee.isRole("admin")||Ee.isMode("create")&&Ee.isRole("manager"))&&(Ee.newStatusOnSave=Ee.requestStatuses[_.statusNames.approved].value)}function ne(){return!Ee.request.status_id||!n.includes(["cancelled","rejected"],W(Ee.request.status_id).name)}function ae(e){var t=Ee.getStatusFromValue(Ee.request.status_id);return!!t&&t.name===e}function re(e){return Ee.request&&Ee.request.request_type===e}function oe(e){return Ee.mode===e}function se(e,t){var n=a(e.from_date),r=a(e.to_date);return n.isSameOrAfter(t.start_date,"day")&&r.isSameOrBefore(t.end_date,"day")}function ie(e){return Le===e}function ue(){return h.all().then(function(e){Ee.absencePeriods=e})}function ce(){return v.all(B()).then(v.loadCalculationUnits).then(function(e){De={types:e,ids:e.map(function(e){return e.id})}})}function le(){return Ee.loading.entitlements=!0,b.all({contact_id:Ee.request.contact_id,period_id:Ee.period.id,type_id:{IN:De.ids}},!0).finally(function(){Ee.loading.entitlements=!1})}function de(){return p.get().then(function(e){Oe=e.contactId})}function me(){return Ee.selectedContactId?f.find(Ee.selectedContactId).then(function(e){Ee.managedContacts=[e]}):Ee.isRole("admin")?f.all().then(function(e){Ee.managedContacts=n.remove(e.list,function(e){return e.id!==Oe})}):f.find(Oe).then(function(e){return e.leaveManagees()}).then(function(e){Ee.managedContacts=e})}function fe(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Ee.requestStatuses=n.indexBy(e,"name")})}function pe(e,t){var a;return n.compact(e.map(function(e){if(a=n.find(t,{type_id:e.id}))return{id:a.type_id,title:e.title+" ( "+a.remainder.current+" ) ",remainder:a.remainder.current,allow_overuse:e.allow_overuse,calculation_unit_name:e.calculation_unit_name}}))}function he(e){T(),d.publish(e,Ee.request),Ee.errors=[],Ee.dismissModal()}function ve(){["from","to"].forEach(function(e){Ee.request[e+"_date"]=Ie[e+"_date"]})}function be(e){if(Ee.absenceTypes=pe(De.types,e),!Ee.absenceTypes.length)return r.reject(ke)}function ge(){Ee.period=n.find(Ee.absencePeriods,function(e){return Ee.isMode("create")?e.current:se(Ee.request,e)})}function ye(){Ee.isMode("create")?(Ee.selectedAbsenceType=Ee.absenceTypes[0],Ee.request.type_id=Ee.selectedAbsenceType.id):Ee.selectedAbsenceType=n.find(Ee.absenceTypes,function(e){return e.id===Ee.request.type_id})}function _e(){Ie=e.copy(Ee.request.attributes())}function $e(){var e;Ee.request.id?(e=[Ee.requestStatuses[_.statusNames.approved].value,Ee.requestStatuses[_.statusNames.adminApproved].value,Ee.requestStatuses[_.statusNames.rejected].value,Ee.requestStatuses[_.statusNames.cancelled].value],Ee.mode="edit",Ee.isRole("staff")&&e.indexOf(Ee.request.status_id)>-1&&(Ee.mode="view")):Ee.mode="create"}function qe(){var e=Ee.request.status_id;if(!Ee.isMode("view")&&!Ee.submitting)return Ee.submitting=!0,I(),A(),Ee.request.isValid().then(ne()&&x).then(M).then(O()&&ve).then(Ce).then(function(){return Ee.isMode("edit")?Pe():L()}).catch(function(t){Ee.request.status_id=e,t&&V(t)}).finally(function(){Ee.submitting=!1})}function Ce(){return r.all(Me.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function we(){function e(e){e&&n.push(e),++a===Re&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Re>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Ae(){xe.forEach(function(e){e()})}function Te(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Pe(){return Ee.request.update().then(we).then(function(){Ee.isRole("manager")?he("LeaveRequest::updatedByManager"):(Ee.isRole("staff")||Ee.isRole("admin"))&&he("LeaveRequest::edit")})}t.debug("RequestCtrl");var De,Se={},Re=0,Ie={},xe=[],Oe="",ke="No entitlement",Le="",Me=[],Ee=n.assign(this,m);Ee.absencePeriods=[],Ee.absenceTypes=[],Ee.canManage=!1,Ee.contactName=null,Ee.errors=[],Ee.loading={absenceTypes:!0,entitlements:!0},Ee.managedContacts=[],Ee.mode="",Ee.newStatusOnSave=null,Ee.period={},Ee.postContactSelection=!1,Ee.requestStatuses={},Ee.selectedAbsenceType={},Ee.staffMemberSelectionComplete=!1,Ee.submitting=!1,Ee.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Ee.canChangeAbsenceType=S,Ee.canSubmit=R,Ee.closeAlert=k,Ee.deleteLeaveRequest=E,Ee.dismissModal=j,Ee.getStatuses=H,Ee.getStatusFromValue=W,Ee.initAfterContactSelection=G,Ee.initRequestAttributes=Z,Ee.isLeaveStatus=ae,Ee.isLeaveType=re,Ee.isMode=oe,Ee.isRole=ie,Ee.submit=qe,Ee.updateAbsenceType=Te,function(){Ee.loading.absenceTypes=!0,z(),K(),de().then(J).then(function(){return r.all([ee(),ue(),fe()])}).then(Q).then($e).then(ge).then(function(){return Ee.canManage&&!Ee.isMode("edit")&&me()}).then(function(){if(Ee.selectedContactId&&(Ee.request.contact_id=Ee.selectedContactId),Ee.request.contact_id)return Ee.initAfterContactSelection()}).catch(V).finally(function(){Ee.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$inject=["$log","$q","$rootScope","$scope","$uibModalInstance","checkPermissions","api.optionGroup","dialog","pubSub","directiveOptions","Contact","Session","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","LeaveRequestInstance","shared-settings","SicknessRequestInstance","TOILRequestInstance","LeaveRequestService"]}),define("leave-absences/shared/services/leave-popup.service",["common/lodash","common/modules/angular-date","leave-absences/shared/modules/services","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/controllers/request.controller"],function(e,t){"use strict";function n(e,t,n,a,r,o,s,i,u){function c(e){return i.get().then(function(t){return e.roleOf(t.contactId)}).then(function(e){return"none"!==e})}function l(e){a.open({appendTo:t.children().eq(0),templateUrl:o.sharedPathTpl+"components/leave-request-popup/leave-request-popup.html",controller:"RequestCtrl",controllerAs:"$ctrl",windowClass:"chr_leave-request-modal",resolve:{ -directiveOptions:function(){return e},format:["DateFormat",function(e){return e.getDateFormat()}]}})}function d(e){return u.find(e).then(function(e){return c(e).then(function(t){t?l({leaveRequest:e,leaveType:e.request_type,selectedContactId:e.contact_id}):r.error("Error","You dont have permission to see this leave request")})}).catch(function(e){r.error("Error",e)})}return e.debug("LeavePopup"),{openModal:l,openModalByID:d}}t.factory("LeavePopup",n),n.$inject=["$log","$rootElement","$rootScope","$uibModal","notificationService","shared-settings","DateFormat","Session","LeaveRequest"]}),define("leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component",[],function(){function e(e,t,n,a){function r(){return n("can administer calendar feeds").then(function(e){i.canCreateNewFeed=!!e})}function o(){return i.loading.feeds=!0,e.all().then(function(e){i.feeds=e}).finally(function(){i.loading.feeds=!1})}function s(e,n){t.open(e,n)}var i=this;i.canCreateNewFeed=!1,i.feeds=[],i.loading={feeds:!1},i.openLinkModal=s,function(){o(),r()}()}return e.$inject=["CalendarFeed","CalendarFeedsLinkModal","checkPermissions","shared-settings"],{__name:"calendarFeedsDropdownButton",bindings:{dropdownPosition:"@"},controller:e,controllerAs:"dropdownButton",templateUrl:["shared-settings",function(e){return e.sourcePath+"calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.html"}]}}),define("leave-absences/calendar-feeds/calendar-feeds.core",["common/angular","leave-absences/shared/modules/shared-settings"],function(e){e.module("calendar-feeds.core",["leave-absences.settings"])}),define("leave-absences/calendar-feeds/services/apis/calendar-feed.api",["common/lodash"],function(e){"use strict";function t(e,t,n){function a(){return this.sendGET("LeaveRequestCalendarFeedConfig","get",{is_active:!0}).then(function(e){return e.values})}return e.debug("CalendarFeedAPI"),n.extend({all:a})}return t.__name="CalendarFeedAPI",t.$inject=["$log","$q","api"],t}),define("leave-absences/calendar-feeds/services/models/calendar-feed.model",[],function(){"use strict";function e(e,t,n){function a(){return t.all().then(function(e){return e.map(function(e){return n.init(e)})})}return e.extend({all:a})}return e.__name="CalendarFeed",e.$inject=["Model","CalendarFeedAPI","CalendarFeedInstance"],e}),define("leave-absences/calendar-feeds/services/models/calendar-feed.instance",[],function(){"use strict";function e(e){return e.extend({})}return e.__name="CalendarFeedInstance",e.$inject=["ModelInstance"],e}),define("leave-absences/calendar-feeds/calendar-feeds.models",["common/angular","leave-absences/calendar-feeds/services/apis/calendar-feed.api","leave-absences/calendar-feeds/services/models/calendar-feed.model","leave-absences/calendar-feeds/services/models/calendar-feed.instance","common/models/model","common/services/api"],function(e,t,n,a){e.module("calendar-feeds.models",["common.apis","common.models"]).factory(t.__name,t).factory(n.__name,n).factory(a.__name,a)}),define("leave-absences/calendar-feeds/link-modal/components/calendar-feeds-link-modal.component",["common/lodash"],function(e){return{__name:"calendarFeedsLinkModal",bindings:{dismiss:"<",url:"<",title:"<"},controller:e.noop,controllerAs:"linkModal",templateUrl:["shared-settings",function(e){return e.sourcePath+"calendar-feeds/link-modal/components/calendar-feeds-link-modal.html"}]}}),define("leave-absences/calendar-feeds/link-modal/services/calendar-feeds-link-modal.service",[],function(){function e(e,t,n){function a(e,a){var o=r(),s=n+"civicrm/calendar-feed?hash="+a;t.open({controllerAs:"modal",size:"md",template:'',controller:["$uibModalInstance","title","url",function(e,t,n){this.dismiss=e.dismiss,this.title=t,this.url=n}],appendTo:o,resolve:{title:function(){return e},url:function(){return s}}})}function r(){var t=e.find("#bootstrap-theme");return 0===t.length&&(t=e.find("body")),t.eq(0)}return{open:a}}return e.__name="CalendarFeedsLinkModal",e.$inject=["$document","$uibModal","HOST_URL"],e}),define("leave-absences/calendar-feeds/link-modal/directives/input-with-copy-button.directive",["common/lodash"],function(e){function t(t,n){function a(e,n,a,r){function o(){i(),c()}function s(){l[0].setSelectionRange(0,0),l.blur()}function i(){u(),document.execCommand("copy"),s()}function u(){l.focus(),l[0].setSelectionRange(0,l.val().length)}function c(){m.justCopied=!0,d&&t.cancel(d),d=t(function(){m.justCopied=!1},2e3)}var l,d,m=e.input;m.model=r.model,m.justCopied=!1,m.copy=o,m.selectInputText=u,function(){l=n.find("input")}()}var r=n.sourcePath+"calendar-feeds/link-modal/directives/input-with-copy-button.html";return{controller:e.noop,controllerAs:"input",link:a,restrict:"E",scope:{},templateUrl:r,require:{model:"^ngModel"}}}return t.__name="inputWithCopyButton",t.$inject=["$timeout","shared-settings"],t}),define("leave-absences/calendar-feeds/link-modal/link-modal.core",["common/angular","common/angularBootstrap"],function(e){e.module("calendar-feeds.link-modal.core",["ui.bootstrap"])}),function(e){define("leave-absences/calendar-feeds/link-modal/link-modal.constants",["common/angular"],function(t){"use strict";t.module("calendar-feeds.link-modal.constants",[]).constant("HOST_URL",e.absoluteUrl("/"))})}(Drupal),define("leave-absences/calendar-feeds/link-modal/link-modal.module",["common/angular","leave-absences/calendar-feeds/link-modal/components/calendar-feeds-link-modal.component","leave-absences/calendar-feeds/link-modal/services/calendar-feeds-link-modal.service","leave-absences/calendar-feeds/link-modal/directives/input-with-copy-button.directive","leave-absences/calendar-feeds/calendar-feeds.core","leave-absences/calendar-feeds/link-modal/link-modal.core","leave-absences/calendar-feeds/link-modal/link-modal.constants"],function(e,t,n,a){e.module("calendar-feeds.link-modal",["calendar-feeds.core","calendar-feeds.link-modal.core","calendar-feeds.link-modal.constants"]).component(t.__name,t).directive(a.__name,a).factory(n.__name,n)}),define("leave-absences/calendar-feeds/dropdown-button/dropdown-button.module",["common/angular","leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component","common/services/check-permissions","leave-absences/calendar-feeds/calendar-feeds.core","leave-absences/calendar-feeds/calendar-feeds.models","leave-absences/calendar-feeds/link-modal/link-modal.module"],function(e,t){e.module("calendar-feeds.dropdown-button",["common.services","calendar-feeds.core","calendar-feeds.models","calendar-feeds.link-modal"]).component(t.__name,t)}),define("leave-absences/my-leave/modules/components",["common/angular"],function(e){return e.module("my-leave.components",[])}),define("leave-absences/my-leave/components/my-leave-container.component",["leave-absences/my-leave/modules/components"],function(e){e.component("myLeaveContainer",{bindings:{contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/my-leave-container.html"}],controllerAs:"myleave",controller:["$log","$rootScope","$state",function(e,t,n){function a(){n.go(r.tabName)}e.debug("Component: my-leave-container"),t.section="my-leave";var r=this;r.tabName=n.current.name,r.changeTab=a}]})}),function(e){define("leave-absences/my-leave/modules/settings",["common/angular"],function(t){return t.module("my-leave.settings",[]).constant("settings",{debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/my-leave/"})})}(CRM),function(e,t){define("leave-absences/my-leave/modules/config",["common/angular","common/lodash","leave-absences/my-leave/modules/settings"],function(t,n){function a(t){t.withAutoBase(!0),t.settings.ga={userId:n.get(e,"vars.session.contact_id")}}return t.module("my-leave.config",["my-leave.settings"]).config(["$stateProvider","$resourceProvider","$urlRouterProvider","$httpProvider","$logProvider","$analyticsProvider","settings",function(t,n,r,o,s,i,u){a(i),s.debugEnabled(u.debug),o.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",n.defaults.stripTrailingSlashes=!1,r.otherwise("/my-leave/report"),t.state("my-leave",{abstract:!0,url:"/my-leave",template:'',resolve:{contactId:function(){return e.vars.leaveAndAbsences.contactId},format:["DateFormat",function(e){return e.getDateFormat()}]}}).state("my-leave.report",{url:"/report?leave-request-id",template:'',onEnter:["$stateParams","LeavePopup",function(e,t){e["leave-request-id"]&&t.openModalByID(e["leave-request-id"])}]}).state("my-leave.calendar",{url:"/calendar",template:''})}])})}(CRM,Drupal),define("leave-absences/my-leave/app",["common/angular","common/angularBootstrap","common/angulartics","common/angulartics-google-tag-manager","common/text-angular","common/directives/loading","common/directives/scroll-shadows.directive","common/directives/time-amount-picker.directive","common/directives/timepicker-select.directive","common/filters/angular-date/format-date","common/filters/time-unit-applier.filter","common/models/option-group","common/modules/dialog","common/services/check-permissions","common/services/crm-ang.service","common/services/angular-date/date-format","leave-absences/shared/ui-router","leave-absences/shared/modules/shared-settings","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/calendar.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/components/leave-calendar.component","leave-absences/shared/components/leave-calendar-day.component","leave-absences/shared/components/leave-calendar-legend.component","leave-absences/shared/components/leave-calendar-month.component","leave-absences/shared/components/leave-request-actions.component","leave-absences/shared/components/leave-request-popup-comments-tab.component","leave-absences/shared/components/leave-request-popup-details-tab.component","leave-absences/shared/components/leave-request-popup-files-tab","leave-absences/shared/components/leave-request-record-actions.component","leave-absences/shared/components/staff-leave-report.component","leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/calendar.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/shared-settings","leave-absences/shared/services/leave-calendar.service","leave-absences/shared/services/leave-popup.service","leave-absences/calendar-feeds/dropdown-button/dropdown-button.module","leave-absences/my-leave/components/my-leave-container.component","leave-absences/my-leave/modules/config"],function(e){return e.module("my-leave",["ngResource","ngAnimate","angulartics","angulartics.google.tagmanager","ui.bootstrap","ui.router","textAngular","common.angularDate","common.dialog","common.directives","common.filters","common.mocks","common.models","common.services","leave-absences.components","leave-absences.controllers","leave-absences.models","leave-absences.services","leave-absences.settings","calendar-feeds.dropdown-button","my-leave.components","my-leave.config"]).run(["$log","$rootScope","shared-settings","settings",function(e,t,n,a){e.debug("app.run"),t.sharedPathTpl=n.sharedPathTpl,t.settings=a}]),e}),function(e,t){var n=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";t.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":n+"/shared","leave-absences/my-leave":n+"/my-leave"}}),t(["leave-absences/shared/config"],function(){t(["leave-absences/my-leave/app"],function(e){e.bootstrap(document.querySelector("[data-leave-absences-my-leave]"),["my-leave"])})})}(CRM,require),define("my-leave",function(){}); +!function(e){define("leave-absences/shared/config",[],function(){e.config({paths:{mocks:"../test/mocks"}}),e.config({paths:{mocks:CRM.vars.leaveAndAbsences.baseURL+"/js/test/mocks"}})})}(require),function(e){define("leave-absences/shared/modules/shared-settings",["common/angular"],function(n){return n.module("leave-absences.settings",[]).constant("shared-settings",{attachmentToken:e.vars.leaveAndAbsences.attachmentToken,debug:e.debug,managerPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/manager-leave/",sharedPathTpl:e.vars.leaveAndAbsences.baseURL+"/views/shared/",sourcePath:e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences/",serverDateFormat:"YYYY-MM-DD",serverDateTimeFormat:"YYYY-MM-DD HH:mm:ss",permissions:{admin:{access:"access leave and absences",administer:"administer leave and absences"},ssp:{access:"access leave and absences in ssp",manage:"manage leave and absences in ssp"}},fileUploader:{queueLimit:10},statusNames:{approved:"approved",adminApproved:"admin_approved",awaitingApproval:"awaiting_approval",moreInformationRequired:"more_information_required",rejected:"rejected",cancelled:"cancelled"}})})}(CRM),define("leave-absences/shared/modules/apis",["common/angular","common/modules/apis","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.apis",["common.apis","leave-absences.settings"])}),define("leave-absences/shared/modules/models-instances",["common/angular","common/models/instances/instance","common/modules/services","common/modules/models","common/services/check-permissions","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models.instances",["common.models","common.models.instances","common.services","leave-absences.settings"])}),define("leave-absences/shared/modules/models",["common/angular","common/modules/models","common/modules/services","leave-absences/shared/modules/apis","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){"use strict";return e.module("leave-absences.models",["common.models","common.services","leave-absences.apis","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/instances/absence-period.instance",["leave-absences/shared/modules/models-instances","common/moment","common/models/instances/instance","common/services/hr-settings"],function(e,n){"use strict";e.factory("AbsencePeriodInstance",["$log","ModelInstance","HR_settings",function(e,t,a){return e.debug("AbsencePeriodInstance"),t.extend({defaultCustomData:function(){return{current:!1}},transformAttributes:function(e){var t=n();return e.current=!1,n(e.start_date).isSameOrBefore(t,"day")&&n(e.end_date).isSameOrAfter(t,"day")&&(e.current=!0),e},isInPeriod:function(e){var t=a.DATE_FORMAT.toUpperCase(),o=n(e,t);return n(this.start_date).isSameOrBefore(o)&&n(this.end_date).isSameOrAfter(o)}})}])}),define("leave-absences/shared/apis/absence-period.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("AbsencePeriodAPI",["$log","api",function(e,n){return e.debug("AbsencePeriodAPI"),n.extend({all:function(n){return e.debug("AbsencePeriodAPI"),this.sendGET("AbsencePeriod","get",n).then(function(e){return e.values})}})}])}),define("leave-absences/shared/models/absence-period.model",["leave-absences/shared/modules/models","common/moment","leave-absences/shared/modules/shared-settings","leave-absences/shared/instances/absence-period.instance","leave-absences/shared/apis/absence-period.api","common/models/model","common/services/hr-settings"],function(e,n){"use strict";e.factory("AbsencePeriod",["$log","Model","AbsencePeriodAPI","AbsencePeriodInstance","shared-settings",function(e,t,a,o,s){return e.debug("AbsencePeriod"),t.extend({all:function(e){return a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},current:function(){var e=n().format(s.serverDateFormat),t={start_date:{"<=":e},end_date:{">=":e}};return a.all(t).then(function(e){return e&&e.length?o.init(e[0],!0):null})}})}])}),define("leave-absences/shared/apis/absence-type.api",["common/lodash","common/moment","leave-absences/shared/modules/apis","common/services/api"],function(e,n,t){"use strict";t.factory("AbsenceTypeAPI",["$log","api","shared-settings",function(t,a,o){return t.debug("AbsenceTypeAPI"),a.extend({all:function(n){return t.debug("AbsenceTypeAPI.all"),this.sendGET("AbsenceType","get",e.defaultsDeep(n||{},{is_active:!0,options:{sort:"weight ASC"}})).then(function(e){return e.values})},calculateToilExpiryDate:function(a,s,i){return t.debug("AbsenceTypeAPI.calculateToilExpiryDate"),i=e.assign({},i,{absence_type_id:a,date:n(s).format(o.serverDateFormat)}),this.sendPOST("AbsenceType","calculateToilExpiryDate",i).then(function(e){return e.values.expiry_date})}})}])}),define("leave-absences/shared/instances/absence-type.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("AbsenceTypeInstance",["$log","ModelInstance",function(e,n){return e.debug("AbsenceTypeInstance"),n.extend({})}])}),define("leave-absences/shared/models/absence-type.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","common/models/option-group","leave-absences/shared/apis/absence-type.api","leave-absences/shared/instances/absence-type.instance"],function(e,n){"use strict";n.factory("AbsenceType",["$log","$q","Model","OptionGroup","AbsenceTypeAPI","AbsenceTypeInstance",function(n,t,a,o,s,i){return n.debug("AbsenceType"),a.extend({all:function(e){return s.all(e).then(function(e){return e.map(function(e){return i.init(e,!0)})})},calculateToilExpiryDate:function(e,n,t){return s.calculateToilExpiryDate(e,n,t)},canExpire:function(e){return s.all({accrual_expiration_unit:{"IS NOT NULL":1},accrual_expiration_duration:{"IS NOT NULL":1},allow_accruals_request:1,id:e,options:{limit:1},return:["id"]}).then(function(e){return e.length>0})},loadCalculationUnits:function(n){return o.valuesOf("hrleaveandabsences_absence_type_calculation_unit").then(function(t){return t=e.indexBy(t,"value"),e.map(n,function(n){return e.assign(n,{calculation_unit_label:t[n.calculation_unit].label,calculation_unit_name:t[n.calculation_unit].name})})})}})}])}),define("leave-absences/shared/apis/work-pattern.api",["common/lodash","leave-absences/shared/modules/apis","common/services/api"],function(e,n){"use strict";n.factory("WorkPatternAPI",["$log","api",function(n,t){function a(n){var t=e.clone(n);return t.workPattern=t["api.WorkPattern.get"].values[0],delete t["api.WorkPattern.get"],t}return n.debug("WorkPatternAPI"),t.extend({assignWorkPattern:function(n,t,a,o,s,i){return this.sendPOST("ContactWorkPattern","create",e.assign({},i,{contact_id:n,pattern_id:t,effective_date:a,effective_end_date:o,change_reason:s})).then(function(e){return e.values})},get:function(e){return this.sendGET("WorkPattern","get",e||{}).then(function(e){return e.values})},getCalendar:function(t,a,o,s){return n.debug("WorkPatternAPI.getCalendar",t,a,o,s),this.sendGET("WorkPattern","getcalendar",e.assign({},s,{contact_id:e.isArray(t)?{IN:t}:t,start_date:a,end_date:o}))},unassignWorkPattern:function(e){return this.sendPOST("ContactWorkPattern","delete",{id:e})},workPatternsOf:function(n,t,o){return this.sendGET("ContactWorkPattern","get",e.assign({},t,{contact_id:n,"api.WorkPattern.get":{id:"$value.pattern_id"}}),o).then(function(e){return e=e.values,e.map(a)})}})}])}),define("leave-absences/shared/instances/calendar.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance"],function(e,n,t){"use strict";t.factory("CalendarInstance",["$log","$q","ModelInstance","shared-settings","OptionGroup",function(t,a,o,s,i){function r(n,t){return u().then(function(a){var o=this.days[c(n).valueOf()];return!!o&&e.find(a,function(e){return e.name===t}).value===o.type}.bind(this))}function c(e){return n(e,s.serverDateFormat).clone()}function u(){return l=l||i.valuesOf("hrleaveandabsences_work_day_type")}var l;return o.extend({defaultCustomData:function(){return{days:[]}},isNonWorkingDay:function(e){return r.call(this,e,"non_working_day")},isWeekend:function(e){return r.call(this,e,"weekend")},isWorkingDay:function(e){return r.call(this,e,"working_day")},transformAttributes:function(n){var t={};return n.calendar.forEach(function(e){t[c(e.date).valueOf()]=e}),e(n).omit("calendar").assign({days:t}).value()}})}])}),define("leave-absences/shared/models/calendar.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/work-pattern.api","leave-absences/shared/instances/calendar.instance"],function(e,n){"use strict";n.factory("Calendar",["$log","Model","WorkPatternAPI","CalendarInstance",function(n,t,a,o){return n.debug("Calendar"),t.extend({get:function(t,s,i,r){return n.debug("Calendar.get"),a.getCalendar(t,s,i,r).then(function(n){var a=n.values.map(function(e){return o.init(e)});return e.isArray(t)?a:a[0]})}})}])}),define("leave-absences/shared/apis/entitlement.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("EntitlementAPI",["$log","api",function(e,t){function a(e){var t=n.clone(e),a=t["api.LeavePeriodEntitlement.getremainder"].values;return a.length&&(t.remainder=a[0].remainder),delete t["api.LeavePeriodEntitlement.getremainder"],t}function o(e){var t=n.clone(e),a=t["api.LeavePeriodEntitlement.getentitlement"].values[0].entitlement;return t.value=a,delete t["api.LeavePeriodEntitlement.getentitlement"],t}return e.debug("EntitlementAPI"),t.extend({all:function(n,t){return e.debug("EntitlementAPI.all"),n["api.LeavePeriodEntitlement.getentitlement"]={entitlement_id:"$value.id"},t&&(n["api.LeavePeriodEntitlement.getremainder"]={entitlement_id:"$value.id",include_future:!0}),this.sendGET("LeavePeriodEntitlement","get",n,!1).then(function(e){return e.values}).then(function(e){return e=e.map(o),t&&(e=e.map(a)),e})},breakdown:function(n){return e.debug("EntitlementAPI.breakdown"),this.sendGET("LeavePeriodEntitlement","getbreakdown",n).then(function(e){return e.values})},getLeaveBalances:function(n,t,a,o,s){return e.debug("EntitlementAPI.getLeaveBalances"),this.getAll("LeavePeriodEntitlement",n,t,a,o,"getLeaveBalances",s)}})}])}),define("leave-absences/shared/apis/entitlement-log.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("EntitlementLogAPI",["$log","api",function(e,n){return e.debug("EntitlementLogAPI"),n.extend({all:function(n){return e.debug("EntitlementLogAPI.all"),this.sendGET("LeavePeriodEntitlementLog","get",n,!1).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/entitlement.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("EntitlementInstance",["$log","ModelInstance","EntitlementAPI",function(e,n,t){return e.debug("EntitlementInstance"),n.extend({defaultCustomData:function(){return{remainder:{current:0,future:0},breakdown:[]}},getBreakdown:function(){return t.breakdown({entitlement_id:this.id}).then(function(e){this.breakdown=e}.bind(this))}})}])}),define("leave-absences/shared/models/entitlement.model",["common/lodash","leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/entitlement.api","leave-absences/shared/apis/entitlement-log.api","leave-absences/shared/instances/entitlement.instance"],function(e,n){"use strict";n.factory("Entitlement",["$log","Model","EntitlementAPI","EntitlementInstance","EntitlementLogAPI",function(n,t,a,o,s){return n.debug("Entitlement"),t.extend({all:function(e,n){return a.all(this.processFilters(e),n).then(function(e){return e.map(function(e){return o.init(e,!0)})})},breakdown:function(n,t){return a.breakdown(n).then(function(n){return t?(t.map(function(t){var a=e.find(n,function(e){return e.id===t.id});return a&&(t.breakdown=a.breakdown),t}),t):n.map(function(e){return o.init(e,!0)})})},logs:function(n){return n=e.cloneDeep(n||{}),n.contact_id&&(n["entitlement_id.contact_id"]=n.contact_id,delete n.contact_id),n.period_id&&(n["entitlement_id.period_id"]=n.period_id,delete n.period_id),n.return=n.return||[],n.return.push("entitlement_id","entitlement_id.type_id","editor_id","entitlement_amount","comment","created_date"),s.all(n)}})}])}),define("leave-absences/shared/apis/leave-request.api",["leave-absences/shared/modules/apis","common/lodash","common/services/api"],function(e,n){"use strict";e.factory("LeaveRequestAPI",["$log","api","$q","shared-settings",function(e,t,a){return e.debug("LeaveRequestAPI"),t.extend({all:function(n,t,o,s,i){e.debug("LeaveRequestAPI.all");var r=a.defer();return n&&n.contact_id&&n.contact_id.IN&&0===n.contact_id.IN.length?r.resolve({list:[],total:0,allIds:[]}):r.resolve(this.getAll("LeaveRequest",n,t,o,s,"getFull",i)),r.promise},balanceChangeByAbsenceType:function(t){e.debug("LeaveRequestAPI.balanceChangeByAbsenceType");var o=a.defer();return t.contact_id&&t.period_id||o.reject("contact_id and period_id are mandatory"),t=n.defaults(t,{statuses:null,public_holiday:!1}),this.sendGET("LeaveRequest","getbalancechangebyabsencetype",t,!1).then(function(e){o.resolve(e.values)}),o.promise},calculateBalanceChange:function(t){return e.debug("LeaveRequestAPI.calculateBalanceChange",t),this.sendPOST("LeaveRequest","calculatebalancechange",t).then(function(e){return e.values.breakdown=n.values(e.values.breakdown),e.values})},getBalanceChangeBreakdown:function(e){return this.sendGET("LeaveRequest","getBreakdown",{leave_request_id:e},!1)},getWorkDayForDate:function(e,n){return this.sendGET("LeaveRequest","getWorkDayForDate",{leave_date:e,contact_id:n.toString()},!1)},create:function(n){return e.debug("LeaveRequestAPI.create",n),this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]})},delete:function(e){return this.sendPOST("LeaveRequest","delete",{id:e})},deleteAttachment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,attachment_id:t}),this.sendPOST("LeaveRequest","deleteattachment",a).then(function(e){return e.values})},deleteComment:function(e,t){return t=n.assign({},t,{comment_id:e}),this.sendPOST("LeaveRequest","deletecomment",t).then(function(e){return e.values})},find:function(n){return e.debug("LeaveRequestAPI.find"),this.sendGET("LeaveRequest","getFull",{id:n},!1).then(function(e){return 0===e.values.length?a.reject("LeaveRequest not found with this ID"):e.values[0]})},getAttachments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getattachments",t,!1).then(function(e){return e.values})},getComments:function(e,t){return t=n.assign({},t,{leave_request_id:e}),this.sendGET("LeaveRequest","getcomment",t,!1).then(function(e){return e.values})},isManagedBy:function(n,t){return e.debug("LeaveRequestAPI.isManagedBy"),this.sendPOST("LeaveRequest","isManagedBy",{leave_request_id:n,contact_id:t}).then(function(e){return e.values})},isValid:function(t){e.debug("LeaveRequestAPI.isValid",t);var o=a.defer();return this.sendPOST("LeaveRequest","isValid",t).then(function(e){e.count>0?o.reject(n(e.values).map().flatten().value()):o.resolve(e.values)}),o.promise},saveComment:function(e,t,a){return a=n.assign({},a,{leave_request_id:e,text:t.text,contact_id:t.contact_id}),this.sendPOST("LeaveRequest","addcomment",a).then(function(e){return e.values})},update:function(n){return e.debug("LeaveRequestAPI.update",n),n.id?this.sendPOST("LeaveRequest","create",n).then(function(e){return e.values[0]}):a.reject("id is mandatory field")}})}])}),define("leave-absences/shared/instances/leave-request.instance",["common/lodash","common/moment","leave-absences/shared/modules/models-instances","common/models/option-group","common/models/instances/instance","leave-absences/shared/models/absence-type.model"],function(e,n,t){"use strict";t.factory("LeaveRequestInstance",["$q","checkPermissions","OptionGroup","shared-settings","ModelInstance","LeaveRequestAPI","AbsenceType",function(t,a,o,s,i,r,c){function u(e){return p(e).then(function(e){var n=this.status_id;return this.status_id=e.value,this.update().catch(function(e){return this.status_id=n,t.reject(e)}.bind(this))}.bind(this))}function l(){return c.all({id:this.type_id}).then(c.loadCalculationUnits).then(function(e){return t.all({calculatedBalanceChange:this.calculateBalanceChange(e[0].calculation_unit_name),currentBalanceChange:this.getBalanceChangeBreakdown()})}.bind(this)).then(function(e){return+e.currentBalanceChange.amount!=+e.calculatedBalanceChange.amount})}function d(e){return p(e).then(function(e){return this.status_id===e.value}.bind(this))}function m(){var n=[];return e.forEach(this.files,function(e){e.toBeDeleted&&n.push(r.deleteAttachment(this.id,e.attachment_id))}.bind(this)),t.all(n)}function f(e){return n.duration(e.time_to).subtract(n.duration(e.time_from)).asHours()}function p(n){return o.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){return e.find(t,function(e){return e.name===n})})}function h(n){var a=e.cloneDeep(n),o=a.breakdown.length>1,s=e.first(e.values(a.breakdown)),i=e.last(e.values(a.breakdown));return t.all([this.getWorkDayForDate(s.date),o&&this.getWorkDayForDate(i.date)]).then(function(n){return s.amount=n[0].time_from?Math.min(this.from_date_amount,f(n[0])):0,o&&(i.amount=n[1].time_from?Math.min(this.to_date_amount,f(n[1])):0),a.amount=-1*e.reduce(a.breakdown,function(e,n){return e+n.amount},0),a}.bind(this))}function v(){var e=this.id,n=[];return n.push(t.sequence(this.comments.filter(function(e){return!e.comment_id}).map(function(n){return function(){return r.saveComment(e,n)}}))),n=n.concat(this.comments.filter(function(e){return e.comment_id&&e.toBeDeleted}).map(function(e){return r.deleteComment(e.comment_id)})),t.all(n)}return i.extend({defaultCustomData:function(){return{comments:[],files:[],request_type:"leave"}},calculateBalanceChange:function(n){var t=["contact_id","from_date","to_date","type_id","from_date_type","to_date_type"];return"hours"===n&&e.pull(t,"from_date_type","to_date_type"),r.calculateBalanceChange(e.pick(this,t)).then(function(e){return"hours"===n?h.call(this,e):e}.bind(this))},cancel:function(){return u.call(this,s.statusNames.cancelled)},approve:function(){return u.call(this,s.statusNames.approved)},checkIfBalanceChangeNeedsRecalculation:function(){return l.call(this)},reject:function(){return u.call(this,s.statusNames.rejected)},sendBack:function(){return u.call(this,s.statusNames.moreInformationRequired)},update:function(){return r.update(this.toAPI()).then(function(){return t.all([v.call(this),m.call(this)])}.bind(this))},create:function(){return r.create(this.toAPI()).then(function(e){return this.id=e.id,t.all([v.call(this)])}.bind(this))},deleteAttachment:function(e){e.toBeDeleted||(e.toBeDeleted=!0)},deleteComment:function(n){if(n.comment_id)return void(n.toBeDeleted=!0);this.comments=e.reject(this.comments,function(e){return n.created_at===e.created_at&&n.text===e.text})},delete:function(){return r.delete(this.id)},getBalanceChangeBreakdown:function(){return r.getBalanceChangeBreakdown(this.id).then(function(n){return{amount:e.reduce(n.values,function(e,n){return e+parseFloat(n.amount)},0),breakdown:n.values.map(function(e){return{amount:Math.abs(parseFloat(e.amount)),date:e.date,type:{id:e.id,value:e.type,label:e.label}}})}})},getWorkDayForDate:function(e){return r.getWorkDayForDate(e,this.contact_id).then(function(e){return e.values}).catch(function(e){return t.reject(e)})},isValid:function(){return r.isValid(this.toAPI())},isApproved:function(){return d.call(this,s.statusNames.approved)},isAwaitingApproval:function(){return d.call(this,s.statusNames.awaitingApproval)},isCancelled:function(){return d.call(this,s.statusNames.cancelled)},isRejected:function(){return d.call(this,s.statusNames.rejected)},isSentBack:function(){return d.call(this,s.statusNames.moreInformationRequired)},loadComments:function(){return this.id?r.getComments(this.id).then(function(e){this.comments=e}.bind(this)):t.resolve()},roleOf:function(e){return this.contact_id===e?t.resolve("owner"):a(s.permissions.admin.administer).then(function(n){return n?"admin":r.isManagedBy(this.id,e).then(function(e){return e?"manager":"none"})}.bind(this))},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])},loadAttachments:function(){return this.id?r.getAttachments(this.id).then(function(e){this.files=e}.bind(this)):t.resolve()}})}])}),define("leave-absences/shared/models/leave-request.model",["leave-absences/shared/modules/models","common/models/model","leave-absences/shared/apis/leave-request.api","leave-absences/shared/instances/leave-request.instance"],function(e){"use strict";e.factory("LeaveRequest",["$log","Model","LeaveRequestAPI","LeaveRequestInstance",function(e,n,t,a){return e.debug("LeaveRequest"),n.extend({all:function(e,n,o,s,i){return t.all(this.processFilters(e),n,o,s,i).then(function(e){return e.list=e.list.map(function(e){return a.init(e,!0)}),e})},balanceChangeByAbsenceType:function(e){return t.balanceChangeByAbsenceType(this.processFilters(e))},find:function(e){return t.find(e).then(function(e){return a.init(e,!0)})}})}])}),define("leave-absences/shared/apis/public-holiday.api",["leave-absences/shared/modules/apis","common/services/api"],function(e){"use strict";e.factory("PublicHolidayAPI",["$log","api",function(e,n){return e.debug("PublicHolidayAPI"),n.extend({all:function(n){return e.debug("PublicHolidayAPI"),this.sendGET("PublicHoliday","get",n).then(function(e){return e.values})}})}])}),define("leave-absences/shared/instances/public-holiday.instance",["leave-absences/shared/modules/models-instances","common/models/instances/instance"],function(e){"use strict";e.factory("PublicHolidayInstance",["$log","ModelInstance",function(e,n){return e.debug("PublicHolidayInstance"),n.extend({})}])}),define("leave-absences/shared/models/public-holiday.model",["common/moment","leave-absences/shared/modules/models","common/models/model","common/services/hr-settings","leave-absences/shared/apis/public-holiday.api","leave-absences/shared/instances/public-holiday.instance"],function(e,n){"use strict";n.factory("PublicHoliday",["$log","Model","PublicHolidayAPI","PublicHolidayInstance","shared-settings",function(n,t,a,o,s){return n.debug("PublicHoliday"),t.extend({all:function(e){return n.debug("PublicHoliday.all",e),a.all(e).then(function(e){return e.map(function(e){return o.init(e,!0)})})},isPublicHoliday:function(t){n.debug("PublicHoliday.isPublicHoliday",t);var o=e(t).format(s.serverDateFormat),i={date:o};return a.all(i).then(function(e){return!!e.length})}})}])}),define("leave-absences/shared/modules/components",["common/angular","common/modules/directives","common/modules/models","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/models"],function(e){return e.module("leave-absences.components",["common.directives","common.models","leave-absences.settings","leave-absences.models"])}),define("leave-absences/shared/modules/controllers",["common/angular","common/angularBootstrap","leave-absences/shared/modules/models","leave-absences/shared/modules/models-instances","leave-absences/shared/modules/shared-settings"],function(e){return e.module("leave-absences.controllers",["ui.select","leave-absences.models","leave-absences.models.instances","leave-absences.settings"])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers","common/models/contract","common/services/notification.service"],function(e,n,t){function a(n,t,a,o,s,i,r){function c(){return{loadContacts:function(){return l.loadContactsForAdmin()}}}function u(e){i.info("",["

    When All filter is selected, all staff members with contracts which are active in the selected absence period are displayed.

    ","

    People I approve filter displays only staff members who you approve leave for.

    ","

    People without approver filter displays all staff members with contracts which are active in the selected absence period and who do not have any leave approver assigned.

    "].join(""))}n.debug("LeaveCalendarAdminController");var l,d;return{init:function(n){return d=n,l=r.init(d),d.filters.userSettings.assignedTo=e.find(d.filtersByAssignee,{type:"me"}),d.showContactDetailsLink=!0,d.showContactName=!0,d.showFilters=!0,d.showAdminFilteringHint=u,c()}}}t.controller("LeaveCalendarAdminController",["$log","$q","Contact","ContactInstance","Contract","notificationService","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(n,t,a,o){function s(){return{loadContacts:function(){return i.loadLookUpAndFilteredContacts()}}}n.debug("LeaveCalendarManagerController");var i,r;return{init:function(n){return r=n,i=o.init(r),r.filters.userSettings.assignedTo=e.find(r.filtersByAssignee,{type:"me"}),r.showContactName=!0,r.showFilters=!0,s()}}}t.controller("LeaveCalendarManagerController",["$log","Contact","ContactInstance","LeaveCalendarService",a])}),define("leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(e,n,t,a){function o(){return{loadContacts:function(){return i.displaySingleContact?s.loadFilteredContacts():"admin"===i.userPermissionRole?s.loadContactsForAdmin():s.loadLookUpAndFilteredContacts()}}}e.debug("LeaveCalendarStaffController");var s,i;return{init:function(e){return i=e,s=a.init(i),i.filters.userSettings.contacts_with_leaves=!0,i.showTheseContacts=[i.contactId],i.showContactName=!0,i.showFilters=!0,i.displaySingleContact&&(i.showFilters=!1,i.lookupContacts=[{id:i.contactId}]),o()}}}t.controller("LeaveCalendarStaffController",["$log","$q","Contact","LeaveCalendarService",a])}),define("leave-absences/shared/components/leave-calendar.component",["common/lodash","common/moment","leave-absences/shared/modules/components","leave-absences/shared/controllers/sub-controllers/leave-calendar-admin.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-manager.controller","leave-absences/shared/controllers/sub-controllers/leave-calendar-staff.controller"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d){function m(){N().then(g).then(b).then(_).then(S).then(function(){return a.all([C(),D(),I(),W.showFilters?R():e.noop])}).then(function(){f(),y(),B()}).then(function(){W.loading.page=!1})}function f(){W.supportData.absenceTypes.push({id:"",title:"Leave",color:"#4D4D68",calculation_unit:e.chain(W.supportData.calculationUnits).find({name:"days"}).get("value").value()})}function p(){for(var e=[],t=n(W.selectedPeriod.start_date).clone().startOf("month"),a=n(W.selectedPeriod.end_date).clone().endOf("month");t.isBefore(a);)e.push(L(t)),t.add(1,"month");W.months=e}function h(){return e.includes(["admin","manager"],W.userPermissionRole)}function v(e){return e.format("YYYY-MM")}function b(){s.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,n){W.supportData.absenceTypesToFilterBy=n,M(!0)})}function g(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(F(),B(),M())})}function y(e){W.injectMonth=!0,j("injected").then(function(){M(e)}).then(function(){W.loading.calendar=!1})}function _(){U=t("LeaveCalendar"+e.capitalize(H)+"Controller").init(W)}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return r.all().then(function(n){W.absencePeriods=e.sortBy(n,"start_date"),W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current})}).then(p).then(x)}function T(){return c.all().then(c.loadCalculationUnits)}function A(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function D(){return U.loadContacts().then(function(e){W.contacts=e})}function R(){return l.valuesOf(["hrjc_region","hrjc_location","hrjc_level_type","hrjc_department"]).then(function(e){W.filters.optionValues.regions=e.hrjc_region,W.filters.optionValues.locations=e.hrjc_location,W.filters.optionValues.levelTypes=e.hrjc_level_type,W.filters.optionValues.departments=e.hrjc_department})}function P(){return u.all()}function I(){return a.all([T(),P(),A()]).then(function(n){W.supportData.absenceTypes=n[0],W.supportData.publicHolidays=n[1],W.supportData.calculationUnits=n[2].hrleaveandabsences_absence_type_calculation_unit,W.supportData.dayTypes=n[2].hrleaveandabsences_leave_request_day_type,W.supportData.leaveRequestStatuses=n[2].hrleaveandabsences_leave_request_status,W.supportData.toilAmounts=e.indexBy(n[2].hrleaveandabsences_toil_amounts,"value")})}function S(){var e=a.resolve();return W.injectMonth&&(e=j("destroyed"),W.injectMonth=!1),e}function L(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:n().year(e.year()).month(e.month())}}function w(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&p(),x(),B(),O("month")}function k(e){var t="previous"===e?"subtract":"add";F(n(W.selectedMonth.moment)[t](1,"month")),B(),O("month")}function O(n){n=e.includes(["contacts","period","month"],n)?n:"period",a.resolve().then(S).then("period"===n&&p).then("period"===n&&$).then("contacts"===n&&D).then("month"===n&&B).then(function(){y("contacts"===n)})}function M(e){s.$emit("LeaveCalendar::showMonth",!!e)}function x(){F(n())}function $(){F(W.months[0].moment)}function E(t){var a="previous"===t?"first":"last",o=e[a](W.months),s=n().year(o.year).month(o.month);W.monthPaginatorsAvailability[t]=!W.selectedMonth.moment.isSame(s,"month")}function B(){E("previous"),E("next")}function F(n){n&&(W.selectedMonthIndex=v(n)),W.selectedMonth=e.find(W.months,{index:W.selectedMonthIndex})}function N(){return a.all([d(i.permissions.admin.administer),d(i.permissions.ssp.manage)]).then(function(e){W.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",H=W.roleOverride?W.roleOverride:W.userPermissionRole})}function j(n){return a(function(t){var a=s.$on("LeaveCalendar::month"+e.capitalize(n),function(){a(),t()})})}o.debug("Component: leave-calendar");var U,H,W=this;W.absencePeriods=[],W.contacts=[],W.contactIdsToReduceTo=null,W.injectMonth=!1,W.months=[],W.selectedMonth={},W.selectedMonthIndex="",W.selectedPeriod=null,W.showContactName=!1,W.showFilters=!1,W.userPermissionRole="staff",W.loading={calendar:!0,page:!0},W.filters={hideOnMobile:!0,optionValues:{},userSettings:{contact:null,contacts_with_leaves:!0,department:null,level_type:null,location:null,region:null},absenceTypes:{}},W.filtersByAssignee=[{type:"me",label:"People I approve"},{type:"unassigned",label:"People without approver"},{type:"all",label:"All"}],W.filters.userSettings.assignedTo=W.filtersByAssignee[2],W.monthPaginatorsAvailability={previous:!0,next:!0},W.supportData={absenceTypesToFilterBy:[]},W.$onInit=m,W.canManageRequests=h,W.labelPeriod=q,W.navigateToCurrentMonth=w,W.paginateMonth=k,W.refresh=O}t.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,t={from_date:{to:Q.month.days[Q.month.days.length-1].date+" 23:59:59"},to_date:{from:Q.month.days[0].date+" 00:00:00"},status_id:{IN:k()},contact_id:{IN:Q.contacts.map(function(e){return e.id})},type_id:{IN:n?Q.supportData.absenceTypesToFilterBy:e.pluck(Q.supportData.absenceTypes,"id")}};return y(),i.all(t,null,null,null,!1).then(function(e){return X={},n&&(e.list=q(e.list)),A(e.list)})}function x(){var n=Q.month.days[0].date,t=Q.month.days[Q.month.days.length-1].date;return s.get(Q.contacts.map(function(e){return e.id}),n,t).then(function(n){z=e.indexBy(n,"contact_id")})}function $(){return Q.contactIdsToReduceTo&&(Q.contacts=Q.contacts.filter(function(n){return e.includes(Q.contactIdsToReduceTo,n.contact_id)||e.find(X,function(e){return e.contact_id===n.contact_id})})),a.resolve()}function E(n){var t=L(n);X[n.contact_id]=X[n.contact_id]||{},t.forEach(function(t){e.remove(X[n.contact_id][t.date],function(e){return e.id===n.id})})}function B(){o.$emit("LeaveCalendar::monthDestroyed"),V.map(function(e){e.remove?e.remove():e()})}function F(n,t,o){var s,i;return n.contactsData[t]=n.contactsData[t]||{},i=f(t),s=!0===o?a.resolve():a.all([i.isWeekend(h(n.date)),i.isNonWorkingDay(h(n.date))]).then(function(a){e.assign(n.contactsData[t],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:I(n.date)})}),s.then(function(){return X[t]&&X[t][n.date]?X[t][n.date]:[]}).then(function(a){a=U(a),e.assign(n.contactsData[t],{leaveRequests:a,leaveRequestsToShowInCell:b(a),leaveRequestsAttributes:C(n,a)})})}function N(){return a.all(Q.month.days.map(function(e){return a.all(Q.contacts.map(function(n){return F(e,n.id)}))}))}function j(e,n){Q.currentPage=0,Q.visible=!0,(n||!G)&&O()}function U(t){return e.sortBy(t,function(e){return+n(e.from_date).format("X")+(R("half_day_pm",e,e.from_date)?1:0)})}function H(n){var t=e.find(Q.supportData.absenceTypes,function(e){return e.id===n.type_id});return n.balance_change>0?{borderColor:t.color}:{borderColor:t.color,backgroundColor:t.color}}function W(e){v(e),-1!==k().indexOf(e.status_id)&&l(e)}function Y(e){return a.all(L(e).map(function(n){return F(n,e.contact_id,!0)}))}t.debug("Component: leave-calendar-month");var G=!1,V=[],z={},X={},Q=this;Q.currentPage=0,Q.pageSize=20,Q.visible=!1,Q.showContactName=!!Q.showContactName,Q.showOnlyWithLeaveRequests=!!Q.showOnlyWithLeaveRequests,Q.$onDestroy=B,Q.$onInit=u,Q.contactsList=p,Q.getContactUrl=_}t.component("leaveCalendarMonth",{bindings:{showTheseContacts:"<",contacts:"<",contactIdsToReduceTo:"<",month:"<",period:"<",showContactName:"<",showContactDetailsLink:"<",showOnlyWithLeaveRequests:"<",supportData:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-month.html"}],controllerAs:"month",controller:["$log","$q","$rootScope","Calendar","LeaveRequest","pubSub","shared-settings",a]})}),define("leave-absences/shared/modules/services",["common/angular","common/modules/services"],function(e){"use strict";return e.module("leave-absences.services",["common.services"])}),define("leave-absences/shared/services/leave-request.service",["common/lodash","leave-absences/shared/modules/services"],function(e,n){"use strict";function t(n,t,a){function o(){var n=t.defer();return a.open(e.defaults(s(),{onConfirm:function(){n.resolve(!0)}})),n.promise}function s(){return{title:"Recalculate Balance Change?",copyCancel:"Cancel",copyConfirm:"Yes",classConfirm:"btn-warning",msg:"The leave balance change has updated since this leave request was created. Do you want to recalculate the balance change?"}}return n.debug("LeaveRequest"),{getBalanceChangeRecalculationPromptOptions:s,promptBalanceChangeRecalculation:o}}n.factory("LeaveRequestService",t),t.$inject=["$log","$q","dialog"]}),define("leave-absences/shared/components/leave-request-actions.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/contact","common/models/session.model","common/services/hr-settings","common/services/notification.service","common/services/pub-sub","leave-absences/shared/services/leave-request.service"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d,m){function f(){a.resolve().then(_).then(C).then(function(){return y()&&"admin"!==w.role&&P()}).then(R).finally(function(){w.loading.component=!1})}function p(n){L=w.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===w.leaveRequest.request_type?i.open(q(n)):b(n)}function h(){return"admin"===w.role&&"public_holiday"===w.leaveRequest.request_type}function v(t){var a=w.absenceTypes[w.leaveRequest.type_id].allow_request_cancelation;return"admin"===w.role||("manager"===w.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(w.leaveRequest.from_date):"2"===a)}function b(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return w.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){A(n)}}):q(n)})}})}function g(){return s.find(S).then(function(e){return e.checkIfSelfLeaveApprover()})}function y(){return S===w.leaveRequest.contact_id}function _(){e.isArray(w.leaveRequestStatuses)&&(w.leaveRequestStatuses=e.indexBy(w.leaveRequestStatuses,"value")),e.isArray(w.absenceTypes)&&(w.absenceTypes=e.indexBy(w.absenceTypes,"id"))}function q(e){var n=O[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return w.leaveRequest[e]().then(function(){D(e)}).catch(function(e){d.error("Error:",e)})}}}function C(){return m.get().then(function(e){S=e.contactId})}function T(e,n){e.stopPropagation(),r.openModal(n)}function A(e){r.openModal({leaveRequest:w.leaveRequest,leaveType:w.leaveRequest.request_type,selectedContactId:w.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[M[e]]})}function D(n){var t=e.find(w.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;L===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:w.leaveRequest})}function R(){var n=w.leaveRequestStatuses[w.leaveRequest.status_id].name,t=e.compact(e.map(O,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!v(n)&&e.pull(t,"cancel"),"admin"!==w.role&&e.pull(t,"delete"),"staff"===w.role&&e.pull(t,"approve","reject"),"staff"!==w.role&&I(t),h()&&t.push("delete"),w.allowedActions=e.map(t,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function P(){return g().then(function(e){e&&(w.role="admin")})}function I(n){e.each(n,function(t,a){"edit"===t&&(n[a]="respond"),e.includes(["respond","view"],t)&&(n[a]="edit")})}t.debug("Component: leave-request-action-dropdown");var S,L,w=this,k=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[k.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[k.moreInformationRequired]},view:{label:"View",allowedStatuses:[k.approved,k.rejected,k.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[k.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[k.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[k.awaitingApproval,k.approved,k.rejected,k.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[k.awaitingApproval,k.moreInformationRequired,k.approved,k.rejected,k.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},M={approve:"approved"};w.allowedActions=[],w.loading={component:!0},w.$onInit=f,w.action=p,w.openLeavePopup=T}t.component("leaveRequestActions",{bindings:{leaveRequest:"<",leaveRequestStatuses:"<",absenceTypes:"<",role:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-actions.html"}],controllerAs:"actions",controller:a}),a.$inject=["$log","$q","$rootScope","Contact","dialog","LeavePopup","LeaveRequestService","pubSub","shared-settings","notificationService","Session"]}),define("leave-absences/shared/components/leave-request-popup-comments-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/hr-settings","common/models/session.model"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){o.$emit("LeaveRequestPopup::addTab",C),y(),_()}function l(){C.request.comments.push({contact_id:q,leave_request_id:C.request.id,text:C.comment.text}),C.comment.text=""}function d(){return C.comment.text.length>0}function m(e){return!e.comment_id||C.canManage}function f(e){return n.utc(e,i.serverDateTimeFormat).local().format(s.DATE_FORMAT.toUpperCase()+" HH:mm")}function p(){return C.request.comments.filter(function(e){return!e.toBeDeleted})}function h(e){return e===q?"Me":C.comment.contacts[e]?C.comment.contacts[e].display_name:void 0}function v(e){return C.mode===e}function b(){C.comment.text.length&&C.addComment()}function g(){var n=e.indexBy(C.request.comments,"contact_id"),t=Object.keys(n);return r.all({id:{IN:t}},{page:1,size:0}).then(function(n){C.comment.contacts=e.indexBy(n.list,"contact_id")})}function y(){return C.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),C.request.comments.length&&g()})}function _(){return C.loading.component=!0,c.get().then(function(e){q=e.contactId}).then(function(){C.loading.component=!1})}t.debug("Component: leave-request-popup-comments-tab");var q=null,C=this;C.loading={component:!0},C.comment={text:"",contacts:{}},C.$onInit=u,C.addComment=l,C.canRemoveComment=m,C.canSubmit=d,C.formatDateTime=f,C.getActiveComments=p,C.getCommentorName=h,C.isMode=v,C.onBeforeSubmit=b}t.component("leaveRequestPopupCommentsTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-comments-tab.html"}],controllerAs:"commentsCtrl",controller:["$log","$rootScope","$scope","HR_settings","shared-settings","Contact","Session",a]})}),define("leave-absences/shared/components/leave-request-popup-details-tab.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/models/session.model","leave-absences/shared/models/calendar.model"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l,d,m){function f(){t("RequestModalDetails"+e.capitalize(T(te.leaveType,te.request))+"Controller",{detailsController:te}),te.canManage=te.isRole("manager")||te.isRole("admin"),te.loading.tab=!0,s.$emit("LeaveRequestPopup::addTab",te),S(),te.initChildController().then(function(){return i.all([$(),x()])}).then(!te.isMode("create")&&I).then(Y).then(function(){if(!te.isMode("create"))return i.resolve().then(te.initTimesExtended).then(z)}).then(!te.isMode("create")&&W).then(L).then(G).then(P).then(w).then(!te.isMode("view")&&te.initWatchersExtended).catch(R).then(function(){te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.totalItems=te.balance.change.breakdown.length}).finally(function(){te.loading.tab=!1})}function p(){te.balance.closing=te.balance.opening+te.balance.change.amount}function h(e){return n(e,c.serverDateFormat).toDate()}function v(e){return n(e).format(c.serverDateFormat)}function b(e){var n;return i.resolve().then(function(){U(e),"from"===e&&j(),k("hours")&&(_(e),"from"!==e||te.uiOptions.multipleDays||_("to")),te.loading[e+"DayTypes"]=!0}).then(function(){return C(e)}).then(function(e){if(n=e.id!==te.period.id,n&&(te.period=e),!te.period.id)return i.reject("Please change date as it is not in any absence period")}).then(W).then(function(){if(n)return $()}).then(function(){return te.onDateChangeExtended&&te.onDateChangeExtended(e)}).then(function(){if(z(),!n)return B();o.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(R).finally(q)}function g(){return z(),B()}function y(){return te.uiOptions.toDate=null,U("to"),i.resolve().then(z).then(te.setDaysSelectionModeExtended).then(q).then(!te.uiOptions.multipleDays&&B)}function _(e){te.uiOptions.times[e].loading=!0}function q(){["from","to"].forEach(function(e){te.loading[e+"DayTypes"]=!1,k("hours")&&(te.uiOptions.times[e].loading=!1)})}function C(t){var a=n(te.uiOptions[t+"Date"]).format(te.uiOptions.userDateFormat.toUpperCase());return e.find(te.absencePeriods,function(e){return e.isInPeriod(a)})||{}}function T(){return te.request?te.request.request_type:te.leaveType||null}function A(e){return n().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function D(){return X(),te.loading.balanceChange=!0,te.request.getBalanceChangeBreakdown().then(H).catch(R)}function R(n){o.$broadcast("LeaveRequestPopup::handleError",e.isArray(n)?n:[n]),te.loading.fromDayTypes=!1,te.loading.balanceChange=!1,te.loading.tab=!1,te.loading.toDayTypes=!1}function P(){return te.isMode("create")||te.forceRecalculateBalanceChange?B():D()}function I(){var e=te.request.attributes();return te.uiOptions.fromDate=h(te.request.from_date),te.request.to_date=e.to_date,te.request.to_date_type=e.to_date_type,te.uiOptions.toDate=h(te.request.to_date),te.initDayTypesExtended?te.initDayTypesExtended():i.resolve()}function S(){ne.push(o.$on("LeaveRequestPopup::absenceTypeChanged",function(){J()}),o.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,n){K(n)}),o.$on("LeaveRequestPopup::recalculateBalanceChange",B))}function L(){te.isMode("edit")&&(te.isLeaveStatus(c.statusNames.approved)||te.isLeaveStatus(c.statusNames.adminApproved))&&(ee={absenceTypeId:te.request.type_id,value:te.selectedAbsenceType.remainder-te.request.balance_change})}function w(){o.$watch(function(){return te.uiOptions.times.from.time},function(e,n){e!==n&&(te.uiOptions.multipleDays||(Z(e),z()))})}function k(e){return te.selectedAbsenceType.calculation_unit_name===e}function O(e){return te.request.request_type===e}function M(n){return e.includes(["weekend","non_working_day","public_holiday"],n)}function x(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){te.requestDayTypes=e})}function $(){return u.get(te.request.contact_id,te.period.start_date,te.period.end_date).then(function(e){te.calendar=e})}function E(){var e=(te.pagination.currentPage-1)*te.pagination.numPerPage,n=e+te.pagination.numPerPage;te.pagination.filteredbreakdown=te.balance.change.breakdown.slice(e,n)}function B(){return X(),te.canCalculateChange()?(te.loading.balanceChange=!0,te.request.change_balance=!0,te.calculateBalanceChange().then(H).catch(R).finally(function(){te.loading.balanceChange=!1})):i.resolve()}function F(){te.pagination.totalItems=te.balance.change.breakdown.length,te.pagination.filteredbreakdown=te.balance.change.breakdown,te.pagination.pageChanged()}function N(){return v(te.request.from_date)===v(te.request.to_date)}function j(){te.uiOptions.toDate&&te.uiOptions.fromDate&&te.uiOptions.multipleDays&&n(te.uiOptions.toDate).isSameOrBefore(te.uiOptions.fromDate)&&(te.uiOptions.toDate=null,U("to"))}function U(e){te.resetUIInputsExtended&&te.resetUIInputsExtended(e),z(),X()}function H(e){te.balance.change=e,te.request.balance_change=e.amount,p(),F(),te.loading.balanceChange=!1}function W(){var e,t,a;te.uiOptions.fromDate?(e=n(te.uiOptions.fromDate).add(1,"day").toDate(),a=e,t=e):(a=h(te.period.start_date),t=te.uiOptions.date.to.options.minDate),te.uiOptions.date.to.options.initDate=t,te.uiOptions.date.to.options.minDate=a,te.uiOptions.date.to.options.maxDate=h(te.period.end_date)}function Y(){return!te.isMode("create")&&N()||te.isMode("create")&&(O("sickness")||k("hours"))?te.uiOptions.multipleDays=!1:te.uiOptions.multipleDays=!0,i.resolve().then(te.setDaysSelectionModeExtended)}function G(){ee&&ee.absenceTypeId===te.selectedAbsenceType.id?te.balance.opening=ee.value||0:te.balance.opening=te.selectedAbsenceType.remainder}function V(){te.selectedAbsenceType=e.find(te.absenceTypes,function(e){return e.id===te.request.type_id})}function z(){var e=te.uiOptions,n=e.times;te.request.from_date=e.fromDate?v(e.fromDate):null,te.request.to_date=e.toDate?v(e.toDate):null,!e.multipleDays&&e.fromDate&&(te.request.to_date=te.request.from_date,te.request.to_date_type=te.request.from_date_type),(k("hours")||O("toil"))&&(te.request.from_date=te.request.from_date&&n.from.time?te.request.from_date+" "+n.from.time:null,te.request.to_date=te.request.to_date&&n.to.time?te.request.to_date+" "+n.to.time:null)}function X(){te.uiOptions.showBalance=te.canCalculateChange()}function Q(){e.forEach(ne,function(e){e()})}function J(){var e,n=te.selectedAbsenceType.calculation_unit_name;return V(),e=n!==te.selectedAbsenceType.calculation_unit_name,G(),i.resolve().then(e&&Y).then(e&&te.onAbsenceTypeUpdateExtended).then(e&&z).then(q).then(B)}function K(e){return te.absenceTypes=e,V(),n(te.uiOptions.toDate).isAfter(te.period.end_date)&&(te.uiOptions.toDate=void 0,U("to")),G(),B()}function Z(e){var n=A(e).add(te.uiOptions.time_interval,"minutes");n.isAfter(A(te.uiOptions.times.to.max))||(te.uiOptions.times.to.min=n.format("HH:mm"),n.isAfter(A(te.uiOptions.times.to.time))&&(te.uiOptions.times.to.time=""))}a.debug("Component: leave-request-popup-details-tab");var ee=null,ne=[],te=this;te.canManage=!1,te.calendar={},te.errors=[],te.isRequired=!0,te.requestDayTypes=[],te.statusNames=c.statusNames,te.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},te.pagination={currentPage:1,filteredbreakdown:[],numPerPage:7,totalItems:0,pageChanged:E},te.uiOptions={isChangeExpanded:!1,multipleDays:!0,userDateFormat:r.DATE_FORMAT,showBalance:!1,date:{from:{show:!1,options:{startingDay:1,showWeeks:!1}},to:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}},expiry:{show:!1,options:{minDate:null,maxDate:null,startingDay:1,showWeeks:!1}}},times:{from:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""},to:{amount:0,amountExpanded:!1,loading:!1,max:"00:00",maxAmount:0,min:"00:00",time:""}},time_interval:15},te.$onInit=f,te.convertDateFormatFromServer=h,te.convertDateToServerFormat=v,te.dateChangeHandler=b,te.dateTypeChangeHandler=g,te.daysSelectionModeChangeHandler=y,te.disableAndShowLoadingTimeInput=_,te.getMomentDateWithGivenTime=A,te.handleError=R,te.isCalculationUnit=k,te.isLeaveType=O,te.isNotWorkingDay=M,te.performBalanceChangeCalculation=B,te.setRequestDateTimesAndDateTypes=z,te.updateEndTimeInputMinTime=Z,te.$onDestroy=Q}t.component("leaveRequestPopupDetailsTab",{bindings:{absencePeriods:"<",absenceTypes:"<",balance:"=",request:"<",isLeaveStatus:"<",leaveType:"<",isMode:"<",isSelfRecord:"<",period:"=",isRole:"<",selectedAbsenceType:"=",forceRecalculateBalanceChange:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-details-tab.html"}],controllerAs:"detailsTab",controller:a}),a.$inject=["$controller","$log","$rootScope","$scope","$q","HR_settings","shared-settings","Calendar","OptionGroup","LeaveRequest","$timeout"]}),define("leave-absences/shared/components/leave-request-popup-files-tab",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/file-upload","common/services/file-mime-types","common/services/hr-settings"],function(e,n,t){function a(t,a,o,s,i,r,c,u,l){function d(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",w),y(),a.all([A(),C()]).then(_).finally(function(){w.filesLoaded=!0})}function m(){return w.fileUploader&&w.fileUploader.queue.length>0}function f(){return w.getFilesAmount()0?I.map(function(e){return e.label}).join(", "):""}function C(){return w.request.loadAttachments().then(function(){o.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function T(){return a.all(I.map(function(e){return l.getMimeTypeFor(e.label).then(function(n){L[e.label]=n})})).catch(function(){L=null})}function A(){return c.valuesOf("safe_file_extension").then(function(e){I=e})}function D(e){return!e.attachment_id||w.canManage}function R(){e.forEach(S,function(e){e()})}function P(e,n){w.fileUploader.queue&&w.fileUploader.queue.length>0?w.fileUploader.uploadAll({entityID:w.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var I=[],S=[],L={},w=Object.create(this);return w.filesLoaded=!1,w.fileUploader=null,w.today=Date.now(),w.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",w.userDateFormat=i.DATE_FORMAT,w.$onDestroy=R,w.$onInit=d,w.canRemoveAttachment=D,w.canSubmit=m,w.canUploadMore=f,w.formatDateTime=p,w.getAuthorName=h,w.getFilesAmount=v,w.listFileTypes=q,w}t.component("leaveRequestPopupFilesTab",{bindings:{canManage:"<",mode:"<",request:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-popup/leave-request-popup-files-tab.html"}],controllerAs:"filesTab",controller:["$log","$q","$rootScope","$scope","HR_settings","shared-settings","OptionGroup","FileUpload","fileMimeTypes",a]})}),define("leave-absences/shared/components/leave-request-record-actions.component",["leave-absences/shared/modules/components","common/services/hr-settings","common/services/before-hash-query-params.service"],function(e){function n(e,n,t){function a(){s=t.parse(),s.openModal&&o({leaveType:s.openModal,selectedContactId:i.selectedContactId})}function o(e){n.openModal(e)}e.debug("Component: leave-request-record-actions");var s,i=this;i.leaveRequestOptions=[{type:"leave",icon:"briefcase",label:"Leave"},{type:"sickness",icon:"stethoscope",label:"Sickness"}],i.$onInit=a,i.openLeavePopup=o}e.component("leaveRequestRecordActions",{bindings:{contactId:"<",selectedContactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-request-record-actions.html"}],controllerAs:"vm",controller:["$log","LeavePopup","beforeHashQueryParams",n]})}),define("leave-absences/shared/components/staff-leave-report.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/pub-sub"],function(e,n,t){function a(n,t,a,o,s,i,r,c,u,l,d,m){function f(){t.all([q(),E(),A(),T()]).then(function(){z.loading.page=!1}).then(function(){return t.all([P(),R()])}).then(B).then(function(){z.loading.content=!1}),j()}function p(e,n){n.data.push(e),n.dataIndex[e.id]=e}function h(){z.absenceTypes=z.absenceTypes.map(function(n){var t=e.find(z.entitlements,function(e){return e.type_id===n.id});return n.entitlement=t?t.value:0,n.remainder=t?t.remainder:{current:0,future:0},n})}function v(e){U(e),z.sections.other.open&&p(e,z.sections.other)}function b(){Object.values(z.sections).forEach(function(e){e.data=[]})}function g(){z.absenceTypesFiltered=z.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function y(e){var n=V[e.status];n?n(e.leaveRequest):z.refresh()}function _(n){n.dataIndex=e.indexBy(n.data,"id")}function q(){return z.role="staff","absence-tab"===a.section?(z.role="admin",t.resolve()):o(m.permissions.admin.administer).then(function(e){e&&(z.role="admin")})}function C(e){return e.current?"Current Period ("+e.title+")":e.title}function T(){return s.all().then(function(n){z.absencePeriods=e.sortBy(n,"start_date"),z.selectedPeriod=e.find(z.absencePeriods,function(e){return!0===e.current})})}function A(){return i.all().then(i.loadCalculationUnits).then(function(n){z.absenceTypes=n,z.absenceTypesIndexed=e.indexBy(n,"id")})}function D(){return w("approved",{status_id:G(m.statusNames.approved)})}function R(){var n={contact_id:z.contactId,period_id:z.selectedPeriod.id};return t.all([c.balanceChangeByAbsenceType(e.assign({},n,{public_holiday:!0})),c.balanceChangeByAbsenceType(e.assign({},n,{expired:!0 +})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[G(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[G(m.statusNames.awaitingApproval),G(m.statusNames.moreInformationRequired)]}}))]).then(function(e){z.absenceTypes.forEach(function(n){n.balanceChanges={holidays:e[0][n.id],expired:e[1][n.id],approved:e[2][n.id],pending:e[3][n.id]}})})}function P(){return r.all({contact_id:z.contactId,period_id:z.selectedPeriod.id},!0).then(function(e){z.entitlements=e})}function I(){return r.breakdown({contact_id:z.contactId,period_id:z.selectedPeriod.id},z.entitlements).then(function(){return F(z.entitlements)}).then(function(e){z.sections.entitlements.data=e})}function S(){return t.all([r.breakdown({contact_id:z.contactId,period_id:z.selectedPeriod.id,expired:!0}),L({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:F(e[0]),expiredTOILS:N(e[1].list)})}).then(function(n){z.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),z.sections.expired.data=e.sortBy(z.sections.expired.data,"expiry_date")})}function L(n){return c.all(e.assign({contact_id:z.contactId,from_date:{from:z.selectedPeriod.start_date},to_date:{to:z.selectedPeriod.end_date},type_id:{IN:z.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function w(e,n){return L(n).then(function(n){z.sections[e].data=n.list})}function k(){return t.all(Object.values(z.sections).filter(function(e){return e.open}).map($))}function O(){return w("other",{status_id:{in:[G(m.statusNames.rejected),G(m.statusNames.cancelled)]}})}function M(){return w("pending",{status_id:{in:[G(m.statusNames.awaitingApproval),G(m.statusNames.moreInformationRequired)]}})}function x(){return w("holidays",{public_holiday:!0})}function $(e){return e.loading=!0,e.loadLeaveRequests().then(_.bind(this,e)).then(function(){e.loading=!1})}function E(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){z.leaveRequestStatuses=e.indexBy(n,"value")})}function B(){h(),g()}function F(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(z.entitlements,function(e){return e.id===n.id});return n.breakdown.map(function(n){return e.assign(e.clone(n),{type_id:t.type_id})})})}).then(function(e){return Array.prototype.concat.apply([],e)})}function N(n){return t.resolve().then(function(){return n.map(function(n){return e.assign({},n,{expiry_date:n.toil_expiry_date,amount:n.toil_to_accrue,type:{label:"Accrued TOIL"}})})})}function j(){l.subscribe("LeaveRequest::new",function(){z.refresh()}),l.subscribe("LeaveRequest::edit",function(){z.refresh()}),l.subscribe("LeaveRequest::statusUpdate",y),l.subscribe("LeaveRequest::delete",function(e){U(e)})}function U(n){e.forEach(z.sections,function(t,a){t.dataIndex[n.id]&&(e.remove(t.data,function(e){return e.id===n.id}),delete t.dataIndex[n.id],"other"!==a&&H(n,a))})}function H(n,t){var a=["future","current"],o=z.absenceTypesIndexed[n.type_id];"pending"===t&&e.pull(a,"current"),o.balanceChanges[t]-=n.balance_change,a.forEach(function(e){o.remainder[e]-=n.balance_change})}function W(){z.loading.content=!0,t.all([P(),R()]).then(B).then(function(){z.loading.content=!1}).then(function(){return t.all([k(),b()])})}function Y(e){var n=z.sections[e];n.open=!n.open,n.open&&!n.data.length&&$(n)}function G(n){return e.find(z.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var V={delete:U,cancel:v},z=this;z.absencePeriods=[],z.absenceTypes=[],z.absenceTypesFiltered=[],z.absenceTypesIndexed={},z.dateFormat=d.DATE_FORMAT,z.leaveRequestStatuses={},z.selectedPeriod=null,z.role=null,z.loading={content:!0,page:!0},z.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:D},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:S},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:x},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O}},z.$onInit=f,z.labelPeriod=C,z.refresh=W,z.toggleSection=Y}t.component("staffLeaveReport",{bindings:{contactId:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/staff-leave-report.html"}],controllerAs:"report",controller:a}),a.$inject=["$log","$q","$rootScope","checkPermissions","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","OptionGroup","pubSub","HR_settings","shared-settings"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){return i.request.calculateBalanceChange(i.selectedAbsenceType.calculation_unit_name)}function l(){var e=i.request,n=!!e.from_date&&!!e.to_date,t=i.selectedAbsenceType.calculation_unit_name;return"days"===t?n=n&&!!e.from_date_type&&!!e.to_date_type:"hours"===t&&(n=n&&!isNaN(+e.from_date_amount)&&!isNaN(+e.to_date_amount)),n}function d(){return i.canCalculateChange()}function m(n,t){var a=i.uiOptions.times[n],o=e.clone(t.time_from),s=e.clone(t.time_to);i.uiOptions.multipleDays||("from"===n&&s&&o&&(s=i.getMomentDateWithGivenTime(s).subtract(i.uiOptions.time_interval,"minutes").format("HH:mm")),"to"===n&&o&&s&&(o=i.getMomentDateWithGivenTime(o).add(i.uiOptions.time_interval,"minutes").format("HH:mm"))),a.min=o||"00:00",a.max=s||"00:00",a.time="to"===n?a.max:a.min}function f(n,t){return n?(n=i.convertDateToServerFormat(n),v(n).then(function(t){return t?i.requestDayTypes.filter(function(e){return"public_holiday"===e.name}):p(n,i.requestDayTypes).then(function(n){return n.length?n:i.requestDayTypes.filter(function(n){return e.includes(["all_day","half_day_am","half_day_pm"],n.name)})})}).then(function(e){return I(t,e),e})):o.reject([])}function p(e,t){return e=n(e),o.all([i.calendar.isNonWorkingDay(e),i.calendar.isWeekend(e)]).then(function(e){return e[0]?"non_working_day":e[1]?"weekend":null}).then(function(e){return e?t.filter(function(n){return n.name===e}):[]})}function h(e,t){return n.duration(t).subtract(n.duration(e)).asHours()}function v(e){return c.all({public_holiday:1,contact_id:i.request.contact_id,from_date:{from:e},to_date:{to:e}}).then(function(e){return!!e.list.length})}function b(){return o.resolve()}function g(){return A(i.uiOptions.fromDate,"from").then(function(){return A(i.uiOptions.toDate,"to")})}function y(e){s.$watch(function(){return i.uiOptions.times[e].amount},function(e,n){i.isCalculationUnit("days")||+e==+n||(i.isRole("staff")&&(i.request.change_balance=!0),w(),i.performBalanceChangeCalculation())})}function _(e){var t=n(i.request[e+"_date"]).format("HH:mm"),a=i.uiOptions.times[e];(h(a.min,t)<=0||h(a.max,t)>=0)&&(t="from"===e?a.min:a.max),i.uiOptions.times[e].time=t}function q(){var e=i.uiOptions.multipleDays?["from","to"]:["from"],n=i.uiOptions.times;if(i.isCalculationUnit("hours"))return o.all(e.map(R)).then(function(){["from","to"].forEach(function(e){_(e),L(e),n[e].amount=Math.min(i.request[e+"_date_amount"],n[e].maxAmount).toString()}),i.uiOptions.multipleDays||i.updateEndTimeInputMinTime(i.uiOptions.times.from.time)}).then(w)}function C(){["from","to"].forEach(function(e){y(e),T(e)})}function T(e){s.$watch(function(){return i.uiOptions.times[e].time},function(n,t){i.isCalculationUnit("days")||n===t||(i.setRequestDateTimesAndDateTypes(),n&&L(e,!0))})}function A(e,n){return f(e,n).then(function(){i.loading[n+"DayTypes"]=!1})}function D(e){return A(i.uiOptions[e+"Date"],e).then(function(){if(i.isCalculationUnit("hours"))return R(e).then(function(){L(e,!0)})})}function R(e){var n=i.uiOptions[e+"Date"],t=!i.uiOptions.multipleDays;return n?i.request.getWorkDayForDate(i.convertDateToServerFormat(n)).then(function(n){O[e]=n,m(e,n),t&&"from"===e&&m("to",n)}).catch(function(n){return O[e]={},i.handleError(n)}).finally(function(){i.uiOptions.times[e].loading=!1,t&&(i.uiOptions.times.to.loading=!1)}):o.resolve()}function P(n){var t=i.uiOptions.times[n];i["request"+e.startCase(n)+"DayTypes"]=[],t.time="",t.min="00:00",t.max="00:00",t.amount="0",t.maxAmount="0"}function I(n,t){var a="request"+e.startCase(n)+"DayTypes";i[a]=t,i.isMode("create")&&(i.request[n+"_date_type"]=i[a][0].value)}function S(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?(i.disableAndShowLoadingTimeInput("from"),!i.uiOptions.multipleDays&&i.disableAndShowLoadingTimeInput("to"),R("from").then(function(){L("from",!0)})):o.resolve()}function L(e,n){var t=i.uiOptions,a=t.multipleDays?e:"from",o=t.times[a],s=t.multipleDays&&"to"===a?o.min:t.times.from.time,r=t.multipleDays&&"from"===a?o.max:t.times.to.time,c=O[a].number_of_hours?h(s,r).toString():"0";o.maxAmount=c,n&&(o.amount=o.maxAmount)}function w(){var e=i.uiOptions.times;i.request.from_date_amount=isNaN(+e.from.amount)?null:e.from.amount,i.request.to_date_amount=isNaN(+e.to.amount)?null:e.to.amount}function k(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?R("from").then(function(){L("from",!0)}):o.resolve()}var O={};a.debug("RequestModalDetailsLeaveController"),i.calculateBalanceChange=u,i.canCalculateChange=l,i.canSubmit=d,i.initChildController=b,i.initDayTypesExtended=g,i.initTimesExtended=q,i.initWatchersExtended=C,i.onAbsenceTypeUpdateExtended=k,i.onDateChangeExtended=D,i.resetUIInputsExtended=P,i.setDaysSelectionModeExtended=S}t.controller("RequestModalDetailsLeaveController",a),a.$inject=["$controller","$log","$q","$rootScope","detailsController","PublicHoliday","LeaveRequest"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller",["common/lodash","leave-absences/shared/modules/controllers"],function(e,n){function t(n,t,a,o,s,i,r){function c(){return!(!r.canCalculateChange()||!r.request.sickness_reason)}function u(){return a.all([m(),h(),f(!0)])}function l(n){var t=r.request.getDocumentArray();return!!e.find(t,function(e){return e===n})}function d(n){return!!e.find(r.sicknessDocumentTypes,function(e){return e.value===n})}function m(){return i.valuesOf("hrleaveandabsences_leave_request_required_document").then(function(e){r.sicknessDocumentTypes=e})}function f(n){return i.valuesOf("hrleaveandabsences_sickness_reason",n).then(function(n){r.sicknessReasons=e.indexBy(n,"name")})}function p(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_sickness_reason?reset=1").on("crmUnload",function(){f(!1)})}function h(){r.showSicknessOptionsEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}t.debug("RequestModalDetailsSicknessController"),n("RequestModalDetailsLeaveController",{detailsController:r}),r.canSubmit=c,r.initChildController=u,r.isChecked=l,r.isDocumentInRequest=d,r.openSicknessReasonOptionsEditor=p}n.controller("RequestModalDetailsSicknessController",t),t.$inject=["$controller","$log","$q","$rootScope","crmAngService","api.optionGroup","detailsController"]}),define("leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller",["common/lodash","common/moment","leave-absences/shared/modules/controllers"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(){return c.balance.change.amount=+c.request.toil_to_accrue,a.resolve(c.balance.change)}function l(){if(!c.request.from_date||!c.request.to_date)return c.uiOptions.max_toil_duration_and_accrual=null,void(c.uiOptions.toil_duration_in_hours=null);c.uiOptions.max_toil_duration_and_accrual=n.duration(n(c.request.to_date).diff(c.request.from_date)).asHours()}function d(){return v().catch(function(e){return e.length&&(c.errors=e),a.reject(e)}).then(function(e){return r.calculateToilExpiryDate(c.request.type_id,e)}).then(function(e){return c.request.toil_expiry_date=e,c.uiOptions.expiryDate=new Date(e),e})}function m(){return!!c.request.toil_to_accrue}function f(){var e=c.uiOptions.multipleDays&&!!c.request.to_date,n=!c.uiOptions.multipleDays&&!!c.request.from_date,t=n||e,a=j.from_date!==c.request.from_date||j.to_date!==c.request.to_date;return c.canDisplayToilExpirationField&&t&&H.hasExpirationFromAdminSettings&&a}function p(){return!!(c.request.from_date&&c.request.to_date&&c.request.toil_duration&&c.request.toil_to_accrue)}function h(){c.request.toil_expiry_date=!1,c.uiOptions.expiryDate=null}function v(){var e=c.uiOptions.multipleDays,n=c.request;return b({hasErrors:e?!n.to_date&&!n.from_date:!n.from_date,label:e?"To Date":"From Date",value:n.to_date})}function b(e){if(e.hasErrors){var t="Please select "+e.label+" to find expiry date";return a.reject([t])}return e.value?a.resolve(n(e.value).format("YYYY-MM-DD")):a.reject([])}function g(){var e=c.isMode("create")&&H.hasExpirationFromAdminSettings,n=H.hasPreviousExpirationDate,t=c.isLeaveType("toil"),a=c.canManage;c.canDisplayToilExpirationField=t&&(a||e||n)}function y(){c.uiOptions.toil_duration_in_hours=c.request.toil_duration/60}function _(){return H.hasPreviousExpirationDate=c.isMode("edit")&&!!c.request.toil_expiry_date,r.canExpire(c.request.type_id).then(function(e){H.hasExpirationFromAdminSettings=e})}function q(){return c.request.to_date_type=c.request.from_date_type="1",_().then(g).then(C).then(I)}function C(){c.canManage&&(c.uiOptions.expiryDate=c.convertDateFormatFromServer(c.request.toil_expiry_date))}function T(){o.$watch(function(){return c.request.toil_to_accrue},function(e,n){+e!=+n&&c.performBalanceChangeCalculation()})}function A(){o.$watch(function(){return c.uiOptions.toil_duration_in_hours},function(e,n){e!==n&&c.isCalculationUnit("hours")&&k(),c.request.toil_duration=c.uiOptions.toil_duration_in_hours?60*c.uiOptions.toil_duration_in_hours:null})}function D(){var e=c.uiOptions.times;e.from.time=n(c.request.from_date).format("HH:mm"),e.to.time=n(c.request.to_date).format("HH:mm"),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time)}function R(){["from","to"].forEach(function(e){o.$watch(function(){return c.uiOptions.times[e].time},function(e,n){e!==n&&(c.setRequestDateTimesAndDateTypes(),F(),l(),O())})})}function P(){c.isMode("view")||(T(),A(),R())}function I(n){return i.valuesOf("hrleaveandabsences_toil_amounts",n).then(function(n){c.toilAmounts=e.sortBy(n,function(e){return+e.weight})})}function S(){return l(),O(),F()}function L(){return x(),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time),l(),U?U=!1:O(),F()}function w(e){c.uiOptions.times[e].time=""}function k(){c.request.toil_to_accrue=c.uiOptions.toil_duration_in_hours}function O(){c.uiOptions.toil_duration_in_hours=c.uiOptions.max_toil_duration_and_accrual}function M(){j=e.cloneDeep(c.request.attributes())}function x(){c.uiOptions.multipleDays?["from","to"].forEach(function(e){c.uiOptions.times[e].min="00:00",c.uiOptions.times[e].max="23:45"}):(c.uiOptions.times.from.min="00:00",c.uiOptions.times.from.max="23:30",c.uiOptions.times.to.min="00:15",c.uiOptions.times.to.max="23:45")}function $(){c.setRequestDateTimesAndDateTypes(),l(),O(),c.isCalculationUnit("hours")?k():c.request.toil_to_accrue=null}function E(){s.loadForm("/civicrm/admin/options/hrleaveandabsences_toil_amounts?reset=1").on("crmUnload",function(){I(!1)})}function B(){c.showTOILAccrualsOptionEditorIcon=e.includes(["admin-dashboard","absence-tab"],o.section)}function F(){return f()?d().catch(a.resolve):a.resolve()}function N(){c.uiOptions.expiryDate&&(c.request.toil_expiry_date=c.convertDateToServerFormat(c.uiOptions.expiryDate))}t.debug("RequestModalDetailsToilController");var j,U=!c.isMode("create"),H={hasPreviousExpirationDate:null,hasExpirationFromAdminSettings:null};c.canDisplayToilExpirationField=!1,c.calculateBalanceChange=u,c.canCalculateChange=m,c.canSubmit=p,c.clearExpiryDate=h,c.initChildController=q,c.initTimesExtended=D,c.initWatchersExtended=P,c.onAbsenceTypeUpdateExtended=$,c.onDateChangeExtended=S,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=w,c.setDaysSelectionModeExtended=L,c.updateExpiryDate=N,function(){M(),x(),B(),!c.isMode("create")&&y()}()}t.controller("RequestModalDetailsToilController",a),a.$inject=["$log","$q","$rootScope","crmAngService","OptionGroup","AbsenceType","detailsController"]}),define("leave-absences/shared/services/leave-calendar.service",["common/lodash","common/moment","leave-absences/shared/modules/services"],function(e,n,t){"use strict";function a(t,a,o,s){function i(t){function i(){return o.all().then(function(e){return e.list})}function r(){return o.leaveManagees(void 0,{unassigned:!0})}function c(){var n=e.get(t,"filters.userSettings.assignedTo.type","all");return m().then(function(e){return t.lookupContacts=e,a.all([d(),"me"!==n?u():a.resolve(null)])}).then(function(e){var n=e[0];return t.contactIdsToReduceTo=e[1],n})}function u(){return l().then(function(a){var o=a.filter(function(e){var a=e.info.details;return n(a.period_start_date).isSameOrBefore(t.selectedPeriod.end_date)&&(n(a.period_end_date).isSameOrAfter(t.selectedPeriod.start_date)||!a.period_end_date)});return e.uniq(o.map(function(e){return e.contact_id}))})}function l(){return v?a.resolve(v):s.all()}function d(){return o.all(h(),null,"display_name").then(function(e){return e.list})}function m(){var n=e.get(t,"filters.userSettings.assignedTo.type","all");return(0,b[n])()}function f(){return m().then(function(e){t.lookupContacts=e}).then(d)}function p(){return o.leaveManagees(t.contactId)}function h(){var n={department:e.get(t,"filters.userSettings.department.value",null),level_type:e.get(t,"filters.userSettings.level_type.value",null),location:e.get(t,"filters.userSettings.location.value",null),region:e.get(t,"filters.userSettings.region.value",null)},a=!!t.filters.userSettings.contact,o=e.isArray(t.lookupContacts)&&t.lookupContacts.length,s="all"!==e.get(t,"filters.userSettings.assignedTo.type","all");return a?n.id={IN:[t.filters.userSettings.contact.id]}:(s||o)&&(n.id={IN:e.pluck(t.lookupContacts,"id")}),n}var v,b={all:i,me:p,unassigned:r};return{loadContactsForAdmin:c,loadFilteredContacts:d,loadLookUpContacts:m,loadLookUpAndFilteredContacts:f}}return t.debug("LeaveCalendarService"),{init:i}}t.factory("LeaveCalendarService",a),a.$inject=["$log","$q","Contact","Contract"]}),define("leave-absences/shared/instances/sickness-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,n){"use strict";n.factory("SicknessRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(n,t){return t.extend({defaultCustomData:function(){var n={sickness_reason:null,sickness_required_documents:"",request_type:"sickness"};return e.assign({},t.defaultCustomData(),n)},getDocumentArray:function(){return this.sickness_required_documents?this.sickness_required_documents.split(","):[]},toggleDocument:function(n){var t=this.getDocumentArray(),a=t.indexOf(n);e.contains(t,n)?t.splice(a,1):t.push(n),this.sickness_required_documents=t.join(",")},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])}})}])}),define("leave-absences/shared/instances/toil-request.instance",["common/lodash","leave-absences/shared/modules/models-instances","leave-absences/shared/instances/leave-request.instance"],function(e,n){"use strict";n.factory("TOILRequestInstance",["LeaveRequestAPI","LeaveRequestInstance",function(n,t){return t.extend({defaultCustomData:function(){var n={from_date_amount:0,to_date_amount:0,request_type:"toil"};return e.assign({},t.defaultCustomData(),n)},toAPIFilter:function(n,t,a){e.includes(["balance_change","dates","comments","files"],a)||(n[a]=this[a])}})}])}),define("leave-absences/shared/controllers/request.controller",["common/angular","leave-absences/shared/modules/controllers","common/lodash","common/moment","common/models/contact","common/services/api/option-group","common/services/hr-settings","common/services/pub-sub","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/instances/leave-request.instance","leave-absences/shared/instances/sickness-request.instance","leave-absences/shared/instances/toil-request.instance","leave-absences/shared/services/leave-request.service"],function(e,n,t,a){"use strict";function o(n,o,s,i,r,c,u,l,d,m,f,p,h,v,b,g,y,_,q,C){function T(e){"days"===Ne.selectedAbsenceType.calculation_unit_name?delete Ne.request[e+"_date_amount"]:delete Ne.request[e+"_date_type"]}function A(){["from","to"].forEach(T)}function D(){return ke.checkIfSelfLeaveApprover().then(function(e){e&&(Be="admin")})}function R(){var e=Ne.requestStatuses[y.statusNames.awaitingApproval].value;xe.status_id===e&&e!==Ne.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Fe.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return Fe.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Ne.loading.entitlements&&(!!le("admin")||!ce("view")&&!(le("manager")&&!ce("create")))}function L(){var e=P();return Ne.isMode("edit")&&(e=e&&(G()||I())),Ne.canManage&&Ne.requestStatuses&&(e=e&&!!Ne.getStatusFromValue(Ne.newStatusOnSave)),(e=e&&!!Ne.period.id)&&!Ne.isMode("view")}function w(){Ne.isSelfRecord&&!Ne.isSelfLeaveApprover?Ne.request.status_id=Ne.requestStatuses[y.statusNames.awaitingApproval].value:Ne.canManage&&(Ne.request.status_id=Ne.newStatusOnSave||Ne.request.status_id)}function k(){if(Ne.isMode("edit")&&!Ne.isRole("staff")&&"toil"!==U())return Ne.request.calculateBalanceChange(Ne.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Ne.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function O(){return"toil"!==U()&&!Ne.request.change_balance}function M(){Ne.errors=[]}function x(){return Ne.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function $(){se()&&!Ne.isRole("staff")&&(Ne.request.change_balance=!0)}function E(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Ne.request.delete().then(function(){Ne.dismissModal(),d.publish("LeaveRequest::delete",Ne.request)})}})}function B(){r.dismiss({$value:"cancel"})}function F(){var e=U();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function N(){return j(Ne.getStatusFromValue(Ne.request.status_id).name)}function j(e){return t.map(Oe[e],function(e){return Ne.requestStatuses[e]})}function U(){return Ne.request?Ne.request.request_type:Ne.leaveType||null}function H(){return!Ne.request||e.equals({},Ne.requestStatuses)?[]:Ne.request.status_id?N():j("none")}function W(e){return t.find(Ne.requestStatuses,function(n){return n.value===e})}function Y(e){Ne.errors=t.isArray(e)?e:[e],Ne.loading.absenceTypes=!1,Ne.submitting=!1}function G(){return!e.equals(xe,Ne.request.attributes())||Ne.canManage&&Ne.newStatusOnSave}function V(){return Ne.postContactSelection=!0,Ne.staffMemberSelectionComplete=!1,Ne.request.contact_id?o.resolve().then(me).then(fe).then(_e).then(Ce).then(oe).then(Q).then(Ne.isMode("edit")?Te:t.noop).then(function(){Ne.postContactSelection=!1,Ne.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return o.reject(e)}):o.reject("The contact id was not set")}function z(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];Oe.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],Oe.awaiting_approval=e,Oe.more_information_required=e,Oe.rejected=e,Oe.approved=e,Oe.cancelled=[y.statusNames.awaitingApproval].concat(e)}function X(){Ne.canManage=Ne.isRole("manager")||Ne.isRole("admin")}function Q(){return Ne.canManage?f.find(Ne.request.contact_id).then(function(e){Ne.contactName=e.display_name}):o.resolve()}function J(){Ne.isRole("admin")&&Ne.isSelfRecord&&(Ne.isSelfLeaveApprover=!0)}function K(){var e="my-leave"===s.section,n=+ke.id==+t.get(Ne,"leaveRequest.contact_id"),a=!t.get(Ne,"leaveRequest.id");Ne.isSelfRecord=e&&a||n}function Z(){$e.push(s.$on("LeaveRequestPopup::requestObjectUpdated",Te),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(_e).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Ne.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,n){Y(n)}),s.$on("LeaveRequestPopup::childComponent::register",function(){Me++})),i.$on("$destroy",Ie),i.$on("LeaveRequestPopup::addTab",function(e,n){Fe.push(n)})}function ee(){var e,n;Ne.request=Ne.leaveRequest||null,e=U(),n=Ne.initRequestAttributes(),"leave"===e?Ne.request=g.init(n):"sickness"===e?Ne.request=_.init(n):"toil"===e&&(Ne.request=q.init(n))}function ne(){var e={};return Ne.request?e=Ne.request.attributes():Ne.canManage||(e={contact_id:ke.id}),e}function te(){return Be="staff",ae().then(Ne.isSelfRecord&&!Ne.isRole("admin")&&D)}function ae(){return c(y.permissions.admin.administer).then(function(e){e&&(Be="admin")}).then(function(){return"admin"!==Be&&c(y.permissions.ssp.manage)}).then(function(e){e&&(Be="manager")})}function oe(){Ne.defaultStatus?Ne.newStatusOnSave=Ne.requestStatuses[y.statusNames[Ne.defaultStatus]].value:(Ne.isRole("admin")||Ne.isMode("create")&&Ne.isRole("manager"))&&(Ne.newStatusOnSave=Ne.requestStatuses[y.statusNames.approved].value)}function se(){return!Ne.request.status_id||!t.includes(["cancelled","rejected"],W(Ne.request.status_id).name)}function ie(e){var n=Ne.getStatusFromValue(Ne.request.status_id);return!!n&&n.name===e}function re(e){return Ne.request&&Ne.request.request_type===e}function ce(e){return Ne.mode===e}function ue(e,n){var t=a(e.from_date),o=a(e.to_date);return t.isSameOrAfter(n.start_date,"day")&&o.isSameOrBefore(n.end_date,"day")}function le(e){return Be===e}function de(){return p.all().then(function(e){Ne.absencePeriods=e})}function me(){return h.all(F()).then(h.loadCalculationUnits).then(function(e){we={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Ne.loading.entitlements=!0,v.all({contact_id:Ne.request.contact_id,period_id:Ne.period.id,type_id:{IN:we.ids}},!0).finally(function(){Ne.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){ke=e})}function he(){return Ne.selectedContactId?f.find(Ne.selectedContactId).then(function(e){Ne.managedContacts=[e]}):Ne.isRole("admin")?f.all().then(function(e){Ne.managedContacts=e.list}):ke.leaveManagees().then(function(e){Ne.managedContacts=e})}function ve(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Ne.requestStatuses=t.indexBy(e,"name")})}function be(e,n){var a;return t.compact(e.map(function(e){if(a=t.find(n,{type_id:e.id}))return{id:a.type_id,title:e.title+" ( "+a.remainder.current+" ) ",remainder:a.remainder.current,allow_overuse:e.allow_overuse,calculation_unit_name:e.calculation_unit_name}}))}function ge(e){R(),d.publish(e,Ne.request),Ne.errors=[],Ne.dismissModal()}function ye(){["from","to"].forEach(function(e){Ne.request[e+"_date"]=xe[e+"_date"]})}function _e(e){if(Ne.absenceTypes=be(we.types,e),!Ne.absenceTypes.length)return o.reject(Ee)}function qe(){Ne.period=t.find(Ne.absencePeriods,function(e){return Ne.isMode("create")?e.current:ue(Ne.request,e)})}function Ce(){Ne.isMode("create")?(Ne.selectedAbsenceType=Ne.absenceTypes[0],Ne.request.type_id=Ne.selectedAbsenceType.id):Ne.selectedAbsenceType=t.find(Ne.absenceTypes,function(e){return e.id===Ne.request.type_id})}function Te(){xe=e.copy(Ne.request.attributes())}function Ae(){var e;Ne.request.id?(e=[Ne.requestStatuses[y.statusNames.approved].value,Ne.requestStatuses[y.statusNames.adminApproved].value,Ne.requestStatuses[y.statusNames.rejected].value,Ne.requestStatuses[y.statusNames.cancelled].value],Ne.mode="edit",Ne.isRole("staff")&&e.indexOf(Ne.request.status_id)>-1&&(Ne.mode="view")):Ne.mode="create"}function De(){var e=Ne.request.status_id;if(!Ne.isMode("view")&&!Ne.submitting)return Ne.submitting=!0,w(),A(),Ne.request.isValid().then(se()&&k).then($).then(O()&&ye).then(Re).then(function(){return Ne.isMode("edit")?Le():x()}).catch(function(n){Ne.request.status_id=e,n&&Y(n)}).finally(function(){Ne.submitting=!1})}function Re(){return o.all(Fe.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&t.push(e),++a===Me&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Me>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function Ie(){$e.forEach(function(e){e()})}function Se(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Le(){return Ne.request.update().then(Pe).then(function(){Ne.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Ne.isRole("staff")||Ne.isRole("admin"))&&ge("LeaveRequest::edit")})}n.debug("RequestCtrl");var we,ke,Oe={},Me=0,xe={},$e=[],Ee="No entitlement",Be="",Fe=[],Ne=t.assign(this,m);Ne.absencePeriods=[],Ne.absenceTypes=[],Ne.canManage=!1,Ne.contactName=null,Ne.errors=[],Ne.isSelfLeaveApprover=!1,Ne.loading={absenceTypes:!0,entitlements:!0},Ne.managedContacts=[],Ne.mode="",Ne.newStatusOnSave=null,Ne.period={},Ne.postContactSelection=!1,Ne.requestStatuses={},Ne.selectedAbsenceType={},Ne.staffMemberSelectionComplete=!1,Ne.submitting=!1,Ne.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Ne.canChangeAbsenceType=S,Ne.canSubmit=L,Ne.closeAlert=M,Ne.deleteLeaveRequest=E,Ne.dismissModal=B,Ne.getStatuses=H,Ne.getStatusFromValue=W,Ne.initAfterContactSelection=V,Ne.initRequestAttributes=ne,Ne.isLeaveStatus=ie,Ne.isLeaveType=re,Ne.isMode=ce,Ne.isRole=le,Ne.submit=De,Ne.updateAbsenceType=Se,function(){Ne.loading.absenceTypes=!0,z(),Z(),pe().then(K).then(function(){return o.all([te(),de(),ve()])}).then(X).then(J).then(ee).then(Ae).then(qe).then(function(){return Ne.canManage&&!Ne.isMode("edit")&&he()}).then(function(){if(Ne.selectedContactId&&(Ne.request.contact_id=Ne.selectedContactId),Ne.request.contact_id)return Ne.initAfterContactSelection()}).catch(Y).finally(function(){Ne.loading.absenceTypes=!1})}()}n.controller("RequestCtrl",o),o.$inject=["$log","$q","$rootScope","$scope","$uibModalInstance","checkPermissions","api.optionGroup","dialog","pubSub","directiveOptions","Contact","AbsencePeriod","AbsenceType","Entitlement","LeaveRequest","LeaveRequestInstance","shared-settings","SicknessRequestInstance","TOILRequestInstance","LeaveRequestService"]}),define("leave-absences/shared/services/leave-popup.service",["common/lodash","common/modules/angular-date","leave-absences/shared/modules/services","common/services/angular-date/date-format","common/services/notification.service","leave-absences/shared/controllers/request.controller"],function(e,n){"use strict";function t(e,n,t,a,o,s,i,r,c){function u(e){return r.get().then(function(n){return e.roleOf(n.contactId)}).then(function(e){return"none"!==e})}function l(e){a.open({appendTo:n.children().eq(0),templateUrl:s.sharedPathTpl+"components/leave-request-popup/leave-request-popup.html",controller:"RequestCtrl",controllerAs:"$ctrl",windowClass:"chr_leave-request-modal",resolve:{directiveOptions:function(){return e},format:["DateFormat",function(e){return e.getDateFormat()}]}})}function d(e){return c.find(e).then(function(e){return u(e).then(function(n){n?l({leaveRequest:e,leaveType:e.request_type,selectedContactId:e.contact_id}):o.error("Error","You dont have permission to see this leave request")})}).catch(function(e){o.error("Error",e)})}return e.debug("LeavePopup"),{openModal:l,openModalByID:d}}n.factory("LeavePopup",t),t.$inject=["$log","$rootElement","$rootScope","$uibModal","notificationService","shared-settings","DateFormat","Session","LeaveRequest"] +}),define("leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component",[],function(){function e(e,n,t,a){function o(){i(),s()}function s(){return t("can administer calendar feeds").then(function(e){c.canCreateNewFeed=!!e})}function i(){return c.loading.feeds=!0,e.all().then(function(e){c.feeds=e}).finally(function(){c.loading.feeds=!1})}function r(e,t){n.open(e,t)}var c=this;c.canCreateNewFeed=!1,c.feeds=[],c.loading={feeds:!1},c.$onInit=o,c.openLinkModal=r}return e.$inject=["CalendarFeed","CalendarFeedsLinkModal","checkPermissions","shared-settings"],{__name:"calendarFeedsDropdownButton",bindings:{dropdownPosition:"@"},controller:e,controllerAs:"dropdownButton",templateUrl:["shared-settings",function(e){return e.sourcePath+"calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.html"}]}}),define("leave-absences/calendar-feeds/calendar-feeds.core",["common/angular","leave-absences/shared/modules/shared-settings"],function(e){e.module("calendar-feeds.core",["leave-absences.settings"])}),define("leave-absences/calendar-feeds/services/apis/calendar-feed.api",["common/lodash"],function(e){"use strict";function n(e,n,t){function a(){return this.sendGET("LeaveRequestCalendarFeedConfig","get",{is_active:!0}).then(function(e){return e.values})}return e.debug("CalendarFeedAPI"),t.extend({all:a})}return n.__name="CalendarFeedAPI",n.$inject=["$log","$q","api"],n}),define("leave-absences/calendar-feeds/services/models/calendar-feed.model",[],function(){"use strict";function e(e,n,t){function a(){return n.all().then(function(e){return e.map(function(e){return t.init(e)})})}return e.extend({all:a})}return e.__name="CalendarFeed",e.$inject=["Model","CalendarFeedAPI","CalendarFeedInstance"],e}),define("leave-absences/calendar-feeds/services/models/calendar-feed.instance",[],function(){"use strict";function e(e){return e.extend({})}return e.__name="CalendarFeedInstance",e.$inject=["ModelInstance"],e}),define("leave-absences/calendar-feeds/calendar-feeds.models",["common/angular","leave-absences/calendar-feeds/services/apis/calendar-feed.api","leave-absences/calendar-feeds/services/models/calendar-feed.model","leave-absences/calendar-feeds/services/models/calendar-feed.instance","common/models/model","common/services/api"],function(e,n,t,a){e.module("calendar-feeds.models",["common.apis","common.models"]).factory(n.__name,n).factory(t.__name,t).factory(a.__name,a)}),define("leave-absences/calendar-feeds/link-modal/components/calendar-feeds-link-modal.component",["common/lodash"],function(e){return{__name:"calendarFeedsLinkModal",bindings:{dismiss:"<",url:"<",title:"<"},controller:e.noop,controllerAs:"linkModal",templateUrl:["shared-settings",function(e){return e.sourcePath+"calendar-feeds/link-modal/components/calendar-feeds-link-modal.html"}]}}),define("leave-absences/calendar-feeds/link-modal/services/calendar-feeds-link-modal.service",[],function(){function e(e,n,t){function a(e,a){var s=o(),i=t+"civicrm/calendar-feed?hash="+a;n.open({controllerAs:"modal",size:"md",template:'',controller:["$uibModalInstance","title","url",function(e,n,t){this.dismiss=e.dismiss,this.title=n,this.url=t}],appendTo:s,resolve:{title:function(){return e},url:function(){return i}}})}function o(){var n=e.find("#bootstrap-theme");return 0===n.length&&(n=e.find("body")),n.eq(0)}return{open:a}}return e.__name="CalendarFeedsLinkModal",e.$inject=["$document","$uibModal","HOST_URL"],e}),define("leave-absences/calendar-feeds/link-modal/directives/input-with-copy-button.directive",["common/lodash"],function(e){function n(n,t){function a(e,t,a,o){function s(){r(),u()}function i(){l[0].setSelectionRange(0,0),l.blur()}function r(){c(),document.execCommand("copy"),i()}function c(){l.focus(),l[0].setSelectionRange(0,l.val().length)}function u(){m.justCopied=!0,d&&n.cancel(d),d=n(function(){m.justCopied=!1},2e3)}var l,d,m=e.input;m.model=o.model,m.justCopied=!1,m.copy=s,m.selectInputText=c,function(){l=t.find("input")}()}var o=t.sourcePath+"calendar-feeds/link-modal/directives/input-with-copy-button.html";return{controller:e.noop,controllerAs:"input",link:a,restrict:"E",scope:{},templateUrl:o,require:{model:"^ngModel"}}}return n.__name="inputWithCopyButton",n.$inject=["$timeout","shared-settings"],n}),define("leave-absences/calendar-feeds/link-modal/link-modal.core",["common/angular","common/angularBootstrap"],function(e){e.module("calendar-feeds.link-modal.core",["ui.bootstrap"])}),function(e){define("leave-absences/calendar-feeds/link-modal/link-modal.constants",["common/angular"],function(n){"use strict";n.module("calendar-feeds.link-modal.constants",[]).constant("HOST_URL",e.absoluteUrl("/"))})}(Drupal),define("leave-absences/calendar-feeds/link-modal/link-modal.module",["common/angular","leave-absences/calendar-feeds/link-modal/components/calendar-feeds-link-modal.component","leave-absences/calendar-feeds/link-modal/services/calendar-feeds-link-modal.service","leave-absences/calendar-feeds/link-modal/directives/input-with-copy-button.directive","leave-absences/calendar-feeds/calendar-feeds.core","leave-absences/calendar-feeds/link-modal/link-modal.core","leave-absences/calendar-feeds/link-modal/link-modal.constants"],function(e,n,t,a){e.module("calendar-feeds.link-modal",["calendar-feeds.core","calendar-feeds.link-modal.core","calendar-feeds.link-modal.constants"]).component(n.__name,n).directive(a.__name,a).factory(t.__name,t)}),define("leave-absences/calendar-feeds/dropdown-button/dropdown-button.module",["common/angular","leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component","common/services/check-permissions","leave-absences/calendar-feeds/calendar-feeds.core","leave-absences/calendar-feeds/calendar-feeds.models","leave-absences/calendar-feeds/link-modal/link-modal.module"],function(e,n){e.module("calendar-feeds.dropdown-button",["common.services","calendar-feeds.core","calendar-feeds.models","calendar-feeds.link-modal"]).component(n.__name,n)}),define("leave-absences/my-leave/modules/components",["common/angular"],function(e){return e.module("my-leave.components",[])}),define("leave-absences/my-leave/components/my-leave-container.component",["leave-absences/my-leave/modules/components"],function(e){e.component("myLeaveContainer",{bindings:{contactId:"<"},templateUrl:["settings",function(e){return e.pathTpl+"components/my-leave-container.html"}],controllerAs:"myleave",controller:["$log","$rootScope","$state",function(e,n,t){function a(){t.go(o.tabName)}e.debug("Component: my-leave-container"),n.section="my-leave";var o=this;o.tabName=t.current.name,o.changeTab=a}]})}),function(e){define("leave-absences/my-leave/modules/settings",["common/angular"],function(n){return n.module("my-leave.settings",[]).constant("settings",{debug:e.debug,pathTpl:e.vars.leaveAndAbsences.baseURL+"/views/my-leave/"})})}(CRM),function(e,n){define("leave-absences/my-leave/modules/config",["common/angular","common/lodash","leave-absences/my-leave/modules/settings"],function(n,t){function a(n){n.withAutoBase(!0),n.settings.ga={userId:t.get(e,"vars.session.contact_id")}}return n.module("my-leave.config",["my-leave.settings"]).config(["$stateProvider","$resourceProvider","$urlRouterProvider","$httpProvider","$logProvider","$analyticsProvider","settings",function(n,t,o,s,i,r,c){a(r),i.debugEnabled(c.debug),s.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",t.defaults.stripTrailingSlashes=!1,o.otherwise("/my-leave/report"),n.state("my-leave",{abstract:!0,url:"/my-leave",template:'',resolve:{contactId:function(){return e.vars.leaveAndAbsences.contactId},format:["DateFormat",function(e){return e.getDateFormat()}]}}).state("my-leave.report",{url:"/report?leave-request-id",template:'',onEnter:["$stateParams","LeavePopup",function(e,n){e["leave-request-id"]&&n.openModalByID(e["leave-request-id"])}]}).state("my-leave.calendar",{url:"/calendar",template:''})}])})}(CRM,Drupal),define("leave-absences/my-leave/app",["common/angular","common/angularBootstrap","common/angulartics","common/angulartics-google-tag-manager","common/angularUiRouter","common/text-angular","common/directives/loading","common/directives/scroll-shadows.directive","common/directives/time-amount-picker.directive","common/directives/timepicker-select.directive","common/filters/angular-date/format-date","common/filters/time-unit-applier.filter","common/models/option-group","common/modules/dialog","common/services/check-permissions","common/services/crm-ang.service","common/services/angular-date/date-format","leave-absences/shared/modules/shared-settings","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/calendar.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/components/leave-calendar.component","leave-absences/shared/components/leave-calendar-day.component","leave-absences/shared/components/leave-calendar-legend.component","leave-absences/shared/components/leave-calendar-month.component","leave-absences/shared/components/leave-request-actions.component","leave-absences/shared/components/leave-request-popup-comments-tab.component","leave-absences/shared/components/leave-request-popup-details-tab.component","leave-absences/shared/components/leave-request-popup-files-tab","leave-absences/shared/components/leave-request-record-actions.component","leave-absences/shared/components/staff-leave-report.component","leave-absences/shared/controllers/sub-controllers/request-modal-details-leave.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-sickness.controller","leave-absences/shared/controllers/sub-controllers/request-modal-details-toil.controller","leave-absences/shared/models/absence-period.model","leave-absences/shared/models/absence-type.model","leave-absences/shared/models/calendar.model","leave-absences/shared/models/entitlement.model","leave-absences/shared/models/leave-request.model","leave-absences/shared/models/public-holiday.model","leave-absences/shared/modules/shared-settings","leave-absences/shared/modules/shared-settings","leave-absences/shared/services/leave-calendar.service","leave-absences/shared/services/leave-popup.service","leave-absences/calendar-feeds/dropdown-button/dropdown-button.module","leave-absences/my-leave/components/my-leave-container.component","leave-absences/my-leave/modules/config"],function(e){return e.module("my-leave",["ngResource","ngAnimate","angulartics","angulartics.google.tagmanager","ui.bootstrap","ui.router","textAngular","common.angularDate","common.dialog","common.directives","common.filters","common.mocks","common.models","common.services","leave-absences.components","leave-absences.controllers","leave-absences.models","leave-absences.services","leave-absences.settings","calendar-feeds.dropdown-button","my-leave.components","my-leave.config"]).run(["$log","$rootScope","shared-settings","settings",function(e,n,t,a){e.debug("app.run"),n.sharedPathTpl=t.sharedPathTpl,n.settings=a}]),e}),function(e,n){var t=e.vars.leaveAndAbsences.baseURL+"/js/src/leave-absences";n.config({urlArgs:"bust="+(new Date).getTime(),paths:{"leave-absences/shared":t+"/shared","leave-absences/my-leave":t+"/my-leave"}}),n(["leave-absences/shared/config"],function(){n(["leave-absences/my-leave/app"],function(e){e.bootstrap(document.querySelector("[data-leave-absences-my-leave]"),["my-leave"])})})}(CRM,require),define("my-leave",function(){}); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-container.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-container.component.js index 06fccd2cf82..db99f6c01be 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-container.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-container.component.js @@ -23,12 +23,14 @@ vm.contactId = CRM.adminId; - (function init () { + vm.$onInit = $onInit; + + function $onInit () { // @NOTE this is a temporary solution that sets date format from CRM // to HRSettings. This should have been done in the config.js file // however Absence Tab has issues with routing so it isn't possible now. DateFormat.getDateFormat(); - })(); + } } }); })(CRM); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-custom-work-pattern-modal.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-custom-work-pattern-modal.component.js index 3a6d1439a7a..0241b9a911c 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-custom-work-pattern-modal.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-custom-work-pattern-modal.component.js @@ -40,17 +40,9 @@ define([ } } }; - vm.openWorkPatternChangeReasonEditor = openWorkPatternChangeReasonEditor; - (function init () { - return $q.all([ - loadWorkPatterns(), - loadJobContractRevisionChangeReasons(true) - ]) - .finally(function () { - vm.loading.content = false; - }); - })(); + vm.$onInit = $onInit; + vm.openWorkPatternChangeReasonEditor = openWorkPatternChangeReasonEditor; /** * Closes the Work Pattern Modal @@ -87,6 +79,16 @@ define([ }); }; + function $onInit () { + return $q.all([ + loadWorkPatterns(), + loadJobContractRevisionChangeReasons(true) + ]) + .finally(function () { + vm.loading.content = false; + }); + } + /** * Handles the error thrown by API * @param {String} errorMessage diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-entitlements.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-entitlements.component.js index d4f94879807..3c08d4fa9ef 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-entitlements.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-entitlements.component.js @@ -25,11 +25,13 @@ define([ vm.absenceTypes = []; vm.loading = { component: true }; - (function init () { + vm.$onInit = $onInit; + + function $onInit () { loadAbsenceTypes().finally(function () { vm.loading.component = false; }); - })(); + } /** * Loads Absence Types and their calculation units. diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-work-patterns.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-work-patterns.component.js index 8d20a053a16..e18ed4588f4 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-work-patterns.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/absence-tab-work-patterns.component.js @@ -27,22 +27,11 @@ define([ vm.customWorkPatterns = []; vm.defaultWorkPattern = null; - vm.linkToWorkPatternListingPage = getWorkPatternListingPageURL(); vm.loading = { workPattern: true }; - (function init () { - refresh([ - loadJobContractRevisionChangeReasons(), - getDefaultWorkPattern(), - DateFormat.getDateFormat() - ]); - - $rootScope.$on('CustomWorkPattern::Added', function () { - refresh(); - }); - })(); + vm.$onInit = $onInit; /** * Shows a delete work pattern confirm dialog before deleting the contact work pattern @@ -78,6 +67,20 @@ define([ }); }; + function $onInit () { + vm.linkToWorkPatternListingPage = getWorkPatternListingPageURL(); + + refresh([ + loadJobContractRevisionChangeReasons(), + getDefaultWorkPattern(), + DateFormat.getDateFormat() + ]); + + $rootScope.$on('CustomWorkPattern::Added', function () { + refresh(); + }); + } + /** * Loads the custom work patterns, * if no custom work pattern is found, calls the getDefaultWorkPattern() diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/annual-entitlement-change-log.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/annual-entitlement-change-log.component.js index 8462689c16b..188291d81b3 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/annual-entitlement-change-log.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/annual-entitlement-change-log.component.js @@ -32,7 +32,9 @@ define([ vm.changeLogRows = []; vm.loading = { component: true }; - (function init () { + vm.$onInit = $onInit; + + function $onInit () { loadAbsencePeriod() .then(loadAbsenceTypes) .then(loadChangeLog) @@ -43,7 +45,7 @@ define([ .finally(function () { vm.loading.component = false; }); - })(); + } /** * Appends the current entitlements for the user and period into the change diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/annual-entitlements.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/annual-entitlements.component.js index a7d7d218506..9fc888bd0e5 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/annual-entitlements.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/annual-entitlements.component.js @@ -35,11 +35,12 @@ vm.absencePeriods = []; vm.loading = { absencePeriods: true }; + vm.$onInit = $onInit; vm.getEditEntitlementsPageURL = getEditEntitlementsPageURL; vm.openAnnualEntitlementChangeLog = openAnnualEntitlementChangeLog; vm.showComment = showComment; - (function init () { + function $onInit () { loadEntitlements() .then(loadCommentsAuthors) .then(loadAbsencePeriods) @@ -49,7 +50,7 @@ .finally(function () { vm.loading.absencePeriods = false; }); - })(); + } /** * Filters absence periods basing on loaded entitlements diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/contract-entitlements.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/contract-entitlements.component.js index 7f0e14786f7..16fec86e63e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/contract-entitlements.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/absence-tab/components/contract-entitlements.component.js @@ -30,7 +30,9 @@ define([ vm.contracts = []; vm.loading = { contracts: true }; - (function init () { + vm.$onInit = $onInit; + + function $onInit () { DateFormat.getDateFormat() .then(loadContracts) .then(filterAbsenceTypes) @@ -38,7 +40,7 @@ define([ .finally(function () { vm.loading.contracts = false; }); - })(); + } /** * Filters absence types basing on loaded entitlements diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/admin-dashboard/app.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/admin-dashboard/app.js index cc740579f70..745d14a708f 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/admin-dashboard/app.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/admin-dashboard/app.js @@ -5,6 +5,7 @@ define([ 'common/angularBootstrap', 'common/angulartics', 'common/angulartics-google-tag-manager', + 'common/angularUiRouter', 'common/directives/scroll-shadows.directive', 'common/directives/time-amount-picker.directive', 'common/directives/timepicker-select.directive', @@ -14,7 +15,6 @@ define([ 'common/services/check-permissions', 'common/services/crm-ang.service', 'common/services/angular-date/date-format', - 'leave-absences/shared/ui-router', 'leave-absences/shared/components/leave-balance-tab.component', 'leave-absences/shared/components/leave-calendar.component', 'leave-absences/shared/components/leave-calendar-day.component', diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component.js index 374f983ea6d..80832c9e33a 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component.js @@ -26,12 +26,13 @@ define([], function () { feeds: false }; + vm.$onInit = $onInit; vm.openLinkModal = openLinkModal; - (function init () { + function $onInit () { loadFeeds(); defineIfCanCreateFeeds(); - }()); + } /** * Defines if user can create feeds based on permissions diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/manager-leave/app.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/manager-leave/app.js index 2cf261e0389..548531dd273 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/manager-leave/app.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/manager-leave/app.js @@ -5,6 +5,7 @@ define([ 'common/angularBootstrap', 'common/angulartics', 'common/angulartics-google-tag-manager', + 'common/angularUiRouter', 'common/text-angular', 'common/directives/loading', 'common/directives/scroll-shadows.directive', @@ -16,7 +17,6 @@ define([ 'common/services/angular-date/date-format', 'common/services/check-permissions', 'common/services/crm-ang.service', - 'leave-absences/shared/ui-router', 'leave-absences/shared/models/absence-period.model', 'leave-absences/shared/models/absence-type.model', 'leave-absences/shared/components/leave-balance-tab.component', diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/manager-notification-badge/components/manager-notification-badge.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/manager-notification-badge/components/manager-notification-badge.component.js index f6611775af5..b39084c9908 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/manager-notification-badge/components/manager-notification-badge.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/manager-notification-badge/components/manager-notification-badge.component.js @@ -25,14 +25,16 @@ define([ vm.refreshCountEventName = 'ManagerBadge:: Update Count'; - (function init () { + vm.$onInit = $onInit; + + function $onInit () { $q.all([ getManagerId(), getStatusId() ]).then(function () { vm.filters = [leaveRequestFilters]; }); - })(); + } /** * Get the logged in contact id and save it as manager id diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/my-leave/app.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/my-leave/app.js index ae820dd4ffe..3c0921da31e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/my-leave/app.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/my-leave/app.js @@ -5,6 +5,7 @@ define([ 'common/angularBootstrap', 'common/angulartics', 'common/angulartics-google-tag-manager', + 'common/angularUiRouter', 'common/text-angular', 'common/directives/loading', 'common/directives/scroll-shadows.directive', @@ -17,7 +18,6 @@ define([ 'common/services/check-permissions', 'common/services/crm-ang.service', 'common/services/angular-date/date-format', - 'leave-absences/shared/ui-router', 'leave-absences/shared/modules/shared-settings', 'leave-absences/shared/models/absence-period.model', 'leave-absences/shared/models/absence-type.model', diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/apis/leave-request.api.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/apis/leave-request.api.js index 423784caf24..16358c952c7 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/apis/leave-request.api.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/apis/leave-request.api.js @@ -309,10 +309,9 @@ define([ */ update: function (params) { $log.debug('LeaveRequestAPI.update', params); - var deferred = $q.defer(); if (!params.id) { - deferred.reject('id is mandatory field'); + return $q.reject('id is mandatory field'); } return this.sendPOST('LeaveRequest', 'create', params) diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-balance-tab.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-balance-tab.component.js index 24ec1527c03..b446f80d6dd 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-balance-tab.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-balance-tab.component.js @@ -37,19 +37,20 @@ define([ vm.reportCount = 0; vm.userRole = null; + vm.$onInit = $onInit; vm.loadReportCurrentPage = loadReportCurrentPage; /** * Initializes the component. Loads dependencies needed by the component * and watches for events coming from child components. */ - (function init () { + function $onInit () { initWatchers(); loadDependencies() .then(function () { vm.loading.component = false; }); - })(); + } /** * Loads the absence periods from the AbsencePeriod model. diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-day.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-day.component.js index 620556f5878..8e873bffb24 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-day.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-day.component.js @@ -26,11 +26,12 @@ define([ var vm = this; + vm.$onInit = $onInit; vm.openLeavePopup = openLeavePopup; - (function init () { + function $onInit () { watchLeaveRequests(); - })(); + } /** * Opens the leave request popup diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-legend.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-legend.component.js index 98285e7e5ad..5da94228f5a 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-legend.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-legend.component.js @@ -37,15 +37,16 @@ define([ { label: 'AT', description: 'Accrued TOIL' } ]; + vm.$onInit = $onInit; vm.checkIfAbsenceTypeIdIsDefined = checkIfAbsenceTypeIdIsDefined; vm.checkIfAbsenceTypeIsSelectedForFiltering = checkIfAbsenceTypeIsSelectedForFiltering; vm.getAbsenceTypeStyle = getAbsenceTypeStyle; vm.resetFilteringByAbsenceTypes = resetFilteringByAbsenceTypes; vm.toggleFilteringByAbsenceType = toggleFilteringByAbsenceType; - (function init () { + function $onInit () { initWatchers(); - }()); + } /** * Checks if the given absence type has a defined id or not. diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-month.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-month.component.js index e39c25f5789..6297a990251 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-month.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar-month.component.js @@ -43,10 +43,11 @@ define([ vm.showOnlyWithLeaveRequests = !!vm.showOnlyWithLeaveRequests; vm.$onDestroy = onDestroy; + vm.$onInit = $onInit; vm.contactsList = contactsList; vm.getContactUrl = getContactUrl; - (function init () { + function $onInit () { var dateFromMonth = moment().month(vm.month.month).year(vm.month.year); indexData(); @@ -55,7 +56,7 @@ define([ vm.month = buildMonthStructure(dateFromMonth); $rootScope.$emit('LeaveCalendar::monthInjected'); - }()); + } /** * Adds a leave request to the calendar diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar.component.js index 73dc4393e8c..bdbaf781aed 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-calendar.component.js @@ -69,13 +69,14 @@ define([ absenceTypesToFilterBy: [] }; + vm.$onInit = $onInit; vm.canManageRequests = canManageRequests; vm.labelPeriod = labelPeriod; vm.navigateToCurrentMonth = navigateToCurrentMonth; vm.paginateMonth = paginateMonth; vm.refresh = refresh; - (function init () { + function $onInit () { setUserRole() .then(initWatchers) .then(initListeners) @@ -97,7 +98,7 @@ define([ .then(function () { vm.loading.page = false; }); - }()); + } /** * Appends a generic absence type that can be used for private diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-actions.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-actions.component.js index 4a999c10c87..49f2d01d374 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-actions.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-actions.component.js @@ -4,6 +4,8 @@ define([ 'common/lodash', 'common/moment', 'leave-absences/shared/modules/components', + 'common/models/contact', + 'common/models/session.model', 'common/services/hr-settings', 'common/services/notification.service', 'common/services/pub-sub', @@ -28,13 +30,15 @@ define([ controller: LeaveRequestActionsController }); - LeaveRequestActionsController.$inject = ['$log', '$rootScope', 'dialog', - 'LeavePopup', 'LeaveRequestService', 'pubSub', 'shared-settings', 'notificationService']; + LeaveRequestActionsController.$inject = ['$log', '$q', '$rootScope', 'Contact', + 'dialog', 'LeavePopup', 'LeaveRequestService', 'pubSub', 'shared-settings', + 'notificationService', 'Session']; - function LeaveRequestActionsController ($log, $rootScope, dialog, - LeavePopup, LeaveRequestService, pubSub, sharedSettings, notification) { + function LeaveRequestActionsController ($log, $q, $rootScope, Contact, dialog, + LeavePopup, LeaveRequestService, pubSub, sharedSettings, notification, Session) { $log.debug('Component: leave-request-action-dropdown'); + var currentlyLoggedInContactId; var vm = this; var statusIdBeforeAction; var statusNames = sharedSettings.statusNames; @@ -116,14 +120,25 @@ define([ }; vm.allowedActions = []; + vm.loading = { component: true }; + vm.$onInit = $onInit; vm.action = action; vm.openLeavePopup = openLeavePopup; - (function init () { - indexSupportData(); - setAllowedActions(); - }()); + function $onInit () { + $q.resolve() + .then(indexSupportData) + .then(loadCurrentlyLoggedInContactId) + .then(function () { + return checkIfOwnLeaveRequest() && vm.role !== 'admin' && + setRoleToAdminIfSelfLeaveApprover(); + }) + .then(setAllowedActions) + .finally(function () { + vm.loading.component = false; + }); + } /** * Performs an action on a given leave request @@ -215,6 +230,27 @@ define([ }); } + /** + * Checks if the currently logged in user is a leave approver + * + * @return {Promise} + */ + function checkIfContactIsSelfLeaveApprover () { + return Contact.find(currentlyLoggedInContactId) + .then(function (currentlyLoggedInContact) { + return currentlyLoggedInContact.checkIfSelfLeaveApprover(); + }); + } + + /** + * Checks if the leave request is own + * + * @return {Boolean} + */ + function checkIfOwnLeaveRequest () { + return currentlyLoggedInContactId === vm.leaveRequest.contact_id; + } + /** * Indexes leave request statuses and absence types * if they are passed as arrays to the component @@ -256,6 +292,18 @@ define([ }; } + /** + * Loads the ID of the currently logged in contact + * + * @return {Promise} + */ + function loadCurrentlyLoggedInContactId () { + return Session.get() + .then(function (session) { + currentlyLoggedInContactId = session.contactId; + }); + } + /** * Opens the leave request popup * @@ -313,7 +361,6 @@ define([ * * Sets actions that can be performed within the * leave request basing on its status and user role - * */ function setAllowedActions () { var leaveRequestStatus = vm.leaveRequestStatuses[vm.leaveRequest.status_id].name; @@ -336,6 +383,21 @@ define([ }); } + /** + * Checks if the contact is a self leave approver and, if true, + * sets the role to "admin" + * + * @return {Promise} + */ + function setRoleToAdminIfSelfLeaveApprover () { + return checkIfContactIsSelfLeaveApprover() + .then(function (isSelfLeaveApprover) { + if (isSelfLeaveApprover) { + vm.role = 'admin'; + } + }); + } + /** * Swaps Edit and Respond actions in allowed actions list * diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-comments-tab.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-comments-tab.component.js index 07a29fe9a87..0d25a3c7d24 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-comments-tab.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-comments-tab.component.js @@ -32,6 +32,7 @@ define([ contacts: {} }; + vm.$onInit = $onInit; vm.addComment = addComment; vm.canRemoveComment = canRemoveComment; vm.canSubmit = canSubmit; @@ -41,11 +42,11 @@ define([ vm.isMode = isMode; vm.onBeforeSubmit = onBeforeSubmit; - (function init () { + function $onInit () { $scope.$emit('LeaveRequestPopup::addTab', vm); loadCommentsAndContactNames(); loadLoggedInContactId(); - }()); + } /** * Adds a comment into comments array and also clears the comments textbox diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-details-tab.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-details-tab.component.js index 1c7a38bea0c..192feec5c1c 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-details-tab.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-details-tab.component.js @@ -55,9 +55,9 @@ define([ }; vm.pagination = { currentPage: 1, - filteredbreakdown: vm.balance.change.breakdown, + filteredbreakdown: [], numPerPage: 7, - totalItems: vm.balance.change.breakdown.length, + totalItems: 0, pageChanged: pageChanged }; vm.uiOptions = { @@ -115,6 +115,7 @@ define([ time_interval: 15 // 15 minutes intervals in time and deduction inputs }; + vm.$onInit = $onInit; vm.convertDateFormatFromServer = convertDateFormatFromServer; vm.convertDateToServerFormat = convertDateToServerFormat; vm.dateChangeHandler = dateChangeHandler; @@ -131,7 +132,7 @@ define([ vm.updateEndTimeInputMinTime = updateEndTimeInputMinTime; vm.$onDestroy = unsubscribeFromEvents; - (function init () { + function $onInit () { $controller( 'RequestModalDetails' + _.capitalize(getLeaveType(vm.leaveType, vm.request)) + 'Controller', { detailsController: vm } @@ -166,10 +167,14 @@ define([ .then(initFromTimeWatcher) .then(!vm.isMode('view') && vm.initWatchersExtended) .catch(handleError) + .then(function () { + vm.pagination.filteredbreakdown = vm.balance.change.breakdown; + vm.pagination.totalItems = vm.balance.change.breakdown.length; + }) .finally(function () { vm.loading.tab = false; }); - }()); + } /** * Calculates closing balance which is opening balance minus change amount. diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-files-tab.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-files-tab.js index 6123edc75ae..d080afbe9f7 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-files-tab.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-popup-files-tab.js @@ -38,6 +38,7 @@ define([ vm.userDateFormat = HRSettings.DATE_FORMAT; vm.$onDestroy = unsubscribeFromEvents; + vm.$onInit = $onInit; vm.canRemoveAttachment = canRemoveAttachment; vm.canSubmit = canSubmit; vm.canUploadMore = canUploadMore; @@ -46,7 +47,7 @@ define([ vm.getFilesAmount = getFilesAmount; vm.listFileTypes = listFileTypes; - (function init () { + function $onInit () { $rootScope.$broadcast('LeaveRequestPopup::childComponent::register'); $scope.$emit('LeaveRequestPopup::addTab', vm); initListeners(); @@ -59,7 +60,7 @@ define([ .finally(function () { vm.filesLoaded = true; }); - }()); + } /** * Allows the user to submit the request if files are waiting to be uploaded. diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-record-actions.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-record-actions.component.js index bc24c22c617..6586e43d5c8 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-record-actions.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-request-record-actions.component.js @@ -28,13 +28,14 @@ define([ { type: 'sickness', icon: 'stethoscope', label: 'Sickness' } ]; + vm.$onInit = $onInit; vm.openLeavePopup = openLeavePopup; /** * Automatically opens a request modal if the `openModal` param * is present in the query string */ - (function init () { + function $onInit () { queryParams = beforeHashQueryParams.parse(); if (queryParams.openModal) { @@ -43,7 +44,7 @@ define([ selectedContactId: vm.selectedContactId }); } - }()); + } /** * Opens the leave request popup diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component.js index a4b03457af2..055cf254c1a 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component.js @@ -33,13 +33,14 @@ define([ vm.leaveRequests = []; vm.$onChanges = $onChanges; + vm.$onInit = $onInit; /** * Initializes the controller by emiting a child is loading event. */ - (function init () { + function $onInit () { $scope.$emit('LeaveWidget::childIsLoading', childComponentName); - })(); + } /** * Implements the $onChanges method for angular controllers. When bindings diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-absence-types-available-balance.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-absence-types-available-balance.component.js index d85a8567cb5..41babd4c7c4 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-absence-types-available-balance.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-absence-types-available-balance.component.js @@ -25,13 +25,14 @@ define([ var vm = this; vm.$onChanges = $onChanges; + vm.$onInit = $onInit; /** * Initializes the component by emiting a child is loading event. */ - (function init () { + function $onInit () { $scope.$emit('LeaveWidget::childIsLoading', childComponentName); - })(); + } /** * Implements the $onChanges controller method. It watches for changes in diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-next-leave.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-next-leave.component.js index eddf976c610..7a5951535b5 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-next-leave.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget-next-leave.component.js @@ -33,13 +33,14 @@ define([ vm.requestStatus = {}; vm.$onChanges = $onChanges; + vm.$onInit = $onInit; /** * Initializes the controller by emiting a child is loading event. */ - (function init () { + function $onInit () { $scope.$emit('LeaveWidget::childIsLoading', childComponentName); - })(); + } /** * Implements $onChanges method for AngularJS Components. Waits for bindings diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget.component.js index a7cf97bc363..0fa551033b2 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/leave-widget/leave-widget.component.js @@ -54,15 +54,18 @@ define([ vm.leaveRequestStatuses = []; vm.sicknessAbsenceTypes = []; + vm.$onInit = $onInit; + /** * Initializes the component by watching for events, and loading * dependencies. */ - (function init () { + function $onInit () { $log.debug('Controller: leaveWidgetController'); + initWatchers(); loadDependencies(); - })(); + } /** * Increases the child component counter and sets loading child components diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/manage-leave-requests.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/manage-leave-requests.component.js index f1f431486a9..9e6b558a077 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/manage-leave-requests.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/manage-leave-requests.component.js @@ -57,6 +57,7 @@ define([ } }; + vm.$onInit = $onInit; vm.clearStaffSelection = clearStaffSelection; vm.countLeaveRequestByStatus = countLeaveRequestByStatus; vm.getAbsenceTypeByID = getAbsenceTypeByID; @@ -71,7 +72,7 @@ define([ vm.refreshWithFilterByAssignee = refreshWithFilterByAssignee; vm.totalNoOfPages = totalNoOfPages; - (function init () { + function $onInit () { checkPermissions(sharedSettings.permissions.admin.administer) .then(function (isAdmin) { vm.isAdmin = isAdmin; @@ -91,7 +92,7 @@ define([ registerEvents(); }); - })(); + } /** * Clears selected users and refreshes leave requests diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/staff-leave-report.component.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/staff-leave-report.component.js index 22833255a0f..38e1e5d22cc 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/staff-leave-report.component.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/components/staff-leave-report.component.js @@ -14,14 +14,16 @@ define([ return settings.sharedPathTpl + 'components/staff-leave-report.html'; }], controllerAs: 'report', - controller: [ - '$log', '$q', '$rootScope', 'checkPermissions', 'AbsencePeriod', 'AbsenceType', - 'Entitlement', 'LeaveRequest', 'OptionGroup', 'pubSub', 'HR_settings', - 'shared-settings', controller - ] + controller: StaffLeaveReportController }); - function controller ($log, $q, $rootScope, checkPermissions, AbsencePeriod, + StaffLeaveReportController.$inject = [ + '$log', '$q', '$rootScope', 'checkPermissions', 'AbsencePeriod', 'AbsenceType', + 'Entitlement', 'LeaveRequest', 'OptionGroup', 'pubSub', 'HR_settings', + 'shared-settings' + ]; + + function StaffLeaveReportController ($log, $q, $rootScope, checkPermissions, AbsencePeriod, AbsenceType, Entitlement, LeaveRequest, OptionGroup, pubSub, HRSettings, sharedSettings) { $log.debug('Component: staff-leave-report'); @@ -39,7 +41,7 @@ define([ vm.dateFormat = HRSettings.DATE_FORMAT; vm.leaveRequestStatuses = {}; vm.selectedPeriod = null; - vm.role = ($rootScope.section === 'absence-tab' ? 'admin' : 'staff'); + vm.role = null; vm.loading = { content: true, page: true @@ -53,12 +55,14 @@ define([ other: { open: false, data: [], dataIndex: {}, loading: false, loadLeaveRequests: loadOtherRequests } }; + vm.$onInit = $onInit; vm.labelPeriod = labelPeriod; vm.refresh = refresh; vm.toggleSection = toggleSection; - (function init () { + function $onInit () { $q.all([ + initRole(), loadStatuses(), loadAbsenceTypes(), loadAbsencePeriods() @@ -78,7 +82,7 @@ define([ }); registerEvents(); - })(); + } /** * Adds a leave request to the provided section's data and index. @@ -175,6 +179,28 @@ define([ section.dataIndex = _.indexBy(section.data, 'id'); } + /** + * Initiates the role based on permissions. + * @NOTE It skips the permission check if the section is 'absence-tab' + * because only admins can access this section. + * + * @return {Promise} + */ + function initRole () { + vm.role = 'staff'; + + if ($rootScope.section === 'absence-tab') { + vm.role = 'admin'; + + return $q.resolve(); + } + + return checkPermissions(sharedSettings.permissions.admin.administer) + .then(function (isAdmin) { + isAdmin && (vm.role = 'admin'); + }); + } + /** * Labels the given period according to whether it's current or not * @@ -593,6 +619,7 @@ define([ */ function toggleSection (sectionName) { var section = vm.sections[sectionName]; + section.open = !section.open; if (section.open && !section.data.length) { diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/config.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/config.js index f5cfb8eab34..ca372fdc9ec 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/config.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/config.js @@ -2,23 +2,16 @@ (function (require) { define(function () { - var srcPath = CRM.vars.leaveAndAbsences.baseURL + '/js/src/leave-absences/shared'; - // This require.config will picked up by the r.js optimizer require.config({ paths: { - 'leave-absences/shared/ui-router': 'leave-absences/shared/vendor/angular-ui-router.min', 'mocks': '../test/mocks' - }, - shim: { - 'leave-absences/shared/ui-router': {} } }); // This require.config will be used by the "live" RequireJS (with debug ON) require.config({ paths: { - 'leave-absences/shared/ui-router': srcPath + '/vendor/angular-ui-router.min', 'mocks': CRM.vars.leaveAndAbsences.baseURL + '/js/test/mocks' } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js index ca440a411af..3593c95427c 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js @@ -6,7 +6,6 @@ define([ 'common/lodash', 'common/moment', 'common/models/contact', - 'common/models/session.model', 'common/services/api/option-group', 'common/services/hr-settings', 'common/services/pub-sub', @@ -25,11 +24,11 @@ define([ controllers.controller('RequestCtrl', RequestCtrl); RequestCtrl.$inject = ['$log', '$q', '$rootScope', '$scope', '$uibModalInstance', 'checkPermissions', 'api.optionGroup', - 'dialog', 'pubSub', 'directiveOptions', 'Contact', 'Session', 'AbsencePeriod', 'AbsenceType', 'Entitlement', + 'dialog', 'pubSub', 'directiveOptions', 'Contact', 'AbsencePeriod', 'AbsenceType', 'Entitlement', 'LeaveRequest', 'LeaveRequestInstance', 'shared-settings', 'SicknessRequestInstance', 'TOILRequestInstance', 'LeaveRequestService']; function RequestCtrl ($log, $q, $rootScope, $scope, $modalInstance, checkPermissions, OptionGroup, dialog, pubSub, - directiveOptions, Contact, Session, AbsencePeriod, AbsenceType, Entitlement, LeaveRequest, + directiveOptions, Contact, AbsencePeriod, AbsenceType, Entitlement, LeaveRequest, LeaveRequestInstance, sharedSettings, SicknessRequestInstance, TOILRequestInstance, LeaveRequestService) { $log.debug('RequestCtrl'); @@ -38,7 +37,7 @@ define([ var childComponentsCount = 0; var initialLeaveRequestAttributes = {}; // used to compare the change in leaverequest in edit mode var listeners = []; - var loggedInContactId = ''; + var loggedInContact; var NO_ENTITLEMENT_ERROR = 'No entitlement'; var role = ''; var tabs = []; @@ -49,6 +48,7 @@ define([ vm.canManage = false; // vm flag is set on initialisation of the controller vm.contactName = null; // contact name of the owner of leave request vm.errors = []; + vm.isSelfLeaveApprover = false; vm.loading = { absenceTypes: true, entitlements: true }; vm.managedContacts = []; vm.mode = ''; // can be edit, create, view @@ -95,15 +95,17 @@ define([ initAvailableStatusesMatrix(); initListeners(); - return loadLoggedInContactId() + return loadLoggedInContact() .then(initIsSelfRecord) .then(function () { return $q.all([ - initRoles(), + initRole(), loadAbsencePeriods(), loadStatuses() ]); }) + .then(initCanManage) + .then(initIsSelfLeaveApprover) .then(initRequest) .then(setModalMode) .then(setInitialAbsencePeriod) @@ -147,6 +149,24 @@ define([ ['from', 'to'].forEach(amendDatesAndDateTypesBeforeSave); } + /** + * Amends the user role based on their self leave approver state. + * If the user is creating or editing their own leave request + * and they are self approvers, they will be treated as "admins". + * + * @return {Promise} + */ + function amendRoleBasedOnSelfLeaveApproverState () { + return loggedInContact.checkIfSelfLeaveApprover() + .then(function (isSelfLeaveApprover) { + if (!isSelfLeaveApprover) { + return; + } + + role = 'admin'; + }); + } + /** * Broadcasts an event when request has been updated from awaiting approval status to something else */ @@ -248,7 +268,7 @@ define([ * If manager or admin have changed the status through dropdown, assign the same before calling API */ function changeStatusBeforeSave () { - if (vm.isSelfRecord) { + if (vm.isSelfRecord && !vm.isSelfLeaveApprover) { vm.request.status_id = vm.requestStatuses[sharedSettings.statusNames.awaitingApproval].value; } else if (vm.canManage) { vm.request.status_id = vm.newStatusOnSave || vm.request.status_id; @@ -507,6 +527,13 @@ define([ ].concat(defaultStatuses); } + /** + * Defines if the contact can manage the leave request + */ + function initCanManage () { + vm.canManage = vm.isRole('manager') || vm.isRole('admin'); + } + /** * Initialize contact * @@ -523,6 +550,17 @@ define([ return $q.resolve(); } + /** + * Initiates the isSelfLeaveApprover public property. + * @NOTE Users are treated as admins if they are self leave approvers. + * @see initRole() + */ + function initIsSelfLeaveApprover () { + if (vm.isRole('admin') && vm.isSelfRecord) { + vm.isSelfLeaveApprover = true; + } + } + /** * Initializes the is self record property and sets it to true when * on My Leave section and the user is editing their own request or creating @@ -530,10 +568,10 @@ define([ */ function initIsSelfRecord () { var isSectionMyLeave = $rootScope.section === 'my-leave'; - var isMyOwnRequest = +loggedInContactId === +_.get(vm, 'leaveRequest.contact_id'); + var isMyOwnRequest = +loggedInContact.id === +_.get(vm, 'leaveRequest.contact_id'); var isNewRequest = !_.get(vm, 'leaveRequest.id'); - vm.isSelfRecord = isSectionMyLeave && (isMyOwnRequest || isNewRequest); + vm.isSelfRecord = (isSectionMyLeave && isNewRequest) || isMyOwnRequest; } /** @@ -594,7 +632,7 @@ define([ if (vm.request) { attributes = vm.request.attributes(); } else if (!vm.canManage) { - attributes = { contact_id: loggedInContactId }; + attributes = { contact_id: loggedInContact.id }; } return attributes; @@ -607,28 +645,28 @@ define([ * * @return {Promise} */ - function initRoles () { + function initRole () { role = 'staff'; - // If the user is creating or editing their own leave, they will be - // treated as a staff regardless of their actual role. - if (vm.isSelfRecord) { - return; - } + return initRoleBasedOnPermissions() + .then(vm.isSelfRecord && !vm.isRole('admin') && amendRoleBasedOnSelfLeaveApproverState); + } + /** + * Initiates user role based on their permissions + * + * @return {Promise} + */ + function initRoleBasedOnPermissions () { return checkPermissions(sharedSettings.permissions.admin.administer) .then(function (isAdmin) { isAdmin && (role = 'admin'); }) .then(function () { - // (role === 'staff') means it is not admin so need to check if manager - return (role === 'staff') && checkPermissions(sharedSettings.permissions.ssp.manage) - .then(function (isManager) { - isManager && (role = 'manager'); - }); + return (role !== 'admin') && checkPermissions(sharedSettings.permissions.ssp.manage); }) - .finally(function () { - vm.canManage = vm.isRole('manager') || vm.isRole('admin'); + .then(function (isManager) { + isManager && (role = 'manager'); }); } @@ -767,14 +805,18 @@ define([ * * @return {Promise} */ - function loadLoggedInContactId () { - return Session.get().then(function (value) { - loggedInContactId = value.contactId; - }); + function loadLoggedInContact () { + return Contact.getLoggedIn() + .then(function (_loggedInContact_) { + loggedInContact = _loggedInContact_; + }); } /** * Loads the managees of currently logged in user + * If a contact is pre-selected, then a single managee is loaded. + * If user is an admin, then all contacts, including the admin, are loaded. + * If user is a manager, then only contacts they manage are loaded. * * @return {Promise} */ @@ -789,17 +831,11 @@ define([ // In case of general administration return Contact.all() .then(function (contacts) { - vm.managedContacts = _.remove(contacts.list, function (contact) { - // Removes the admin from the list of contacts - return contact.id !== loggedInContactId; - }); + vm.managedContacts = contacts.list; }); } else { // In any other case (including managing) - return Contact.find(loggedInContactId) - .then(function (contact) { - return contact.leaveManagees(); - }) + return loggedInContact.leaveManagees() .then(function (contacts) { vm.managedContacts = contacts; }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/vendor/angular-ui-router.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/vendor/angular-ui-router.min.js deleted file mode 100644 index ec05d2b9433..00000000000 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/vendor/angular-ui-router.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * State-based routing for AngularJS - * @version v0.3.2 - * @link http://angular-ui.github.com/ - * @license MIT License, http://www.opensource.org/licenses/MIT - */ -"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return S(new(S(function(){},{prototype:a})),b)}function e(a){return R(arguments,function(b){b!==a&&R(b,function(b,c){a.hasOwnProperty(c)||(a[c]=b)})}),a}function f(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function g(a){if(Object.keys)return Object.keys(a);var b=[];return R(a,function(a,c){b.push(c)}),b}function h(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=d<0?Math.ceil(d):Math.floor(d),d<0&&(d+=c);d=0||(k.push(e[m]),j[e[m]]=a[e[m]]);return S({},j,b)}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e "));if(s[c]=d,O(a))q.push(c,[function(){return b.get(a)}],j);else{var e=b.annotate(a);R(e,function(a){a!==c&&i.hasOwnProperty(a)&&n(i[a],a)}),q.push(c,a,e)}r.pop(),s[c]=f}}function o(a){return P(a)&&a.then&&a.$$promises}if(!P(i))throw new Error("'invocables' must be an object");var p=g(i||{}),q=[],r=[],s={};return R(i,n),i=r=s=null,function(d,f,g){function h(){--u||(v||e(t,f.$$values),r.$$values=t,r.$$promises=r.$$promises||!0,delete r.$$inheritedValues,n.resolve(t))}function i(a){r.$$failure=a,n.reject(a)}function j(c,e,f){function j(a){l.reject(a),i(a)}function k(){if(!M(r.$$failure))try{l.resolve(b.invoke(e,g,t)),l.promise.then(function(a){t[c]=a,h()},j)}catch(a){j(a)}}var l=a.defer(),m=0;R(f,function(a){s.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,s[a].then(function(b){t[a]=b,--m||k()},j))}),m||k(),s[c]=l.promise}if(o(d)&&g===c&&(g=f,f=d,d=null),d){if(!P(d))throw new Error("'locals' must be an object")}else d=k;if(f){if(!o(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=l;var n=a.defer(),r=n.promise,s=r.$$promises={},t=S({},d),u=1+q.length/3,v=!1;if(M(f.$$failure))return i(f.$$failure),r;f.$$inheritedValues&&e(t,m(f.$$inheritedValues,p)),S(s,f.$$promises),f.$$values?(v=e(t,m(f.$$values,p)),r.$$inheritedValues=m(f.$$values,p),h()):(f.$$inheritedValues&&(r.$$inheritedValues=m(f.$$inheritedValues,p)),f.then(h,i));for(var w=0,x=q.length;w=0));)s=f(r.id,r.type,r.cfg,"path"),l+=g(r.segment,s.type.pattern.source,s.squash,s.isOptional),n.push(r.segment),m=j.lastIndex;t=a.substring(m);var u=t.indexOf("?");if(u>=0){var v=this.sourceSearch=t.substring(u);if(t=t.substring(0,u),this.sourcePath=a.substring(0,m+u),v.length>0)for(m=0;i=k.exec(v);)r=h(i,!0),s=f(r.id,r.type,r.cfg,"search"),m=j.lastIndex}else this.sourcePath=a,this.sourceSearch="";l+=g(t)+(b.strict===!1?"/?":"")+"$",n.push(t),this.regexp=new RegExp(l,b.caseInsensitive?"i":c),this.prefix=n[0],this.$$paramNames=q}function t(a){S(this,a)}function u(){function a(a){return null!=a?a.toString().replace(/(~|\/)/g,function(a){return{"~":"~~","/":"~2F"}[a]}):a}function e(a){return null!=a?a.toString().replace(/(~~|~2F)/g,function(a){return{"~~":"~","~2F":"/"}[a]}):a}function f(){return{strict:p,caseInsensitive:m}}function i(a){return N(a)||Q(a)&&N(a[a.length-1])}function j(){for(;w.length;){var a=w.shift();if(a.pattern)throw new Error("You cannot override a type's .pattern at runtime.");b.extend(r[a.name],l.invoke(a.def))}}function k(a){S(this,a||{})}V=this;var l,m=!1,p=!0,q=!1,r={},v=!0,w=[],x={string:{encode:a,decode:e,is:function(a){return null==a||!M(a)||"string"==typeof a},pattern:/[^\/]*/},int:{encode:a,decode:function(a){return parseInt(a,10)},is:function(a){return M(a)&&this.decode(a.toString())===a},pattern:/\d+/},bool:{encode:function(a){return a?1:0},decode:function(a){return 0!==parseInt(a,10)},is:function(a){return a===!0||a===!1},pattern:/0|1/},date:{encode:function(a){return this.is(a)?[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2)].join("-"):c},decode:function(a){if(this.is(a))return a;var b=this.capture.exec(a);return b?new Date(b[1],b[2]-1,b[3]):c},is:function(a){return a instanceof Date&&!isNaN(a.valueOf())},equals:function(a,b){return this.is(a)&&this.is(b)&&a.toISOString()===b.toISOString()},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:{encode:b.toJson,decode:b.fromJson,is:b.isObject,equals:b.equals,pattern:/[^\/]*/},any:{encode:b.identity,decode:b.identity,equals:b.equals,pattern:/.*/}};u.$$getDefaultValue=function(a){if(!i(a.value))return a.value;if(!l)throw new Error("Injectable functions cannot be called at configuration time");return l.invoke(a.value)},this.caseInsensitive=function(a){return M(a)&&(m=a),m},this.strictMode=function(a){return M(a)&&(p=a),p},this.defaultSquashPolicy=function(a){if(!M(a))return q;if(a!==!0&&a!==!1&&!O(a))throw new Error("Invalid squash policy: "+a+". Valid policies: false, true, arbitrary-string");return q=a,a},this.compile=function(a,b){return new s(a,S(f(),b))},this.isMatcher=function(a){if(!P(a))return!1;var b=!0;return R(s.prototype,function(c,d){N(c)&&(b=b&&M(a[d])&&N(a[d]))}),b},this.type=function(a,b,c){if(!M(b))return r[a];if(r.hasOwnProperty(a))throw new Error("A type named '"+a+"' has already been defined.");return r[a]=new t(S({name:a},b)),c&&(w.push({name:a,def:c}),v||j()),this},R(x,function(a,b){r[b]=new t(S({name:b},a))}),r=d(r,{}),this.$get=["$injector",function(a){return l=a,v=!1,j(),R(x,function(a,b){r[b]||(r[b]=new t(a))}),this}],this.Param=function(a,d,e,f){function j(a){var b=P(a)?g(a):[],c=h(b,"value")===-1&&h(b,"type")===-1&&h(b,"squash")===-1&&h(b,"array")===-1;return c&&(a={value:a}),a.$$fn=i(a.value)?a.value:function(){return a.value},a}function k(c,d,e){if(c.type&&d)throw new Error("Param '"+a+"' has two type configurations.");return d?d:c.type?b.isString(c.type)?r[c.type]:c.type instanceof t?c.type:new t(c.type):"config"===e?r.any:r.string}function m(){var b={array:"search"===f&&"auto"},c=a.match(/\[\]$/)?{array:!0}:{};return S(b,c,e).array}function p(a,b){var c=a.squash;if(!b||c===!1)return!1;if(!M(c)||null==c)return q;if(c===!0||O(c))return c;throw new Error("Invalid squash policy: '"+c+"'. Valid policies: false, true, or arbitrary string")}function s(a,b,d,e){var f,g,i=[{from:"",to:d||b?c:""},{from:null,to:d||b?c:""}];return f=Q(a.replace)?a.replace:[],O(e)&&f.push({from:e,to:c}),g=o(f,function(a){return a.from}),n(i,function(a){return h(g,a.from)===-1}).concat(f)}function u(){if(!l)throw new Error("Injectable functions cannot be called at configuration time");var a=l.invoke(e.$$fn);if(null!==a&&a!==c&&!x.type.is(a))throw new Error("Default value ("+a+") for parameter '"+x.id+"' is not an instance of Type ("+x.type.name+")");return a}function v(a){function b(a){return function(b){return b.from===a}}function c(a){var c=o(n(x.replace,b(a)),function(a){return a.to});return c.length?c[0]:a}return a=c(a),M(a)?x.type.$normalize(a):u()}function w(){return"{Param:"+a+" "+d+" squash: '"+A+"' optional: "+z+"}"}var x=this;e=j(e),d=k(e,d,f);var y=m();d=y?d.$asArray(y,"search"===f):d,"string"!==d.name||y||"path"!==f||e.value!==c||(e.value="");var z=e.value!==c,A=p(e,z),B=s(e,y,z,A);S(this,{id:a,type:d,location:f,array:y,squash:A,replace:B,isOptional:z,value:v,dynamic:c,config:e,toString:w})},k.prototype={$$new:function(){return d(this,S(new k,{$$parent:this}))},$$keys:function(){for(var a=[],b=[],c=this,d=g(k.prototype);c;)b.push(c),c=c.$$parent;return b.reverse(),R(b,function(b){R(g(b),function(b){h(a,b)===-1&&h(d,b)===-1&&a.push(b)})}),a},$$values:function(a){var b={},c=this;return R(c.$$keys(),function(d){b[d]=c[d].value(a&&a[d])}),b},$$equals:function(a,b){var c=!0,d=this;return R(d.$$keys(),function(e){var f=a&&a[e],g=b&&b[e];d[e].type.equals(f,g)||(c=!1)}),c},$$validates:function(a){var d,e,f,g,h,i=this.$$keys();for(d=0;d=0)throw new Error("State must have a valid name");if(A.hasOwnProperty(c))throw new Error("State '"+c+"' is already defined");var e=c.indexOf(".")!==-1?c.substring(0,c.lastIndexOf(".")):O(b.parent)?b.parent:P(b.parent)&&O(b.parent.name)?b.parent.name:"";if(e&&!A[e])return n(e,b.self);for(var f in D)N(D[f])&&(b[f]=D[f](b,D.$delegates[f]));return A[c]=b,!b[C]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){z.$current.navigable==b&&j(a,c)||z.transitionTo(b,a,{inherit:!0,location:!1})}]),q(c),b}function s(a){return a.indexOf("*")>-1}function t(a){for(var b=a.split("."),c=z.$current.name.split("."),d=0,e=b.length;d=A;d--)g=o[d],g.self.onExit&&h.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=A;d2?k.enter(a,null,c).then(d):k.enter(a,null,c,d)},leave:function(a,c){b.version.minor>2?k.leave(a).then(c):k.leave(a,c)}};if(j){var e=j&&j(c,a);return{enter:function(a,b,c){e.enter(a,null,b),c()},leave:function(a,b){e.leave(a),b()}}}return d()}var i=g(),j=i("$animator"),k=i("$animate"),l={restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(c,g,i){return function(c,g,j){function k(){if(m&&(m.remove(),m=null),o&&(o.$destroy(),o=null),n){var a=n.data("$uiViewAnim");s.leave(n,function(){a.$$animLeave.resolve(),m=null}),m=n,n=null}}function l(h){var l,m=B(c,j,g,e),t=m&&a.$current&&a.$current.locals[m];if(h||t!==p){l=c.$new(),p=a.$current.locals[m],l.$emit("$viewContentLoading",m);var u=i(l,function(a){var e=f.defer(),h=f.defer(),i={$animEnter:e.promise,$animLeave:h.promise,$$animLeave:h};a.data("$uiViewAnim",i),s.enter(a,g,function(){e.resolve(),o&&o.$emit("$viewContentAnimationEnded"),(b.isDefined(r)&&!r||c.$eval(r))&&d(a)}),k()});n=u,o=l,o.$emit("$viewContentLoaded",m),o.$eval(q)}}var m,n,o,p,q=j.onload||"",r=j.autoscroll,s=h(j,c);g.inheritedData("$uiView");c.$on("$stateChangeSuccess",function(){l(!1)}),l(!0)}}};return l}function A(a,c,d,e){return{restrict:"ECA",priority:-400,compile:function(f){var g=f.html();return function(f,h,i){var j=d.$current,k=B(f,i,h,e),l=j&&j.locals[k];if(l){h.data("$uiView",{name:k,state:l.$$state}),h.html(l.$template?l.$template:g);var m=b.extend({},l);f[l.$$resolveAs]=m;var n=a(h.contents());if(l.$$controller){l.$scope=f,l.$element=h;var o=c(l.$$controller,l);l.$$controllerAs&&(f[l.$$controllerAs]=o,f[l.$$controllerAs][l.$$resolveAs]=m),N(o.$onInit)&&o.$onInit(),h.data("$ngControllerController",o),h.children().data("$ngControllerController",o)}n(f)}}}}}function B(a,b,c,d){var e=d(b.uiView||b.name||"")(a),f=c.inheritedData("$uiView");return e.indexOf("@")>=0?e:e+"@"+(f?f.state.name:"")}function C(a,b){var c,d=a.match(/^\s*({[^}]*})\s*$/);if(d&&(a=b+"("+d[1]+")"),c=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!c||4!==c.length)throw new Error("Invalid state ref '"+a+"'");return{state:c[1],paramExpr:c[3]||null}}function D(a){var b=a.parent().inheritedData("$uiView");if(b&&b.state&&b.state.name)return b.state}function E(a){var b="[object SVGAnimatedString]"===Object.prototype.toString.call(a.prop("href")),c="FORM"===a[0].nodeName;return{attr:c?"action":b?"xlink:href":"href",isAnchor:"A"===a.prop("tagName").toUpperCase(),clickable:!c}}function F(a,b,c,d,e){return function(f){var g=f.which||f.button,h=e();if(!(g>1||f.ctrlKey||f.metaKey||f.shiftKey||a.attr("target"))){var i=c(function(){b.go(h.state,h.params,h.options)});f.preventDefault();var j=d.isAnchor&&!h.href?1:0;f.preventDefault=function(){j--<=0&&c.cancel(i)}}}}function G(a,b){return{relative:D(a)||b.$current,inherit:!0}}function H(a,c){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(d,e,f,g){var h,i=C(f.uiSref,a.current.name),j={state:i.state,href:null,params:null},k=E(e),l=g[1]||g[0],m=null;j.options=S(G(e,a),f.uiSrefOpts?d.$eval(f.uiSrefOpts):{});var n=function(c){c&&(j.params=b.copy(c)),j.href=a.href(i.state,j.params,j.options),m&&m(),l&&(m=l.$$addStateInfo(i.state,j.params)),null!==j.href&&f.$set(k.attr,j.href)};i.paramExpr&&(d.$watch(i.paramExpr,function(a){a!==j.params&&n(a)},!0),j.params=b.copy(d.$eval(i.paramExpr))),n(),k.clickable&&(h=F(e,a,c,k,function(){return j}),e[e.on?"on":"bind"]("click",h),d.$on("$destroy",function(){e[e.off?"off":"unbind"]("click",h)}))}}}function I(a,b){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(c,d,e,f){function g(b){m.state=b[0],m.params=b[1],m.options=b[2],m.href=a.href(m.state,m.params,m.options),n&&n(),j&&(n=j.$$addStateInfo(m.state,m.params)),m.href&&e.$set(i.attr,m.href)}var h,i=E(d),j=f[1]||f[0],k=[e.uiState,e.uiStateParams||null,e.uiStateOpts||null],l="["+k.map(function(a){return a||"null"}).join(", ")+"]",m={state:null,params:null,options:null,href:null},n=null;c.$watch(l,g,!0),g(c.$eval(l)),i.clickable&&(h=F(d,a,b,i,function(){return m}),d[d.on?"on":"bind"]("click",h),c.$on("$destroy",function(){d[d.off?"off":"unbind"]("click",h)}))}}}function J(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(b,d,e,f){function g(b,c,e){var f=a.get(b,D(d)),g=h(b,c),i={state:f||{name:b},params:c,hash:g};return p.push(i),q[g]=e,function(){var a=p.indexOf(i);a!==-1&&p.splice(a,1)}}function h(a,c){if(!O(a))throw new Error("state should be a string");return P(c)?a+U(c):(c=b.$eval(c),P(c)?a+U(c):a)}function i(){for(var a=0;a0)){var c=g(a,b,o);return i(),c}},b.$on("$stateChangeSuccess",i),i()}]}}function K(a){var b=function(b,c){return a.is(b,c)};return b.$stateful=!0,b}function L(a){var b=function(b,c,d){return a.includes(b,c,d)};return b.$stateful=!0,b}var M=b.isDefined,N=b.isFunction,O=b.isString,P=b.isObject,Q=b.isArray,R=b.forEach,S=b.extend,T=b.copy,U=b.toJson;b.module("ui.router.util",["ng"]),b.module("ui.router.router",["ui.router.util"]),b.module("ui.router.state",["ui.router.router","ui.router.util"]),b.module("ui.router",["ui.router.state"]),b.module("ui.router.compat",["ui.router"]),q.$inject=["$q","$injector"],b.module("ui.router.util").service("$resolve",q),r.$inject=["$http","$templateCache","$injector"],b.module("ui.router.util").service("$templateFactory",r);var V;s.prototype.concat=function(a,b){var c={caseInsensitive:V.caseInsensitive(),strict:V.strictMode(),squash:V.defaultSquashPolicy()};return new s(this.sourcePath+a+this.sourceSearch,S(c,b),this)},s.prototype.toString=function(){return this.source},s.prototype.exec=function(a,b){function c(a){function b(a){return a.split("").reverse().join("")}function c(a){return a.replace(/\\-/g,"-")}var d=b(a).split(/-(?!\\)/),e=o(d,b);return o(e,c).reverse()}var d=this.regexp.exec(a);if(!d)return null;b=b||{};var e,f,g,h=this.parameters(),i=h.length,j=this.segments.length-1,k={};if(j!==d.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var l,m;for(e=0;e=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "is-extglob": "^2.1.0" } } } }, - "glob-watcher": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", - "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", + "glob-stream": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", + "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", "dev": true, "requires": { - "gaze": "^0.5.1" + "extend": "^3.0.0", + "glob": "^7.1.1", + "glob-parent": "^3.1.0", + "is-negated-glob": "^1.0.0", + "ordered-read-streams": "^1.0.0", + "pumpify": "^1.3.5", + "readable-stream": "^2.1.5", + "remove-trailing-separator": "^1.0.1", + "to-absolute-glob": "^2.0.0", + "unique-stream": "^2.0.2" } }, - "glob2base": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", - "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", + "glob-watcher": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.1.tgz", + "integrity": "sha512-fK92r2COMC199WCyGUblrZKhjra3cyVMDiypDdqg1vsSDmexnbYivK1kNR4QItiNXLKmGlqan469ks67RtNa2g==", "dev": true, "requires": { - "find-index": "^0.1.1" + "async-done": "^1.2.0", + "chokidar": "^2.0.0", + "just-debounce": "^1.0.0", + "object.defaults": "^1.1.0" } }, "global-modules": { @@ -751,95 +1669,59 @@ "which": "^1.2.14" } }, - "globule": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", - "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", - "dev": true, - "requires": { - "glob": "~3.1.21", - "lodash": "~1.0.1", - "minimatch": "~0.2.11" - }, - "dependencies": { - "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", - "dev": true, - "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" - } - }, - "graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", - "dev": true - }, - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", - "dev": true - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", - "dev": true - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "dev": true, - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, "glogg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.0.tgz", - "integrity": "sha1-f+DxmfV6yQbPUS/urY+Q7kooT8U=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", + "integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==", "dev": true, "requires": { "sparkles": "^1.0.0" } }, "graceful-fs": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", - "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", - "dev": true, - "requires": { - "natives": "^1.1.0" - } + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true }, "gulp": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz", - "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", - "dev": true, - "requires": { - "archy": "^1.0.0", - "chalk": "^1.0.0", - "deprecated": "^0.0.1", - "gulp-util": "^3.0.0", - "interpret": "^1.0.0", - "liftoff": "^2.1.0", - "minimist": "^1.1.0", - "orchestrator": "^0.3.0", - "pretty-hrtime": "^1.0.0", - "semver": "^4.1.0", - "tildify": "^1.0.0", - "v8flags": "^2.0.2", - "vinyl-fs": "^0.3.0" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.0.tgz", + "integrity": "sha1-lXZsYB2t5Kd+0+eyttwDiBtZY2Y=", + "dev": true, + "requires": { + "glob-watcher": "^5.0.0", + "gulp-cli": "^2.0.0", + "undertaker": "^1.0.0", + "vinyl-fs": "^3.0.0" + }, + "dependencies": { + "gulp-cli": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.0.1.tgz", + "integrity": "sha512-RxujJJdN8/O6IW2nPugl7YazhmrIEjmiVfPKrWt68r71UCaLKS71Hp0gpKT+F6qOUFtr7KqtifDKaAJPRVvMYQ==", + "dev": true, + "requires": { + "ansi-colors": "^1.0.1", + "archy": "^1.0.0", + "array-sort": "^1.0.0", + "color-support": "^1.1.3", + "concat-stream": "^1.6.0", + "copy-props": "^2.0.1", + "fancy-log": "^1.3.2", + "gulplog": "^1.0.0", + "interpret": "^1.1.0", + "isobject": "^3.0.1", + "liftoff": "^2.5.0", + "matchdep": "^2.0.0", + "mute-stdout": "^1.0.0", + "pretty-hrtime": "^1.0.0", + "replace-homedir": "^1.0.0", + "semver-greatest-satisfied-range": "^1.1.0", + "v8flags": "^3.0.1", + "yargs": "^7.1.0" + } + } } }, "gulp-clean": { @@ -895,32 +1777,6 @@ "integrity": "sha1-OtRCh2PwXidk3sHGfYaNsnVoeBc=", "dev": true }, - "gulp-util": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz", - "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", - "dev": true, - "requires": { - "array-differ": "^1.0.0", - "array-uniq": "^1.0.2", - "beeper": "^1.0.0", - "chalk": "^1.0.0", - "dateformat": "^2.0.0", - "fancy-log": "^1.1.0", - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "lodash._reescape": "^3.0.0", - "lodash._reevaluate": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.template": "^3.0.0", - "minimist": "^1.1.0", - "multipipe": "^0.1.2", - "object-assign": "^3.0.0", - "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl": "^0.5.0" - } - }, "gulplog": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", @@ -930,23 +1786,11 @@ "glogg": "^1.0.0" } }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-gulplog": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", - "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true }, "has-value": { "version": "1.0.0", @@ -989,6 +1833,12 @@ "parse-passwd": "^1.0.0" } }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1017,6 +1867,12 @@ "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", "dev": true }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", @@ -1027,13 +1883,39 @@ "is-windows": "^1.0.1" } }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", "dev": true, "requires": { - "kind-of": "^6.0.0" + "binary-extensions": "^1.0.0" } }, "is-buffer": { @@ -1042,24 +1924,52 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, - "is-data-descriptor": { + "is-builtin-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { - "kind-of": "^6.0.0" + "builtin-modules": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } } }, "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } } }, "is-extendable": { @@ -1074,15 +1984,30 @@ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", "dev": true, "requires": { - "is-extglob": "^2.1.0" + "is-extglob": "^2.1.1" } }, + "is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", + "dev": true + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -1103,15 +2028,6 @@ } } }, - "is-odd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", - "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", - "dev": true, - "requires": { - "is-number": "^3.0.0" - } - }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -1145,16 +2061,22 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, + "is-valid-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", + "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=", + "dev": true + }, "is-windows": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz", - "integrity": "sha1-MQ23D3QtJZoWo2kgK1GvhCMzENk=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, "isexe": { @@ -1169,19 +2091,68 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "just-debounce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", + "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", + "dev": true + }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, - "lazy-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", - "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", + "last-run": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", + "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=", + "dev": true, + "requires": { + "default-resolution": "^2.0.0", + "es6-weak-map": "^2.0.1" + } + }, + "lazystream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", + "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", + "dev": true, + "requires": { + "readable-stream": "^2.0.5" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "lead": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", + "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", "dev": true, "requires": { - "set-getter": "^0.1.0" + "flush-write-stream": "^1.0.2" } }, "liftoff": { @@ -1200,149 +2171,32 @@ "resolve": "^1.1.7" } }, - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", - "dev": true - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basetostring": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", - "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", - "dev": true - }, - "lodash._basevalues": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", - "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash._reescape": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", - "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", - "dev": true - }, - "lodash._reevaluate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", - "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", - "dev": true - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "dev": true - }, - "lodash._root": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", - "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", - "dev": true - }, - "lodash.escape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", - "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", - "dev": true, - "requires": { - "lodash._root": "^3.0.0" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" } }, - "lodash.restparam": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", - "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, - "lodash.template": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", - "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", - "dev": true, - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", - "lodash._basevalues": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0", - "lodash.keys": "^3.0.0", - "lodash.restparam": "^3.0.0", - "lodash.templatesettings": "^3.0.0" - } - }, - "lodash.templatesettings": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", - "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" - } - }, "make-iterator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.0.tgz", - "integrity": "sha1-V7713IXSOSO6I3ZzJNjo+PPZaUs=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", "dev": true, "requires": { - "kind-of": "^3.1.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } + "kind-of": "^6.0.2" } }, "map-cache": { @@ -1360,46 +2214,52 @@ "object-visit": "^1.0.0" } }, + "matchdep": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz", + "integrity": "sha1-xvNINKDY28OzfCfui7yyfHd1WC4=", + "dev": true, + "requires": { + "findup-sync": "^2.0.0", + "micromatch": "^3.0.4", + "resolve": "^1.4.0", + "stack-trace": "0.0.10" + } + }, "micromatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.5.tgz", - "integrity": "sha512-ykttrLPQrz1PUJcXjwsTUjGoPJ64StIGNE2lGVD1c9CuguJ+L7/navsE8IcDNndOoCMvYV0qc/exfVbMHkUhvA==", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "dev": true, "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", - "braces": "^2.3.0", - "define-property": "^1.0.0", - "extend-shallow": "^2.0.1", - "extglob": "^2.0.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", "fragment-cache": "^0.2.1", - "kind-of": "^6.0.0", - "nanomatch": "^1.2.5", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", "object.pick": "^1.3.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "to-regex": "^3.0.2" } }, "minimatch": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "^1.0.0" + "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, "mixin-deep": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.0.tgz", - "integrity": "sha512-dgaCvoh6i1nosAUBKb0l0pfJ78K8+S9fluyIR2YvAeUD/QuMahnFnF3xYty5eYXMjhGSsB0DsW6A0uAZyetoAg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", "dev": true, "requires": { "for-in": "^1.0.2", @@ -1417,75 +2277,84 @@ } } }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "multipipe": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", - "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", + "mute-stdout": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.0.tgz", + "integrity": "sha1-WzLqB+tDyd7WEwQ0z5JvRrKn/U0=", + "dev": true + }, + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", "dev": true, - "requires": { - "duplexer2": "0.0.2" - } + "optional": true }, "nanomatch": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.7.tgz", - "integrity": "sha512-/5ldsnyurvEw7wNpxLFgjVvBLMta43niEYOy0CJ4ntcYSbx6bugRUTQeFb4BR/WanEL1o3aQgHuVLHQaB6tOqg==", + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", "dev": true, "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "extend-shallow": "^2.0.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", "fragment-cache": "^0.2.1", - "is-odd": "^1.0.0", - "kind-of": "^5.0.2", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", "object.pick": "^1.3.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", "to-regex": "^3.0.1" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } } }, - "natives": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz", - "integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==", + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, - "object-assign": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "now-and-later": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.0.tgz", + "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", + "dev": true, + "requires": { + "once": "^1.3.2" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "object-copy": { @@ -1508,43 +2377,6 @@ "is-descriptor": "^0.1.0" } }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -1556,6 +2388,12 @@ } } }, + "object-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "dev": true + }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -1565,6 +2403,18 @@ "isobject": "^3.0.0" } }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, "object.defaults": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", @@ -1596,6 +2446,16 @@ "isobject": "^3.0.1" } }, + "object.reduce": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.reduce/-/object.reduce-1.0.1.tgz", + "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, "once": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", @@ -1605,29 +2465,24 @@ "wrappy": "1" } }, - "orchestrator": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", - "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", + "ordered-read-streams": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", + "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", "dev": true, "requires": { - "end-of-stream": "~0.1.5", - "sequencify": "~0.0.7", - "stream-consume": "~0.1.0" + "readable-stream": "^2.0.1" + } + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "^1.0.0" } }, - "ordered-read-streams": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz", - "integrity": "sha1-/VZamvjrRHO6abbtijQ1LLVS8SY=", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, "parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", @@ -1639,6 +2494,15 @@ "path-root": "^0.1.1" } }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, "parse-passwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", @@ -1661,6 +2525,21 @@ "util": "^0.10.3" } }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1668,9 +2547,9 @@ "dev": true }, "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, "path-root": { @@ -1688,6 +2567,38 @@ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", "dev": true }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, "plugin-error": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", @@ -1764,16 +2675,81 @@ "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "dev": true }, + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + } + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" } }, "rechoir": { @@ -1786,12 +2762,34 @@ } }, "regex-not": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", - "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "remove-bom-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", + "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", + "dev": true, + "requires": { + "is-buffer": "^1.1.5", + "is-utf8": "^0.2.1" + } + }, + "remove-bom-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz", + "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", "dev": true, "requires": { - "extend-shallow": "^2.0.1" + "remove-bom-buffer": "^3.0.0", + "safe-buffer": "^5.1.0", + "through2": "^2.0.3" } }, "remove-trailing-separator": { @@ -1813,15 +2811,38 @@ "dev": true }, "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true + }, + "replace-homedir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-1.0.0.tgz", + "integrity": "sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1", + "is-absolute": "^1.0.0", + "remove-trailing-separator": "^1.1.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, "resolve": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", "dev": true, "requires": { "path-parse": "^1.0.5" @@ -1837,12 +2858,27 @@ "global-modules": "^1.0.0" } }, + "resolve-options": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz", + "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", + "dev": true, + "requires": { + "value-or-function": "^3.0.0" + } + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -1883,27 +2919,42 @@ "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true }, - "semver": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", - "dev": true + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } }, - "sequencify": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", - "integrity": "sha1-kM/xnQLgcCf9dn9erT57ldHnOAw=", + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true }, - "set-getter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", - "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", + "semver-greatest-satisfied-range": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz", + "integrity": "sha1-E+jCZYq5aRywzXEJMkAoDTb3els=", "dev": true, "requires": { - "to-object-path": "^0.3.0" + "sver-compat": "^1.5.0" } }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", @@ -1914,18 +2965,23 @@ "is-extendable": "^0.1.1", "is-plain-object": "^2.0.3", "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } } }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", - "dev": true - }, "snapdragon": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", - "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", "dev": true, "requires": { "base": "^0.11.1", @@ -1935,7 +2991,7 @@ "map-cache": "^0.2.2", "source-map": "^0.5.6", "source-map-resolve": "^0.5.0", - "use": "^2.0.0" + "use": "^3.1.0" }, "dependencies": { "define-property": { @@ -1947,62 +3003,14 @@ "is-descriptor": "^0.1.0" } }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "is-extendable": "^0.1.0" } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true } } }, @@ -2015,6 +3023,46 @@ "define-property": "^1.0.0", "isobject": "^3.0.0", "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } } }, "snapdragon-util": { @@ -2044,12 +3092,12 @@ "dev": true }, "source-map-resolve": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", - "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", "dev": true, "requires": { - "atob": "^2.0.0", + "atob": "^2.1.1", "decode-uri-component": "^0.2.0", "resolve-url": "^0.2.1", "source-map-url": "^0.4.0", @@ -2063,131 +3111,111 @@ "dev": true }, "sparkles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", - "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz", + "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==", "dev": true }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "spdx-correct": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", + "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", "dev": true, "requires": { - "extend-shallow": "^3.0.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" } }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "spdx-exceptions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", + "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", + "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "is-descriptor": "^0.1.0" } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true } } }, - "stream-consume": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.0.tgz", - "integrity": "sha1-pB6tGm1ggc63n2WwYZAbbY89HQ8=", + "stream-exhaust": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", + "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", "dev": true }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", "dev": true }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -2198,20 +3226,23 @@ } }, "strip-bom": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", - "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "first-chunk-stream": "^1.0.0", "is-utf8": "^0.2.0" } }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "sver-compat": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz", + "integrity": "sha1-PPh9/rTQe0o/FIJ7wYaz/QxkXNg=", + "dev": true, + "requires": { + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" + } }, "through2": { "version": "2.0.3", @@ -2255,13 +3286,14 @@ } } }, - "tildify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", - "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", + "through2-filter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", + "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", "dev": true, "requires": { - "os-homedir": "^1.0.0" + "through2": "~2.0.0", + "xtend": "~4.0.0" } }, "time-stamp": { @@ -2270,6 +3302,16 @@ "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", "dev": true }, + "to-absolute-glob": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", + "dev": true, + "requires": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + } + }, "to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", @@ -2291,82 +3333,15 @@ } }, "to-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", - "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", "dev": true, "requires": { - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "regex-not": "^1.0.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" } }, "to-regex-range": { @@ -2379,12 +3354,50 @@ "repeat-string": "^1.6.1" } }, + "to-through": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-through/-/to-through-2.0.0.tgz", + "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", + "dev": true, + "requires": { + "through2": "^2.0.3" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, + "undertaker": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.0.tgz", + "integrity": "sha1-M52kZGJS0ILcN45wgGcpl1DhG0k=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "bach": "^1.0.0", + "collection-map": "^1.0.0", + "es6-weak-map": "^2.0.1", + "last-run": "^1.1.0", + "object.defaults": "^1.0.0", + "object.reduce": "^1.0.0", + "undertaker-registry": "^1.0.0" + } + }, + "undertaker-registry": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-1.0.1.tgz", + "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=", + "dev": true + }, "union-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", @@ -2397,6 +3410,15 @@ "set-value": "^0.4.3" }, "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, "set-value": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", @@ -2412,10 +3434,14 @@ } }, "unique-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", - "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=", - "dev": true + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz", + "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", + "dev": true, + "requires": { + "json-stable-stringify": "^1.0.0", + "through2-filter": "^2.0.0" + } }, "unset-value": { "version": "1.0.0", @@ -2454,15 +3480,15 @@ "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true } } }, + "upath": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", + "dev": true + }, "urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", @@ -2470,88 +3496,9 @@ "dev": true }, "use": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", - "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "lazy-cache": "^2.0.2" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "user-home": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", - "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, "util": { @@ -2578,90 +3525,109 @@ "dev": true }, "v8flags": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", - "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.1.tgz", + "integrity": "sha512-iw/1ViSEaff8NJ3HLyEjawk/8hjJib3E7pvG4pddVXfUg1983s3VGsiClDjhK64MQVDGqc1Q8r18S4VKQZS9EQ==", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "requires": { - "user-home": "^1.1.1" + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" } }, + "value-or-function": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz", + "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=", + "dev": true + }, "vinyl": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", - "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" } }, "vinyl-fs": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz", - "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", - "dev": true, - "requires": { - "defaults": "^1.0.0", - "glob-stream": "^3.1.5", - "glob-watcher": "^0.0.6", - "graceful-fs": "^3.0.0", - "mkdirp": "^0.5.0", - "strip-bom": "^1.0.0", - "through2": "^0.6.1", - "vinyl": "^0.4.0" - }, - "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", - "dev": true, - "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" - } - }, - "vinyl": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", - "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", - "dev": true, - "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" - } - } + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz", + "integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==", + "dev": true, + "requires": { + "fs-mkdirp-stream": "^1.0.0", + "glob-stream": "^6.1.0", + "graceful-fs": "^4.0.0", + "is-valid-glob": "^1.0.0", + "lazystream": "^1.0.0", + "lead": "^1.0.0", + "object.assign": "^4.0.4", + "pumpify": "^1.3.5", + "readable-stream": "^2.3.3", + "remove-bom-buffer": "^3.0.0", + "remove-bom-stream": "^1.2.0", + "resolve-options": "^1.1.0", + "through2": "^2.0.0", + "to-through": "^2.0.0", + "value-or-function": "^3.0.0", + "vinyl": "^2.0.0", + "vinyl-sourcemap": "^1.1.0" + } + }, + "vinyl-sourcemap": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz", + "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", + "dev": true, + "requires": { + "append-buffer": "^1.0.2", + "convert-source-map": "^1.5.0", + "graceful-fs": "^4.1.6", + "normalize-path": "^2.1.1", + "now-and-later": "^2.0.0", + "remove-bom-buffer": "^3.0.0", + "vinyl": "^2.0.0" } }, "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { "isexe": "^2.0.0" } }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -2673,6 +3639,42 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yargs": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", + "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "dev": true, + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^5.0.0" + } + }, + "yargs-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", + "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "dev": true, + "requires": { + "camelcase": "^3.0.0" + } } } } diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/package.json b/uk.co.compucorp.civicrm.hrleaveandabsences/package.json index 3926b9dceec..cfaa6b34ed1 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/package.json +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/package.json @@ -9,7 +9,7 @@ "author": "", "license": "ISC", "devDependencies": { - "gulp": "^3.9.1", + "gulp": "^4.0.0", "gulp-clean": "^0.4.0", "gulp-rename": "^1.2.2", "path": "^0.12.7" diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/BAO/LeaveRequestTest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/BAO/LeaveRequestTest.php index fdcd2be3a13..449369760e5 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/BAO/LeaveRequestTest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/BAO/LeaveRequestTest.php @@ -1000,72 +1000,6 @@ public function testLeaveRequestCanBeCreatedWhenNumberOfLeaveWorkingDaysNotGreat ]); } - public function testAUserCannotCancelOwnLeaveRequestWhenAbsenceTypeDoesNotAllowIt() { - $contactID = 5; - $this->registerCurrentLoggedInContactInSession($contactID); - - $absenceType = AbsenceTypeFabricator::fabricate([ - 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_NO - ]); - - $leaveRequestStatuses = array_flip(LeaveRequest::buildOptions('status_id', 'validate')); - - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation([ - 'type_id' => $absenceType->id, - 'contact_id' => $contactID, - 'status_id' => $leaveRequestStatuses['awaiting_approval'], - 'from_date' => CRM_Utils_Date::processDate('now'), - 'to_date' => CRM_Utils_Date::processDate('+4 days') - ]); - - $this->setExpectedException('CRM_HRLeaveAndAbsences_Exception_InvalidLeaveRequestException', 'Absence Type does not allow leave request cancellation'); - //cancel leave request - LeaveRequest::create([ - 'id' => $leaveRequest->id, - 'type_id' => $absenceType->id, - 'contact_id' => $contactID, - 'status_id' => $leaveRequestStatuses['cancelled'], - 'from_date' => CRM_Utils_Date::processDate('now'), - 'from_date_type' => 1, - 'to_date' => CRM_Utils_Date::processDate('+4 days'), - 'to_date_type' => 1, - 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE - ]); - } - - public function testAUserCannotCancelOwnLeaveRequestWhenAbsenceTypeAllowsItInAdvanceOfStartDateAndFromDateIsLessThanToday() { - $contactID = 5; - $this->registerCurrentLoggedInContactInSession($contactID); - - $absenceType = AbsenceTypeFabricator::fabricate([ - 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_IN_ADVANCE_OF_START_DATE - ]); - - $leaveRequestStatuses = array_flip(LeaveRequest::buildOptions('status_id', 'validate')); - - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation([ - 'type_id' => $absenceType->id, - 'contact_id' => $contactID, - 'status_id' => $leaveRequestStatuses['awaiting_approval'], - 'from_date' => CRM_Utils_Date::processDate('-1 day'), - 'to_date' => CRM_Utils_Date::processDate('+4 days') - ]); - - $this->setExpectedException('CRM_HRLeaveAndAbsences_Exception_InvalidLeaveRequestException', 'Leave Request with past days cannot be cancelled'); - //cancel leave request - LeaveRequest::create([ - 'id' => $leaveRequest->id, - 'type_id' => $absenceType->id, - 'contact_id' => $contactID, - 'status_id' => $leaveRequestStatuses['cancelled'], - 'from_date' => CRM_Utils_Date::processDate('-1 day'), - 'from_date_type' => 1, - 'to_date' => CRM_Utils_Date::processDate('+4 days'), - 'to_date_type' => 1, - 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE - ]); - } - public function testFindOverlappingLeaveRequestsForOneOverlappingLeaveRequest() { $contactID = 1; $fromDate1 = new DateTime('2016-11-02'); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestCalendarFeedDataTest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestCalendarFeedDataTest.php index e9571cef77c..330a377bddb 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestCalendarFeedDataTest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestCalendarFeedDataTest.php @@ -391,59 +391,73 @@ public function testGetWillNotReturnToilRequestsData() { public function testGetWillNotReturnDataForRequestsOutsideTheDateRange() { $absenceType = AbsenceTypeFabricator::fabricate(); - $contact1 = ContactFabricator::fabricate(['first_name' => 'Contact1', 'last_name' => 'LastContact1']); + $contact = ContactFabricator::fabricate(['first_name' => 'ContactName', 'last_name' => 'ContactLastName']); HRJobContractFabricator::fabricate( - ['contact_id' => $contact1['id']], + ['contact_id' => $contact['id']], ['period_start_date' => CRM_Utils_Date::processDate('yesterday')] ); - //Leave is outside date range for feed data - $params[1] = [ - 'contact_id' => $contact1['id'], - 'first_name' => $contact1['first_name'], - 'last_name' => $contact1['last_name'], - 'type_id' => $absenceType->id, - 'from_date' => CRM_Utils_Date::processDate('yesterday'), - 'to_date' => CRM_Utils_Date::processDate('yesterday'), + // These are test cases for different leave request dates. + // As a general rule, leave requests should only be included if at least + // one day appears in the period of [today - 3 months from today]. + $testCases = [ + [ + 'from_date' => CRM_Utils_Date::processDate('-3 days'), + 'to_date' => CRM_Utils_Date::processDate('-2 days'), + 'shouldBeIncluded' => false + ], + [ + 'from_date' => CRM_Utils_Date::processDate('-1 days'), + 'to_date' => CRM_Utils_Date::processDate('today'), + 'shouldBeIncluded' => true + ], + [ + 'from_date' => CRM_Utils_Date::processDate('+1 month +10 days'), + 'to_date' => CRM_Utils_Date::processDate('+1 month +20 days'), + 'shouldBeIncluded' => true + ], + [ + 'from_date' => CRM_Utils_Date::processDate('+3 months'), + 'to_date' => CRM_Utils_Date::processDate('+3 months +1 day'), + 'shouldBeIncluded' => true + ], + [ + 'from_date' => CRM_Utils_Date::processDate('+3 months +2 days'), + 'to_date' => CRM_Utils_Date::processDate('+3 months +3 days'), + 'shouldBeIncluded' => false + ] ]; - $params[2] = [ - 'contact_id' => $contact1['id'], - 'first_name' => $contact1['first_name'], - 'last_name' => $contact1['last_name'], - 'type_id' => $absenceType->id, - 'from_date' => CRM_Utils_Date::processDate('today'), - 'to_date' => CRM_Utils_Date::processDate('+2 days'), - ]; + $expectedFeedData = []; - //Leave is outside date range for feed data - $params[2] = [ - 'contact_id' => $contact1['id'], - 'first_name' => $contact1['first_name'], - 'last_name' => $contact1['last_name'], - 'type_id' => $absenceType->id, - 'from_date' => CRM_Utils_Date::processDate('+4 months'), - 'to_date' => CRM_Utils_Date::processDate('+4 months'), - ]; + foreach ($testCases as $testCase) { + $params = [ + 'contact_id' => $contact['id'], + 'first_name' => $contact['first_name'], + 'last_name' => $contact['last_name'], + 'type_id' => $absenceType->id, + 'from_date' => $testCase['from_date'], + 'to_date' => $testCase['to_date'], + ]; - foreach ($params as &$param) { - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($param); - $param['id'] = $leaveRequest->id; + $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params); + $params['id'] = $leaveRequest->id; + + $testCase['shouldBeIncluded'] && array_push($expectedFeedData, $params); } - //feed config is for all contacts in any department/location - $feedConfig1 = LeaveCalendarFeedConfigFabricator::fabricate([ - 'title' => 'Feed 1', + // A sample feed config which is visible to everyone + $feedConfig = LeaveCalendarFeedConfigFabricator::fabricate([ + 'title' => 'Feed', 'composed_of' => [ 'leave_type' => [$absenceType->id], ] ]); - $leaveFeedData = new LeaveRequestCalendarFeedData($feedConfig1->hash); + $leaveFeedData = new LeaveRequestCalendarFeedData($feedConfig->hash); - unset($params[1], $params[2]); - $this->assertEquals($this->getExpectedLeaveDataResult($params), $leaveFeedData->get()); + $this->assertEquals($this->getExpectedLeaveDataResult($expectedFeedData), $leaveFeedData->get()); } private function getExpectedLeaveDataResult($leaveData) { diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestRightsTest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestRightsTest.php index 224527491f4..9ecd600abac 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestRightsTest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestRightsTest.php @@ -4,6 +4,7 @@ use CRM_HRLeaveAndAbsences_BAO_LeaveRequest as LeaveRequest; use CRM_HRLeaveAndAbsences_Test_Fabricator_AbsenceType as AbsenceTypeFabricator; use CRM_HRCore_Test_Fabricator_Contact as ContactFabricator; +use CRM_HRLeaveAndAbsences_BAO_AbsenceType as AbsenceType; /** * Class CRM_HRLeaveAndAbsences_Service_LeaveRequestRightsTest @@ -37,13 +38,22 @@ public function testCanDeleteForReturnsFalseWhenCurrentUserIsLeaveContact() { } public function testCanDeleteForReturnsFalseWhenCurrentUserIsLeaveManager() { + $managerId = 5; + $this->registerCurrentLoggedInContactInSession($managerId); $this->assertFalse($this->getLeaveRequestRightsForLeaveManagerAsCurrentUser()->canDeleteFor($this->leaveContact)); + $this->unregisterCurrentLoggedInContactFromSession(); } public function testCanDeleteForReturnsTrueWhenCurrentUserIsAdmin() { $this->assertTrue($this->getLeaveRequestRightsForAdminAsCurrentUser()->canDeleteFor($this->leaveContact)); } + public function testCanDeleteForReturnsTrueWhenCurrentUserIsOwnLeaveApproverAndIsOwnRequest() { + $this->registerCurrentLoggedInContactInSession($this->leaveContact); + $this->assertTrue($this->getLeaveRequestRightsForLeaveManagerAsCurrentUser()->canDeleteFor($this->leaveContact)); + $this->unregisterCurrentLoggedInContactFromSession(); + } + /** * @dataProvider openLeaveRequestStatusesDataProvider */ @@ -170,6 +180,29 @@ public function testCanChangeDatesForReturnsTrueForAnyRequestTypeWhenCurrentUser ); } + /** + * @dataProvider leaveRequestStatusesDataProvider + */ + public function testCanChangeDatesForReturnsTrueForAnyRequestTypeWhenCurrentUserIsOwnLeaveApproverIrrespectiveOfStatusPassed($status) { + $contactID = 2; + $this->registerCurrentLoggedInContactInSession($contactID); + $managerRightsService = $this->getLeaveRequestRightsForLeaveManagerAsCurrentUser(); + + $this->assertTrue( + $managerRightsService->canChangeDatesFor($contactID, $status, LeaveRequest::REQUEST_TYPE_LEAVE) + ); + + $this->assertTrue( + $managerRightsService->canChangeDatesFor($contactID, $status, LeaveRequest::REQUEST_TYPE_SICKNESS) + ); + + $this->assertTrue( + $managerRightsService->canChangeDatesFor($contactID, $status, LeaveRequest::REQUEST_TYPE_TOIL) + ); + + $this->unregisterCurrentLoggedInContactFromSession(); + } + /** * @dataProvider openLeaveRequestStatusesDataProvider */ @@ -314,6 +347,62 @@ public function testAdminShouldHaveAccessToAllContacts() { $this->assertEquals([], $accessibleContacts); } + public function testCanCancelForAbsenceTypeReturnsTrueWhenUserIsAdmin() { + $typeId = 1; + $contactID = 2; + $leaveDate = new DateTime(); + $leaveRequestRightsService = $this->getLeaveRequestRightsForAdminAsCurrentUser(); + $result = $leaveRequestRightsService->canCancelForAbsenceType($typeId, $contactID, $leaveDate); + $this->assertTrue($result); + } + + public function testCanCancelForAbsenceTypeReturnsTrueWhenUserIsLeaveManager() { + $typeId = 1; + $contactID = 2; + $leaveDate = new DateTime(); + $leaveRequestRightsService = $this->getLeaveRequestRightsForLeaveManagerAsCurrentUser(); + $result = $leaveRequestRightsService->canCancelForAbsenceType($typeId, $contactID, $leaveDate); + $this->assertTrue($result); + } + + public function testCanCancelForAbsenceTypeReturnsTrueWhenAbsenceTypeAllowsCancellationForStaff() { + $absenceType = AbsenceTypeFabricator::fabricate([ + 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_ALWAYS + ]); + $contactID = 2; + $leaveDate = new DateTime(); + $leaveRequestRightsService = $this->getLeaveRightsService(); + $result = $leaveRequestRightsService->canCancelForAbsenceType($absenceType->id, $contactID, $leaveDate); + $this->assertTrue($result); + } + + public function testCanCancelForAbsenceTypeReturnsFalseWhenAbsenceTypeDoesNotAllowCancellationForStaff() { + $absenceType = AbsenceTypeFabricator::fabricate(['allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_NO]); + $contactID = 2; + $leaveDate = new DateTime(); + $leaveRequestRightsService = $this->getLeaveRightsService(); + $result = $leaveRequestRightsService->canCancelForAbsenceType($absenceType->id, $contactID, $leaveDate); + $this->assertFalse($result); + } + + public function testCanCancelForAbsenceTypeReturnsFalseWhenAbsenceTypeAllowsCancellationForFutureDateButLeaveDateIsPast() { + $absenceType = AbsenceTypeFabricator::fabricate(['allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_IN_ADVANCE_OF_START_DATE]); + $contactID = 2; + $leaveDate = new DateTime('yesterday'); + $leaveRequestRightsService = $this->getLeaveRightsService(); + $result = $leaveRequestRightsService->canCancelForAbsenceType($absenceType->id, $contactID, $leaveDate); + $this->assertFalse($result); + } + + public function testCanCancelForAbsenceTypeReturnsTrueWhenAbsenceTypeAllowsCancellationForFutureDateAndLeaveDateIsInFuture() { + $absenceType = AbsenceTypeFabricator::fabricate(['allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_IN_ADVANCE_OF_START_DATE]); + $contactID = 2; + $leaveDate = new DateTime('tomorrow'); + $leaveRequestRightsService = $this->getLeaveRightsService(); + $result = $leaveRequestRightsService->canCancelForAbsenceType($absenceType->id, $contactID, $leaveDate); + $this->assertTrue($result); + } + private function getLeaveRightsService($isAdmin = FALSE, $isManager = FALSE) { $leaveManagerService = $this->createLeaveManagerServiceMock($isAdmin, $isManager); return new LeaveRequestRightsService($leaveManagerService); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrixTest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrixTest.php index ceb343797f5..befcecddc13 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrixTest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrixTest.php @@ -136,37 +136,66 @@ public function testCanTransitionToReturnsFalseForPossibleManagerExclusiveStatus } } - /** - * @dataProvider allPossibleStatusTransitionForStaffDataProvider - */ - public function testCanTransitionToReturnsTrueForAllPossibleStaffTransitionStatusesWhenAdminIsTheLeaveContact($fromStatus, $toStatus) { + public function testCanTransitionToReturnsFalseWhenAdminIsTheLeaveContactForAllNonPossibleManagerTransitionStatuses() { $adminID = 5; $this->registerCurrentLoggedInContactInSession($adminID); $this->setPermissions(['administer leave and absences']); + $nonPossibleTransitions = $this->allNonPossibleStatusTransitionForLeaveApprover(); - $this->assertTrue($this->leaveRequestStatusMatrix->canTransitionTo($fromStatus, $toStatus, $adminID)); + foreach($nonPossibleTransitions as $transition) { + $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo( + $transition[0], + $transition[1], + $adminID + )); + } } - /** - * @dataProvider allNonPossibleStatusTransitionForStaffDataProvider - */ - public function testCanTransitionToReturnsFalseForAllNonPossibleStaffTransitionStatusesWhenAdminIsTheLeaveContact($fromStatus, $toStatus) { + public function testCanTransitionToReturnsTrueWhenAdminIsTheLeaveContactForAllPossibleManagerTransitionStatuses() { $adminID = 5; $this->registerCurrentLoggedInContactInSession($adminID); $this->setPermissions(['administer leave and absences']); + $possibleTransitions = $this->allPossibleStatusTransitionForLeaveApprover(); - $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo($fromStatus, $toStatus, $adminID)); + foreach($possibleTransitions as $transition) { + $this->assertTrue($this->leaveRequestStatusMatrix->canTransitionTo( + $transition[0], + $transition[1], + $adminID + )); + } } - /** - * @dataProvider getManagerExclusivePossibleStatusTransitionsDataProvider - */ - public function testCanTransitionToReturnsFalseForPossibleManagerExclusiveStatusTransitionsWhenAdminIsTheLeaveContact($fromStatus, $toStatus) { - $adminID = 5; - $this->registerCurrentLoggedInContactInSession($adminID); - $this->setPermissions(['administer leave and absences']); + public function testCanTransitionToReturnsFalseWhenUserIsTheLeaveContactAndOwnApproverForAllNonPossibleManagerTransitionStatuses() { + $manager = ContactFabricator::fabricate(); + $this->registerCurrentLoggedInContactInSession($manager['id']); + $this->setContactAsLeaveApproverOf($manager, $manager); + + $nonPossibleTransitions = $this->allNonPossibleStatusTransitionForLeaveApprover(); + + foreach($nonPossibleTransitions as $transition) { + $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo( + $transition[0], + $transition[1], + $manager['id'] + )); + } + } + + public function testCanTransitionToReturnsTrueWhenUserIsTheLeaveContactAndOwnApproverForAllPossibleManagerTransitionStatuses() { + $manager = ContactFabricator::fabricate(); + $this->registerCurrentLoggedInContactInSession($manager['id']); + $this->setContactAsLeaveApproverOf($manager, $manager); - $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo($fromStatus, $toStatus, $adminID)); + $possibleTransitions = $this->allPossibleStatusTransitionForLeaveApprover(); + + foreach($possibleTransitions as $transition) { + $this->assertTrue($this->leaveRequestStatusMatrix->canTransitionTo( + $transition[0], + $transition[1], + $manager['id'] + )); + } } public function allPossibleStatusTransitionForStaffDataProvider() { diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestTest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestTest.php index 1baac64247b..27487c88c53 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestTest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestTest.php @@ -3,6 +3,7 @@ use CRM_Hrjobcontract_Test_Fabricator_HRJobContract as HRJobContractFabricator; use CRM_HRLeaveAndAbsences_BAO_LeaveBalanceChange as LeaveBalanceChange; use CRM_HRLeaveAndAbsences_BAO_LeaveRequest as LeaveRequest; +use CRM_HRLeaveAndAbsences_BAO_AbsenceType as AbsenceType; use CRM_HRLeaveAndAbsences_BAO_PublicHoliday as PublicHoliday; use CRM_HRLeaveAndAbsences_Service_LeaveBalanceChange as LeaveBalanceChangeService; use CRM_HRLeaveAndAbsences_Service_LeaveRequest as LeaveRequestService; @@ -49,7 +50,7 @@ public function testCreateAlsoCreateTheLeaveRequestBalanceChanges() { ['period_start_date' => '2016-01-01'] ); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); // a 7 days leave request, from monday to sunday $leaveRequest = $this->getleaveRequestService()->create([ @@ -61,7 +62,7 @@ public function testCreateAlsoCreateTheLeaveRequestBalanceChanges() { 'to_date' => CRM_Utils_Date::processDate('2016-01-10'), 'to_date_type' => $this->getLeaveRequestDayTypes()['all_day']['value'], 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE - ], false); + ], FALSE); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); // Since the 40 hours work pattern was used, and it this is a week long @@ -80,7 +81,7 @@ public function testCreateAlsoCreateTheLeaveRequestBalanceChangesForLeaveInHours ['period_start_date' => '2016-01-01'] ); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); // a 5 days leave request, from monday to sunday $absenceType = AbsenceTypeFabricator::fabricate(['calculation_unit' => 2]); @@ -93,7 +94,7 @@ public function testCreateAlsoCreateTheLeaveRequestBalanceChangesForLeaveInHours 'to_date' => CRM_Utils_Date::processDate('2016-01-08 16:45'), 'to_date_amount' => 2.4, 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE - ], false); + ], FALSE); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); // Since the 40 hours work pattern was used, and it this is a week long @@ -112,7 +113,7 @@ public function testCreateAlsoCreatesTheBalanceChangesForTheLeaveDatesCorrectlyF ['period_start_date' => '2016-01-01'] ); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); // a 5 days leave request, from monday to friday $absenceType = AbsenceTypeFabricator::fabricate(['calculation_unit' => 2]); @@ -125,7 +126,7 @@ public function testCreateAlsoCreatesTheBalanceChangesForTheLeaveDatesCorrectlyF 'to_date' => CRM_Utils_Date::processDate('2016-01-08 16:45'), 'to_date_amount' => 2.4, 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE - ], false); + ], FALSE); $amountInHours = 8.0; $expectedBreakdown = $this->getExpectedBreakdownForLeaveRequest($leaveRequest, $amountInHours); @@ -142,7 +143,7 @@ public function testCreateAlsoCreateTheLeaveRequestBalanceChangesProperlyForLeav ['period_start_date' => '2016-01-01'] ); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); // a 6 days leave request, from monday to saturday $absenceType = AbsenceTypeFabricator::fabricate(['calculation_unit' => 2]); @@ -155,7 +156,7 @@ public function testCreateAlsoCreateTheLeaveRequestBalanceChangesProperlyForLeav 'to_date' => CRM_Utils_Date::processDate('2016-01-09 16:45'), 'to_date_amount' => 2.4, 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE - ], false); + ], FALSE); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); // Since the 40 hours work pattern was used, and it this is a week long @@ -175,7 +176,7 @@ public function testCreateDoesNotDuplicateLeaveBalanceChangesOnUpdate() { ['period_start_date' => '2016-01-01'] ); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); // a 7 days leave request, from friday to thursday $params = [ @@ -189,7 +190,7 @@ public function testCreateDoesNotDuplicateLeaveBalanceChangesOnUpdate() { 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE ]; - $leaveRequest = $this->getleaveRequestService()->create($params, false); + $leaveRequest = $this->getleaveRequestService()->create($params, FALSE); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); // Since the 40 hours work pattern was used, and it this is a week long @@ -204,7 +205,7 @@ public function testCreateDoesNotDuplicateLeaveBalanceChangesOnUpdate() { // Increase the Leave Request period by 4 days (2 weekend + 2 working days) $params['id'] = $leaveRequest->id; $params['to_date'] = CRM_Utils_Date::processDate('2016-01-11'); - $this->getleaveRequestService()->create($params, false); + $this->getleaveRequestService()->create($params, FALSE); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); // 5 from before + 2 (from the 2 new working days) @@ -232,7 +233,7 @@ public function testDeleteSoftDeletesTheLeaveRequest() { $leaveRequestRecord = new LeaveRequest(); $leaveRequestRecord->id = $leaveRequest->id; - $leaveRequestRecord->find(true); + $leaveRequestRecord->find(TRUE); $this->assertEquals(1, $leaveRequestRecord->is_deleted); } @@ -248,7 +249,7 @@ public function testDeleteSoftDeletesAPublicHolidayLeaveRequest() { $publicHolidayLeaveRequestRecord = new LeaveRequest(); $publicHolidayLeaveRequestRecord->id = $publicHolidayLeaveRequest->id; - $publicHolidayLeaveRequestRecord->find(true); + $publicHolidayLeaveRequestRecord->find(TRUE); $this->assertEquals(1, $publicHolidayLeaveRequestRecord->is_deleted); } @@ -301,7 +302,7 @@ public function testCreateThrowsAnExceptionWhenCurrentUserDoesNotHaveCreateAndUp //logged in user has no permissions, also a contactID different from that of the logged in user is passed $contactID = 2; $params = $this->getDefaultParams(['contact_id' => $contactID]); - $this->getleaveRequestService()->create($params, false); + $this->getleaveRequestService()->create($params, FALSE); } /** @@ -309,7 +310,7 @@ public function testCreateThrowsAnExceptionWhenCurrentUserDoesNotHaveCreateAndUp * @expectedExceptionMessage You can't create a Leave Request with this status */ public function testCreateThrowsAnExceptionWhenTransitionStatusIsNotValidForNewLeaveRequest() { - $this->getLeaveRequestServiceWhenStatusTransitionIsNotAllowed()->create($this->getDefaultParams(), false); + $this->getLeaveRequestServiceWhenStatusTransitionIsNotAllowed()->create($this->getDefaultParams(), FALSE); } public function testCreateThrowsAnExceptionWhenTransitionStatusIsNotValidWhenUpdatingLeaveRequestStatus() { @@ -325,24 +326,7 @@ public function testCreateThrowsAnExceptionWhenTransitionStatusIsNotValidWhenUpd $params['id'] = $leaveRequest->id; $params['status_id'] = $leaveRequestStatuses['awaiting_approval']; - $this->getLeaveRequestServiceWhenStatusTransitionIsNotAllowed()->create($params, false); - } - - public function testCreateThrowsAnExceptionWhenAttemptingToApproveOwnLeaveRequest() { - $params = $this->getDefaultParams(); - $leaveRequestStatuses = LeaveRequest::getStatuses(); - - $params['status_id'] = $leaveRequestStatuses['awaiting_approval']; - - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params); - - $this->setExpectedException( - 'RuntimeException', "You can't approve your own leave requests"); - - $params['id'] = $leaveRequest->id; - $params['status_id'] = $leaveRequestStatuses['approved']; - - $this->getLeaveRequestServiceWhenStatusTransitionIsNotAllowed()->create($params, false); + $this->getLeaveRequestServiceWhenStatusTransitionIsNotAllowed()->create($params, FALSE); } /** @@ -358,7 +342,7 @@ public function testCreateThrowsAnExceptionWhenLeaveApproverUpdatesDatesForLeave $params['to_date'] = CRM_Utils_Date::processDate('2016-01-15'); $params['id'] = $leaveRequest->id; - $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create($params, FALSE); } public function testCreateDoesNotThrowAnExceptionWhenAdminUpdatesDatesForLeaveRequest() { @@ -370,7 +354,7 @@ public function testCreateDoesNotThrowAnExceptionWhenAdminUpdatesDatesForLeaveRe $params['to_date'] = $toDate->modify('+10 days')->format('YmdHis'); $params['id'] = $leaveRequest->id; - $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, FALSE); $this->assertNotNull($leaveRequest->id); } @@ -390,7 +374,7 @@ public function testCreateDoesNotThrowAnExceptionWhenLeaveManagerUpdatesDatesFor $params['to_date'] = $toDate->modify('+10 days')->format('YmdHis'); $params['id'] = $leaveRequest->id; - $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create($params, FALSE); } /** @@ -409,7 +393,7 @@ public function testCreateDoesNotThrowAnExceptionWhenAdminUpdatesDatesForAnOpenS $params['to_date'] = $toDate->modify('+10 days')->format('YmdHis'); $params['id'] = $leaveRequest->id; - $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, FALSE); } /** @@ -430,7 +414,7 @@ public function testCreateThrowsAnExceptionWhenLeaveContactUpdatesDatesForAClose $params['to_date'] = $toDate->modify('+10 days')->format('YmdHis'); $params['id'] = $leaveRequest->id; - $this->getLeaveRequestService()->create($params, false); + $this->getLeaveRequestService()->create($params, FALSE); } /** @@ -445,7 +429,7 @@ public function testCreateThrowsAnExceptionWhenLeaveApproverUpdatesAbsenceTypeFo $params['id'] = $leaveRequest->id; $params['type_id'] = 2; - $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create($params, FALSE); } /** @@ -460,7 +444,7 @@ public function testCreateThrowsAnExceptionWhenAdminUpdatesAbsenceTypeForLeaveRe $params['id'] = $leaveRequest->id; $params['type_id'] = 2; - $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, FALSE); } /** @@ -484,7 +468,22 @@ public function testDeleteThrowsAnExceptionWhenLeaveContactTriesToDeleteALeaveRe $this->getLeaveRequestService()->delete($leaveRequest->id); } - private function getLeaveRequestService($isAdmin = false, $isManager = false, $allowStatusTransition = true, $mockBalanceChangeService = false) { + public function testDeleteDoesNotThrowAnExceptionWhenLeaveContactWhoIsOwnLeaveApproverTriesToDeleteOwnLeaveRequest() { + $this->registerCurrentLoggedInContactInSession($this->leaveContact); + $params = $this->getDefaultParams(['contact_id' => $this->leaveContact]); + $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params); + $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->delete($leaveRequest->id); + + //Check that the leave request is actually soft deleted. + $leaveRequestRecord = new LeaveRequest(); + $leaveRequestRecord->id = $leaveRequest->id; + $leaveRequestRecord->find(TRUE); + $this->assertEquals(1, $leaveRequestRecord->is_deleted); + + $this->unregisterCurrentLoggedInContactFromSession(); + } + + private function getLeaveRequestService($isAdmin = FALSE, $isManager = FALSE, $allowStatusTransition = TRUE, $mockBalanceChangeService = FALSE) { $leaveManagerService = $this->createLeaveManagerServiceMock($isAdmin, $isManager); $leaveRequestStatusMatrixService = $this->createLeaveRequestStatusMatrixServiceMock($allowStatusTransition); $leaveRequestRightsService = new LeaveRequestRightsService($leaveManagerService); @@ -501,6 +500,25 @@ private function getLeaveRequestService($isAdmin = false, $isManager = false, $a ); } + private function getLeaveRequestServiceForWhenAbsenceTypeCannotBeCancelled( + $typeId, + $contactID, + $leaveFromDate + ) { + $leaveRightsService = $this->prophesize(LeaveRequestRightsService::class); + $leaveRightsService->canCreateAndUpdateFor($contactID)->willReturn(TRUE); + $leaveRightsService->canCancelForAbsenceType( + $typeId, + $contactID, + new DateTime($leaveFromDate))->willReturn(FALSE); + + return new LeaveRequestService( + $this->leaveBalanceChangeService, + $this->createLeaveRequestStatusMatrixServiceMock(TRUE), + $leaveRightsService->reveal() + ); + } + public function testLeaveRequestServiceCallsRecalculateExpiredBalanceChangesForLeaveRequestPastDatesMethodWhenALeaveRequestHasPastDates() { $params = $this->getDefaultParams([ 'from_date' => CRM_Utils_Date::processDate('-2 days'), @@ -508,23 +526,23 @@ public function testLeaveRequestServiceCallsRecalculateExpiredBalanceChangesForL 'status' => 1 ]); - $this->getLeaveRequestServiceWhenCurrentUserIsAdminWithBalanceChangeServiceMock()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsAdminWithBalanceChangeServiceMock()->create($params, FALSE); } private function getLeaveRequestServiceWhenStatusTransitionIsNotAllowed() { - return $this->getLeaveRequestService(false, false, false); + return $this->getLeaveRequestService(FALSE, FALSE, FALSE); } private function getLeaveRequestServiceWhenCurrentUserIsAdmin() { - return $this->getLeaveRequestService(true, false); + return $this->getLeaveRequestService(TRUE, FALSE); } private function getLeaveRequestServiceWhenCurrentUserIsLeaveManager() { - return $this->getLeaveRequestService(false, true); + return $this->getLeaveRequestService(FALSE, TRUE); } private function getLeaveRequestServiceWhenCurrentUserIsAdminWithBalanceChangeServiceMock() { - return $this->getLeaveRequestService(true, false, true, true); + return $this->getLeaveRequestService(TRUE, FALSE, TRUE, TRUE); } private function getDefaultParams($params = []) { $absenceType = AbsenceTypeFabricator::fabricate(); @@ -552,7 +570,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); //Leave dates on Monday to Friday, all working days $leaveDates = [ @@ -561,7 +579,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal ]; $params = $this->getDefaultParams($leaveDates); - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the leave request $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); @@ -596,7 +614,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal $leaveRequest = $this->getleaveRequestService()->create( $params, - false + FALSE ); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); @@ -614,7 +632,7 @@ public function testBalanceChangeIsNotUpdatedForAnExistingLeaveRequestWhenChange 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); //Leave dates on Monday to Friday, all working days $leaveDates = [ @@ -623,7 +641,7 @@ public function testBalanceChangeIsNotUpdatedForAnExistingLeaveRequestWhenChange ]; $params = $this->getDefaultParams($leaveDates); - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the leave request $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); @@ -658,7 +676,7 @@ public function testBalanceChangeIsNotUpdatedForAnExistingLeaveRequestWhenChange $leaveRequest = $this->getleaveRequestService()->create( $params, - false + FALSE ); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); @@ -676,7 +694,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); //Leave dates on Monday to Friday, all working days $leaveDates = [ @@ -685,7 +703,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal ]; $params = $this->getDefaultParams($leaveDates); - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the leave request $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); @@ -731,7 +749,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal $leaveRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //The leave request balance has been updated to pick from the current work pattern @@ -750,7 +768,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); //Leave dates on Monday to Friday, all working days $leaveDates = [ @@ -759,7 +777,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal ]; $params = $this->getDefaultParams($leaveDates); - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the leave request $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); @@ -805,7 +823,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal $leaveRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //The leave request balance has been updated to pick from the current work pattern @@ -825,7 +843,7 @@ public function testBalanceIsUpdatedForExistingToilWhenChangeBalanceIsFalseAndTo 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); $toilToAccrue1 = 1; $toilParams = [ @@ -834,7 +852,7 @@ public function testBalanceIsUpdatedForExistingToilWhenChangeBalanceIsFalseAndTo ]; $params = $this->getDefaultParams($toilParams); - $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the toil $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -848,7 +866,7 @@ public function testBalanceIsUpdatedForExistingToilWhenChangeBalanceIsFalseAndTo $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //Balance change is updated for the TOIL @@ -867,7 +885,7 @@ public function testBalanceIsUpdatedForExistingToilWhenChangeBalanceIsTrueAndToi 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); $toilToAccrue1 = 1; $toilParams = [ @@ -876,7 +894,7 @@ public function testBalanceIsUpdatedForExistingToilWhenChangeBalanceIsTrueAndToi ]; $params = $this->getDefaultParams($toilParams); - $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the toil $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -890,7 +908,7 @@ public function testBalanceIsUpdatedForExistingToilWhenChangeBalanceIsTrueAndToi $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //Balance change is updated for the TOIL @@ -909,7 +927,7 @@ public function testBalanceRemainsSameButDatesAreUpdatedForToilWhenChangeBalance 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); $toilToAccrue1 = 1; $toilParams = [ @@ -920,7 +938,7 @@ public function testBalanceRemainsSameButDatesAreUpdatedForToilWhenChangeBalance ]; $params = $this->getDefaultParams($toilParams); - $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the toil $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -939,7 +957,7 @@ public function testBalanceRemainsSameButDatesAreUpdatedForToilWhenChangeBalance $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -960,7 +978,7 @@ public function testBalanceRemainsSameButDatesAreUpdatedForToilWhenChangeBalance 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); $toilToAccrue1 = 1; $toilParams = [ @@ -971,7 +989,7 @@ public function testBalanceRemainsSameButDatesAreUpdatedForToilWhenChangeBalance ]; $params = $this->getDefaultParams($toilParams); - $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the toil $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -990,7 +1008,7 @@ public function testBalanceRemainsSameButDatesAreUpdatedForToilWhenChangeBalance $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -1011,7 +1029,7 @@ public function testBalanceAndDatesNotUpdatedForExistingToilWhenChangeBalanceIsF 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); $toilToAccrue1 = 1; $toilParams = [ @@ -1022,7 +1040,7 @@ public function testBalanceAndDatesNotUpdatedForExistingToilWhenChangeBalanceIsF ]; $params = $this->getDefaultParams($toilParams); - $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the toil $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -1034,7 +1052,7 @@ public function testBalanceAndDatesNotUpdatedForExistingToilWhenChangeBalanceIsF $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //Both the dates and balance changes remain the same. @@ -1056,7 +1074,7 @@ public function testBalanceAndDatesRemainsSameForExistingToilWhenChangeBalanceIs 'end_date' => CRM_Utils_Date::processDate('2016-12-31'), ]); - WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => true]); + WorkPatternFabricator::fabricateWithA40HourWorkWeek(['is_default' => TRUE]); $toilToAccrue1 = 1; $toilParams = [ @@ -1067,7 +1085,7 @@ public function testBalanceAndDatesRemainsSameForExistingToilWhenChangeBalanceIs ]; $params = $this->getDefaultParams($toilParams); - $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, true); + $toilRequest = LeaveRequestFabricator::fabricateWithoutValidation($params, TRUE); //Just to make sure that we have the expected balance change for the toil $previousBalance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -1079,7 +1097,7 @@ public function testBalanceAndDatesRemainsSameForExistingToilWhenChangeBalanceIs $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //Both the dates and balance changes remain the same. @@ -1097,14 +1115,14 @@ public function testGetBreakdownIncludeOnlyTheLeaveBalanceChangesOfTheLeaveReque 'type_id' => 1, 'from_date' => CRM_Utils_Date::processDate('2016-01-01'), 'to_date' => CRM_Utils_Date::processDate('2016-01-02'), - ], true); + ], TRUE); $leaveRequest2 = LeaveRequestFabricator::fabricateWithoutValidation([ 'contact_id' => 1, 'type_id' => 1, 'from_date' => CRM_Utils_Date::processDate('2016-01-03'), 'to_date' => CRM_Utils_Date::processDate('2016-01-03'), - ], true); + ], TRUE); $expectedBreakdown = $this->getExpectedBreakdownForLeaveRequest($leaveRequest1); $breakdown = $this->getLeaveRequestService()->getBreakdown($leaveRequest1->id); @@ -1117,8 +1135,9 @@ public function testGetBreakdownIncludeOnlyTheLeaveBalanceChangesOfTheLeaveReque public function testToilRequestWithPastDatesCanNotBeCancelledWhenUserIsLeaveContactAndAbsenceTypeDoesNotAllowPastAccrual() { $absenceType = AbsenceTypeFabricator::fabricate([ - 'allow_accruals_request' => true, - 'allow_accrue_in_the_past' => false + 'allow_accruals_request' => TRUE, + 'allow_accrue_in_the_past' => FALSE, + 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_ALWAYS ]); $leaveStatuses = LeaveRequest::getStatuses(); @@ -1139,13 +1158,13 @@ public function testToilRequestWithPastDatesCanNotBeCancelledWhenUserIsLeaveCont $params['id'] = $toilRequest->id; $this->setExpectedException('RuntimeException', 'You may only cancel TOIL with dates in the future.'); - $this->getLeaveRequestService()->create($params, false); + $this->getLeaveRequestService()->create($params, FALSE); } public function testToilRequestWithPastDatesCanBeCancelledWhenUserIsAdminAndAbsenceTypeDoesNotAllowPastAccrual() { $absenceType = AbsenceTypeFabricator::fabricate([ - 'allow_accruals_request' => true, - 'allow_accrue_in_the_past' => false + 'allow_accruals_request' => TRUE, + 'allow_accrue_in_the_past' => FALSE ]); $leaveStatuses = LeaveRequest::getStatuses(); @@ -1165,7 +1184,7 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenUserIsAdminAndAbse $params['status_id'] = $leaveStatuses['cancelled']; $params['id'] = $toilRequest->id; - $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, false); + $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, FALSE); $this->assertNotNull($toilRequest->id); $this->assertEquals($toilRequest->status_id, $leaveStatuses['cancelled']); @@ -1173,8 +1192,8 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenUserIsAdminAndAbse public function testToilRequestWithPastDatesCanBeCancelledWhenUserIsManagerAndAbsenceTypeDoesNotAllowPastAccrual() { $absenceType = AbsenceTypeFabricator::fabricate([ - 'allow_accruals_request' => true, - 'allow_accrue_in_the_past' => false + 'allow_accruals_request' => TRUE, + 'allow_accrue_in_the_past' => FALSE ]); $leaveStatuses = LeaveRequest::getStatuses(); @@ -1196,7 +1215,7 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenUserIsManagerAndAb $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create( $params, - false + FALSE ); $this->assertNotNull($toilRequest->id); @@ -1205,8 +1224,9 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenUserIsManagerAndAb public function testToilRequestWithPastDatesCanBeCancelledWhenAbsenceTypeAllowsPastAccrual() { $absenceType = AbsenceTypeFabricator::fabricate([ - 'allow_accruals_request' => true, - 'allow_accrue_in_the_past' => true + 'allow_accruals_request' => TRUE, + 'allow_accrue_in_the_past' => TRUE, + 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_ALWAYS ]); $leaveStatuses = LeaveRequest::getStatuses(); @@ -1228,14 +1248,37 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenAbsenceTypeAllowsP $toilRequest = $this->getLeaveRequestService()->create( $params, - false + FALSE ); $this->assertNotNull($toilRequest->id); $this->assertEquals($toilRequest->status_id, $leaveStatuses['cancelled']); } - private function getExpectedBreakdownForLeaveRequest(LeaveRequest $leaveRequest, $amount = false) { + public function testCreateThrowsAnExceptionWhenUserIsNotAllowedToCancelAbsenceType() { + $leaveRequestStatuses = LeaveRequest::getStatuses(); + $this->registerCurrentLoggedInContactInSession($this->leaveContact); + $typeId = 1; + $params = $this->getDefaultParams([ + 'contact_id' => $this->leaveContact, + 'type_id' => $typeId, + ]); + + $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation($params); + $params['status_id'] = $leaveRequestStatuses['cancelled']; + $params['id'] = $leaveRequest->id; + + $leaveRequestService = $this->getLeaveRequestServiceForWhenAbsenceTypeCannotBeCancelled( + $params['type_id'], $params['contact_id'], $params['from_date']); + + $this->setExpectedException( + RuntimeException::class, + 'You cannot cancel leave requests for this Absence type' + ); + $leaveRequestService->create($params, FALSE); + } + + private function getExpectedBreakdownForLeaveRequest(LeaveRequest $leaveRequest, $amount = FALSE) { $leaveRequestDayTypes = LeaveRequest::buildOptions('from_date_type'); $dates = $leaveRequest->getDates(); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/api/v3/LeaveRequestTest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/api/v3/LeaveRequestTest.php index 0bd824b3b53..f9f844cdf6d 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/api/v3/LeaveRequestTest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/api/v3/LeaveRequestTest.php @@ -2856,86 +2856,6 @@ public function testLeaveRequestIsValidShouldReturnErrorWhenLeaveDaysIsGreaterTh $this->assertEquals($expectedResult, $result); } - public function testLeaveRequestIsValidShouldReturnErrorWhenUserCancelsOwnLeaveRequestAndAbsenceTypeDoesNotAllowIt() { - $contactID = 5; - $this->registerCurrentLoggedInContactInSession($contactID); - - $absenceType = AbsenceTypeFabricator::fabricate([ - 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_NO - ]); - - $fromDate = new DateTime(); - $toDate = new DateTime('+4 days'); - $leaveRequestStatuses = array_flip(LeaveRequest::buildOptions('status_id', 'validate')); - - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation([ - 'type_id' => $absenceType->id, - 'contact_id' => $contactID, - 'status_id' => $leaveRequestStatuses['awaiting_approval'], - 'from_date' => $fromDate->format('YmdHis'), - 'from_date_type' => 1, - 'to_date' => $toDate->format('YmdHis'), - 'to_date_type' => 1 - ]); - - //cancel leave request - $result = civicrm_api3('LeaveRequest', 'isvalid', [ - 'id' => $leaveRequest->id, - 'type_id' => $absenceType->id, - 'contact_id' => $contactID, - 'status_id' => $leaveRequestStatuses['cancelled'], - 'from_date' => $fromDate->format('YmdHis'), - 'from_date_type' => 1, - 'to_date' => $toDate->format('YmdHis'), - 'to_date_type' => 1, - 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE - ]); - - $errorMessage = 'Absence Type does not allow leave request cancellation'; - $expectedResult = $this->getExpectedArrayForIsValidError('type_id', $errorMessage); - $this->assertEquals($expectedResult, $result); - } - - public function testLeaveRequestIsValidShouldReturnErrorWhenUserCancelsOwnLeaveRequestAndAbsenceTypeAllowsItInAdvanceOfStartDateAndLeaveRequestFromDateIsLessThanToday() { - $contactID = 5; - $this->registerCurrentLoggedInContactInSession($contactID); - - $absenceType = AbsenceTypeFabricator::fabricate([ - 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_IN_ADVANCE_OF_START_DATE - ]); - - $fromDate = new DateTime('-1 day'); - $toDate = new DateTime('+4 days'); - $leaveRequestStatuses = array_flip(LeaveRequest::buildOptions('status_id', 'validate')); - - $leaveRequest = LeaveRequestFabricator::fabricateWithoutValidation([ - 'type_id' => $absenceType->id, - 'contact_id' => $contactID, - 'status_id' => $leaveRequestStatuses['awaiting_approval'], - 'from_date' => $fromDate->format('YmdHis'), - 'from_date_type' => 1, - 'to_date' => $toDate->format('YmdHis'), - 'to_date_type' => 1 - ]); - - //cancel leave request - $result = civicrm_api3('LeaveRequest', 'isvalid', [ - 'id' => $leaveRequest->id, - 'type_id' => $absenceType->id, - 'contact_id' => $contactID, - 'status_id' => $leaveRequestStatuses['cancelled'], - 'from_date' => $fromDate->format('YmdHis'), - 'from_date_type' => 1, - 'to_date' => $toDate->format('YmdHis'), - 'to_date_type' => 1, - 'request_type' => LeaveRequest::REQUEST_TYPE_LEAVE - ]); - - $errorMessage = 'Leave Request with past days cannot be cancelled'; - $expectedResult = $this->getExpectedArrayForIsValidError('type_id', $errorMessage); - $this->assertEquals($expectedResult, $result); - } - public function testLeaveRequestIsValidShouldReturnAnErrorWhenTheToilToAccrueDoesNotHaveAValidValue() { AbsencePeriodFabricator::fabricate([ 'start_date' => CRM_Utils_Date::processDate('2015-01-01'), @@ -2962,6 +2882,7 @@ public function testLeaveRequestIsValidShouldReturnAnErrorWhenTheToilToAccrueDoe } public function testToilCanBeAccruedWhenToilIsInHoursAndToilToAccrueValueIsNotAValidToilAmountOptionValue() { + $this->setPermissions(); $contactID = 1; $period = AbsencePeriodFabricator::fabricate([ 'start_date' => CRM_Utils_Date::processDate('2016-01-01'), @@ -3221,6 +3142,7 @@ public function testLeaveRequestIsValidShouldNotReturnErrorWhenValidationsPass() public function testCreateAlsoCreatesTheBalanceChangesForTheLeaveRequest() { $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $startDate = new DateTime(); $endDate = new DateTime('+5 days'); @@ -4847,6 +4769,7 @@ public function testTheTimeForFromAndToDateOfLeaveRequestIsAddedCorrectlyWhenLea $toDate = new DateTime('2016-01-10'); $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $period = AbsencePeriodFabricator::fabricate([ 'start_date' => $fromDate->format('YmdHis'), @@ -4895,6 +4818,7 @@ public function testTheTimeForFromAndToDateOfLeaveRequestStaysUntouchedWhenReque $toDate = new DateTime('2016-01-10 12:34:56'); $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $period = AbsencePeriodFabricator::fabricate([ 'start_date' => $fromDate->format('YmdHis'), @@ -4939,6 +4863,7 @@ public function testCreateReturnsFalseForFromEmailParameterWhenFromEmailIsNotCon $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $startDate = new DateTime(); $endDate = new DateTime('+5 days'); @@ -4980,6 +4905,7 @@ public function testCreateReturnsFalseForFromEmailParameterWhenFromEmailIsNotCon public function testCreateReturnsTrueForFromEmailParameterWhenFromEmailIsConfigured() { $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $startDate = new DateTime(); $endDate = new DateTime('+5 days'); @@ -5027,6 +4953,7 @@ public function testTheTimeForFromAndToDateOfLeaveRequestIsNotModifiedWhenLeaveI $contactID = 1; $absenceType = AbsenceTypeFabricator::fabricate(['calculation_unit' => 2]); $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $period = AbsencePeriodFabricator::fabricate([ 'start_date' => $fromDate->format('YmdHis'), @@ -5070,6 +4997,7 @@ public function testTheTimeForFromAndToDateOfLeaveRequestIsAddedCorrectlyWhenLea $toDate = new DateTime('2016-01-10 15:45:00'); $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $period = AbsencePeriodFabricator::fabricate([ 'start_date' => $fromDate->format('YmdHis'), diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-actions.html b/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-actions.html index c3eb424164a..b974e47936e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-actions.html +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-actions.html @@ -1,10 +1,14 @@ -
    +
    -
    diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-footer.html b/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-footer.html index b2c190820da..04f20d13e7d 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-footer.html +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-footer.html @@ -8,7 +8,7 @@ Delete diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/partials/staff-leave-report-requests-rows.html b/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/partials/staff-leave-report-requests-rows.html index 1c9ba6a3114..c5ba7e6386a 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/partials/staff-leave-report-requests-rows.html +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/partials/staff-leave-report-requests-rows.html @@ -14,7 +14,7 @@ diff --git a/uk.co.compucorp.civicrm.hrsampledata/info.xml b/uk.co.compucorp.civicrm.hrsampledata/info.xml index 42f3c13540a..124f5888ecf 100644 --- a/uk.co.compucorp.civicrm.hrsampledata/info.xml +++ b/uk.co.compucorp.civicrm.hrsampledata/info.xml @@ -8,8 +8,8 @@ Compucorp info@compucorp.com - 2018-07-24 - 1.7.9 + 2018-08-20 + 1.7.10 stable 4.7 diff --git a/uk.co.compucorp.civicrm.hrsampledata/resources/csv/civicrm_option_value.csv b/uk.co.compucorp.civicrm.hrsampledata/resources/csv/civicrm_option_value.csv index 70beb41a1e1..ed6ff7da462 100644 --- a/uk.co.compucorp.civicrm.hrsampledata/resources/csv/civicrm_option_value.csv +++ b/uk.co.compucorp.civicrm.hrsampledata/resources/csv/civicrm_option_value.csv @@ -85,9 +85,6 @@ name,phone_type,Mobile,Mobile,,0,0,0,0,,0 name,marital_status_20130913084916,Single,Single,,0,0,0,0,,0 name,marital_status_20130913084916,Married,Married,,0,0,0,0,,0 name,marital_status_20130913084916,Divorced,Divorced,,0,0,0,0,,0 -name,sexual_orientation_20130725124348,Not Applicable,Not Applicable,,0,0,0,0,,0 -name,religion_20130725124132,Not Applicable,Not Applicable,,0,0,0,0,,0 -name,ethnicity_20130725123943,Not Applicable,Not Applicable,,0,0,0,0,,0 name,hrjc_benefit_type,Fixed,Fixed,,0,0,0,0,,0 name,hrjc_benefit_name,Bike,Bike,,0,0,0,0,,0 name,postal_greeting,Dear {contact.first_name},Dear {contact.first_name},,1,1,0,0,,0 diff --git a/uk.co.compucorp.civicrm.hrsampledata/tests/phpunit/CRM/HRSampleData/BaseCSVProcessorTest.php b/uk.co.compucorp.civicrm.hrsampledata/tests/phpunit/CRM/HRSampleData/BaseCSVProcessorTest.php index 59bd263f19d..04c4a161ff7 100644 --- a/uk.co.compucorp.civicrm.hrsampledata/tests/phpunit/CRM/HRSampleData/BaseCSVProcessorTest.php +++ b/uk.co.compucorp.civicrm.hrsampledata/tests/phpunit/CRM/HRSampleData/BaseCSVProcessorTest.php @@ -20,7 +20,6 @@ public function setUpHeadless() { ->install('com.civicrm.hrjobroles') ->install('org.civicrm.hrrecruitment') ->install('org.civicrm.hremergency') - ->install('org.civicrm.hrdemog') ->install('org.civicrm.hrbank') ->install('uk.co.compucorp.civicrm.tasksassignments') ->install('org.civicrm.hrcase') diff --git a/uk.co.compucorp.civicrm.hrsampledata/tests/phpunit/CRM/HRSampleData/Importer/ExtendedDemographicsTest.php b/uk.co.compucorp.civicrm.hrsampledata/tests/phpunit/CRM/HRSampleData/Importer/ExtendedDemographicsTest.php index 60a7184a6eb..a429706bc4b 100644 --- a/uk.co.compucorp.civicrm.hrsampledata/tests/phpunit/CRM/HRSampleData/Importer/ExtendedDemographicsTest.php +++ b/uk.co.compucorp.civicrm.hrsampledata/tests/phpunit/CRM/HRSampleData/Importer/ExtendedDemographicsTest.php @@ -22,9 +22,6 @@ public function testProcess() { $this->rows[] = [ $this->testContact['id'], 1020, - 'Not Applicable', - 'Not Applicable', - 'Not Applicable', 'Single', ]; @@ -43,9 +40,6 @@ private function importHeadersFixture() { return [ 'entity_id', 'Nationality', - 'Ethnicity', - 'Religion', - 'Sexual_Orientation', 'Marital_Status', ]; }