From be1ed18691d69d7eb4cd313eabb7df664748d8ff Mon Sep 17 00:00:00 2001 From: Elisio Leonardo Date: Tue, 19 Jun 2018 12:26:20 +0200 Subject: [PATCH 001/151] PCHR-3545: Changed Order For Individual Prefix --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1018.php | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 230c30760e0..2dd44cd6f67 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -25,6 +25,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1015; use CRM_HRCore_Upgrader_Steps_1016; use CRM_HRCore_Upgrader_Steps_1017; + use CRM_HRCore_Upgrader_Steps_1018; /** * @var array diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php new file mode 100644 index 00000000000..4afc20b2a6e --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php @@ -0,0 +1,52 @@ +up1018_changeOrderOfIndividualPrefix(); + + return TRUE; + } + + /** + * Changes The Order of Individual Prefixes + */ + private function up1018_changeOrderOfIndividualPrefix() { + $optionValues = civicrm_api3('OptionValue', 'get', [ + 'option_group_id' => 'individual_prefix', + ]); + + $optionValues = $optionValues['values']; + foreach ($optionValues as $optionValueId => $optionValue) { + switch ($optionValue['name']) { + case 'Mr.': + $newWeight = 1; + break; + + case 'Mrs.': + $newWeight = 2; + break; + + case 'Ms.': + $newWeight = 3; + break; + + case 'Miss': + $newWeight = 4; + break; + + case 'Dr.': + $newWeight = 5; + break; + } + civicrm_api3('OptionValue', 'create', [ + 'id' => $optionValueId, + 'weight' => $newWeight, + ]); + } + } + +} From c6ca03a33a507b94db2efb8458fe25a8c6a29d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Thu, 21 Jun 2018 09:21:01 +0200 Subject: [PATCH 002/151] PCHR-3603: Rename "Line Manager" Relationship For old and new sites: Rename "Line manager" relationship 'Line Manager is' to 'Is Line Managed by' 'Line Manager' to 'Is Line Manager of' --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1020.php | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1020.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 2dd44cd6f67..cd2a87501db 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -26,6 +26,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1016; use CRM_HRCore_Upgrader_Steps_1017; use CRM_HRCore_Upgrader_Steps_1018; + use CRM_HRCore_Upgrader_Steps_1020; /** * @var array diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1020.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1020.php new file mode 100644 index 00000000000..97d2bc4dd25 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1020.php @@ -0,0 +1,31 @@ +up1020_renameLineManagerRelationship(); + + return TRUE; + } + + /** + * Renaming Line Manager Relationship + */ + private function up1020_renameLineManagerRelationship() { + $relationshipType = civicrm_api3('RelationshipType', 'get', [ + 'name_b_a' => 'Line Manager', + ]); + if (empty($relationshipType['values'])) { + return; + } + civicrm_api3('RelationshipType', 'create', [ + 'id' => $relationshipType['id'], + 'label_a_b' => 'Is Line Managed by', + 'label_b_a' => 'Is Line Manager of', + ]); + } + +} From a2c1bccc362b91b59d5a6ac3606399b5e458e2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Thu, 21 Jun 2018 09:43:45 +0200 Subject: [PATCH 003/151] PCHR-3603: Changing Rename to Relabel --- .../CRM/HRCore/Upgrader/Steps/1020.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1020.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1020.php index 97d2bc4dd25..cd22d0ff27f 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1020.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1020.php @@ -3,22 +3,22 @@ trait CRM_HRCore_Upgrader_Steps_1020 { /** - * Rename Line Manager Relationship + * Relabel Line Manager Relationship */ public function upgrade_1020() { - $this->up1020_renameLineManagerRelationship(); + $this->up1020_reLabelLineManagerRelationship(); return TRUE; } /** - * Renaming Line Manager Relationship + * ReLabeling Line Manager Relationship */ - private function up1020_renameLineManagerRelationship() { + private function up1020_reLabelLineManagerRelationship() { $relationshipType = civicrm_api3('RelationshipType', 'get', [ 'name_b_a' => 'Line Manager', ]); - if (empty($relationshipType['values'])) { + if (empty($relationshipType['id'])) { return; } civicrm_api3('RelationshipType', 'create', [ From 3b8991576ea1854634bba8b2402a5bd78cb10f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Thu, 21 Jun 2018 10:03:52 +0200 Subject: [PATCH 004/151] PCHR-3604: Changed the order of the Gender Options --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1021.php | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 2dd44cd6f67..9f91590d0a6 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -26,6 +26,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1016; use CRM_HRCore_Upgrader_Steps_1017; use CRM_HRCore_Upgrader_Steps_1018; + use CRM_HRCore_Upgrader_Steps_1021; /** * @var array diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php new file mode 100644 index 00000000000..0e0b3ca64d3 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php @@ -0,0 +1,44 @@ +up1021_setDefaultGenderOptions(); + + return TRUE; + } + + /** + * Changes The Order of Individual Prefixes + */ + private function up1021_setDefaultGenderOptions() { + $optionValues = civicrm_api3('OptionValue', 'get', [ + 'option_group_id' => 'gender', + ]); + + $optionValues = $optionValues['values']; + foreach ($optionValues as $optionValueId => $optionValue) { + switch ($optionValue['name']) { + case 'Male': + $newWeight = 1; + break; + + case 'Female': + $newWeight = 2; + break; + + case 'Other': + $newWeight = 3; + break; + } + civicrm_api3('OptionValue', 'create', [ + 'id' => $optionValueId, + 'weight' => $newWeight, + ]); + } + } + +} From 2e6ba746d094040b8c0c8c91a06e66be28f902a4 Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Thu, 21 Jun 2018 10:01:40 +0100 Subject: [PATCH 005/151] PCHR-3544: Hide fields for contact summary --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1021.php | 82 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index cd2a87501db..bdf96f8284f 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -27,6 +27,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1017; use CRM_HRCore_Upgrader_Steps_1018; use CRM_HRCore_Upgrader_Steps_1020; + use CRM_HRCore_Upgrader_Steps_1021; /** * @var array diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php new file mode 100644 index 00000000000..1b2783930e7 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php @@ -0,0 +1,82 @@ +up1021_getContactEditOptionValues(); + $optionValues = $this->up1021_getActiveContactEditOptionValues(); + + $activeOptionValues = array_diff($optionValues, $valuesRemoved); + civicrm_api3('Setting', 'create', [ + 'contact_edit_options' => $activeOptionValues, + ]); + + return TRUE; + } + + /** + * Retrieves active contact edit option setting value + * + * @return array + */ + private function up1021_getActiveContactEditOptionValues() { + $result = civicrm_api3('Setting', 'get', [ + 'sequential' => 1, + 'return' => ['contact_edit_options'], + ]); + + return $result['values'][0]['contact_edit_options']; + } + + /** + * Retrieves value for contact edit options to be removed + * + * @return array + */ + private function up1021_getContactEditOptionValues() { + $values = []; + $names = $this->up1021_getUnusedContactEditOptionNames(); + + $params = [ + 'sequential' => 1, + 'return' => ['value', 'name'], + 'option_group_id' => 'contact_edit_options', + 'is_active' => 1, + 'name' => ['IN' => $names] + ]; + + $optionValues = civicrm_api3('OptionValue', 'get', $params); + foreach ($optionValues['values'] as $optionValue) { + array_push($values, $optionValue['value']); + } + + return $values; + } + + /** + * Get names of contact edit options not in use + * + * @return array + */ + private function up1021_getUnusedContactEditOptionNames() { + $names = []; + + foreach (['Contact', 'IM', 'Website'] as $name) { + $params = ['return' => ['id']]; + if ($name == 'Contact') { + $params['suffix_id'] = ['IS NOT NULL' => 1]; + } + + $result = civicrm_api3($name, 'get', $params); + if ($result['count'] == 0) { + array_push($names, $name == 'Contact' ? 'Suffix' : $name); + } + } + + return $names; + } + +} From f3b4a6f407b66cafb8453054c7400712c052a20e Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Thu, 21 Jun 2018 12:45:52 +0100 Subject: [PATCH 006/151] PCHR-3544: PR Feedback - Code refactoring --- .../CRM/HRCore/Upgrader/Steps/1022.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1022.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1022.php index fbae2462b7a..3f885aa8bcf 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1022.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1022.php @@ -4,12 +4,14 @@ trait CRM_HRCore_Upgrader_Steps_1022 { /** * Hide Fields For Contact Summary + * + * @return bool */ public function upgrade_1022() { - $valuesRemoved = $this->up1022_getContactEditOptionValues(); - $optionValues = $this->up1022_getActiveContactEditOptionValues(); + $valuesToRemove = $this->up1022_getContactEditOptionValuesToRemove(); + $activeOptionValues = $this->up1022_getActiveContactEditOptionValues(); - $activeOptionValues = array_diff($optionValues, $valuesRemoved); + $activeOptionValues = array_diff($activeOptionValues, $valuesToRemove); civicrm_api3('Setting', 'create', [ 'contact_edit_options' => $activeOptionValues, ]); @@ -24,11 +26,10 @@ public function upgrade_1022() { */ private function up1022_getActiveContactEditOptionValues() { $result = civicrm_api3('Setting', 'get', [ - 'sequential' => 1, 'return' => ['contact_edit_options'], ]); - return $result['values'][0]['contact_edit_options']; + return $result['values'][$result['id']]['contact_edit_options']; } /** @@ -36,21 +37,20 @@ private function up1022_getActiveContactEditOptionValues() { * * @return array */ - private function up1022_getContactEditOptionValues() { + private function up1022_getContactEditOptionValuesToRemove() { $values = []; $names = $this->up1022_getUnusedContactEditOptionNames(); $params = [ - 'sequential' => 1, 'return' => ['value', 'name'], 'option_group_id' => 'contact_edit_options', 'is_active' => 1, 'name' => ['IN' => $names] ]; - $optionValues = civicrm_api3('OptionValue', 'get', $params); - foreach ($optionValues['values'] as $optionValue) { - array_push($values, $optionValue['value']); + $results = civicrm_api3('OptionValue', 'get', $params); + foreach ($results['values'] as $result) { + array_push($values, $result['value']); } return $values; @@ -66,13 +66,13 @@ private function up1022_getUnusedContactEditOptionNames() { foreach (['Contact', 'IM', 'Website'] as $name) { $params = ['return' => ['id']]; - if ($name == 'Contact') { + if ($name === 'Contact') { $params['suffix_id'] = ['IS NOT NULL' => 1]; } $result = civicrm_api3($name, 'get', $params); if ($result['count'] == 0) { - array_push($names, $name == 'Contact' ? 'Suffix' : $name); + array_push($names, $name === 'Contact' ? 'Suffix' : $name); } } From e14e0f90543eec410eb99365575fc70f5bef056c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Thu, 21 Jun 2018 14:59:34 +0200 Subject: [PATCH 007/151] PCHR-3536: Fixing merge conflicts --- .../CRM/HRCore/Upgrader/Steps/1018.php | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php new file mode 100644 index 00000000000..1b1277168d7 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php @@ -0,0 +1,222 @@ +up1018_createPersonalLocationType(); + $this->up1018_migrateLocationTypes(); + $this->up1018_setDefaultLocationType('Work'); + $this->up1018_reserveLocationTypes(['Work', 'Personal']); + $this->up1018_disableLocationType('Billing'); + $this->up1018_deleteLocationTypes(['Home', 'Correspondence', 'Main', 'Other']); + + return TRUE; + } + + /** + * The "Personal" location type should be created by the CiviHR installer + * script, but it could have been deleted so we need to ensure it exists + * before using it and making it reserved. + */ + private function up1018_createPersonalLocationType() { + $params = [ + 'name' => 'Personal', + 'description' => 'Place of Residence', + 'display_name' => 'Personal', + 'vcard_name' => 'PERSONAL', + ]; + + $existingId = $this->up1018_getLocationTypeID('Personal'); + if ($existingId) { + $params['id'] = $existingId; + } + + $result = civicrm_api3('LocationType', 'create', $params); + + // update the cached IDs + $this->up1018_locationTypeIds['Personal'] = $result['id']; + } + + /** + * Migrates location type data from one type to another + */ + private function up1018_migrateLocationTypes() { + // All these entities have a reference to location_type_id + $entityTypesToMigrate = [ + 'Address', + 'Email', + 'IM', + 'Mailing', + 'OpenID', + 'MappingField', + 'Phone', + 'UFField' + ]; + // This is the map of old location type names to new ones + $locationTypeMap = [ + 'Billing' => 'Personal', + 'Home' => 'Personal', + 'Main' => 'Personal', + 'Other' => 'Personal', + ]; + $locationTypeMap = $this->up1018_convertLocationNamesToIds($locationTypeMap); + + foreach ($locationTypeMap as $oldLocationId => $newLocationId) { + foreach ($entityTypesToMigrate as $entityName) { + $this->up1018_updateLocationTypeForEntities( + $entityName, + $oldLocationId, + $newLocationId + ); + } + } + } + + /** + * Sets the default location type + * + * @param string $locationType + */ + private function up1018_setDefaultLocationType($locationType) { + $locationTypeId = $this->up1018_getLocationTypeID($locationType); + + civicrm_api3('LocationType', 'create', [ + 'id' => $locationTypeId, + 'is_default' => TRUE + ]); + } + + /** + * Sets all given location types as reserved + * + * @param array $locationTypes + */ + private function up1018_reserveLocationTypes($locationTypes) { + foreach ($locationTypes as $locationType) { + $locationTypeId = $this->up1018_getLocationTypeID($locationType); + civicrm_api3('LocationType', 'create', [ + 'id' => $locationTypeId, + 'is_reserved' => TRUE + ]); + } + } + + /** + * Sets the given location type to be not active + * + * @param string $locationType + */ + private function up1018_disableLocationType($locationType) { + $locationTypeId = $this->up1018_getLocationTypeID($locationType); + civicrm_api3('LocationType', 'create', [ + 'id' => $locationTypeId, + 'is_active' => FALSE + ]); + } + + /** + * Deletes all given location types if they exist + * + * @param array $locationTypes + */ + private function up1018_deleteLocationTypes($locationTypes) { + foreach ($locationTypes as $locationType) { + $locationTypeId = $this->up1018_getLocationTypeID($locationType); + if ($locationTypeId) { + civicrm_api3('LocationType', 'delete', ['id' => $locationTypeId]); + } + } + } + + /** + * Fetch all entities of a given type with a certain location type, then + * update them to have the new location type + * + * @param string $entityName + * @param int $oldLocationId + * @param int $newLocationId + */ + private function up1018_updateLocationTypeForEntities( + $entityName, + $oldLocationId, + $newLocationId + ) { + $params = ['location_type_id' => $oldLocationId, 'return' => ['id']]; + + // UFField is wacky for updates. It complains about missing fields and + // does a dupe check that disregards whether you're trying to update, so + // we return all the existing params for use in the update + if ($entityName === 'UFField') { + unset($params['return']); + } + + $entitiesToMigrate = civicrm_api3($entityName, 'get', $params); + + foreach ($entitiesToMigrate['values'] as $entity) { + $entity['location_type_id'] = $newLocationId; + civicrm_api3($entityName, 'create', $entity); + } + } + + /** + * Convert location type names to their IDs. This is required for now since + * not all API endpoints support sending a string location type + * + * @param array $locationTypeMap + * + * @return array + */ + private function up1018_convertLocationNamesToIds($locationTypeMap) { + $locationTypeIds = $this->up1018_getLocationTypeIds(); + + foreach ($locationTypeMap as $oldLocationName => $newLocationName) { + + unset($locationTypeMap[$oldLocationName]); + $oldLocationId = CRM_Utils_Array::value($oldLocationName, $locationTypeIds); + $newLocationId = CRM_Utils_Array::value($newLocationName, $locationTypeIds); + + if ($oldLocationId && $newLocationId) { + $locationTypeMap[$oldLocationId] = $newLocationId; + } + } + + return $locationTypeMap; + } + + /** + * Looks up the location type ID for a given location type name + * + * @param string $locationTypeName + * + * @return int|null + */ + private function up1018_getLocationTypeID($locationTypeName) { + $locationIds = $this->up1018_getLocationTypeIds(); + $existing = CRM_Utils_Array::value($locationTypeName, $locationIds); + + return $existing ? (int) $existing : NULL; + } + + /** + * Gets a list of location type names mapped to their database ID + * + * @return array + */ + private function up1018_getLocationTypeIds() { + if (empty($this->up1018_locationTypeIds)) { + $locationTypeIds = civicrm_api3('LocationType', 'get')['values']; + $this->up1018_locationTypeIds = array_column($locationTypeIds, 'id', 'name'); + } + + return $this->up1018_locationTypeIds; + } + +} From 45176dd82be3b288b179f6f8e5baa2f6f275c6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Thu, 21 Jun 2018 15:08:37 +0200 Subject: [PATCH 008/151] PCHR-3536: Fixing Merge Conflicts --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1023.php | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index d23572bbb86..4bb164fd24b 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -30,6 +30,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1020; use CRM_HRCore_Upgrader_Steps_1021; use CRM_HRCore_Upgrader_Steps_1022; + use CRM_HRCore_Upgrader_Steps_1023; /** diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php new file mode 100644 index 00000000000..76fa7e3c354 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php @@ -0,0 +1,52 @@ +up1023_changeOrderOfIndividualPrefix(); + + return TRUE; + } + + /** + * Changes The Order of Individual Prefixes + */ + private function up1023_changeOrderOfIndividualPrefix() { + $optionValues = civicrm_api3('OptionValue', 'get', [ + 'option_group_id' => 'individual_prefix', + ]); + + $optionValues = $optionValues['values']; + foreach ($optionValues as $optionValueId => $optionValue) { + switch ($optionValue['name']) { + case 'Mr.': + $newWeight = 1; + break; + + case 'Mrs.': + $newWeight = 2; + break; + + case 'Ms.': + $newWeight = 3; + break; + + case 'Miss': + $newWeight = 4; + break; + + case 'Dr.': + $newWeight = 5; + break; + } + civicrm_api3('OptionValue', 'create', [ + 'id' => $optionValueId, + 'weight' => $newWeight, + ]); + } + } + +} From 0c8ded24bc54f888cac14501016fa0cdaaac62fc Mon Sep 17 00:00:00 2001 From: Elisio Leonardo Date: Wed, 20 Jun 2018 21:51:41 +0200 Subject: [PATCH 009/151] PCHR-3546: Made all currencies available for new installations --- .../CRM/HRCore/Upgrader.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 4bb164fd24b..68e6e118732 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -71,6 +71,7 @@ public function install() { $this->createRequiredLocationTypes(); $this->deleteUnneededCustomGroups(); $this->createDefaultRelationshipTypes(); + $this->makeAllCurrenciesAvailable(); $this->runAllUpgraders(); } @@ -223,6 +224,29 @@ private function createDefaultRelationshipTypes() { } } + /** + * Making All Currencies Available for new installations + */ + private function makeAllCurrenciesAvailable() { + $result = civicrm_api3('OptionValue', 'get', [ + 'return' => ['name'], + 'option_group_id' => 'currencies_enabled', + ]); + $enabledCurrencies = array_column($result['values'], 'name'); + + $dao = CRM_Core_DAO::executeQuery('SELECT * from civicrm_currency'); + while ($dao->fetch()) { + if (!in_array($dao->name, $enabledCurrencies)) { + civicrm_api3('OptionValue', 'create', [ + 'option_group_id' => 'currencies_enabled', + 'label' => $dao->name . ' (' . $dao->symbol . ')', + 'value' => $dao->name, + 'name' => $dao->name . ' (' . $dao->symbol . ')', + ]); + } + } + } + /** * Removes default relationship types */ From 28b7bf78209f541c37e855a3da439c2d3be4dea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Fri, 22 Jun 2018 09:43:32 +0200 Subject: [PATCH 010/151] PCHR-3606: Remove Some Social Accounts and Reorder the Remaining --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1024.php | 74 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1024.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 68e6e118732..e2a1ce41df6 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -31,6 +31,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1021; use CRM_HRCore_Upgrader_Steps_1022; use CRM_HRCore_Upgrader_Steps_1023; + use CRM_HRCore_Upgrader_Steps_1024; /** diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1024.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1024.php new file mode 100644 index 00000000000..a86549c941d --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1024.php @@ -0,0 +1,74 @@ +up1024_removeSocialAccountOptions([ + 'Work', + 'MySpace', + 'Vine', + 'Google+', + 'Snapchat', + 'Tumblr', + ]); + $this->up1024_reorderSocialAccountOptions([ + 'LinkedIn', + 'Twitter', + 'Facebook', + ]); + + return TRUE; + } + + /** + * Removes Some Social Account Options + */ + private function up1024_removeSocialAccountOptions($accounts) { + $socialAccounts = civicrm_api3('OptionValue', 'get', [ + 'option_group_id' => 'website_type', + 'name' => ['IN' => $accounts], + ]); + + $socialAccounts = $socialAccounts['values']; + foreach ($socialAccounts as $optionValueId => $optionValue) { + civicrm_api3('OptionValue', 'delete', [ + 'id' => $optionValueId, + ]); + } + } + + /** + * Reorder Social Accounts + */ + private function up1024_reorderSocialAccountOptions($accounts) { + $socialAccounts = civicrm_api3('OptionValue', 'get', [ + 'option_group_id' => 'website_type', + 'name' => ['IN' => $accounts], + ]); + + $socialAccounts = $socialAccounts['values']; + foreach ($socialAccounts as $optionValueId => $optionValue) { + switch ($optionValue['name']) { + case 'LinkedIn': + $newWeight = 1; + break; + + case 'Twitter': + $newWeight = 2; + break; + + case 'Facebook': + $newWeight = 3; + break; + } + civicrm_api3('OptionValue', 'create', [ + 'id' => $optionValueId, + 'weight' => $newWeight, + ]); + } + } + +} From 5b92160f4dbed15d7eabd39402da7669326d8197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Fri, 29 Jun 2018 09:17:03 +0200 Subject: [PATCH 011/151] PCHR-3606: If a social account is used, only disable it --- .../CRM/HRCore/Upgrader/Steps/1024.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1024.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1024.php index a86549c941d..e2f24bc8686 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1024.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1024.php @@ -3,7 +3,7 @@ trait CRM_HRCore_Upgrader_Steps_1024 { /** - * Remove Social Account Options and reorder de remaining + * Removes social account options and reorder the remaining */ public function upgrade_1024() { $this->up1024_removeSocialAccountOptions([ @@ -24,7 +24,7 @@ public function upgrade_1024() { } /** - * Removes Some Social Account Options + * Removes some social account options if not used, and disable it if used */ private function up1024_removeSocialAccountOptions($accounts) { $socialAccounts = civicrm_api3('OptionValue', 'get', [ @@ -34,9 +34,21 @@ private function up1024_removeSocialAccountOptions($accounts) { $socialAccounts = $socialAccounts['values']; foreach ($socialAccounts as $optionValueId => $optionValue) { - civicrm_api3('OptionValue', 'delete', [ - 'id' => $optionValueId, + $socialAccountIsUsed = civicrm_api3('Website', 'get', [ + 'website_type_id' => $optionValue['name'], + 'url' => ['IS NOT NULL' => 1], ]); + if ($socialAccountIsUsed['count'] == 0) { + civicrm_api3('OptionValue', 'delete', [ + 'id' => $optionValueId, + ]); + } + else { + civicrm_api3('OptionValue', 'create', [ + 'id' => $optionValueId, + 'is_active' => 0, + ]); + } } } From 9d56520413a5cb59a482fd41ecedc5d0e4453b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Mon, 2 Jul 2018 10:52:00 +0200 Subject: [PATCH 012/151] PCHR-3605: Deletes Some Instant Messenger Options and Disable if Used --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1025.php | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1025.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index e2a1ce41df6..71c3bcdb82e 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -32,6 +32,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1022; use CRM_HRCore_Upgrader_Steps_1023; use CRM_HRCore_Upgrader_Steps_1024; + use CRM_HRCore_Upgrader_Steps_1025; /** diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1025.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1025.php new file mode 100644 index 00000000000..757c591aefc --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1025.php @@ -0,0 +1,47 @@ +up1025_removeInstantMessengerOptions([ + 'Yahoo', + 'MSN', + 'AIM', + 'Jabber', + ]); + + return TRUE; + } + + /** + * Removes some instant messenger options if not used, and disable it if used + */ + private function up1025_removeInstantMessengerOptions($accounts) { + $socialAccounts = civicrm_api3('OptionValue', 'get', [ + 'option_group_id' => 'instant_messenger_service', + 'name' => ['IN' => $accounts], + ]); + + $socialAccounts = $socialAccounts['values']; + foreach ($socialAccounts as $optionValueId => $optionValue) { + $socialAccountIsUsed = civicrm_api3('Im', 'get', [ + 'provider_id' => $optionValue['name'], + ]); + if ($socialAccountIsUsed['count'] == 0) { + civicrm_api3('OptionValue', 'delete', [ + 'id' => $optionValueId, + ]); + } + else { + civicrm_api3('OptionValue', 'create', [ + 'id' => $optionValueId, + 'is_active' => 0, + ]); + } + } + } + +} From d0f60ece7cc15cb37341f6732b291052f221a0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Tue, 3 Jul 2018 18:17:05 +0200 Subject: [PATCH 013/151] PCHR-3605: Extracted some logic to their own method and renamed the main method --- .../CRM/HRCore/Upgrader/Steps/1025.php | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1025.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1025.php index 757c591aefc..bf15657c0b9 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1025.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1025.php @@ -4,9 +4,11 @@ trait CRM_HRCore_Upgrader_Steps_1025 { /** * Removes Instant Messenger options + * + * @return bool */ public function upgrade_1025() { - $this->up1025_removeInstantMessengerOptions([ + $this->up1025_deleteOrDisableSocialAccounts([ 'Yahoo', 'MSN', 'AIM', @@ -19,7 +21,7 @@ public function upgrade_1025() { /** * Removes some instant messenger options if not used, and disable it if used */ - private function up1025_removeInstantMessengerOptions($accounts) { + private function up1025_deleteOrDisableSocialAccounts($accounts) { $socialAccounts = civicrm_api3('OptionValue', 'get', [ 'option_group_id' => 'instant_messenger_service', 'name' => ['IN' => $accounts], @@ -31,17 +33,31 @@ private function up1025_removeInstantMessengerOptions($accounts) { 'provider_id' => $optionValue['name'], ]); if ($socialAccountIsUsed['count'] == 0) { - civicrm_api3('OptionValue', 'delete', [ - 'id' => $optionValueId, - ]); + $this->up1025_deleteSocialAccount($optionValueId); } else { - civicrm_api3('OptionValue', 'create', [ - 'id' => $optionValueId, - 'is_active' => 0, - ]); + $this->up1025_disableSocialAccount($optionValueId); } } } + /** + * @param int $optionValueId + */ + private function up1025_deleteSocialAccount($optionValueId) { + civicrm_api3('OptionValue', 'delete', [ + 'id' => $optionValueId, + ]); + } + + /** + * @param int $optionValueId + */ + private function up1025_disableSocialAccount($optionValueId) { + civicrm_api3('OptionValue', 'create', [ + 'id' => $optionValueId, + 'is_active' => 0, + ]); + } + } From 88b146a738304221e1b1fa588fe69b77070da07e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Wed, 4 Jul 2018 15:17:51 +0200 Subject: [PATCH 014/151] PCHR-3608: Makes contract length read only and hides it from Personal Details Screen --- hrjobcontract/CRM/Hrjobcontract/Upgrader.php | 30 +++++++++++++++++++- hrjobcontract/xml/length_of_service.xml | 20 +------------ 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/hrjobcontract/CRM/Hrjobcontract/Upgrader.php b/hrjobcontract/CRM/Hrjobcontract/Upgrader.php index a858562a875..f8fe3661a15 100755 --- a/hrjobcontract/CRM/Hrjobcontract/Upgrader.php +++ b/hrjobcontract/CRM/Hrjobcontract/Upgrader.php @@ -515,6 +515,7 @@ public function upgradeBundle() { $this->upgrade_1034(); $this->upgrade_1035(); $this->upgrade_1036(); + $this->upgrade_1037(); } function upgrade_1001() { @@ -1192,7 +1193,7 @@ public function upgrade_1035() { 'HRJob_Summary', 'HRJobContract_Summary' ]; - + $result = civicrm_api3('CustomGroup', 'get', [ 'return' => ['id', 'name'], 'name' => ['IN' => $customGroups], @@ -1261,6 +1262,33 @@ public function upgrade_1036() { return TRUE; } + /** + * Updates the custom field to view only and disables the custom group + * + * @return bool + */ + public function upgrade_1037() { + $customField = civicrm_api3('CustomField', 'get', [ + 'name' => 'Length_Of_Service', + ]); + civicrm_api3('CustomField', 'create', [ + 'id' => $customField['id'], + 'is_view' => 1, + ] + ); + + $customGroup = civicrm_api3('CustomGroup', 'get', [ + 'name' => 'Contact_Length_Of_Service', + ]); + civicrm_api3('CustomGroup', 'create', [ + 'id' => $customGroup['id'], + 'is_active' => 0, + ] + ); + + return TRUE; + } + /** * Creates a navigation menu item using the API * diff --git a/hrjobcontract/xml/length_of_service.xml b/hrjobcontract/xml/length_of_service.xml index 4209db8c033..e0168f9b729 100644 --- a/hrjobcontract/xml/length_of_service.xml +++ b/hrjobcontract/xml/length_of_service.xml @@ -19,23 +19,5 @@ - - Length_Of_Service - - Int - Text - 0 - 1 - 0 - 1 - 1 - 0 - 16 - 60 - 4 - length_of_service - Contact_Length_Of_Service - 1 - - \ No newline at end of file + From 8d6fc735a4081410e2614c8be3ed259cc4e7eaad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Wed, 4 Jul 2018 17:20:57 +0200 Subject: [PATCH 015/151] PCHR-3608: Field should not be removed on XML and chained the API calls --- hrjobcontract/CRM/Hrjobcontract/Upgrader.php | 16 ++++------------ hrjobcontract/xml/length_of_service.xml | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/hrjobcontract/CRM/Hrjobcontract/Upgrader.php b/hrjobcontract/CRM/Hrjobcontract/Upgrader.php index f8fe3661a15..2505c2c6a1c 100755 --- a/hrjobcontract/CRM/Hrjobcontract/Upgrader.php +++ b/hrjobcontract/CRM/Hrjobcontract/Upgrader.php @@ -1268,23 +1268,15 @@ public function upgrade_1036() { * @return bool */ public function upgrade_1037() { - $customField = civicrm_api3('CustomField', 'get', [ + civicrm_api3('CustomField', 'get', [ 'name' => 'Length_Of_Service', + 'api.CustomField.create' => ['id' => '$value.id', 'is_view' => 1], ]); - civicrm_api3('CustomField', 'create', [ - 'id' => $customField['id'], - 'is_view' => 1, - ] - ); - $customGroup = civicrm_api3('CustomGroup', 'get', [ + civicrm_api3('CustomGroup', 'get', [ 'name' => 'Contact_Length_Of_Service', + 'api.CustomGroup.create' => ['id' => '$value.id', 'is_active' => 0], ]); - civicrm_api3('CustomGroup', 'create', [ - 'id' => $customGroup['id'], - 'is_active' => 0, - ] - ); return TRUE; } diff --git a/hrjobcontract/xml/length_of_service.xml b/hrjobcontract/xml/length_of_service.xml index e0168f9b729..41c12f465fd 100644 --- a/hrjobcontract/xml/length_of_service.xml +++ b/hrjobcontract/xml/length_of_service.xml @@ -19,5 +19,23 @@ + + Length_Of_Service + + Int + Text + 0 + 1 + 0 + 1 + 1 + 1 + 16 + 60 + 4 + length_of_service + Contact_Length_Of_Service + 1 + From ff6723edaab20068f7e39eeabb1c2a57f735f885 Mon Sep 17 00:00:00 2001 From: Elisio Leonardo Date: Wed, 11 Jul 2018 10:06:20 +0200 Subject: [PATCH 016/151] PCHR-3602 Hides disabled relationship Types from non-root admins --- .../Hook/PageRun/RelationshipTypesFilter.php | 37 +++++++++++++++++++ uk.co.compucorp.civicrm.hrcore/hrcore.php | 1 + 2 files changed, 38 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/PageRun/RelationshipTypesFilter.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/PageRun/RelationshipTypesFilter.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/PageRun/RelationshipTypesFilter.php new file mode 100644 index 00000000000..2a6aba312dd --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/PageRun/RelationshipTypesFilter.php @@ -0,0 +1,37 @@ +shouldHandle($page)) { + return; + } + + $rows = $page->get_template_vars('rows'); + // remove disabled relationship types + foreach ($rows as $index => $row) { + if (CRM_Utils_Array::value('is_active', $row) == '0'&& in_array(CRM_Utils_Array::value('name', $row),['Case Coordinator is','Employee of','Head of Household for','Household member of'])) { + unset($rows[$index]); + } + } + $page->assign('rows', $rows); + } + + /** + * Checks if this is the right page + * + * @param CRM_Core_Page $page + * + * @return bool + */ + public function shouldHandle($page) { + global $user; + return $page instanceof CRM_Admin_Page_RelationshipType && !in_array('administrator', $user->roles); + } + +} diff --git a/uk.co.compucorp.civicrm.hrcore/hrcore.php b/uk.co.compucorp.civicrm.hrcore/hrcore.php index 5348cddb0fd..be8e1d7ab98 100644 --- a/uk.co.compucorp.civicrm.hrcore/hrcore.php +++ b/uk.co.compucorp.civicrm.hrcore/hrcore.php @@ -286,6 +286,7 @@ function hrcore_civicrm_pageRun($page) { $hooks = [ new CRM_HRCore_Hook_PageRun_LocationTypeFilter(), + new CRM_HRCore_Hook_PageRun_RelationshipTypesFilter(), ]; foreach ($hooks as $hook) { From 7ed2530c5081da0bbbcbf34dd85a698f213292c8 Mon Sep 17 00:00:00 2001 From: Elisio Leonardo Date: Wed, 11 Jul 2018 09:08:37 +0200 Subject: [PATCH 017/151] PCHR-3607: Delete Default Groups and Hides One of Them --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1026.php | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1026.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 71c3bcdb82e..03991f6ccbc 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -33,6 +33,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1023; use CRM_HRCore_Upgrader_Steps_1024; use CRM_HRCore_Upgrader_Steps_1025; + use CRM_HRCore_Upgrader_Steps_1026; /** diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1026.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1026.php new file mode 100644 index 00000000000..b89177a0525 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1026.php @@ -0,0 +1,58 @@ +up1026_deleteDefaultGroups([ + 'Advisory board', + 'Newsletter Subscribers', + 'Summer Program Volunteers', + 'Administrators', + ]); + + $this->up1026_disableAndHideDefaultGroup('Case_Resources'); + + return TRUE; + } + + /** + * Deletes the Groups passed by params + * + * @param array $groupsToDelete + */ + private function up1026_deleteDefaultGroups($groupsToDelete) { + $groups = civicrm_api3('Group', 'get', [ + 'name' => ['IN' => $groupsToDelete], + ]); + + $groups = $groups['values']; + foreach ($groups as $groupId => $group) { + civicrm_api3('Group', 'delete', [ + 'id' => $groupId, + ]); + } + } + + /** + * Disable and Hide Groups Passed By Params + * + * @param string $groupToHide + */ + private function up1026_disableAndHideDefaultGroup($groupToHide) { + $group = civicrm_api3('Group', 'get', [ + 'name' => $groupToHide, + ]); + + civicrm_api3('Group', 'create', [ + 'id' => $group['id'], + 'is_hidden' => 1, + 'is_active' => 0, + ]); + } + +} From 20c60c6f131852a8a1879b100e42f3a20fc3840e Mon Sep 17 00:00:00 2001 From: Elisio Leonardo Date: Wed, 11 Jul 2018 12:16:00 +0200 Subject: [PATCH 018/151] PCHR-3602: PR Feedback --- .../Hook/PageRun/RelationshipTypesFilter.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/PageRun/RelationshipTypesFilter.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/PageRun/RelationshipTypesFilter.php index 2a6aba312dd..24f1d4cb155 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/PageRun/RelationshipTypesFilter.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/PageRun/RelationshipTypesFilter.php @@ -13,9 +13,18 @@ public function handle($page) { } $rows = $page->get_template_vars('rows'); + + $targetRelTypes = [ + 'Case Coordinator is', + 'Employee of', + 'Head of Household for', + 'Household member of', + ]; // remove disabled relationship types foreach ($rows as $index => $row) { - if (CRM_Utils_Array::value('is_active', $row) == '0'&& in_array(CRM_Utils_Array::value('name', $row),['Case Coordinator is','Employee of','Head of Household for','Household member of'])) { + $isActive = CRM_Utils_Array::value('is_active', $row) == '1'; + $isTargetType = in_array(CRM_Utils_Array::value('name', $row), $targetRelTypes); + if (!$isActive && $isTargetType) { unset($rows[$index]); } } @@ -31,7 +40,9 @@ public function handle($page) { */ public function shouldHandle($page) { global $user; - return $page instanceof CRM_Admin_Page_RelationshipType && !in_array('administrator', $user->roles); + $isRootAdmin = in_array('administrator', $user->roles); + + return $page instanceof CRM_Admin_Page_RelationshipType && !$isRootAdmin; } } From 3f8d4442d90146d7c1fa92b71f773ed8f8e7b3c4 Mon Sep 17 00:00:00 2001 From: Elisio Leonardo Date: Wed, 11 Jul 2018 14:03:39 +0200 Subject: [PATCH 019/151] PCHR-3607: changed to chained API calls --- .../CRM/HRCore/Upgrader/Steps/1026.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1026.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1026.php index b89177a0525..4daf9733c4f 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1026.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1026.php @@ -28,14 +28,8 @@ public function upgrade_1026() { private function up1026_deleteDefaultGroups($groupsToDelete) { $groups = civicrm_api3('Group', 'get', [ 'name' => ['IN' => $groupsToDelete], + 'api.Group.delete' => ['id' => '$value.id'], ]); - - $groups = $groups['values']; - foreach ($groups as $groupId => $group) { - civicrm_api3('Group', 'delete', [ - 'id' => $groupId, - ]); - } } /** @@ -46,12 +40,11 @@ private function up1026_deleteDefaultGroups($groupsToDelete) { private function up1026_disableAndHideDefaultGroup($groupToHide) { $group = civicrm_api3('Group', 'get', [ 'name' => $groupToHide, - ]); - - civicrm_api3('Group', 'create', [ - 'id' => $group['id'], - 'is_hidden' => 1, - 'is_active' => 0, + 'api.Group.create' => [ + 'id' => '$value.id', + 'is_hidden' => 1, + 'is_active' => 0, + ], ]); } From 5af61dd9a8b94e3010ec0bdd678c5c7cd8748b70 Mon Sep 17 00:00:00 2001 From: Davi Alexandre Date: Mon, 16 Jul 2018 13:53:26 -0300 Subject: [PATCH 020/151] PCHR-3983: Fix hrcore installation issues related to enabling currencies --- .../CRM/HRCore/Upgrader.php | 4 ++-- .../CRM/HRCore/Upgrader/Steps/1000.php | 17 +---------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 53b9c503424..fc39f28d96f 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -232,10 +232,10 @@ private function createDefaultRelationshipTypes() { */ private function makeAllCurrenciesAvailable() { $result = civicrm_api3('OptionValue', 'get', [ - 'return' => ['name'], + 'return' => ['value'], 'option_group_id' => 'currencies_enabled', ]); - $enabledCurrencies = array_column($result['values'], 'name'); + $enabledCurrencies = array_column($result['values'], 'value'); $dao = CRM_Core_DAO::executeQuery('SELECT * from civicrm_currency'); while ($dao->fetch()) { diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1000.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1000.php index e17681c5eb8..806dff4e9c7 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1000.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1000.php @@ -45,8 +45,7 @@ private function up1000_downloadUKEnglish() { /** * Updates the default localization settings which includes : - * 1- setting the default currency to GBP and adding it to - * enabled currencies list. + * 1- setting the default currency to GBP * 2- setting the default date formats * 3- setting the default country to UK * 4- setting the system language to UK english (en_GB) @@ -72,20 +71,6 @@ private function up1000_updateLocalisationSettings() { } civicrm_api3('Setting', 'create', $settings); - - $currenciesToEnable = [ - ['EUR (€)','EUR', 0], - ]; - - foreach ($currenciesToEnable as $currency) { - civicrm_api3('OptionValue', 'create', [ - 'option_group_id' => 'currencies_enabled', - 'label' => $currency[0], - 'value' => $currency[1], - 'is_default' => $currency[2], - 'is_active' => 1, - ]); - } } /** From ba439cb546b61b4db2152868e83c6e1a385f2b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Mon, 16 Jul 2018 16:43:29 +0200 Subject: [PATCH 021/151] PCHR-3975: Disable Prefer Not To Say Gender Option --- .../CRM/HRCore/Upgrader/Steps/1021.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php index 0e0b3ca64d3..46ced511050 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1021.php @@ -7,6 +7,7 @@ trait CRM_HRCore_Upgrader_Steps_1021 { */ public function upgrade_1021() { $this->up1021_setDefaultGenderOptions(); + $this->up1021_disableDefaultGenderOptions('Prefer not to say'); return TRUE; } @@ -41,4 +42,12 @@ private function up1021_setDefaultGenderOptions() { } } + private function up1021_disableDefaultGenderOptions($genderOption) { + civicrm_api3('OptionValue', 'get', [ + 'option_group_id' => 'gender', + 'name' => $genderOption, + 'api.OptionValue.create' => ['id' => '$value.id', 'is_active' => 0], + ]); + } + } From 7c921f47073b318328a9ae3b5b0f86154f73172d Mon Sep 17 00:00:00 2001 From: Davi Alexandre Date: Mon, 16 Jul 2018 13:53:26 -0300 Subject: [PATCH 022/151] PCHR-3983: Fix hrcore installation issues related to enabling currencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In CiviCRM, the list of enabled currencies is stored as Option Values under the `currencies_enabled` Option Group. Each Option Value there represents one enabled currency. The name of the Option Value follows the format "CURRENCY ABBREVIATION (CURRENCY SYMBOL)" (for example "GBP (£)"). The value of only the the Abbrenviation. The list of available currencies is stored in the `civicrm_currency` table, which has two fields of relevance here: `name` and `symbol`. Name is used to store only the abbreviantion (e.g. GBP). The code added in hrcore to make all the currencies enabled look like this: ```php private function makeAllCurrenciesAvailable() { $result = civicrm_api3('OptionValue', 'get', [ 'return' => ['name'], 'option_group_id' => 'currencies_enabled', ]); $enabledCurrencies = array_column($result['values'], 'name'); $dao = CRM_Core_DAO::executeQuery('SELECT * from civicrm_currency'); while ($dao->fetch()) { if (!in_array($dao->name, $enabledCurrencies)) { civicrm_api3('OptionValue', 'create', [ 'option_group_id' => 'currencies_enabled', 'label' => $dao->name . ' (' . $dao->symbol . ')', 'value' => $dao->name, 'name' => $dao->name . ' (' . $dao->symbol . ')', ]); } } } ``` As it is possible to see, first it gets a list of the names of all the Option Values representing enabled currencies. Next, to check if a currency is already enabled, it compares that name to the ones returned frrom the `civicrm_currency` table. Unfortunately, as mentioned before, the format of the Option Value name is different from the name what we have in the `civicrm_currency` table (the former has something like "GBP (£)" while the latter has only "GBP"). Since they don't match, the logic thinks the currency is not yet enabled and tries to enable it by creating a new Option Value. This worked fine for CiviCRM 4.7.27, but 4.7.28 (https://github.com/civicrm/civicrm-core/pull/11089), it is not possible to have more than one option value with the same value in the same option group. So, when we try to insert a new Option Value to a currency that is already enabled, we end up with that "value already exists in the database" error. To fix this, I've changed the code that fetches the already enabled currencies to load the Option Value value instead of the name. The value contains only the Abbreviation, which is the same we have in the `civicrm_currency` table and this make the comparison work as expected. After fixing that, I got a new error still related to enabling currencies. One of the things done by the upgrade step `1000.php`, was to enable the `EUR` currency, but since now this is done by `makeAllCurrenciesAvailable()` it was resulting in the same error of the currency already being enabled. To fix that, I simply removed the code to enable `EUR` from `1000.php`. --- .../CRM/HRCore/Upgrader.php | 4 ++-- .../CRM/HRCore/Upgrader/Steps/1000.php | 17 +---------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 53b9c503424..fc39f28d96f 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -232,10 +232,10 @@ private function createDefaultRelationshipTypes() { */ private function makeAllCurrenciesAvailable() { $result = civicrm_api3('OptionValue', 'get', [ - 'return' => ['name'], + 'return' => ['value'], 'option_group_id' => 'currencies_enabled', ]); - $enabledCurrencies = array_column($result['values'], 'name'); + $enabledCurrencies = array_column($result['values'], 'value'); $dao = CRM_Core_DAO::executeQuery('SELECT * from civicrm_currency'); while ($dao->fetch()) { diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1000.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1000.php index e17681c5eb8..806dff4e9c7 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1000.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1000.php @@ -45,8 +45,7 @@ private function up1000_downloadUKEnglish() { /** * Updates the default localization settings which includes : - * 1- setting the default currency to GBP and adding it to - * enabled currencies list. + * 1- setting the default currency to GBP * 2- setting the default date formats * 3- setting the default country to UK * 4- setting the system language to UK english (en_GB) @@ -72,20 +71,6 @@ private function up1000_updateLocalisationSettings() { } civicrm_api3('Setting', 'create', $settings); - - $currenciesToEnable = [ - ['EUR (€)','EUR', 0], - ]; - - foreach ($currenciesToEnable as $currency) { - civicrm_api3('OptionValue', 'create', [ - 'option_group_id' => 'currencies_enabled', - 'label' => $currency[0], - 'value' => $currency[1], - 'is_default' => $currency[2], - 'is_active' => 1, - ]); - } } /** From 5843ff76055e1c3845934ed821e00533096e1777 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Fri, 20 Jul 2018 10:59:53 +0200 Subject: [PATCH 023/151] PCHR-3944: Update AngularJS to 1.6.10 --- .../js/dist/reqangular.min.js | 68 +- .../vendor/angular/angular-animate.min.js | 106 +-- .../common/vendor/angular/angular-mocks.js | 607 ++++++++++++---- .../vendor/angular/angular-resource.min.js | 22 +- .../vendor/angular/angular-route.min.js | 25 +- .../src/common/vendor/angular/angular.min.js | 650 +++++++++--------- 6 files changed, 931 insertions(+), 547 deletions(-) diff --git a/org.civicrm.reqangular/js/dist/reqangular.min.js b/org.civicrm.reqangular/js/dist/reqangular.min.js index 3e6b48592e3..39834107382 100644 --- a/org.civicrm.reqangular/js/dist/reqangular.min.js +++ b/org.civicrm.reqangular/js/dist/reqangular.min.js @@ -5,8 +5,8 @@ */ /* - AngularJS v1.5.9 - (c) 2010-2016 Google, Inc. http://angularjs.org + AngularJS v1.6.10 + (c) 2010-2018 Google, Inc. http://angularjs.org License: MIT */ @@ -17,8 +17,8 @@ */ /** - * @license AngularJS v1.5.9 - * (c) 2010-2016 Google, Inc. http://angularjs.org + * @license AngularJS v1.6.10 + * (c) 2010-2018 Google, Inc. http://angularjs.org * License: MIT */ @@ -95,34 +95,34 @@ See README.md or https://github.com/fraywing/textAngular/wiki for requirements a */ -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}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(L,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&&(L[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([])")))):(b(),C.nextTick(function(){b(),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){if(!b(e))return ur;y(e.objectMaxDepth)&&(ur.objectMaxDepth=n(e.objectMaxDepth)?e.objectMaxDepth:NaN)}function n(e){return C(e)&&0--n)return"...";var r,i=t.$$hashKey;if(Cr(e)){r=0;for(var o=e.length;r
    ").append(e).html();try{return e[0].nodeType===Rr?dr(t):t.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(e,t){return"<"+dr(t)})}catch(e){return dr(t)}}function G(e){try{return decodeURIComponent(e)}catch(e){}}function K(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=G(r),y(r)&&(i=!y(i)||G(i),fr.call(t,r)?Cr(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))}),t}function Z(e){var t=[];return o(e,function(e,n){Cr(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 J(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 X(e,t){var n,r,i=Dr.length;for(r=0;r protocol indicates an extension, document.location.href does not match."))}function te(t,n,r){b(r)||(r={}),r=c({strictDi:!1},r);var i=function(){if(t=ar(t),t.injector()){var i=t[0]===e.document?"document":W(t);throw yr("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=ze(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,""),br.resumeBootstrap=function(e){return o(e,function(e){n.push(e)}),i()},S(br.resumeDeferredBootstrap)&&br.resumeDeferredBootstrap()}function ne(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function re(e){if(!(e=br.element(e).injector()))throw yr("test");return e.get("$$testability")}function ie(e,t){return t=t||"_",e.replace(Or,function(e,n){return(n?t:"")+e.toLowerCase()})}function oe(e,t,n){if(!e)throw yr("areq",t||"?",n||"required");return e}function ae(e,t,n){return n&&Cr(e)&&(e=e[e.length-1]),oe(S(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function se(e,t){if("hasOwnProperty"===e)throw yr("badname",t)}function le(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=U(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 ye(t){if(t instanceof ye)return t;var n;if(x(t)&&(t=Er(t),n=!0),!(this instanceof ye)){if(n&&"<"!==t.charAt(0))throw Hr("nosel");return new ye(t)}if(n){n=e.document;var r;t=(r=qr.exec(t))?[n.createElement(r[1])]:(r=$e(t,n))?r.childNodes:[],Te(this,t)}else S(t)?Ie(t):Te(this,t)}function be(e){return e.cloneNode(!0)}function we(e,t){!t&&ve(e)&&ar.cleanData([e]),e.querySelectorAll&&ar.cleanData(e.querySelectorAll("*"))}function xe(e,t,n,r){if(y(r))throw Hr("offargs");var i=(r=ke(e))&&r.events,a=r&&r.handle;if(a)if(t){var s=function(t){var r=i[t];y(n)&&I(r||[],n),y(n)&&r&&0u&&this.remove(p.key),t}},get:function(e){if(u",t=Me.firstChild.attributes;var r=t[0];t.removeNamedItem(r.name),r.value=n,e.attributes.setNamedItem(r)}function z(e,t){try{e.addClass(t)}catch(e){}}function Y(e,t,n,r,i){e instanceof ar||(e=ar(e));var o=G(e,t,e,n,r,i);Y.$$addScopeClass(e);var a=null;return function(t,n,r){if(!e)throw hi("multilink");oe(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"!==R(r)&&vr.call(r).match(/SVG/)?"svg":"html"),r="html"!==a?ar(ge(a,ar("
    ").append(e).html())):n?Gr.clone.call(e):e,l)for(var u in l)r.data("$"+u+"Controller",l[u].instance);return Y.$$addScopeInfo(r,t),n&&n(r,t),o&&o(t,r,r,s),n||(e=o=null),r}}function G(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((y=h.scope)&&(h.templateUrl||(b(y)?(he("new/isolated scope",k||x,h,N),k=h):he("new/isolated scope",k,h,N)),x=x||h),m=h.name,!P&&(h.replace&&(h.templateUrl||h.template)||h.transclude&&!h.$$tlb)){for(y=L+1;P=e[y++];)if(P.transclude&&!P.$$tlb||P.replace&&(P.templateUrl||P.template)){F=!0;break}P=!0}if(!h.templateUrl&&h.controller&&(C=C||ce(),he("'"+m+"' controller",C[m],h,N),C[m]=h),y=h.transclude)if(D=!0,h.$$tlb||(he("transclusion",_,h,N),_=h),"element"===y)O=!0,w=h.priority,g=N,N=n.$$element=ar(Y.$$createComment(m,n[m])),t=N[0],ye(a,hr.call(g,0),t),g[0].$$parentNode=g[0].parentNode,I=te(F,g,r,w,s&&s.name,{nonTlbTranscludeDirective:_});else{var B=ce();if(b(y)){g=[];var z=ce(),G=ce();o(y,function(e,t){var n="?"===e.charAt(0);e=n?e.substring(1):e,z[e]=t,B[t]=null,G[t]=n}),o(N.contents(),function(e){var t=z[nt(R(e))];t?(G[t]=!0,B[t]=B[t]||[],B[t].push(e)):g.push(e)}),o(G,function(e,t){if(!e)throw hi("reqslot",t)});for(var K in B)B[K]&&(B[K]=te(F,B[K],r))}else g=ar(be(t)).contents();N.empty(),I=te(F,g,r,void 0,void 0,{needsNewScope:h.$$isolateScope||h.$$newScope}),I.$$slots=B}if(h.template)if(A=!0,he("template",E,h,N),E=h,y=S(h.template)?h.template(N,n):h.template,y=Ne(y),h.replace){if(s=h,g=Vr.test(y)?it(ge(h.templateNamespace,Er(y))):[],t=g[0],1!==g.length||1!==t.nodeType)throw hi("tplrt",m,"");ye(a,N,t),U={$attr:{}},y=J(t,[],U);var Z=e.splice(L+1,e.length-(L+1));(k||x)&&se(y,k,x),e=e.concat(y).concat(Z),fe(n,U),U=e.length}else N.html(y);if(h.templateUrl)A=!0,he("template",E,h,N),E=h,h.replace&&(s=h),p=de(e.splice(L,e.length-L),N,n,a,D&&I,l,u,{controllerDirectives:C,newScopeDirective:x!==h&&x,newIsolateScopeDirective:k,templateDirective:E,nonTlbTranscludeDirective:_}),U=e.length;else if(h.compile)try{v=h.compile(N,n,I);var Q=h.$$originalDirective||h;S(v)?d(null,j(Q,v),H,q):v&&d(j(Q,v.pre),j(Q,v.post),H,q)}catch(e){i(e,W(N))}h.terminal&&(p.terminal=!0,w=Math.max(w,h.priority))}return p.scope=x&&!0===x.scope,p.transcludeOnThisElement=D,p.templateOnThisElement=A,p.transclude=I,f.hasElementTranscludeDirective=O,p}function re(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 hi("ctreq",t,e)}else if(Cr(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 hi("noctrl",m);c=c.$$bindings=g,b(c.isolateScope)&&(n.$$isolateBindings=c.isolateScope)}e.push(n),c=n}}return c}function ue(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 ve(e,t){if("srcdoc"===t)return N.HTML;var n=R(e);if("src"===t||"ngSrc"===t){if(-1===["img","video","audio","source","track"].indexOf(n))return N.RESOURCE_URL}else if("xlinkHref"===t||"form"===n&&"action"===t||"link"===n&&"href"===t)return N.RESOURCE_URL}function $e(e,t,r,i,o){var a=ve(e,i),s=d[i]||o,l=n(r,!o,a,s);if(l){if("multiple"===i&&"select"===R(e))throw hi("selmulti",W(e));if(w.test(i))throw hi("nodomevents");t.push({priority:100,compile:function(){return{pre:function(e,t,o){t=o.$$observers||(o.$$observers=ce());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 ye(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===Rr&&""===n.nodeValue.trim())&&mr.call(e,t,1)}return e}function ot(e,t){if(t&&x(t))return t;if(x(e)){var n=yi.exec(e);if(n)return n[3]}}function at(){var e={},t=!1;this.has=function(t){return e.hasOwnProperty(t)},this.register=function(t,n){se(t,"controller"),b(t)?c(e,t):e[t]=n},this.allowGlobals=function(){t=!0},this.$get=["$injector","$window",function(n,i){function o(e,t,n,i){if(!e||!b(e.$scope))throw r("$controller")("noscp",i,t);e.$scope[t]=n}return function(r,a,s,l){var u,f,d;if(s=!0===s,l&&x(l)&&(d=l),x(r)){if(!(l=r.match(yi)))throw $i("ctrlfmt",r);if(f=l[1],d=d||l[3],!(r=e.hasOwnProperty(f)?e[f]:le(a.$scope,f,!0)||(t?le(i,f,!0):void 0)))throw $i("ctrlreg",f);ae(r,f,!0)}return s?(s=(Cr(r)?r[r.length-1]:r).prototype,u=Object.create(s||null),d&&o(a,d,u,f||r.name),c(function(){var e=n.invoke(r,u,a,f);return e!==u&&(b(e)||S(e))&&(u=e,d&&o(a,d,u,f||r.name)),u},{instance:u,identifier:d})):(u=n.instantiate(r,a,f),d&&o(a,d,u,f||r.name),u)}}]}function st(){this.$get=["$window",function(e){return ar(e.document)}]}function lt(){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 ut(){this.$get=["$log",function(e){return function(t,n){e.error.apply(e,arguments)}}]}function ct(e){return b(e)?k(e)?e.toISOString():q(e):e}function ft(){this.$get=function(){return function(e){if(!e)return"";var t=[];return a(e,function(e,n){null===e||$(e)||S(e)||(Cr(e)?o(e,function(e){t.push(Q(n)+"="+Q(ct(e)))}):t.push(Q(n)+"="+Q(ct(e))))}),t.join("&")}}}function dt(){this.$get=function(){return function(e){function t(e,r,i){null===e||$(e)||(Cr(e)?o(e,function(e,n){t(e,r+"["+(b(e)?n:"")+"]")}):b(e)&&!k(e)?a(e,function(e,n){t(e,r+(i?"":"[")+n+(i?"":"]"))}):n.push(Q(r)+"="+Q(ct(e))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function pt(e,t){if(x(e)){var n=e.replace(Ei,"").trim();if(n){var r,i=t("Content-Type"),i=i&&0===i.indexOf(wi);if((r=i)||(r=(r=n.match(Ci))&&ki[r[0]].test(n)),r)try{e=V(n)}catch(t){if(!i)return e;throw Si("baddata",e,t)}}}return e}function ht(e){var t,n=ce();return x(e)?o(e.split("\n"),function(e){t=e.indexOf(":");var r=dr(Er(e.substr(0,t)));e=Er(e.substr(t+1)),r&&(n[r]=n[r]?n[r]+", "+e:e)}):b(e)&&o(e,function(e,t){var r=dr(t),i=Er(e);r&&(n[r]=n[r]?n[r]+", "+i:i)}),n}function mt(e){var t;return function(n){return t||(t=ht(e)),n?(n=t[dr(n)],void 0===n&&(n=null),n):t}}function gt(e,t,n,r){return S(r)?r(e,t,n):(o(r,function(r){e=r(e,t,n)}),e)}function vt(){var e=this.defaults={transformResponse:[pt],transformRequest:[function(e){return b(e)&&"[object File]"!==vr.call(e)&&"[object Blob]"!==vr.call(e)&&"[object FormData]"!==vr.call(e)?q(e):e}],headers:{common:{Accept:"application/json, text/plain, */*"},post:pe(xi),put:pe(xi),patch:pe(xi)},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[dr(t.method)]);e:for(n in a){r=dr(n);for(o in s)if(dr(o)===r)continue e;s[n]=a[n]}return i(s,pe(t))}(t),l.method=pr(l.method),l.paramSerializer=x(l.paramSerializer)?p.get(l.paramSerializer):l.paramSerializer,a.$$incOutstandingRequestCount();var u=[],f=[];return t=d.resolve(l),o(E,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=gt(t.data,mt(n),void 0,t.transformRequest);return $(r)&&o(n,function(e,t){"content-type"===dr(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(A,[e,n,ht(r),i,o]):h.remove(A)),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?E.resolve:E.reject)({data:e,status:t,headers:mt(r),config:n,statusText:i,xhrStatus:o})}function c(e){u(e.data,e.status,pe(e.headers()),e.statusText,e.xhrStatus)}function p(){var e=g.pendingRequests.indexOf(n);-1!==e&&g.pendingRequests.splice(e,1)}var h,v,E=d.defer(),_=E.promise,T=n.headers,D="jsonp"===dr(n.method),A=n.url;return D?A=m.getTrustedResourceUrl(A):x(A)||(A=m.valueOf(A)),A=w(A,n.paramSerializer(n.params)),D&&(A=C(A,n.jsonpCallbackParam)),g.pendingRequests.push(n),_.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:k),h&&(v=h.get(A),y(v)?v&&S(v.then)?v.then(c,c):Cr(v)?u(v[1],v[0],pe(v[2]),v[3],v[4]):u(v,200,{},"OK","complete"):h.put(A,_)),$(v)&&((v=M(n.url)?l()[n.xsrfCookieName||e.xsrfCookieName]:void 0)&&(T[n.xsrfHeaderName||e.xsrfHeaderName]=v),s(n.method,A,r,a,T,n.timeout,n.withCredentials,n.responseType,i(n.eventHandlers),i(n.uploadEventHandlers))),_}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){return!!(e&&e.$$intervalId in a)&&(a[e.$$intervalId].promise.$$state.pur=!0,a[e.$$intervalId].reject("canceled"),t.clearInterval(e.$$intervalId),delete a[e.$$intervalId],!0)},o}]}function Ct(e){e=e.split("/");for(var t=e.length;t--;)e[t]=J(e[t].replace(/%2F/g,"/"));return e.join("/")}function kt(e,t){var n=fn(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=d(n.port)||Di[n.protocol]||null}function Et(e,t,n){if(Oi.test(e))throw Ai("badpath",e);var r="/"!==e.charAt(0);r&&(e="/"+e),e=fn(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=K(e.search),t.$$hash=decodeURIComponent(e.hash),t.$$path&&"/"!==t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function St(e,t){return e.slice(0,t.length)===t}function Mt(e,t){if(St(t,e))return t.substr(e.length)}function _t(e){var t=e.indexOf("#");return-1===t?e:e.substr(0,t)}function Tt(e){return e.replace(/(#.+)|#$/,"$1")}function Dt(e,t,n){this.$$html5=!0,n=n||"",kt(e,this),this.$$parse=function(e){var n=Mt(t,e);if(!x(n))throw Ai("ipthprfx",e,t);Et(n,this,!0),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=Z(this.$$search),n=this.$$hash?"#"+J(this.$$hash):"";this.$$url=Ct(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=Mt(e,r))?(a=o,a=n&&y(o=Mt(n,o))?t+(Mt("/",o)||o):e+a):y(o=Mt(t,r))?a=t+o:t===r+"/"&&(a=t),a&&this.$$parse(a),!!a}}function At(e,t,n){kt(e,this),this.$$parse=function(r){var i,o=Mt(e,r)||Mt(t,r);$(o)||"#"!==o.charAt(0)?this.$$html5?i=o:(i="",$(o)&&(e=r,this.replace())):(i=Mt(n,o),$(i)&&(i=o)),Et(i,this,!1),r=this.$$path;var o=e,a=/^\/[A-Z]:(\/.*)/;St(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=Z(this.$$search),r=this.$$hash?"#"+J(this.$$hash):"";this.$$url=Ct(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+(this.$$url?n+this.$$url:""),this.$$urlUpdatedByLocation=!0},this.$$parseLinkUrl=function(t,n){return _t(e)===_t(t)&&(this.$$parse(t),!0)}}function Ot(e,t,n){this.$$html5=!0,At.apply(this,arguments),this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return e===_t(r)?o=r:(a=Mt(t,r))?o=e+n+a:t===r+"/"&&(o=t),o&&this.$$parse(o),!!o},this.$$compose=function(){var t=Z(this.$$search),r=this.$$hash?"#"+J(this.$$hash):"";this.$$url=Ct(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+n+this.$$url,this.$$urlUpdatedByLocation=!0}}function Nt(e){return function(){return this[e]}}function Rt(e,t){return function(n){return $(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function It(){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 D(e)?(t.enabled=e,this):b(e)?(D(e.enabled)&&(t.enabled=e.enabled),D(e.requireBase)&&(t.requireBase=e.requireBase),(D(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 Ai("nobase");f=d.substring(0,d.indexOf("/",d.indexOf("//")+2))+(c||"/"),c=i.history?Dt:Ot}else f=_t(d),c=At;var p=f.substr(0,_t(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 s=ar(e.target);"a"!==R(s[0]);)if(s[0]===o[0]||!(s=s.parent())[0])return;if(!x(i)||!$(s.attr(i))){var i=s.prop("href"),l=s.attr("href")||s.attr("xlink:href");b(i)&&"[object SVGAnimatedString]"===i.toString()&&(i=fn(i.animVal).href),h.test(i)||!i||s.attr("target")||e.isDefaultPrevented()||!u.$$parseLinkUrl(i,l)||(e.preventDefault(),u.absUrl()!==r.url()&&(n.$apply(),a.angular["ff-684208-preventDefault"]=!0))}}}),Tt(u.absUrl())!==Tt(d)&&r.url(u.absUrl(),!0);var m=!0;return r.onUrlChange(function(e,t){St(e,p)?(n.$evalAsync(function(){var r,i=u.absUrl(),o=u.$$state;e=Tt(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=Tt(r.url()),t=Tt(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 Pt(){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 E(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=or||/\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 Ft(e){return e+""}function Lt(e,t){return void 0!==e?e:t}function Ut(e,t){return void 0===e?t:void 0===t?e:e+t}function jt(e,t){switch(e.type){case Ui.MemberExpression:if(e.computed)return!1;break;case Ui.UnaryExpression:return 1;case Ui.BinaryExpression:return"+"!==e.operator&&1;case Ui.CallExpression:return!1}return void 0===t?ji:t}function Ht(e,t,n){var r,i,a=e.isPure=jt(e,n);switch(e.type){case Ui.Program:r=!0,o(e.body,function(e){Ht(e.expression,t,a),r=r&&e.expression.constant}),e.constant=r;break;case Ui.Literal:e.constant=!0,e.toWatch=[];break;case Ui.UnaryExpression:Ht(e.argument,t,a),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case Ui.BinaryExpression:Ht(e.left,t,a),Ht(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case Ui.LogicalExpression:Ht(e.left,t,a),Ht(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case Ui.ConditionalExpression:Ht(e.test,t,a),Ht(e.alternate,t,a),Ht(e.consequent,t,a),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case Ui.Identifier:e.constant=!1,e.toWatch=[e];break;case Ui.MemberExpression:Ht(e.object,t,a),e.computed&&Ht(e.property,t,a),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=e.constant?[]:[e];break;case Ui.CallExpression:r=n=!!e.filter&&!t(e.callee.name).$stateful,i=[],o(e.arguments,function(e){Ht(e,t,a),r=r&&e.constant,i.push.apply(i,e.toWatch)}),e.constant=r,e.toWatch=n?i:[e];break;case Ui.AssignmentExpression:Ht(e.left,t,a),Ht(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case Ui.ArrayExpression:r=!0,i=[],o(e.elements,function(e){Ht(e,t,a),r=r&&e.constant,i.push.apply(i,e.toWatch)}),e.constant=r,e.toWatch=i;break;case Ui.ObjectExpression:r=!0,i=[],o(e.properties,function(e){Ht(e.value,t,a),r=r&&e.value.constant,i.push.apply(i,e.value.toWatch),e.computed&&(Ht(e.key,t,!1),r=r&&e.key.constant,i.push.apply(i,e.key.toWatch))}),e.constant=r,e.toWatch=i;break;case Ui.ThisExpression:e.constant=!1,e.toWatch=[];break;case Ui.LocalsExpression:e.constant=!1,e.toWatch=[]}}function qt(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 Vt(e){return e.type===Ui.Identifier||e.type===Ui.MemberExpression}function Bt(e){if(1===e.body.length&&Vt(e.body[0].expression))return{type:Ui.AssignmentExpression,left:e.body[0].expression,right:{type:Ui.NGValueParameter},operator:"="}}function zt(e){this.$filter=e}function Yt(e){this.$filter=e}function Wt(e,t,n){this.ast=new Ui(e,n),this.astCompiler=n.csp?new Yt(t):new zt(t)}function Gt(e){return S(e.valueOf)?e.valueOf():Ii.call(e)}function Kt(){var e,t,n=ce(),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 Li(p),r=new Wt(r,i,p).parse(e),r.constant?r.$$watchDelegate=f:r.oneTime?r.$$watchDelegate=r.literal?c:u:r.inputs&&(r.$$watchDelegate=l),n[o]=r),d(r,t);case"function":return d(e,t);default:return d(h,t)}}function s(e,t,n){return null==e||null==t?e===t:!("object"==typeof e&&"object"==typeof(e=Gt(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&&Gt(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)fr.call(r,t)||(m--,delete o[t])}else o!==r&&(o=r,c++);return c}}n.$stateful=!0;var r,o,a,s=this,u=1$&&(m=4-$,b[m]||(b[m]=[]),b[m].push({msg:S(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!==this&&h.$$nextSibling))for(;h!==this&&!(f=h.$$nextSibling);)h=h.$parent}while(h=f);if((d||C.length)&&!$--)throw x.$$phase=null,n("infdig",t,b)}while(d||C.length);for(x.$$phase=null;Mor)throw Hi("iequirks");var r=pe(qi);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(qi,function(e,t){var n=dr(t);r[("parse_as_"+n).replace(Vi,me)]=function(t){return i(e,t)},r[("get_trusted_"+n).replace(Vi,me)]=function(t){return a(e,t)},r[("trust_as_"+n).replace(Vi,me)]=function(t){return s(e,t)}}),r}]}function sn(){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(dr((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&&or)return!1;if($(n[e])){var t=a.createElement("div");n[e]="on"+e in t}return n[e]},csp:Mr(),transitions:l,animations:u,android:i}}]}function ln(){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 Cr(u)?u=u.filter(function(e){return e!==pt}):u===pt&&(u=null),r.get(s,c({cache:n,transformResponse:u},e)).finally(function(){a.totalPendingRequests--}).then(function(e){return n.put(s,e.data),e.data},function(e){return l||(e=Bi("tpload",s,e.status,e.statusText),t(e)),i.reject(e)})}return a.totalPendingRequests=0,a}]}function un(){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=br.element(e).data("$binding");i&&o(i,function(i){n?new RegExp("(^|\\s)"+Sr(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)===Ki;r++);if(r===(o=e.length))t=[0],n=1;else{for(o--;e.charAt(o)===Ki;)o--;for(n-=r,t=[],i=0;r<=o;r++,i++)t[i]=+e.charAt(r)}return n>Wi&&(t=t.splice(0,Wi-1),a=n-1,n=1),{d:t,e:a,i:n}}function En(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 Mn(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),Mn(o,t,r,i)}}function Tn(e,t,n){return function(r,i){var o=r["get"+e]();return i[pr((n?"STANDALONE":"")+(t?"SHORT":"")+e)][o]}}function Dn(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(4>=t?5:12)-t)}function An(e){return function(t){var n=Dn(t.getFullYear());return t=+new Date(t.getFullYear(),t.getMonth(),t.getDate()+(4-t.getDay()))-+n,t=1+Math.round(t/6048e5),Mn(t,e)}}function On(e,t){return 0>=e.getFullYear()?t.ERAS[0]:t.ERAS[1]}function Nn(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=Qi.test(n)?d(n):t(n)),C(n)&&(n=new Date(n)),!k(n)||!isFinite(n.getTime()))return n;for(;r;)(s=Ji.exec(r))?(u=U(u,s,1),r=u.pop()):(u.push(r),r=null);var c=n.getTimezoneOffset();return i&&(c=B(i,c),n=Y(n,i,!0)),o(u,function(t){a=Zi[t],l+=a?a(n,e.DATETIME_FORMATS,c):"''"===t?"'":t.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),l}}function Rn(){return function(e,t){return $(t)&&(t=2),q(e,t)}}function In(){return function(e,t,n){return t=1/0===Math.abs(Number(t))?Number(t):d(t),xr(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?Pn(e,n,n+t):0===n?Pn(e,t,e.length):Pn(e,Math.max(0,n+t),n)):e)}}function Pn(e,t,n){return x(e)?e.slice(t,n):hr.call(e,t,n)}function Fn(e){function t(t){return t.map(function(t){var n=1,r=m;if(S(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),vo[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 zn(e,t){return function(n,r){var i,a;if(k(n))return n;if(x(n)){if('"'===n.charAt(0)&&'"'===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),so.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){n=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 Wn(e,t,n,r){(r.$$hasNativeValidators=b(t[0].validity))&&r.$parsers.push(function(e){var n=t.prop("validity")||{};return n.badInput||n.typeMismatch?void 0:e})}function Gn(e){e.$$parserName="number",e.$parsers.push(function(t){return e.$isEmpty(t)?null:co.test(t)?parseFloat(t):void 0}),e.$formatters.push(function(t){if(!e.$isEmpty(t)){if(!C(t))throw qo("numfmt",t);t=t.toString()}return t})}function Kn(e){return y(e)&&!C(e)&&(e=parseFloat(e)),xr(e)?void 0:e}function Zn(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 Jn(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?Zn(e):0,s=i?Zn(t):0,l=o?Zn(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 Qn(e,t,n,r,i){if(y(r)){if(e=e(r),!e.constant)throw qo("constexpr",n,r);return e(t)}return i}function Xn(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>|)$/,Vr=/<|&#?\w+;/,Br=/<([\w:-]+)/,zr=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Yr={option:[1,'"],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};Yr.optgroup=Yr.option,Yr.tbody=Yr.tfoot=Yr.colgroup=Yr.caption=Yr.thead,Yr.th=Yr.td;var Wr=e.Node.prototype.contains||function(e){return!!(16&this.compareDocumentPosition(e))},Gr=ye.prototype={ready:Ie,toString:function(){var e=[];return o(this,function(t){e.push(""+t)}),"["+e.join(", ")+"]"},eq:function(e){return ar(0<=e?this[e]:this[this.length+e])},length:0,push:gr,sort:[].sort,splice:[].splice},Kr={};o("multiple selected checked disabled readOnly required open".split(" "),function(e){Kr[dr(e)]=e});var Zr={};o("input select option textarea button form details".split(" "),function(e){Zr[e]=!0});var Jr={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};o({data:Ee,removeData:Ce,hasData:function(e){for(var t in Pr[e.ng339])return!0;return!1},cleanData:function(e){for(var t=0,n=e.length;t/,ni=/^[^(]*\(\s*([^)]*)\)/m,ri=/,/,ii=/^\s*(_?)(\S+?)\1\s*$/,oi=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,ai=r("$injector");ze.$$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||Be(e)),ai("strictdi",n);t=Ve(e),o(t[1].split(ri),function(e){e.replace(ii,function(e,t,n){r.push(n)})})}e.$inject=r}}else Cr(e)?(t=e.length-1,ae(e[t],"fn"),r=e.slice(0,t)):ae(e,"fn",!0);return r};var si=r("$animate"),li=function(){this.$get=h},ui=function(){var e=new Xr,t=[];this.$get=["$$AnimateRunner","$rootScope",function(n,r){function i(e,t,n){var r=!1;return t&&(t=x(t)?t.split(" "):Cr(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=Ge(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&&_e(e,i),a&&Me(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}}}]},ci=["$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 si("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=S(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,si("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){Pi[e]=!0});var Fi={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Li=function(e){this.options=e};Li.prototype={constructor:Li,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,Ri("lexerr",e,t,this.text)},readNumber:function(){for(var e="",t=this.index;this.index","<=",">=");)t={type:Ui.BinaryExpression,operator:e.text,left:t,right:this.additive()};return t},additive:function(){for(var e,t=this.multiplicative();e=this.expect("+","-");)t={type:Ui.BinaryExpression,operator:e.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t={type:Ui.BinaryExpression,operator:e.text,left:t,right:this.unary()};return t},unary:function(){var e;return(e=this.expect("+","-","!"))?{type:Ui.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=P(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:Ui.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:Ui.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(")")):"["===t.text?(e={type:Ui.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume("]")):"."===t.text?e={type:Ui.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return e},filter:function(e){e=[e];for(var t={type:Ui.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:Ui.Identifier,name:e.text}},constant:function(){return{type:Ui.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:Ui.ArrayExpression,elements:e}},object:function(){var e,t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;e={type:Ui.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:Ui.ObjectExpression,properties:t}},throwError:function(e,t){throw Ri("syntax",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw Ri("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 Ri("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:Ui.ThisExpression},$locals:{type:Ui.LocalsExpression}}};var ji=2;zt.prototype={compile:function(e){var t=this;this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},Ht(e,t.$filter);var n,r="";return this.stage="assign",(n=Bt(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=qt(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,Ft,Lt,Ut),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 Ui.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 Ui.Literal:c=this.escape(e.value),this.assign(t,c),r(t||c);break;case Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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===Ui.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===Ui.Identifier?t.key.name:""+t.key.value)+":"+e)})}),c="{"+u.join(",")+"}",this.assign(t,c)),r(t||c);break;case Ui.ThisExpression:this.assign(t,"s"),r(t||"s");break;case Ui.LocalsExpression:this.assign(t,"l"),r(t||"l");break;case Ui.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 Ri("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]}},Yt.prototype={compile:function(e){var t=this;Ht(e,t.$filter);var n,r;(n=Bt(e))&&(r=this.recurse(n)),n=qt(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 Ui.Literal:return this.value(e.value,t);case Ui.UnaryExpression:return i=this.recurse(e.argument),this["unary"+e.operator](i,t);case Ui.BinaryExpression:case Ui.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this["binary"+e.operator](r,i,t);case Ui.ConditionalExpression:return this["ternary?:"](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case Ui.Identifier:return s.identifier(e.name,t,n);case Ui.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 Ui.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)}}},Wt.prototype={constructor:Wt,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===Ui.Literal||n.body[0].expression.type===Ui.ArrayExpression||n.body[0].expression.type===Ui.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 Hi=r("$sce"),qi={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Vi=/_([a-z])/g,Bi=r("$compile"),zi=e.document.createElement("a"),Yi=fn(e.location.href);mn.$inject=["$document"],vn.$inject=["$provide"];var Wi=22,Gi=".",Ki="0";xn.$inject=["$locale"],Cn.$inject=["$locale"];var Zi={yyyy:_n("FullYear",4,0,!1,!0),yy:_n("FullYear",2,0,!0,!0),y:_n("FullYear",1,0,!1,!0),MMMM:Tn("Month"),MMM:Tn("Month",!0),MM:_n("Month",2,1),M:_n("Month",1,1),LLLL:Tn("Month",!1,!0),dd:_n("Date",2),d:_n("Date",1),HH:_n("Hours",2),H:_n("Hours",1),hh:_n("Hours",2,-12),h:_n("Hours",1,-12),mm:_n("Minutes",2),m:_n("Minutes",1),ss:_n("Seconds",2),s:_n("Seconds",1),sss:_n("Milliseconds",3),EEEE:Tn("Day"),EEE:Tn("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?"+":"")+(Mn(Math[0=e.getFullYear()?t.ERANAMES[0]:t.ERANAMES[1]}},Ji=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,Qi=/^-?\d+$/;Nn.$inject=["$locale"];var Xi=g(dr),eo=g(pr);Fn.$inject=["$parse"];var to=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]"===vr.call(t.prop("href"))?"xlink:href":"href";t.on("click",function(e){t.attr(n)||e.preventDefault()})}}}}),no={};o(Kr,function(e,t){function n(e,n,i){e.$watch(i[r],function(e){i.$set(t,!!e)})}if("multiple"!==e){var r=nt("ng-"+t),i=n;"checked"===e&&(i=function(e,t,i){i.ngModel!==i[r]&&n(e,t,i)}),no[r]=function(){return{restrict:"A",priority:100,link:i}}}}),o(Jr,function(e,t){no[t]=function(){return{priority:100,link:function(e,n,r){if("ngPattern"===t&&"/"===r.ngPattern.charAt(0)&&(n=r.ngPattern.match(cr)))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=nt("ng-"+e);no[t]=function(){return{priority:99,link:function(n,r,i){var o=e,a=e;"href"===e&&"[object SVGAnimatedString]"===vr.call(r.prop("href"))&&(a="xlinkHref",i.$attr[a]="xlink:href",o=null),i.$observe(t,function(t){t?(i.$set(a,t),or&&o&&r.prop(o,i[a])):"href"===e&&i.$set(a,null)})}}}});var ro={$addControl:h,$$renameControl:function(e,t){e.$name=t},$removeControl:h,$setValidity:h,$setDirty:h,$setPristine:h,$setSubmitted:h};Un.$inject=["$element","$attrs","$scope","$animate","$interpolate"],Un.prototype={$rollbackViewValue:function(){o(this.$$controls,function(e){e.$rollbackViewValue()})},$commitViewValue:function(){o(this.$$controls,function(e){e.$commitViewValue()})},$addControl:function(e){se(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),I(this.$$controls,e),e.$$parentForm=ro},$setDirty:function(){this.$$animate.removeClass(this.$$element,jo),this.$$animate.addClass(this.$$element,Ho),this.$dirty=!0,this.$pristine=!1,this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,jo,Ho+" 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(){this.$$animate.addClass(this.$$element,"ng-submitted"),this.$submitted=!0,this.$$parentForm.$setSubmitted()}},Hn({clazz:Un,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&&(I(r,n),0===r.length&&delete e[t])}});var io=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:Un,compile:function(n,i){n.addClass(jo).addClass(Lo);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,ro)})}}}}}]},oo=io(),ao=io(!0),so=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,lo=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:\/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,uo=/^(?=.{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])?)*$/,co=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,fo=/^(\d{4,})-(\d{2})-(\d{2})$/,po=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ho=/^(\d{4,})-W(\d\d)$/,mo=/^(\d{4,})-(\d\d)$/,go=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,vo=ce();o(["date","datetime-local","month","time","week"],function(e){vo[e]=!0});var $o={text:function(e,t,n,r,i,o){Bn(e,t,n,r,i,o),Vn(r)},date:Yn("date",fo,zn(fo,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":Yn("datetimelocal",po,zn(po,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:Yn("time",go,zn(go,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:Yn("week",ho,function(e,t){if(k(e))return e;if(x(e)){ho.lastIndex=0;var n=ho.exec(e);if(n){var r=+n[1],i=+n[2],o=n=0,a=0,s=0,l=Dn(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:Yn("month",mo,zn(mo,["yyyy","MM"]),"yyyy-MM"),number:function(e,t,n,r,i,o){Wn(e,t,n,r),Gn(r),Bn(e,t,n,r,i,o);var a,s;if((y(n.min)||n.ngMin)&&(r.$validators.min=function(e){return r.$isEmpty(e)||$(a)||e>=a},n.$observe("min",function(e){a=Kn(e),r.$validate()})),(y(n.max)||n.ngMax)&&(r.$validators.max=function(e){return r.$isEmpty(e)||$(s)||e<=s},n.$observe("max",function(e){s=Kn(e),r.$validate()})),y(n.step)||n.ngStep){var l;r.$validators.step=function(e,t){return r.$isEmpty(t)||$(l)||Jn(t,a||0,l)},n.$observe("step",function(e){l=Kn(e),r.$validate()})}},url:function(e,t,n,r,i,o){Bn(e,t,n,r,i,o),Vn(r),r.$$parserName="url",r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||lo.test(n)}},email:function(e,t,n,r,i,o){Bn(e,t,n,r,i,o),Vn(r),r.$$parserName="email",r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||uo.test(n)}},radio:function(e,t,n,r){var i=!n.ngTrim||"false"!==Er(n.ngTrim);$(n.name)&&t.attr("name",++wr),t.on("click",function(e){var o;t[0].checked&&(o=n.value,i&&(o=Er(o)),r.$setViewValue(o,e&&e.type))}),r.$render=function(){var e=n.value;i&&(e=Er(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=Kn(e),xr(r.$modelValue)||(c?(e=t.val(),f>e&&(e=f,t.val(e)),r.$setViewValue(e)):r.$validate())}function l(e){d=Kn(e),xr(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)||Jn(t,f||0,p)},a("step",u))},checkbox:function(e,t,n,r,i,o,a,s){var l=Qn(s,e,"ngTrueValue",n.ngTrueValue,!0),u=Qn(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 L(e,l)}),r.$parsers.push(function(e){return e?l:u})},hidden:h,button:h,submit:h,reset:h,file:h},yo=["$browser","$sniffer","$filter","$parse",function(e,t,n,r){return{restrict:"E",require:["?ngModel"],link:{pre:function(i,o,a,s){s[0]&&($o[dr(a.type)]||$o.text)(i,o,a,s[0],t,e,n,r)}}}}],bo=/^(true|false|\d+)$/,wo=function(){function e(e,t,n){var r=y(n)?n:9===or?"":null;e.prop("value",r),t.$set("value",n)}return{restrict:"A",priority:100,compile:function(t,n){return bo.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)})}}}},xo=["$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=fe(e)})}}}}],Co=["$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})}}}}],ko=["$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)||"")})}}}}],Eo=g({restrict:"A",require:"ngModel",link:function(e,t,n,r){r.$viewChangeListeners.push(function(){e.$eval(n.ngChange)})}}),So=Xn("",!0),Mo=Xn("Odd",0),_o=Xn("Even",1),To=Ln({compile:function(e,t){t.$set("ngCloak",void 0),e.removeClass("ng-cloak")}}),Do=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Ao={},Oo={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=nt("ng-"+e);Ao[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})};Oo[e]&&r.$$phase?t.$evalAsync(i):t.$apply(i)})}}}}]});var No=["$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=ue(s.clone),e.leave(u).done(function(e){!1!==e&&(u=null)}),s=null))})}}}],Ro=["$templateRequest","$anchorScroll","$animate",function(e,t,n){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:br.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)})}}}}],Io=["$compile",function(t){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(n,r,i,o){vr.call(r[0]).match(/SVG/)?(r.empty(),t($e(o.template,e.document).childNodes)(n,function(e){r.append(e)},{futureParentElement:r})):(r.html(o.template),t(r.contents())(n))}}}],Po=Ln({priority:450,compile:function(){return{pre:function(e,t,n){e.$eval(n.ngInit)}}}}),Fo=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(e,t,n,r){var i=n.ngList||", ",a="false"!==n.ngTrim,s=a?Er(i):i;r.$parsers.push(function(e){if(!$(e)){var t=[];return e&&o(e.split(s),function(e){e&&t.push(a?Er(e):e)}),t}}),r.$formatters.push(function(e){if(Cr(e))return e.join(i)}),r.$isEmpty=function(e){return!e||!e.length}}}},Lo="ng-valid",Uo="ng-invalid",jo="ng-pristine",Ho="ng-dirty",qo=r("ngModel");er.$inject="$scope $exceptionHandler $attrs $element $parse $animate $timeout $q $interpolate".split(" "),er.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 S(n)&&(n=e(t)),n},this.$$ngModelSet=function(e,n){S(this.$$parsedNgModel(e))?t(e,{$$$p:n}):this.$$parsedNgModelAssign(e,n)}}else if(!this.$$parsedNgModel.assign)throw qo("nonassign",this.$$attr.ngModel,W(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,Ho),this.$$animate.addClass(this.$$element,jo)},$setDirty:function(){this.$dirty=!0,this.$pristine=!1,this.$$animate.removeClass(this.$$element,jo),this.$$animate.addClass(this.$$element,Ho),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(!xr(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||"parse";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(s.then))throw qo("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)for(var n=0;ni||r.$isEmpty(t)||t.length<=i}}}}},ma=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(!Nr){var n=_r();(sr=$(n)?e.jQuery:n?e[n]:void 0)&&sr.fn.on?(ar=sr,c(sr.fn,{scope:Gr.scope,isolateScope:Gr.isolateScope,controller:Gr.controller,injector:Gr.injector,inheritedData:Gr.inheritedData}),t=sr.cleanData,sr.cleanData=function(e){for(var n,r,i=0;null!=(r=e[i]);i++)(n=sr._data(r,"events"))&&n.$destroy&&sr(r).triggerHandler("$destroy");t(e)}):ar=ye,br.element=ar,Nr=!0}}(),function(n){c(n,{errorHandlingConfig:t,bootstrap:te,copy:P,extend:c,merge:f,equals:L,element:ar,forEach:o,injector:ze,noop:h,bind:j,toJson:q,fromJson:V,identity:m,isUndefined:$,isDefined:y,isString:x,isFunction:S,isObject:b,isNumber:C,isElement:O,isArray:Cr,version:Ir,isDate:k,lowercase:dr,uppercase:pr,callbacks:{$$counter:0},getTestability:re,reloadWithDebugInfo:ne,$$minErr:r,$$csp:Mr,$$encodeUriSegment:J,$$encodeUriQuery:Q,$$stringify:fe}),lr=de(e),lr("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:tn}),e.provider("$compile",et).directive({a:to,input:yo,textarea:yo,form:oo,script:sa,select:ca,option:fa,ngBind:xo,ngBindHtml:ko,ngBindTemplate:Co,ngClass:So,ngClassEven:_o,ngClassOdd:Mo,ngCloak:To,ngController:Do,ngForm:ao,ngHide:ea,ngIf:No,ngInclude:Ro,ngInit:Po,ngNonBindable:Wo,ngPluralize:Jo,ngRepeat:Qo,ngShow:Xo,ngStyle:ta,ngSwitch:na,ngSwitchWhen:ra,ngSwitchDefault:ia,ngOptions:Zo,ngTransclude:aa,ngModel:Bo,ngList:Fo,ngChange:Eo,pattern:pa,ngPattern:pa,required:da,ngRequired:da,minlength:ma,ngMinlength:ma,maxlength:ha,ngMaxlength:ha,ngValue:wo,ngModelOptions:Yo}).directive({ngInclude:Io}).directive(no).directive(Ao),e.provider({$anchorScroll:Ye,$animate:ci,$animateCss:pi,$$animateJs:li,$$animateQueue:ui,$$AnimateRunner:di,$$animateAsyncRun:fi,$browser:Je,$cacheFactory:Qe,$controller:at,$document:st,$$isDocumentHidden:lt,$exceptionHandler:ut,$filter:vn,$$forceReflow:bi,$interpolate:wt,$interval:xt,$http:vt,$httpParamSerializer:ft,$httpParamSerializerJQLike:dt,$httpBackend:yt,$xhrFactory:$t,$jsonpCallbacks:_i,$location:It,$log:Pt,$parse:Kt,$rootScope:en,$q:Zt,$$q:Jt,$sce:an,$sceDelegate:on,$sniffer:sn,$templateCache:Xe,$templateRequest:ln,$$testability:un,$timeout:cn,$window:hn,$$rAF:Xt,$$jqLite:je,$$Map:ei,$$cookieReader:gn})}]).info({angularVersion:"1.6.10"})}(br),br.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"}})}]),ar(function(){ee(e.document,te)}))}(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=M(q,de,he),$e=ve.maxDelay,X=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(" "),L),j.to&&(j.cleanupStyles&&_(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"),_.attr("ng-model-options","ngModelOptions")):I=null,_.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":S}),T=angular.element(_.children()[0]),T.attr("template-url",M),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(_)(e),_.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",b),s.off("click",y),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",y);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",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 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=$;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"},k=0,E=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),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&&($=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"})),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(),$=u.endSymbol(),y="
    ';return{compile:function(e,t){var n=o(y);return function(e,t,r,o){function u(){L.isOpen?g():d()}function d(){F&&!e.$eval(r[c+"Enable"])||(b(),C(),L.popupDelay?A||(A=a(v,L.popupDelay,!1)):v())}function g(){$(),L.popupCloseDelay?O||(O=a(y,L.popupCloseDelay,!1)):y()}function v(){if($(),b(),!L.content)return angular.noop;w(),L.$evalAsync(function(){L.isOpen=!0,k(!0),V()})}function $(){A&&(a.cancel(A),A=null),N&&(a.cancel(N),N=null)}function y(){L&&L.$evalAsync(function(){L&&(L.isOpen=!1,k(!1),L.animation?D||(D=a(x,150,!1)):x())})}function b(){O&&(a.cancel(O),O=null),D&&(a.cancel(D),D=null)}function w(){_||(T=L.$new(),_=n(T,function(e){I?s.find("body").append(e):t.after(e)}),E())}function x(){$(),b(),S(),_&&(_.remove(),_=null),T&&(T.$destroy(),T=null)}function C(){L.title=r[c+"Title"],L.content=H?H(e):r[i],L.popupClass=r[c+"Class"],L.placement=angular.isDefined(r[c+"Placement"])?r[c+"Placement"]:p.placement;var t=l.parsePlacement(L.placement);R=t[1]?t[0]+"-"+t[1]:t[0];var n=parseInt(r[c+"PopupDelay"],10),o=parseInt(r[c+"PopupCloseDelay"],10);L.popupDelay=isNaN(n)?p.popupDelay:n,L.popupCloseDelay=isNaN(o)?p.popupCloseDelay:o}function k(t){j&&angular.isFunction(j.assign)&&j.assign(e,t)}function E(){q.length=0,H?(q.push(e.$watch(H,function(e){L.content=e,!e&&L.isOpen&&y()})),q.push(T.$watch(function(){U||(U=!0,T.$$postDigest(function(){U=!1,L&&L.isOpen&&V()}))}))):q.push(r.$observe(i,function(e){L.content=e,!e&&L.isOpen?y():V()})),q.push(r.$observe(c+"Title",function(e){L.title=e,L.isOpen&&V()})),q.push(r.$observe(c+"Placement",function(e){L.placement=e||p.placement,L.isOpen&&V()}))}function S(){q.length&&(angular.forEach(q,function(e){e()}),q.length=0)}function M(e){L&&L.isOpen&&_&&(t[0].contains(e.target)||_[0].contains(e.target)||g())}var _,T,D,A,O,N,R,I=!!angular.isDefined(p.appendToBody)&&p.appendToBody,P=m(void 0),F=angular.isDefined(r[c+"Enable"]),L=e.$new(!0),U=!1,j=!!angular.isDefined(r[c+"IsOpen"])&&f(r[c+"IsOpen"]),H=!!p.useContentExp&&f(r[i]),q=[],V=function(){_&&_.html()&&(N||(N=a(function(){var e=l.positionElements(t,_,L.placement,I);_.css({top:e.top+"px",left:e.left+"px"}),_.hasClass(e.placement.split("-")[0])||(_.removeClass(R.split("-")[0]),_.addClass(e.placement.split("-")[0])),_.hasClass(p.placementClassPrefix+e.placement)||(_.removeClass(p.placementClassPrefix+R),_.addClass(p.placementClassPrefix+e.placement)),_.hasClass("uib-position-measure")?(l.positionArrow(_,e.placement),_.removeClass("uib-position-measure")):R!==e.placement&&l.positionArrow(_,e.placement),R=e.placement,N=null},0,!1)))};L.origScope=e,L.isOpen=!1,h.add(L,{close:y}),L.contentExp=function(){return L.content},r.$observe("disabled",function(e){e&&$(),e&&L.isOpen&&y()}),j&&e.$watch(j,function(e){L&&!e===L.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",M):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",M)):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"]);L.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(L),L=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 k=a.minuteStep;n.minuteStep&&y.push(e.$parent.$watch(r(n.minuteStep),function(e){k=+e}));var E;y.push(e.$parent.$watch(r(n.min),function(e){var t=new Date(e);E=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 M=!1;n.ngDisabled&&y.push(e.$parent.$watch(r(n.ngDisabled),function(e){M=e})),e.noIncrementHours=function(){var e=m($,60*C);return M||e>S||e<$&&e$&&e>S},e.noIncrementMinutes=function(){var e=m($,k);return M||e>S||e<$&&e$&&e>S},e.noIncrementSeconds=function(){var e=g($,_);return M||e>S||e<$&&e$&&e>S},e.noToggleMeridian=function(){return $.getHours()<12?M||m($,720)>S:M||m($,-720)0};t.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementHours():e.decrementHours()),t.preventDefault()}),n.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementMinutes():e.decrementMinutes()),t.preventDefault()}),r.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementSeconds():e.decrementSeconds()),t.preventDefault()})},this.setupArrowkeyEvents=function(t,n,r){t.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementHours(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementHours(),e.$apply()))}),n.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementMinutes(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementMinutes(),e.$apply()))}),r.bind("keydown",function(t){M||(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*k)},e.decrementMinutes=function(){e.noDecrementMinutes()||h(60*-k)},e.incrementSeconds=function(){e.noIncrementSeconds()||h(_)},e.decrementSeconds=function(){e.noDecrementSeconds()||h(-_)},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,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),M=i(n.typeaheadNoResults).assign||angular.noop,_=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)},L=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),M(e,!1),o.when(L.source(e,i)).then(function(o){var a=n===m.$viewValue;if(a&&w)if(o&&o.length>0){U.activeIdx=A?0:-1,M(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(),M(e,!0);a&&C(e,!1)},function(){Y(),C(e,!1),M(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,Q=function(e){J=a(function(){K(e)},y)},X=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[L.itemName]=s=U.matches[r].model,o=L.modelMapper(e,l),F(e,o),m.$setValidity("editable",!0),m.$setValidity("parse",!0),E(e,{$item:s,$model:o,$label:L.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=k(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?(X(),Q(t)):K(t):(C(e,!1),X(),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),_?(i.$model=t,_(e,i)):(i[L.itemName]=t,n=L.viewMapper(e,i),i[L.itemName]=void 0,r=L.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{b=e.getSelectionElement()}catch(e){}var x=angular.element(b);if(void 0!==b){var C=b.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("
    "+b.innerHTML+"
    ")[0]],x,k)}if(C.match(n)){if(v=e.getOnlySelectedElements(),0===v.length)m=angular.element("<"+k+">
  • "+b.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"+M[0].innerHTML+"":g+=M[0].childNodes[0].innerHTML,S.unshift(M)}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(y=d.toLowerCase().replace(/[<>]/gi,""),"default"===y.trim()&&(y=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===y){v=m.children();var _=!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(),$=m[0].childNodes,y=!0;if($.length>0){for(f=[],c=0;c<$.length;c++)"p"===$[c].nodeName.toLowerCase()&&""===$[c].innerHTML.trim()||3===$[c].nodeType&&""===$[c].nodeValue.trim()||(y=y&&!n.test($[c].nodeName),f.push($[c]));for(var b=0;b)$/i.test(g.startContainer.innerHTML)&&g.selectNode(g.startContainer)}else y=!0,p=v=o.createTextNode(e);if(y)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?j:0)+(e.ctrlKey?U: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,L=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,U=1,j=2,H=4,q=8,V=[{specialKey:"UndoKey",forbiddenModifiers:H+q,mustHaveModifiers:[j+U],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H,mustHaveModifiers:[j+U,q],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H+q,mustHaveModifiers:[j+U],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:j+q+H+U,mustHaveModifiers:[],keyCode:9},{specialKey:"ShiftTabKey",forbiddenModifiers:j+H+U,mustHaveModifiers:[q],keyCode:9}];void 0===x.taDefaultWrap&&(x.taDefaultWrap="p"),""===x.taDefaultWrap?(M="",_=void 0===e.ie?"

    ":e.ie>=11?"


    ":e.ie<=8?"

     

    ":"

     

    "):(M=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+">":"<"+x.taDefaultWrap+">",_=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+"> ":"<"+x.taDefaultWrap+"> "),D.$options||(D.$options={});var B=v(_),z=function(e){if(B(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=$(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()),B(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!B(e||t)}),T.$parsers.push(Q),T.$parsers.unshift(z),T.$formatters.push(Q),T.$formatters.unshift(z),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 $=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&&$(e)}),angular.forEach(i.find("font"),$),e=i.html()}else{if(e=e.replace(/<(|\/)meta[^>]*?>/gi,""),e.match(/<[^>]*?(ta-bind)[^>]*?>/)){if(e.match(/<[^>]*?(text-angular)[^>]*?>/)){var b=angular.element("
          "+e+"
          ");b.find("textarea").remove();for(var x=y.getByAttribute(b,"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(),b.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(M),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(""!==M&&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(M);angular.element(n).replaceWith(r),d.setSelectionToElementStart(r[0])}}var a=Z();""!==M&&""===a.trim()?(ce(M),d.setSelectionToElementStart(w.children()[0])):"<"!==a.substring(0,1)&&x.taDefaultWrap;var s=E!==e.keyCode&&L.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?M:e:""===e?M: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,M=h.serial?h.serial:Math.floor(1e16*Math.random());d._name=h.name?h.name:"textAngularEditor"+M;var _=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"+M]():"redo"===e.toLowerCase()?d["$redoTaBindtaTextElement"+M]():(k(e,!1,t,d.defaultTagAttributes),n&&d["reApplyOnSelectorHandlerstaTextElement"+M](),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"),_(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),_(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),_(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"+M,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":p.attr("ng-model-options")}),d.displayElements.text.attr({id:"taTextElement"+M,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"+M],d.updateTaBindtaHtmlElement=d["updateTaBindtaHtmlElement"+M],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"+M]()},b=function(){d.focussed=!0,p.addClass(d.classes.focussed),C.focus(),p.triggerHandler("focus")},d.displayElements.html.on("focus",b),d.displayElements.text.on("focus",b),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"+M])}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"+M]()}),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"+M]()})}catch(e){u.error(e)}}),r.preventDefault(),r.stopPropagation()):t(function(){d["updateTaBindtaTextElement"+M]()},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),$=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",$),d.displayElements.text.on("keypress",$),y=function(){d._bUpdateSelectedStyles=!1,d.$apply(function(){d.updateSelectedStyles()})},d.displayElements.html.on("mouseup",y),d.displayElements.text.on("mouseup",y)}}}]),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=[];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},k=[];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 E=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!==E||o(i())||(E=t.$watch(function(){S||(S=!0,t.$$postDigest(function(){S=!1,o(i())&&(E(),E=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 M=o(function(){b.sizeSearchInput()},50);angular.element(f).bind("resize",M),t.$on("$destroy",function(){b.searchInput.off("keyup keydown tagged blur paste"),angular.element(f).off("resize",M)}),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=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)&&b(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>Ma){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();Ma=!(a.f||a.e),r.remove()}}return Ma?(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)*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(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)/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 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 Me(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),_e(t,n,e,r)}}function _e(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)}:$;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)||Fe;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 k=m.length+b.length+w.length+(y?0:i.length),E=c>k?new Array(k=c-k+1).join(r):"";return y&&(b=o(E+b,E.length?c-w.length:1/0)),i+=m,e=b+w,("<"===a?i+e+E:">"===a?E+i+e:"^"===a?E.substring(0,k>>=1)+i+e+E.substring(k):i+(y?e:E+e))+n}}}function Fe(e){return e+""}function Le(){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=Le;var r=new Le;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=Le;var r=new Le;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=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,_.c.toString(),t,r)}function l(e,t,r){return n(e,_.x.toString(),t,r)}function u(e,t,r){return n(e,_.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=Le;var t=new as;return t._=e,r(t)}finally{as=Date}}var r=t(e);return n.parse=function(e){try{as=Le;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),k=Ve(v),E=Be(v),S=Ve($),M=Be($);h.forEach(function(e,t){y.set(e.toLowerCase(),t)});var _={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:Xe,e:Xe,H:tt,I:tt,j:et,L:it,m:Qe,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 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 $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])<_a&&da(e[1]-t[1])<_a}function xt(e,t){e*=Ra;var n=Math.cos(t*=Ra);Ct(n*Math.cos(e),n*Math.sin(e),Math.sin(t))}function Ct(e,t,n){++$s,bs+=(e-bs)/$s,ws+=(t-ws)/$s,xs+=(n-xs)/$s}function kt(){function e(e,i){e*=Ra;var o=Math.cos(i*=Ra),a=o*Math.cos(e),s=o*Math.sin(e),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=n*l-r*s)*u+(u=r*a-t*l)*u+(u=t*s-n*a)*u),t*a+n*s+r*l);ys+=u,Cs+=u*(t+(t=a)),ks+=u*(n+(n=s)),Es+=u*(r+(r=l)),Ct(t,n,r)}var t,n,r;Ts.point=function(i,o){i*=Ra;var a=Math.cos(o*=Ra);t=a*Math.cos(i),n=a*Math.sin(i),r=Math.sin(o),Ts.point=e,Ct(t,n,r)}}function Et(){Ts.point=xt}function St(){function e(e,t){e*=Ra;var n=Math.cos(t*=Ra),a=n*Math.cos(e),s=n*Math.sin(e),l=Math.sin(t),u=i*l-o*s,c=o*a-r*l,f=r*s-i*a,d=Math.sqrt(u*u+c*c+f*f),p=r*a+i*s+o*l,h=d&&-ee(p)/d,m=Math.atan2(d,p);Ss+=h*u,Ms+=h*c,_s+=h*f,ys+=m,Cs+=m*(r+(r=a)),ks+=m*(i+(i=s)),Es+=m*(o+(o=l)),Ct(r,i,o)}var t,n,r,i,o;Ts.point=function(a,s){t=a,n=s,Ts.point=e,a*=Ra;var l=Math.cos(s*=Ra);r=l*Math.cos(a),i=l*Math.sin(a),o=Math.sin(s),Ct(r,i,o)},Ts.lineEnd=function(){e(t,n),Ts.lineEnd=Et,Ts.point=xt}}function Mt(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function _t(){return!0}function Tt(e,t,n,r,i){var o=[],a=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t];if(wt(n,r)){i.lineStart();for(var s=0;t>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-_a:Na-e[1])-((t=t.x)[0]<0?t[1]-Na-_a: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)<_a?(e.point(n,r=(r+a)/2>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)<_a&&(n-=i*_a),da(o-s)<_a&&(o-=s*_a),r=Ft(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}function Ft(e,t,n,r){var i,o,a=Math.sin(e-n);return da(a)>_a?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 Lt(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])>_a){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,k=C>Da,E=h*y;if(gs.add(Math.atan2(E*x*Math.sin(C),m*b+E*Math.cos(C))),o+=k?w+x*Aa:w,k^d>=n^v>=n){var S=gt(ht(f),ht(e));yt(S);var M=gt(i,S);yt(M);var _=(k^w>=0?-1:1)*te(M[2]);(r>_||r===_&&(S[0]||S[1]))&&(a+=k^w>=0?1:-1)}if(!g++)break;d=v,h=y,m=b,f=e}}return(-_a>o||_a>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]+=_a,h[1]+=_a,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],k=e[1],E=t[1];x>C&&(w=x,x=C,C=w);var S=C-x,M=da(S-Da)<_a,_=M||_a>S;if(!M&&k>E&&(w=k,k=E,E=w),_?M?k+E>0^b[1]<(da(b[0]-x)<_a?k:E):k<=b[1]&&b[1]<=E:S>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)>_a;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)<_a?i>0?0:3:da(r[0]-n)<_a?i>0?2:1:da(r[1]-t)<_a?i>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&&M.rejoin(),m.push(M.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)$=e,y=t,b=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}};_(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,M=Rt(),_=Ht(e,t,n,r),T={point:f,lineStart:d,lineEnd:p,polygonStart:function(){s=M,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 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;Ls.point=function(o,a){Ls.point=e,t=r=o,n=i=a},Ls.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){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,ks+=a*(n+r)/2,Es+=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 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),Ms+=a*(i+t),_s+=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 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(){y=NaN,k.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(){k.point=n,t.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(e,t){o(f=e,d=t),p=y,h=b,m=w,g=x,v=C,k.point=o}function c(){i(y,b,$,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 $=c-t,y=f-n,b=$*$+y*y;if(b>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)<_a||da(r-d)<_a?(r+d)/2:Math.atan2(x,w),M=e(S,E),_=M[0],T=M[1],D=_-t,A=T-n,O=y*D-$*A;(O*O/b>o||da(($*D+y*A)/b-.5)>.3||a>s*p+l*h+u*m)&&(i(t,n,r,s,l,u,_,T,S,w/=k,x/=k,C,g,v),v.point(_,T),i(_,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=Mt(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,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):jt((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]):$,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,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?Mt(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-_a)%(2*Math.PI)}function gn(e,t,n){var r=na.range(e,t-_a,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-_a,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+_a>t&&(t=-Na+_a):t>Na-_a&&(t=Na-_a);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)<_a?ln:(n.invert=function(e,t){var n=o-t;return[Math.atan2(e,n)/i,o-Q(i)*Math.sqrt(e*e+n*n)]},n)}function En(e,t){return[e,Math.log(Math.tan(Da/4+t/2))]}function Sn(e){var t,n=on(e),r=n.scale,i=n.translate,o=n.clipExtent;return n.scale=function(){var e=r.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.translate=function(){var e=i.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.clipExtent=function(e){var a=o.apply(n,arguments);if(a===n){if(t=null==e){var s=Da*r(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else t&&(a=null);return a},n.clipExtent(null)}function Mn(e,t){return[Math.log(Math.tan(Da/4+t/2)),-e]}function _n(e){return e[0]}function Tn(e){return e[1]}function Dn(e){for(var t=e.length,n=[0,1],r=2,i=2;t>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 Ln(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)<_a&&da(r-l.circle.cy)<_a;)o=l.P,s.unshift(l),Fn(l),l=o;s.unshift(l),Wn(l);for(var u=a;u.circle&&da(n-u.circle.x)<_a&&da(r-u.circle.cy)<_a;)a=u.N,s.push(u),Fn(u),u=a;s.push(u),Wn(u);var c,f=s.length;for(c=1;f>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 Un(e){for(var t,n,r,i,o=e.x,a=e.y,s=Js._;s;)if((r=jn(s,a)-o)>_a)s=s.L;else{if(!((i=o-Hn(s,a))>_a)){r>-_a?(t=s.P,n=s):i>-_a?(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};Xn(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)>_a||da(i-n)>_a)&&(s.splice(a,0,new er(Qn(o.site,c,da(r-f)<_a&&h-i>_a?{x:f,y:da(t-f)<_a?n:h}:da(i-h)<_a&&d-r>_a?{x:da(n-h)<_a?t:d,y:h}:da(r-d)<_a&&i-p>_a?{x:d,y:da(t-d)<_a?n:p}:da(i-p)<_a&&r-f>_a?{x:da(n-p)<_a?t:f,y:p}:null),o.site,null)),++l)}function Bn(e,t){return t.angle-e.angle}function zn(){nr(this),this.x=this.y=this.arc=this.site=this.cy=null}function Yn(e){var t=e.P,n=e.N;if(t&&n){var r=t.site,i=e.site,o=n.site;if(r!==o){var a=i.x,s=i.y,l=r.x-a,u=r.y-s,c=o.x-a,f=o.y-s,d=2*(l*f-u*c);if(!(d>=-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=Xs._;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,k=C<<1|x,E=k+4;E>k;++k)if(u=y[3&k])switch(3&k){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 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 Mr(e){return 1-Math.cos(e*Na)}function _r(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=Ur(t),i=Lr(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],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(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 Fi(e){var t=e[0],n=e[e.length-1];return n>t?[t,n]:[n,t]}function Li(e){return e.rangeExtent?e.rangeExtent():Fi(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=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=ji(r.map(i),n?Math:$l);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)},Bi(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(zi(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)},Bi(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,$=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)/$,k=(b*v+g*w)/$,E=(-b*g+v*w)/$,S=x-h,M=C-m,_=k-h,T=E-m;return S*S+M*M>_*_+T*T&&(x=k,C=E),[[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)?_t: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)},Bi(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]},$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=_(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=L(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},wa.insert=function(e,t){return e=L(e),t=_(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 M(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 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 Ma=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]-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=E().touches),t?ia(t).map(function(t){var n=Z(e,t);return n.identifier=t.identifier,n}):[]};var _a=1e-6,Ta=_a*_a,Da=Math.PI,Aa=2*Da,Oa=Aa-_a,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*$;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,$=(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]-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(_[0],Math.min(_[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(b.range().map(function(e){return(e-E.x)/E.k}).map(b.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(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(E.k)/Math.LN2)+1),k()}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),k(),i(Math.pow(2,.002*La())*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},M=[960,500],_=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?(La=function(){return-na.event.deltaY*(na.event.deltaMode?120:1)},"wheel"):"onmousewheel"in oa?(La=function(){return na.event.wheelDelta},"mousewheel"):(La=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=M[0],r=M[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?(_=null==t?ja:[+t[0],+t[1]],e):_},e.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],e):v},e.size=function(t){return arguments.length?(M=t&&[+t[0],+t[1]],e):M},e.duration=function(t){return arguments.length?(T=+t,e):T},e.x=function(t){return arguments.length?(w=t,b=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 La,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=Me($),na.dsv=function(e,t){function n(e,n,o){arguments.length<3&&(o=n,n=null);var a=_e(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[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,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;Le.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($)>_a&&(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)):$>_a?p=90:-_a>$&&(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=ks=Es=Ss=Ms=_s=0,na.geo.stream(e,Ts);var t=Ss,n=Ms,r=_s,i=t*t+n*n+r*r;return Ta>i&&(t=Cs,n=ks,r=Es,_a>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,ks,Es,Ss,Ms,_s,Ts={sphere:w,point:xt,lineStart:kt,lineEnd:Et,polygonStart:function(){Ts.lineStart=St},polygonEnd:function(){Ts.lineStart=kt}},Ds=Ot(_t,Pt,Lt,[-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+_a,f+.12*u+_a],[c-.214*u-_a,f+.234*u-_a]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+_a,f+.166*u+_a],[c-.115*u-_a,f+.234*u-_a]]).stream(l).point,e},e.scale(1070)};var Os,Ns,Rs,Is,Ps,Fs,Ls={point:w,lineStart:w,lineEnd:w,polygonStart:function(){Ns=0,Ls.lineStart=zt},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.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=Qt},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(Ls)),Os},e.centroid=function(e){return bs=ws=xs=Cs=ks=Es=Ss=Ms=_s=0,na.geo.stream(e,i(js)),_s?[Ss/_s,Ms/_s]:Es?[Cs/Es,ks/Es]:xs?[bs/xs,ws/xs]:[NaN,NaN]},e.bounds=function(e){return Ps=Fs=-(Rs=Is=1/0),na.geo.stream(e,i(Us)),[[Rs,Is],[Ps,Fs]]},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 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)>_a}).map(c)).concat(na.range(Math.ceil(s/m)*m,a,m).filter(function(e){return da(e%v)>_a}).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+_a],[180,90-_a]]).minorExtent([[-180,-80-_a],[180,80+_a]])},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(kn)}).raw=kn;var zs=xn(function(e){return 1/e},Math.atan);(na.geo.gnomonic=function(){return on(zs)}).raw=zs,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,Mn.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Na]},(na.geo.transverseMercator=function(){var e=Sn(Mn),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=Mn,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)/_a)*_a,y:Math.round(a(e,t)/_a)*_a,i:t}})}var r=_n,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,k=$-g;C>k?$=g+C:v=m+k;var E=fr();if(E.add=function(e){o(E,e,+y(e,++p),+b(e,p),m,g,v,$)},E.visit=function(e){dr(e,E,m,g,v,$)},E.find=function(e){return pr(E,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 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=[],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&&(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=$,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},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),$=l[1]/(m.depth||1);Xr(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=Mi(a),i=Si(i),a&&i;)l=Si(l),o=Mi(o),o.a=e,r=a.z+f-i.z-u+s(a._,i._),r>0&&(_i(Di(a,e,n),e,r),u+=r,c+=r),f+=a.m,u+=i.m,d+=l.m,c+=o.m;a&&!Mi(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:$,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 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(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,k,E,S=0,M=0,_=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=o===Cl?Math.sqrt(e*e+u*u):+o.apply(this,arguments),p||(M*=-1),u&&(M=te(g/u*Math.sin(v))),e&&(S=te(g/e*Math.sin(v)))),u){$=u*Math.cos(c+M),y=u*Math.sin(c+M),b=u*Math.cos(f-M),w=u*Math.sin(f-M);var T=Math.abs(f-c-2*M)<=Da?0:1;if(M&&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),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==b?[$,y]:Nn([$,y],[k,E],[b,w],[x,C]),R=$-N[0],I=y-N[1],P=b-N[0],F=w-N[1],L=1/Math.sin(Math.acos((R*P+I*F)/(Math.sqrt(R*R+I*I)*Math.sqrt(P*P+F*F)))/2),U=Math.sqrt(N[0]*N[0]+N[1]*N[1]);if(null!=b){var j=Math.min(h,(u-U)/(L+1)),H=po(null==k?[x,C]:[k,E],[$,y],u,j,p),q=po([b,w],[x,C],u,j,p);h===j?_.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]):_.push("M",H[0],"A",j,",",j," 0 1,",m," ",q[0])}else _.push("M",$,",",y);if(null!=k){var V=Math.min(h,(e-U)/(L-1)),B=po([$,y],[k,E],e,-V,p),z=po([x,C],null==b?[$,y]:[b,w],e,-V,p);h===V?_.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]):_.push("L",z[0],"A",V,",",V," 0 0,",m," ",B[0])}else _.push("L",x,",",C)}else _.push("M",$,",",y),null!=b&&_.push("A",u,",",u," 0 ",T,",",p," ",b,",",w),_.push("L",x,",",C),null!=k&&_.push("A",e,",",e," 0 ",A,",",1-p," ",k,",",E);return _.push("Z"),_.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 kl=na.map({linear:mo,"linear-closed":go,step:vo,"step-before":$o,"step-after":yo,basis:Eo,"basis-open":So,"basis-closed":Mo,bundle:_o,cardinal:xo,"cardinal-open":bo,"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],Ml=[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=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=$n,n=yn,r=Lo;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=Lo,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(_l.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 _l=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=_l.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 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",_a),g=na.transition(h.exit()).style("opacity",_a).remove(),v=na.transition(h.order()).style("opacity",1),y=Math.max(i,0)+a,b=Li(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=m.select("line"),_=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"+b[0]+","+O*o+"V0H"+b[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+","+b[0]+"H0V"+b[1]+"H"+O*o)),M.attr(S,O*i),D.attr(E,O*y),_.attr(k,0).attr(S,O*i),A.attr(C,0).attr(E,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 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,$);s.exit().remove(),s.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Ll[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=Li(u),d.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),c&&(l=Li(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),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;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(),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 y,b,w=this,x=na.select(na.event.target),C=l.of(w,arguments),E=na.select(w),S=x.datum(),M=!/^(n|s)$/.test(S)&&u,_=!/^(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",$),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);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());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=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 Ll={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",_t]]),Yl={range:function(e,t,n){return na.range(Math.ceil(e/n)*n,+t,n).map(Xo)},floor:$,ceil:$};Bl.year=os.year,os.scale=function(){return Qo(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",_t]]);Wl.year=os.year.utc,os.scale.utc=function(){return Qo(na.scale.linear(),Wl,Gl)},na.text=Me(function(e){return e.responseText}),na.json=function(e,t){return _e(e,"application/json",ea,t)},na.html=function(e,t){return _e(e,"text/html",ta,t)},na.xml=Me(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&&_o(n)?e(n,r,i,a):Mt(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,k=jr(y);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),y=y-E.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),_t(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=Ft(e,t),rn?wi(i+n,0):n||0,"string"==typeof e||!_o(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(L);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(L);return n.cache=new ur.Cache,n}function cr(e,t){if("function"!=typeof e)throw new Kr(L);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(Xr.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 Fr(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 Li(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 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=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=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=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),_t(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(L);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=kr,Ie.toPlainObject=Er,Ie.transform=function(e,t,n,r){var i=_o(e)||xr(e);return t=bn(t,r,4),null==n&&(i||gr(e)?(r=e.constructor,n=i?_o(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,Mr(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,M,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,_t(t,0,-1))))return!1;t=Wn(t),n=ei.call(e,t)}return n||Rn(e.length)&&Dn(t,e.length)&&(_o(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=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=Lr,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=_o(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=Xe(et({},n||t),r,Qe),n=Xe(et({},t.imports),r.imports,Qe);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,(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,$):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,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){Le.prototype[e]=function(n){var r=this.__filtered__;if(r&&!t)return new Le(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},Le.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;Le.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":"");Le.prototype[e]=function(){return this[n](1).value()[0]}}),Ve(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");Le.prototype[e]=function(){return this.__filtered__?new Le(this):this[n](1)}}),Ve(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?bt:Ur;Le.prototype[e]=function(e){return this[n](r(e))}}),Le.prototype.compact=function(){return this.filter(Ir)},Le.prototype.reject=function(e,t){return e=bn(e,t,1),this.filter(function(t){return!e(t)})},Le.prototype.slice=function(e,t){e=null==e?0:+e||0;var n=this;return n.__filtered__&&(0t)?new Le(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)},Le.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Le.prototype.toArray=function(){return this.take(Mi)},pt(Le.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 Le,c=o[0],f=u||_o(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 Le(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(Le.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}],Le.prototype.clone=function(){var e=new Le(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},Le.prototype.reverse=function(){if(this.__filtered__){var e=new Le(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},Le.prototype.value=function(){var e,t=this.__wrapped__.value(),n=this.__dir__,r=_o(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,ke=/\w*$/,Ee=/^0[xX]/,Se=/^\[object .+?Constructor\]$/,Me=/^\d+$/,_e=/[\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[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[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[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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Fe={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Le={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=Le[typeof exports]&&exports&&!exports.nodeType&&exports,qe=Le[typeof module]&&module&&!module.nodeType&&module,Ve=Le[typeof self]&&self&&self.Object&&self,Be=Le[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)?k(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 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 b(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 M(e){var t,n,r={};for(n in e)i(e,n)&&(t=S(n))&&(r[t]=e[n]);return r}function _(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),_(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=L(t,e.localeData()),er[t]=er[t]||P(t),er[t](e)):e.localeData().invalidDate()}function L(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 U(e,t,n){yr[e]=_(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 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[Mr])?kr:n[Er]<0||n[Er]>59?Er:n[Sr]<0||n[Sr]>59?Sr:n[Mr]<0||n[Mr]>999?Mr:-1,l(e)._overflowDayOfYear&&(wr>t||t>Cr)&&(t=Cr),l(e)._overflowWeeks&&-1===t&&(t=_r),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=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(!Lr.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[kr]&&0===e._a[Er]&&0===e._a[Sr]&&0===e._a[Mr]&&(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 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=L(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),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[kr]<=12&&t._a[kr]>0&&(l(t).bigHour=void 0),t._a[kr]=xe(t._locale,t._a[kr],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 ke(e){if(!e._d){var t=M(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 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:Me(e),u(e)||(e._d=null),e))}function Me(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?ke(i):"number"==typeof o?i._d=new Date(o):e.createFromInputFallback(i)}function _e(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 _e(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 Le(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=Le(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:Le(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(Le(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[kr])*n,m:g(s[Er])*n,s:g(s[Sr])*n,ms:g(s[Mr])*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&&(_(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),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 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[Mr]=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 _(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 _(i)?i(e,t,n,r):i.replace(/%d/i,e)}function $n(e,t){var n=this._relativeTime[e>0?"future":"past"];return _(n)?n(t):n.replace(/%s/i,t)}function yn(e){var t,n;for(n in e)t=e[n],_(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=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 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 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 Mn(){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 _n(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 _n(this,e,t,1)}function Dn(e,t){return _n(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 Ln(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={},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})?/,$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,kr=3,Er=4,Sr=5,Mr=6,_r=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"),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)?)?/,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)?)?/,Lr=/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"),E("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"),E("weekYear","gg"),E("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"),E("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"),E("week","w"),E("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 Qr={dow:0,doy:6};R("D",["DD",2],"Do","date"),E("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 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"),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"),E("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),E("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"],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"),U("m",sr),U("mm",sr,rr),V(["m","mm"],Er);var oi=T("Minutes",!1);R("s",["ss",2],0,"second"),E("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()}),E("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=Mt,ui.toDate=Et,ui.toISOString=pt,ui.toJSON=_t,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=jt,ui.month=J,ui.daysInMonth=Q,ui.week=ui.weeks=Bt,ui.isoWeek=ui.isoWeeks=zt,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=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.",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",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=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"),$i=Fn("s"),yi=Fn("m"),bi=Fn("h"),wi=Fn("d"),xi=Fn("w"),Ci=Fn("M"),ki=Fn("y"),Ei=Un("milliseconds"),Si=Un("seconds"),Mi=Un("minutes"),_i=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=Mn,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=ki,Ii.valueOf=Pn,Ii._bubble=On,Ii.get=Ln,Ii.milliseconds=Ei,Ii.seconds=Si,Ii.minutes=Mi,Ii.hours=_i,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=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 U(new(U(function(){},{prototype:e})),t)}function i(e){return L(arguments,function(t){t!==e&&L(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 L(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 U({},u,t)}function u(e,t,n){if(!n){n=[];for(var r in e)n.push(r)}for(var i=0;i "));if($[n]=r,I(e))g.push(n,[function(){return t.get(e)}],u);else{var i=t.annotate(e);L(i,function(e){e!==n&&l.hasOwnProperty(e)&&p(l[e],e)}),g.push(n,e,i)}v.pop(),$[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=[],$={};return L(l,p),l=v=$=null,function(r,o,a){function s(){--y||(b||i($,o.$$values),p.$$values=$,p.$$promises=p.$$promises||!0,delete p.$$inheritedValues,u.resolve($))}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={},$=U({},r),y=1+g.length/3,b=!1;if(N(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i($,d(o.$$inheritedValues,m)),U(v,o.$$promises),o.$$values?(b=i($,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,$)),f.promise.then(function(e){$[n]=e,s()},u)}catch(e){u(e)}}var f=e.defer(),d=0;L(o,function(e){v.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&(d++,v[e].then(function(t){$[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=U({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;(l=u.exec(e))&&(v=s(l,!1),!(v.segment.indexOf("?")>=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 $(e){U(this,e)}function y(){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(b[e.name],f.invoke(e.def))}}function c(e){U(this,e||{})}H=this;var f,d=!1,m=!0,g=!1,b={},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:/.*/}};y.$$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,U(o(),t))},this.isMatcher=function(e){if(!P(e))return!1;var t=!0;return L(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 b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new $(U({name:e},t)),n&&(x.push({name:e,def:n}),w||u()),this},L(C,function(e,t){b[t]=new $(U({name:t},e))}),b=r(b,{}),this.$get=["$injector",function(e){return f=e,w=!1,u(),L(C,function(e,t){b[t]||(b[t]=new $(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: '"+y+"' 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 $?t.type:new $(t.type):"config"===r?b.any:b.string)}(r,t,i);var m=function(){var t={array:"search"===i&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return U(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,y=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,y);U(this,{id:e,type:t,location:i,array:m,squash:y,replace:w,isOptional:v,value:u,dynamic:n,config:r,toString:c})},c.prototype={$$new:function(){return r(this,U(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(),L(t,function(t){L(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return L(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return L(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)}]),U(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)}]),U(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 _)R(_[o])&&(t[o]=_[o](t,_.$delegates[o]));return E[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})}]),m(n),t}function v(e){return e.indexOf("*")>-1}function $(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 y(e,t){return I(e)&&!N(t)?_[e]:R(t)&&I(e)?(_[e]&&!_.$delegates[e]&&(_.$delegates[e]=_[e]),_[e]=t,this):this}function b(e,t){return P(e)?t=e:t.name=e,g(t),this}function w(e,i,o,s,f,p,m,g,y){function b(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 L(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")),_=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,U({inherit:!0,relative:k.$current},n))},k.transitionTo=function(t,n,o){n=n||{},o=U({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 $={to:t,toParams:n,options:o},y=b($,u.self,f,o);if(y)return y;if(t=$.to,n=$.toParams,o=$.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[M])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,j(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(),_;for(var L=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 M(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 _(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=M(a.uiSref,e.current.name),u=null,c=_(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},$=i.$eval(a.uiSrefOpts)||{};t.forEach(r,function(e){e in $&&(v[e]=$[e])});var y=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&&y(e)},!0),u=t.copy(i.$eval(l.paramExpr))),y(),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 $=n[o+1];if(!1===g)null!=v&&(u+=F(v)?h(v,t).join("-"):encodeURIComponent(v)),u+=$;else if(!0===g){var y=u.match(/\/$/)?/\/?(.*)/:/(.*)/;u+=$.match(y)[1]}else I(g)&&(u+=g+$)}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},$.prototype.is=function(e,t){return!0},$.prototype.encode=function(e,t){return e},$.prototype.decode=function(e,t){return e},$.prototype.equals=function(e,t){return e==t},$.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},$.prototype.pattern=/.*/,$.prototype.toString=function(){return"{Type:"+this.name+"}"},$.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},$.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)}); //# 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/src/common/vendor/angular/angular-animate.min.js b/org.civicrm.reqangular/js/src/common/vendor/angular/angular-animate.min.js index cabd0cfe67f..82298ec10e5 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.6.10 + (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=g,g=0,b.push(e),e=[]);e.push(f.fn);f.children.forEach(function(a){g++;c.push(a)});a--}e.length&&b.push(e);return b}(c)}var s=[],y=X(a);return function(n,q,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 g(a){var b=[],c={};t(a,function(a,d){var k=J(a.element),g=0<=["enter","move"].indexOf(a.event),k=a.structural?E(k):[];if(k.length){var e=g?"to":"from";t(k,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]||{};c[b][e]={animationID:d,element:A(a)}})}else b.push(a)});var d={},g={};t(c,function(c,e){var f=c.from,p=c.to;if(f&&p){var H=a[f.animationID], +z=a[p.animationID],m=f.animationID.toString();if(!g[m]){var l=g[m]={structural:!0,beforeStart:function(){H.beforeStart();z.beforeStart()},close:function(){H.close();z.close()},classes:M(H.classes,z.classes),from:H,to:z,anchors:[]};l.classes.length?b.push(l):(b.push(H),b.push(z))}g[m].anchors.push({out:f.element,"in":p.element})}else f=f?f.animationID:p.animationID,p=f.toString(),d[p]||(d[p]=!0,b.push(a[f]))});return b}function M(a,b){a=a.split(" ");b=b.split(" ");for(var c=[],d=0;d=P&&b>=N&&(ba=!0,m()))}function ga(){function b(){if(!M){L(!1);t(x,function(a){k.style[a[0]]=a[1]});g(a,h); +e.addClass(a,ca);if(r.recalculateTimingStyles){ma=k.getAttribute("class")+" "+fa;ja=q(k,ma);B=E(k,ma,ja);$=B.maxDelay;w=Math.max($,0);N=B.maxDuration;if(0===N){m();return}r.hasTransitions=0s.expectedEndTime)?n.cancel(s.timer):f.push(m)}F&&(l=n(c,l,!1),f[0]={timer:l,expectedEndTime:d},f.push(m),a.data("$$animateCss",f));if(ea.length)a.on(ea.join(" "),z);h.to&&(h.cleanupStyles&&Ma(p,k,Object.keys(h.to)),Ia(a,h))}}function c(){var b= +a.data("$$animateCss");if(b){for(var d=1;d * * 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 +1051,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 +1146,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 +1156,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...'; }); }; @@ -1192,7 +1220,7 @@ angular.mock.dump = function(object) { 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 @@ -1301,9 +1329,8 @@ 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. @@ -1324,15 +1351,18 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { expectations = [], responses = [], responsesPush = angular.bind(responses, responses.push), - copy = angular.copy; + 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] - : [200, status, data, headers]; + ? [status, data, headers, statusText, 'complete'] + : [200, status, data, headers, 'complete']; }; } @@ -1355,26 +1385,31 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { function wrapResponse(wrapped) { if (!$browser && timeout) { if (timeout.then) { - timeout.then(handleTimeout); + timeout.then(function() { + handlePrematureEnd(angular.isDefined(timeout.$$timeoutId) ? 'timeout' : 'abort'); + }); } else { - $timeout(handleTimeout, timeout); + $timeout(function() { + handlePrematureEnd('timeout'); + }, timeout); } } + 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] || '')); + copy(response[3] || ''), copy(response[4])); } - function handleTimeout() { + function handlePrematureEnd(reason) { for (var i = 0, ii = responses.length; i < ii; i++) { if (responses[i] === handleResponse) { responses.splice(i, 1); - callback(-1, undefined, ''); + callback(-1, undefined, '', undefined, reason); break; } } @@ -1409,15 +1444,21 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { // 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); + originalHttpBackend(method, url, data, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers); } else throw new Error('No response defined !'); return; } } - throw wasExpected ? + 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; } /** @@ -1427,7 +1468,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * 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,17 +1479,20 @@ 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) { + + assertArgDefined(arguments, 1, 'url'); + var definition = new MockHttpExpectation(method, url, data, headers, keys), chain = { respond: function(status, data, headers, statusText) { @@ -1476,7 +1520,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 above. @@ -1491,7 +1535,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 above. @@ -1506,7 +1550,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 above. @@ -1521,7 +1565,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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. @@ -1538,7 +1582,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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. @@ -1555,7 +1599,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 @@ -1591,7 +1635,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { url = url .replace(/([().])/g, '\\$1') - .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) { + .replace(/(\/)?:(\w+)([?*])?/g, function(_, slash, key, option) { var optional = option === '?' ? option : null; var star = option === '*' ? option : null; keys.push({ name: key, optional: !!optional }); @@ -1605,7 +1649,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { + ')' + (optional || ''); }) - .replace(/([\/$\*])/g, '\\$1'); + .replace(/([/$*])/g, '\\$1'); ret.regexp = new RegExp('^' + url, 'i'); return ret; @@ -1618,7 +1662,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * 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,17 +1674,20 @@ 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) { + + assertArgDefined(arguments, 1, 'url'); + var expectation = new MockHttpExpectation(method, url, data, headers, keys), chain = { respond: function(status, data, headers, statusText) { @@ -1659,7 +1706,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 + * @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 {(Array)=} keys Array of keys to assign to regex matches in request url described above. @@ -1674,7 +1721,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 + * @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 {(Array)=} keys Array of keys to assign to regex matches in request url described above. @@ -1689,7 +1736,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 + * @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 {(Array)=} keys Array of keys to assign to regex matches in request url described above. @@ -1704,7 +1751,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 + * @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 @@ -1722,7 +1769,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 + * @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 @@ -1740,7 +1787,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 + * @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 @@ -1758,7 +1805,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * @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 + * @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 {(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 @@ -1858,9 +1905,12 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * afterEach($httpBackend.verifyNoOutstandingRequest); * ``` */ - $httpBackend.verifyNoOutstandingRequest = function() { + $httpBackend.verifyNoOutstandingRequest = function(digest) { + if (digest !== false) $rootScope.$digest(); if (responses.length) { - throw new Error('Unflushed requests: ' + responses.length); + var unflushedDescriptions = responses.map(function(res) { return res.description; }); + throw new Error('Unflushed requests: ' + responses.length + '\n ' + + unflushedDescriptions.join('\n ')); } }; @@ -1878,24 +1928,43 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { responses.length = 0; }; + $httpBackend.$$originalHttpBackend = originalHttpBackend; + return $httpBackend; function createShortMethods(prefix) { angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) { $httpBackend[prefix + method] = function(url, headers, keys) { + assertArgDefined(arguments, 0, 'url'); + + // 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'); + + // 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, data, headers, keys); }; }); } } +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'); + } +} + + function MockHttpExpectation(method, url, data, headers, keys) { function getUrlParams(u) { @@ -2052,10 +2121,14 @@ function MockXhr() { return lines.join('\n'); }; - this.abort = angular.noop; + this.abort = function() { + if (isFunction(this.onabort)) { + this.onabort(); + } + }; // 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 + // 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) { @@ -2166,6 +2239,10 @@ angular.mock.$RootElementProvider = function() { * A decorator for {@link ng.$controller} with additional `bindings` parameter, useful when testing * controllers of directives that use {@link $compile#-bindtocontroller- `bindToController`}. * + * Depending on the value of + * {@link ng.$compileProvider#preAssignBindingsEnabled `preAssignBindingsEnabled()`}, the properties + * will be bound before or after invoking the constructor. + * * * ## Example * @@ -2184,18 +2261,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']); + * })); + * }); * }); * * ``` @@ -2207,44 +2290,61 @@ 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) + * `window` object (deprecated, 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(compileProvider) { + angular.mock.$ControllerDecorator = ['$delegate', function($delegate) { + return function(expression, locals, later, ident) { + if (later && typeof later === 'object') { + var preAssignBindingsEnabled = compileProvider.preAssignBindingsEnabled(); + + var instantiate = $delegate(expression, locals, true, ident); + if (preAssignBindingsEnabled) { + angular.extend(instantiate.instance, later); + } + + var instance = instantiate(); + if (!preAssignBindingsEnabled || instance !== instantiate.instance) { + 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 @@ -2287,21 +2387,17 @@ angular.mock.$ComponentControllerProvider = ['$compileProvider', * @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"` @@ -2330,15 +2426,15 @@ angular.module('ngMock', ['ng']).provider({ $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) { +}).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', angular.mock.$ControllerDecorator); -}]); + $provide.decorator('$controller', createControllerDecorator($compileProvider)); + $provide.decorator('$httpBackend', angular.mock.$httpBackendDecorator); +}]).info({ angularVersion: '1.6.10' }); /** * @ngdoc module @@ -2347,14 +2443,13 @@ angular.module('ngMock', ['ng']).provider({ * @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); -}]); +}]).info({ angularVersion: '1.6.10' }); /** * @ngdoc service @@ -2401,14 +2496,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', []); @@ -2479,9 +2574,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,15 +2586,15 @@ 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. @@ -2511,7 +2607,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * @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 @@ -2528,7 +2624,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * @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 @@ -2545,7 +2641,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * @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 @@ -2562,9 +2658,10 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * @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}. @@ -2580,9 +2677,10 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * @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}. @@ -2598,9 +2696,10 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * @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}. @@ -2616,7 +2715,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * @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}. @@ -2914,12 +3013,6 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { delete fn.$inject; }); - angular.forEach(currentSpec.$modules, function(module) { - if (module && module.$$hashKey) { - module.$$hashKey = undefined; - } - }); - currentSpec.$injector = null; currentSpec.$modules = null; currentSpec.$providerInjector = null; @@ -2981,7 +3074,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. * * ``` @@ -3134,5 +3227,279 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { } })(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'; + } + + keys = keys || []; + function pressed(key) { + return keys.indexOf(key) !== -1; + } + + 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 { + 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); + } + + /* 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; + + var originalPreventDefault = evnt.preventDefault, + appWindow = element.ownerDocument.defaultView, + fakeProcessDefault = true, + finalProcessDefault, + angular = appWindow.angular || {}; + + // igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208 + angular['ff-684208-preventDefault'] = false; + evnt.preventDefault = function() { + fakeProcessDefault = false; + return originalPreventDefault.apply(evnt, arguments); + }; + + if (!eventData.bubbles || supportsEventBubblingInDetachedTree() || isAttachedToDocument(element)) { + element.dispatchEvent(evnt); + } else { + triggerForPath(element, evnt); + } + + finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault); + + delete angular['ff-684208-preventDefault']; + + return finalProcessDefault; + }; + + 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..d9ce09db874 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.6.10 + (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").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;pc)return"...";var d=b.$$hashKey,g;if(I(a)){g=0;for(var f=a.length;g
    ").append(a).html();try{return a[0].nodeType===Ma?N(b):b.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(a,b){return"<"+N(b)})}catch(d){return N(b)}}function Vc(a){try{return decodeURIComponent(a)}catch(b){}}function fc(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=Vc(e),u(e)&&(f=u(f)?Vc(f):!0,ra.call(b,e)?I(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function gc(a){var b=[];q(a,function(a,c){I(a)?q(a,function(a){b.push(ia(c,!0)+(!0===a?"":"="+ia(a,!0)))}):b.push(ia(c,!0)+(!0===a?"":"="+ia(a,!0)))});return b.length?b.join("&"):""}function fb(a){return ia(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ia(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=Ga.length;for(c=0;c protocol indicates an extension, document.location.href does not match."))}function Wc(a,b,d){G(d)||(d={});d=P({strictDi:!1},d);var c=function(){a=z(a);if(a.injector()){var c=a[0]===y.document?"document":za(a);throw oa("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=gb(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!/;y&&e.test(y.name)&&(d.debugInfoEnabled=!0,y.name=y.name.replace(e,""));if(y&&!f.test(y.name))return c();y.name=y.name.replace(f,"");ea.resumeBootstrap=function(a){q(a,function(a){b.push(a)});return c()};C(ea.resumeDeferredBootstrap)&& +ea.resumeDeferredBootstrap()}function Ae(){y.name="NG_ENABLE_DEBUG_INFO!"+y.name;y.location.reload()}function Be(a){a=ea.element(a).injector();if(!a)throw oa("test");return a.get("$$testability")}function Xc(a,b){b=b||"_";return a.replace(Ce,function(a,c){return(c?b:"")+a.toLowerCase()})}function De(){var a;if(!Yc){var b=rb();(ta=x(b)?y.jQuery:b?y[b]:void 0)&&ta.fn.on?(z=ta,P(ta.fn,{scope:Ua.scope,isolateScope:Ua.isolateScope,controller:Ua.controller,injector:Ua.injector,inheritedData:Ua.inheritedData}), +a=ta.cleanData,ta.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=ta._data(f,"events"))&&c.$destroy&&ta(f).triggerHandler("$destroy");a(b)}):z=S;ea.element=z;Yc=!0}}function hb(a,b,d){if(!a)throw oa("areq",b||"?",d||"required");return a}function sb(a,b,d){d&&I(a)&&(a=a[a.length-1]);hb(C(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Ha(a,b){if("hasOwnProperty"===a)throw oa("badname",b);}function Zc(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=db(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 S(a){if(a instanceof S)return a;var b;F(a)&&(a=Q(a),b=!0);if(!(this instanceof S)){if(b&&"<"!==a.charAt(0))throw mc("nosel");return new S(a)}if(b){b=y.document;var d;a=(d=hg.exec(a))?[b.createElement(d[1])]: +(d=hd(a,b))?d.childNodes:[];nc(this,a)}else C(a)?id(a):nc(this,a)}function oc(a){return a.cloneNode(!0)}function yb(a,b){!b&&kc(a)&&z.cleanData([a]);a.querySelectorAll&&z.cleanData(a.querySelectorAll("*"))}function jd(a,b,d,c){if(u(c))throw mc("offargs");var e=(c=zb(a))&&c.events,f=c&&c.handle;if(f)if(b){var g=function(b){var c=e[b];u(d)&&cb(c||[],d);u(d)&&c&&0l&&this.remove(n.key);return b}},get:function(a){if(l";b=Aa.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);d.value=c;a.attributes.setNamedItem(d)}function Pa(a,b){try{a.addClass(b)}catch(c){}} +function ba(a,b,c,d,e){a instanceof z||(a=z(a));var g=Sa(a,b,a,c,d,e);ba.$$addScopeClass(a);var f=null;return function(b,c,d){if(!a)throw aa("multilink");hb(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);f||(f=(d=d&&d[0])?"foreignobject"!==ya(d)&&ha.call(d).match(/SVG/)?"svg":"html":"html");d="html"!==f?z(fa(f,z("
    ").append(a).html())):c?Ua.clone.call(a): +a;if(k)for(var l in k)d.data("$"+l+"Controller",k[l].instance);ba.$$addScopeInfo(d,b);c&&c(d,b);g&&g(b,d,d,h);c||(a=g=null);return d}}function Sa(a,b,c,d,e,g){function f(a,c,d,e){var g,k,l,m,p,n,H;if(K)for(H=Array(c.length),m=0;mt.priority)break;if(y=t.scope)t.templateUrl||(G(y)?($("new/isolated scope",O||H,t,v),O=t):$("new/isolated scope",O,t,v)),H=H||t;L=t.name;if(!la&&(t.replace&&(t.templateUrl||t.template)||t.transclude&&!t.$$tlb)){for(y=Ca+1;la=a[y++];)if(la.transclude&&!la.$$tlb||la.replace&&(la.templateUrl||la.template)){u=!0;break}la=!0}!t.templateUrl&& +t.controller&&(w=w||R(),$("'"+L+"' controller",w[L],t,v),w[L]=t);if(y=t.transclude)if(T=!0,t.$$tlb||($("transclusion",s,t,v),s=t),"element"===y)qa=!0,n=t.priority,V=v,v=d.$$element=z(ba.$$createComment(L,d[L])),b=v[0],ja(g,xa.call(V,0),b),V[0].$$parentNode=V[0].parentNode,r=U(u,V,e,n,f&&f.name,{nonTlbTranscludeDirective:s});else{var F=R();if(G(y)){V=[];var Qa=R(),M=R();q(y,function(a,b){var c="?"===a.charAt(0);a=c?a.substring(1):a;Qa[a]=b;F[b]=null;M[b]=c});q(v.contents(),function(a){var b=Qa[Da(ya(a))]; +b?(M[b]=!0,F[b]=F[b]||[],F[b].push(a)):V.push(a)});q(M,function(a,b){if(!a)throw aa("reqslot",b);});for(var Sa in F)F[Sa]&&(F[Sa]=U(u,F[Sa],e))}else V=z(oc(b)).contents();v.empty();r=U(u,V,e,void 0,void 0,{needsNewScope:t.$$isolateScope||t.$$newScope});r.$$slots=F}if(t.template)if(E=!0,$("template",A,t,v),A=t,y=C(t.template)?t.template(v,d):t.template,y=Ha(y),t.replace){f=t;V=lc.test(y)?sd(fa(t.templateNamespace,Q(y))):[];b=V[0];if(1!==V.length||1!==b.nodeType)throw aa("tplrt",L,"");ja(g,v,b);Oa= +{$attr:{}};y=sc(b,[],Oa);var N=a.splice(Ca+1,a.length-(Ca+1));(O||H)&&Z(y,O,H);a=a.concat(y).concat(N);da(d,Oa);Oa=a.length}else v.html(y);if(t.templateUrl)E=!0,$("template",A,t,v),A=t,t.replace&&(f=t),p=ia(a.splice(Ca,a.length-Ca),v,d,g,T&&r,h,k,{controllerDirectives:w,newScopeDirective:H!==t&&H,newIsolateScopeDirective:O,templateDirective:A,nonTlbTranscludeDirective:s}),Oa=a.length;else if(t.compile)try{ua=t.compile(v,d,r);var tc=t.$$originalDirective||t;C(ua)?m(null,Ta(tc,ua),Pa,D):ua&&m(Ta(tc, +ua.pre),Ta(tc,ua.post),Pa,D)}catch(X){c(X,za(v))}t.terminal&&(p.terminal=!0,n=Math.max(n,t.priority))}p.scope=H&&!0===H.scope;p.transcludeOnThisElement=T;p.templateOnThisElement=E;p.transclude=r;l.hasElementTranscludeDirective=qa;return p}function W(a,b,c,d){var e;if(F(b)){var g=b.match(l);b=b.substring(g[0].length);var f=g[1]||g[3],g="?"===g[2];"^^"===f?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e=f?c.inheritedData(h):c.data(h)}if(!e&&!g)throw aa("ctreq",b,a);}else if(I(b))for(e= +[],f=0,g=b.length;fc.priority)&&-1!==c.restrict.indexOf(e)){k&&(c=$b(c,{$$start:k,$$end:l}));if(!c.$$bindings){var H=m=c,K=c.name,t={isolateScope:null,bindToController:null};G(H.scope)&&(!0===H.bindToController?(t.bindToController=d(H.scope,K,!0),t.isolateScope={}):t.isolateScope=d(H.scope,K,!1));G(H.bindToController)&&(t.bindToController=d(H.bindToController,K,!0));if(t.bindToController&&!H.controller)throw aa("noctrl", +K);m=m.$$bindings=t;G(m.isolateScope)&&(c.$$isolateBindings=m.isolateScope)}b.push(c);m=c}}return m}function ea(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 pa(a,b){if("srcdoc"===b)return qa.HTML;var c=ya(a);if("src"===b||"ngSrc"===b){if(-1===["img","video","audio","source","track"].indexOf(c))return qa.RESOURCE_URL}else if("xlinkHref"===b||"form"===c&&"action"===b||"link"===c&&"href"===b)return qa.RESOURCE_URL} +function va(a,c,d,e,g){var f=pa(a,e),k=h[e]||g,l=b(d,!g,f,k);if(l){if("multiple"===e&&"select"===ya(a))throw aa("selmulti",za(a));if(m.test(e))throw aa("nodomevents");c.push({priority:100,compile:function(){return{pre:function(a,c,g){c=g.$$observers||(g.$$observers=R());var h=g[e];h!==d&&(l=h&&b(h,!0,f,k),d=h);l&&(g[e]=l(a),(c[e]||(c[e]=[])).$$inter=!0,(g.$$observers&&g.$$observers[e].$$scope||a).$watch(l,function(a,b){"class"===e&&a!==b?g.$updateClass(a,b):g.$set(e,a)}))}}}})}}function ja(a,b,c){var d= +b[0],e=b.length,g=d.parentNode,f,h;if(a)for(f=0,h=a.length;f=b)return a;for(;b--;){var d=a[b];(8===d.nodeType||d.nodeType===Ma&&""===d.nodeValue.trim())&&wg.call(a,b,1)}return a}function ug(a,b){if(b&&F(b))return b;if(F(a)){var d=vd.exec(a);if(d)return d[3]}} +function Af(){var a={},b=!1;this.has=function(b){return a.hasOwnProperty(b)};this.register=function(b,c){Ha(b,"controller");G(b)?P(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||!G(a.$scope))throw M("$controller")("noscp",d,b);a.$scope[b]=c}return function(f,g,k,h){var l,m,p;k=!0===k;h&&F(h)&&(p=h);if(F(f)){h=f.match(vd);if(!h)throw wd("ctrlfmt",f);m=h[1];p=p||h[3];f=a.hasOwnProperty(m)?a[m]:Zc(g.$scope,m,!0)||(b?Zc(c,m,!0): +void 0);if(!f)throw wd("ctrlreg",m);sb(f,m,!0)}if(k)return k=(I(f)?f[f.length-1]:f).prototype,l=Object.create(k||null),p&&e(g,p,l,m||f.name),P(function(){var a=d.invoke(f,l,g,m);a!==l&&(G(a)||C(a))&&(l=a,p&&e(g,p,l,m||f.name));return l},{instance:l,identifier:p});l=d.instantiate(f,g,m);p&&e(g,p,l,m||f.name);return l}}]}function Bf(){this.$get=["$window",function(a){return z(a.document)}]}function Cf(){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 Df(){this.$get=["$log",function(a){return function(b,d){a.error.apply(a,arguments)}}]}function vc(a){return G(a)?da(a)?a.toISOString():eb(a):a}function If(){this.$get=function(){return function(a){if(!a)return"";var b=[];Qc(a,function(a,c){null===a||x(a)||C(a)||(I(a)?q(a,function(a){b.push(ia(c)+"="+ia(vc(a)))}):b.push(ia(c)+"="+ia(vc(a))))});return b.join("&")}}}function Jf(){this.$get= +function(){return function(a){function b(a,e,f){null===a||x(a)||(I(a)?q(a,function(a,c){b(a,e+"["+(G(a)?c:"")+"]")}):G(a)&&!da(a)?Qc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}):d.push(ia(e)+"="+ia(vc(a))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function wc(a,b){if(F(a)){var d=a.replace(xg,"").trim();if(d){var c=b("Content-Type"),c=c&&0===c.indexOf(xd),e;(e=c)||(e=(e=d.match(yg))&&zg[e[0]].test(d));if(e)try{a=Tc(d)}catch(f){if(!c)return a;throw Kb("baddata",a,f);}}}return a}function yd(a){var b= +R(),d;F(a)?q(a.split("\n"),function(a){d=a.indexOf(":");var e=N(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=N(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[N(d)],void 0===d&&(d=null),d):b}}function Ad(a,b,d,c){if(C(c))return c(a,b,d);q(c,function(c){a=c(a,b,d)});return a}function Hf(){var a=this.defaults={transformResponse:[wc],transformRequest:[function(a){return G(a)&&"[object File]"!== +ha.call(a)&&"[object Blob]"!==ha.call(a)&&"[object FormData]"!==ha.call(a)?eb(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:pa(xc),put:pa(xc),patch:pa(xc)},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 M("$http")("badreq",b);if(!F(p.valueOf(b.url)))throw M("$http")("badreq",b.url);var f= +P({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer,jsonpCallbackParam:a.jsonpCallbackParam},b);f.headers=function(b){var c=a.headers,e=P({},b.headers),g,f,h,c=P({},c.common,c[N(b.method)]);a:for(g in c){f=N(g);for(h in e)if(N(h)===f)continue a;e[g]=c[g]}return d(e,pa(b))}(b);f.method=ub(f.method);f.paramSerializer=F(f.paramSerializer)?m.get(f.paramSerializer):f.paramSerializer;e.$$incOutstandingRequestCount();var h=[],k=[];b= +l.resolve(f);q(s,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);x(d)&&q(c,function(a,b){"content-type"===N(b)&&delete c[b]});x(b.withCredentials)&&!x(a.withCredentials)&&(b.withCredentials=a.withCredentials);return B(b,d).then(g,g)});b=c(b,k);return b=b.finally(function(){e.$$completeOutstandingRequest(D)})}function B(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,g){function f(){m(c,a,d,e,g)}L&&(200<=a&&300>a?L.put(z,[a,c,yd(d),e,g]):L.remove(z));b?h.$applyAsync(f):(f(),h.$$phase||h.$apply())}function m(a,b,d,e,g){b=-1<=b?b:0;(200<=b&&300>b?s.resolve:s.reject)({data:a,status:b,headers:zd(d),config:c,statusText:e,xhrStatus:g})}function t(a){m(a.data,a.status,pa(a.headers()),a.statusText,a.xhrStatus)} +function B(){var a=n.pendingRequests.indexOf(c);-1!==a&&n.pendingRequests.splice(a,1)}var s=l.defer(),qa=s.promise,L,r,la=c.headers,y="jsonp"===N(c.method),z=c.url;y?z=p.getTrustedResourceUrl(z):F(z)||(z=p.valueOf(z));z=v(z,c.paramSerializer(c.params));y&&(z=E(z,c.jsonpCallbackParam));n.pendingRequests.push(c);qa.then(B,B);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(L=G(c.cache)?c.cache:G(a.cache)?a.cache:A);L&&(r=L.get(z),u(r)?r&&C(r.then)?r.then(t,t):I(r)?m(r[1],r[0], +pa(r[2]),r[3],r[4]):m(r,200,{},"OK","complete"):L.put(z,qa));x(r)&&((r=J(c.url)?g()[c.xsrfCookieName||a.xsrfCookieName]:void 0)&&(la[c.xsrfHeaderName||a.xsrfHeaderName]=r),f(c.method,z,d,k,la,c.timeout,c.withCredentials,c.responseType,e(c.eventHandlers),e(c.uploadEventHandlers)));return qa}function v(a,b){0=l&&(J.resolve(A),E(q.$$intervalId),delete g[q.$$intervalId]);s||a.$apply()},h);g[q.$$intervalId]=J;return q}var g={};f.cancel=function(a){return a&&a.$$intervalId in g?(g[a.$$intervalId].promise.$$state.pur=!0,g[a.$$intervalId].reject("canceled"),b.clearInterval(a.$$intervalId),delete g[a.$$intervalId],!0):!1};return f}]}function yc(a){a=a.split("/");for(var b=a.length;b--;)a[b]= +fb(a[b].replace(/%2F/g,"/"));return a.join("/")}function Bd(a,b){var d=ma(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=Z(d.port)||Cg[d.protocol]||null}function Cd(a,b,d){if(Dg.test(a))throw kb("badpath",a);var c="/"!==a.charAt(0);c&&(a="/"+a);a=ma(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=fc(a.search);b.$$hash=decodeURIComponent(a.hash); +b.$$path&&"/"!==b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function zc(a,b){return a.slice(0,b.length)===b}function va(a,b){if(zc(b,a))return b.substr(a.length)}function Ka(a){var b=a.indexOf("#");return-1===b?a:a.substr(0,b)}function lb(a){return a.replace(/(#.+)|#$/,"$1")}function Ac(a,b,d){this.$$html5=!0;d=d||"";Bd(a,this);this.$$parse=function(a){var d=va(b,a);if(!F(d))throw kb("ipthprfx",a,b);Cd(d,this,!0);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=gc(this.$$search), +d=this.$$hash?"#"+fb(this.$$hash):"";this.$$url=yc(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=va(a,c))?(g=f,g=d&&u(f=va(d,f))?b+(va("/",f)||f):a+g):u(f=va(b,c))?g=b+f:b===c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function Bc(a,b,d){Bd(a,this);this.$$parse=function(c){var e=va(a,c)||va(b,c),f;x(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",x(e)&&(a=c, +this.replace())):(f=va(d,e),x(f)&&(f=e));Cd(f,this,!1);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;zc(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=gc(this.$$search),e=this.$$hash?"#"+fb(this.$$hash):"";this.$$url=yc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+(this.$$url?d+this.$$url:"");this.$$urlUpdatedByLocation=!0};this.$$parseLinkUrl=function(b,d){return Ka(a)===Ka(b)?(this.$$parse(b),!0):!1}}function Dd(a,b,d){this.$$html5= +!0;Bc.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a===Ka(c)?f=c:(g=va(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$compose=function(){var b=gc(this.$$search),e=this.$$hash?"#"+fb(this.$$hash):"";this.$$url=yc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+d+this.$$url;this.$$urlUpdatedByLocation=!0}}function Lb(a){return function(){return this[a]}}function Ed(a,b){return function(d){if(x(d))return this[a];this[a]= +b(d);this.$$compose();return this}}function Nf(){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(La(a))return b.enabled=a,this;if(G(a)){La(a.enabled)&&(b.enabled=a.enabled);La(a.requireBase)&&(b.requireBase=a.requireBase);if(La(a.rewriteLinks)||F(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(),g=l.$$state;try{c.url(a,b,d),l.$$state=c.state()}catch(f){throw l.url(e),l.$$state=g,f;}}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?Ac:Dd}else n=Ka(p),m=Bc;var B=n.substr(0,Ka(n).lastIndexOf("/")+1);l=new m(n,B,"#"+a);l.$$parseLinkUrl(p,p);l.$$state=c.state();var v=/^\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 h=z(a.target);"a"!==ya(h[0]);)if(h[0]===f[0]||!(h=h.parent())[0])return;if(!F(e)||!x(h.attr(e))){var e=h.prop("href"),k=h.attr("href")||h.attr("xlink:href");G(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=ma(e.animVal).href);v.test(e)||!e||h.attr("target")||a.isDefaultPrevented()||!l.$$parseLinkUrl(e,k)||(a.preventDefault(),l.absUrl()!==c.url()&&(d.$apply(),g.angular["ff-684208-preventDefault"]= +!0))}}});lb(l.absUrl())!==lb(p)&&c.url(l.absUrl(),!0);var q=!0;c.onUrlChange(function(a,b){zc(a,B)?(d.$evalAsync(function(){var c=l.absUrl(),e=l.$$state,g;a=lb(a);l.$$parse(a);l.$$state=b;g=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;l.absUrl()===a&&(g?(l.$$parse(c),l.$$state=e,k(c,!1,e)):(q=!1,h(c,e)))}),d.$$phase||d.$digest()):g.location.href=a});d.$watch(function(){if(q||l.$$urlUpdatedByLocation){l.$$urlUpdatedByLocation=!1;var a=lb(c.url()),b=lb(l.absUrl()),g=c.state(),f=l.$$replace, +m=a!==b||l.$$html5&&e.history&&g!==l.$$state;if(q||m)q=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,l.$$state,g).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=g):(m&&k(b,f,g===l.$$state?null:l.$$state),h(a,g)))})}l.$$replace=!1});return l}]}function Of(){var a=!0,b=this;this.debugEnabled=function(b){return u(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){bc(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||D;return function(){var a=[];q(arguments,function(b){a.push(c(b))});return Function.prototype.apply.call(e,b,a)}}var f=Ba||/\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 Eg(a){return a+""}function Fg(a, +b){return"undefined"!==typeof a?a:b}function Fd(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function Gg(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 U(a,b,d){var c,e,f=a.isPure=Gg(a,d);switch(a.type){case r.Program:c=!0;q(a.body,function(a){U(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:U(a.argument,b,f);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;break;case r.BinaryExpression:U(a.left,b,f);U(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:U(a.left,b,f);U(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case r.ConditionalExpression:U(a.test,b,f);U(a.alternate,b,f); +U(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:U(a.object,b,f);a.computed&&U(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){U(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:U(a.left,b,f);U(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){U(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){U(a.value,b,f);c=c&&a.value.constant;e.push.apply(e,a.value.toWatch);a.computed&&(U(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 Mb(a,b,d){this.ast=new r(a,d);this.astCompiler=d.csp?new Ld(b):new Kd(b)}function Cc(a){return C(a.valueOf)?a.valueOf():Hg.call(a)}function Pf(){var a=R(),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,g;switch(typeof b){case "string":return g=b=b.trim(),d=a[g],d||(d=new Nb(n),d=(new Mb(d,e,n)).parse(b), +d.constant?d.$$watchDelegate=m:d.oneTime?d.$$watchDelegate=d.literal?l:h:d.inputs&&(d.$$watchDelegate=k),a[g]=d),p(d,c);case "function":return p(b,c);default:return p(D,c)}}function g(a,b,c){return null==a||null==b?a===b:"object"!==typeof a||(a=Cc(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&&Cc(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)ra.call(e,b)||(q--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$stateful=!0;var d=this,e,f,h,k=1B&&(z=4-B,A[z]||(A[z]=[]),A[z].push({msg:C(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:g,oldVal:h}));else if(a===c){q=!1;break a}}catch(F){f(F)}if(!(n=!w.$$suspended&&w.$$watchersCount&&w.$$childHead||w!==this&&w.$$nextSibling))for(;w!==this&&!(n=w.$$nextSibling);)w=w.$parent}while(w=n);if((q||J.length)&&!B--)throw s.$$phase=null,d("infdig", +b,A);}while(q||J.length);for(s.$$phase=null;HBa)throw wa("iequirks");var c=pa(fa);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=ab);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(fa,function(a,b){var d=N(b);c[("parse_as_"+d).replace(Dc,wb)]=function(b){return e(a,b)};c[("get_trusted_"+d).replace(Dc,wb)]=function(b){return f(a,b)};c[("trust_as_"+d).replace(Dc,wb)]=function(b){return g(a,b)}});return c}]}function Vf(){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=Z((/android (\d+)/.exec(N((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&&Ba)return!1;if(x(d[a])){var b=g.createElement("div"); +d[a]="on"+a in b}return d[a]},csp:Ia(),transitions:h,animations:l,android:e}}]}function Xf(){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(!F(k)||x(d.get(k)))k=f.getTrustedResourceUrl(k);var l=c.defaults&&c.defaults.transformResponse;I(l)?l=l.filter(function(a){return a!==wc}):l===wc&&(l=null);return c.get(k,P({cache:d,transformResponse:l},a)).finally(function(){g.totalPendingRequests--}).then(function(a){d.put(k, +a.data);return a.data},function(a){h||(a=Jg("tpload",k,a.status,a.statusText),b(a));return e.reject(a)})}g.totalPendingRequests=0;return g}]}function Yf(){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=ea.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>Yd&&(d=d.splice(0,Yd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function Rg(a,b,d,c){var e=a.d,f=e.length-a.i;b=x(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 Ob(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 Ob(f,b,c,e)}}function mb(a,b,d){return function(c,e){var f=c["get"+a](),g=ub((d?"STANDALONE":"")+(b?"SHORT":"")+a);return e[g][f]}}function Zd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function $d(a){return function(b){var d=Zd(b.getFullYear());b=+new Date(b.getFullYear(), +b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Ob(b,a)}}function Gc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Td(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=Z(b[9]+b[10]),g=Z(b[9]+b[11]));k.call(a,Z(b[1]),Z(b[2])-1,Z(b[3]));f=Z(b[4]||0)-f;g=Z(b[5]||0)-g;k=Z(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;F(c)&&(c=Sg.test(c)?Z(c):b(c));Y(c)&&(c=new Date(c));if(!da(c)||!isFinite(c.getTime()))return c;for(;d;)(l=Tg.exec(d))?(k=db(k,l,1),d=k.pop()):(k.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=dc(f,m),c=ec(c,f,!0));q(k,function(b){h=Ug[b];g+=h?h(c,a.DATETIME_FORMATS,m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Lg(){return function(a,b){x(b)&&(b=2);return eb(a,b)}}function Mg(){return function(a, +b,d){b=Infinity===Math.abs(Number(b))?Number(b):Z(b);if(X(b))return a;Y(a)&&(a=a.toString());if(!ja(a))return a;d=!d||isNaN(d)?0:Z(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 F(a)?a.slice(b,d):xa.call(a,b,d)}function Vd(a){function b(b){return b.map(function(b){var c=1,d=ab;if(C(b))d=b;else if(F(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(ee[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(da(d))return d;if(F(d)){'"'===d.charAt(0)&&'"'===d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));if(Vg.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=A};g.$observe("min",function(a){A=n(a);k.$validate()})}if(u(g.max)||g.ngMax){var s;k.$validators.max= +function(a){return!p(a)||x(s)||d(a)<=s};g.$observe("max",function(a){s=n(a);k.$validate()})}}}function Jc(a,b,d,c){(c.$$hasNativeValidators=G(b[0].validity))&&c.$parsers.push(function(a){var c=b.prop("validity")||{};return c.badInput||c.typeMismatch?void 0:a})}function fe(a){a.$$parserName="number";a.$parsers.push(function(b){if(a.$isEmpty(b))return null;if(Wg.test(b))return parseFloat(b)});a.$formatters.push(function(b){if(!a.$isEmpty(b)){if(!Y(b))throw pb("numfmt",b);b=b.toString()}return b})}function Wa(a){u(a)&& +!Y(a)&&(a=parseFloat(a));return X(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 ge(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 he(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 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+;/,fg=/<([\w:-]+)/,gg=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,$={option:[1,'"],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};$.optgroup=$.option;$.tbody=$.tfoot=$.colgroup=$.caption=$.thead;$.th=$.td;var ng=y.Node.prototype.contains|| +function(a){return!!(this.compareDocumentPosition(a)&16)},Ua=S.prototype={ready:id,toString:function(){var a=[];q(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?z(this[a]):z(this[this.length+a])},length:0,push:Zg,sort:[].sort,splice:[].splice},Gb={};q("multiple selected checked disabled readOnly required open".split(" "),function(a){Gb[N(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 ib[a.ng339])return!0;return!1},cleanData:function(a){for(var b=0,d=a.length;b/,qg=/^[^(]*\(\s*([^)]*)\)/m,bh=/,/,ch=/^\s*(_?)(\S+?)\1\s*$/,og=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Aa=M("$injector");gb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw F(d)&&d||(d=a.name||rg(a)),Aa("strictdi",d);b=pd(a);q(b[1].split(bh),function(a){a.replace(ch,function(a,b,d){c.push(d)})})}a.$inject= +c}}else I(a)?(b=a.length-1,sb(a[b],"fn"),c=a.slice(0,b)):sb(a,"fn",!0);return c};var je=M("$animate"),uf=function(){this.$get=D},vf=function(){var a=new Hb,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=F(b)?b.split(" "):I(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=sg(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&& +Db(a,e);f&&Cb(a,f)});a.delete(b)}});b.length=0}return{enabled:D,on:D,off:D,pin:D,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}}}]},sf=["$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 je("notcsel", +c);var g=c+"-animation";b.$$registeredAnimations[c.substr(1)]=g;a.factory(g,d)};this.customFilter=function(a){1===arguments.length&&(c=C(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,je("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 fh={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Nb=function(a){this.options=a};Nb.prototype={constructor:Nb,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 Xa("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=na(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 Xa("syntax",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw Xa("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 Xa("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:[]};U(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,Eg,Fg,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||D;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(F(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(Y(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 Xa("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;U(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?D: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,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(''); +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)}}};Mb.prototype={constructor:Mb,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 wa=M("$sce"),fa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"}, +Dc=/_([a-z])/g,Jg=M("$compile"),W=y.document.createElement("a"),Qd=ma(y.location.href);Rd.$inject=["$document"];gd.$inject=["$provide"];var Yd=22,Xd=".",Fc="0";Sd.$inject=["$locale"];Ud.$inject=["$locale"];var Ug={yyyy:ca("FullYear",4,0,!1,!0),yy:ca("FullYear",2,0,!0,!0),y:ca("FullYear",1,0,!1,!0),MMMM:mb("Month"),MMM:mb("Month",!0),MM:ca("Month",2,1),M:ca("Month",1,1),LLLL:mb("Month",!1,!0),dd:ca("Date",2),d:ca("Date",1),HH:ca("Hours",2),H:ca("Hours",1),hh:ca("Hours",2,-12),h:ca("Hours",1,-12),mm:ca("Minutes", +2),m:ca("Minutes",1),ss:ca("Seconds",2),s:ca("Seconds",1),sss:ca("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?"+":"")+(Ob(Math[0=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},Tg=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,Sg=/^-?\d+$/; +Td.$inject=["$locale"];var Ng=ka(N),Og=ka(ub);Vd.$inject=["$parse"];var Je=ka({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]"===ha.call(b.prop("href"))?"xlink:href":"href";b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),vb={};q(Gb,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!==a){var c=Da("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!== +e[c]&&d(a,b,e)});vb[c]=function(){return{restrict:"A",priority:100,link:e}}}});q(ud,function(a,b){vb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"===e.ngPattern.charAt(0)&&(c=e.ngPattern.match(Yg))){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=Da("ng-"+a);vb[b]=function(){return{priority:99,link:function(d,c,e){var f=a,g=a;"href"===a&&"[object SVGAnimatedString]"===ha.call(c.prop("href"))&& +(g="xlinkHref",e.$attr[g]="xlink:href",f=null);e.$observe(b,function(b){b?(e.$set(g,b),Ba&&f&&c.prop(f,e[g])):"href"===a&&e.$set(g,null)})}}}});var Qb={$addControl:D,$$renameControl:function(a,b){a.$name=b},$removeControl:D,$setValidity:D,$setDirty:D,$setPristine:D,$setSubmitted:D};Pb.$inject=["$element","$attrs","$scope","$animate","$interpolate"];Pb.prototype={$rollbackViewValue:function(){q(this.$$controls,function(a){a.$rollbackViewValue()})},$commitViewValue:function(){q(this.$$controls,function(a){a.$commitViewValue()})}, +$addControl:function(a){Ha(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);cb(this.$$controls,a); +a.$$parentForm=Qb},$setDirty:function(){this.$$animate.removeClass(this.$$element,Ya);this.$$animate.addClass(this.$$element,Vb);this.$dirty=!0;this.$pristine=!1;this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,Ya,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(){this.$$animate.addClass(this.$$element, +"ng-submitted");this.$submitted=!0;this.$$parentForm.$setSubmitted()}};ce({clazz:Pb,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&&(cb(c,d),0===c.length&&delete a[b])}});var ke=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||D}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Pb,compile:function(d,f){d.addClass(Ya).addClass(nb);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 q=g?c(p.$name):D;g&&(q(a,p),e.$observe(g,function(b){p.$name!==b&&(q(a,void 0),p.$$parentForm.$$renameControl(p,b),q=c(p.$name),q(a,p))}));d.on("$destroy",function(){p.$$parentForm.$removeControl(p); +q(a,void 0);P(p,Qb)})}}}}}]},Ke=ke(),We=ke(!0),Vg=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,gh=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,hh=/^(?=.{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])?)*$/,Wg=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,le=/^(\d{4,})-(\d{2})-(\d{2})$/, +me=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Nc=/^(\d{4,})-W(\d\d)$/,ne=/^(\d{4,})-(\d\d)$/,oe=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ee=R();q(["date","datetime-local","month","time","week"],function(a){ee[a]=!0});var pe={text:function(a,b,d,c,e,f){Va(a,b,d,c,e,f);Ic(c)},date:ob("date",le,Rb(le,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":ob("datetimelocal",me,Rb(me,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:ob("time",oe,Rb(oe,["HH","mm", +"ss","sss"]),"HH:mm:ss.sss"),week:ob("week",Nc,function(a,b){if(da(a))return a;if(F(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=Zd(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:ob("month",ne,Rb(ne,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f){Jc(a,b,d,c);fe(c);Va(a,b,d,c,e,f);var g,k;if(u(d.min)||d.ngMin)c.$validators.min=function(a){return c.$isEmpty(a)|| +x(g)||a>=g},d.$observe("min",function(a){g=Wa(a);c.$validate()});if(u(d.max)||d.ngMax)c.$validators.max=function(a){return c.$isEmpty(a)||x(k)||a<=k},d.$observe("max",function(a){k=Wa(a);c.$validate()});if(u(d.step)||d.ngStep){var h;c.$validators.step=function(a,b){return c.$isEmpty(b)||x(h)||ge(b,g||0,h)};d.$observe("step",function(a){h=Wa(a);c.$validate()})}},url:function(a,b,d,c,e,f){Va(a,b,d,c,e,f);Ic(c);c.$$parserName="url";c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||gh.test(d)}}, +email:function(a,b,d,c,e,f){Va(a,b,d,c,e,f);Ic(c);c.$$parserName="email";c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||hh.test(d)}},radio:function(a,b,d,c){var e=!d.ngTrim||"false"!==Q(d.ngTrim);x(d.name)&&b.attr("name",++qb);b.on("click",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=Wa(a);X(c.$modelValue)||(m?(a=b.val(),p>a&&(a=p,b.val(a)),c.$setViewValue(a)):c.$validate())}function h(a){n=Wa(a);X(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)||x(n)||b<=n},g("max",h));f&&(c.$validators.step=m?function(){return!r.stepMismatch}:function(a,b){return c.$isEmpty(b)||x(q)||ge(b,p||0,q)},g("step",l))},checkbox:function(a,b,d,c,e, +f,g,k){var h=he(k,a,"ngTrueValue",d.ngTrueValue,!0),l=he(k,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 sa(a,h)});c.$parsers.push(function(a){return a?h:l})},hidden:D,button:D,submit:D,reset:D,file:D},ad=["$browser","$sniffer","$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e, +f,g,k){k[0]&&(pe[N(g.type)]||pe.text)(e,f,g,k[0],b,a,d,c)}}}}],ih=/^(true|false|\d+)$/,of=function(){function a(a,d,c){var e=u(c)?c:9===Ba?"":null;a.prop("value",e);d.$set("value",c)}return{restrict:"A",priority:100,compile:function(b,d){return ih.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)})}}}},Oe=["$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=hc(a)})}}}}],Qe=["$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=x(a)?"":a})}}}}],Pe=["$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)||"")})}}}}],nf=ka({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Re=Lc("",!0),Te=Lc("Odd",0),Se=Lc("Even",1),Ue=Ra({compile:function(a,b){b.$set("ngCloak",void 0);a.removeClass("ng-cloak")}}),Ve=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],fd={},jh={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=Da("ng-"+a);fd[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})};jh[a]&&c.$$phase?b.$evalAsync(e):b.$apply(e)})}}}}]});var Ye=["$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=tb(k.clone),a.leave(l).done(function(a){!1!==a&&(l=null)}),k=null))})}}}],Ze=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:ea.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 q=0,r,E,A,s=function(){E&&(E.remove(),E=null);r&&(r.$destroy(),r=null);A&&(d.leave(A).done(function(a){!1!==a&&(E=null)}),E=A,A=null)};c.$watch(f,function(f){var m=function(a){!1===a||!u(k)||k&&!c.$eval(k)||b()},w=++q;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&w===q){var b=c.$new();p.template=a;a=n(b,function(a){s();d.enter(a,null,e).done(m)});r=b;A=a;r.$emit("$includeContentLoaded",f);c.$eval(g)}},function(){c.$$destroyed|| +w!==q||(s(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(s(),p.template=null)})}}}}],qf=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(b,d,c,e){ha.call(d[0]).match(/SVG/)?(d.empty(),a(hd(e.template,y.document).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],$e=Ra({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),mf=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(!x(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(I(a))return a.join(e)});c.$isEmpty=function(a){return!a||!a.length}}}},nb="ng-valid",be="ng-invalid",Ya="ng-pristine",Vb="ng-dirty",pb=M("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);C(c)&&(c=a(b));return c};this.$$ngModelSet=function(a,c){C(this.$$parsedNgModel(a))?b(a,{$$$p:c}):this.$$parsedNgModelAssign(a,c)}}else if(!this.$$parsedNgModel.assign)throw pb("nonassign",this.$$attr.ngModel,za(this.$$element));},$render:D,$isEmpty:function(a){return x(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,Ya)},$setDirty:function(){this.$dirty=!0;this.$pristine=!1;this.$$animate.removeClass(this.$$element, +Ya);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(!X(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||!C(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?h.$$q.all(c).then(function(){g(d)},D):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||"parse";if(x(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;if(this.$$parserValid= +x(a)?void 0:!0)for(var d=0;de||c.$isEmpty(b)|| +b.length<=e}}}}},dd=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=0;d.$observe("minlength",function(a){e=Z(a)||0;c.$validate()});c.$validators.minlength=function(a,b){return c.$isEmpty(b)||b.length>=e}}}}};y.angular.bootstrap?y.console&&console.log("WARNING: Tried to load AngularJS more than once."):(De(),Ge(ea),ea.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"}})}]),z(function(){ye(y.document,Wc)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(''); //# sourceMappingURL=angular.min.js.map From c55c74a09fffe9e0e22f70a8f53eea8c19bc97d7 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Fri, 20 Jul 2018 16:06:54 +0100 Subject: [PATCH 024/151] PCHR-4001: Allow contact to be own leave approver on relationship screens. --- .../hrleaveandabsences.php | 39 ------------------- 1 file changed, 39 deletions(-) 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; -} From a25038e9dab1423b79f6f4fd8bb8480aebf1066f Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 24 Jul 2018 12:55:25 +0100 Subject: [PATCH 025/151] PCHR-4018: Add getCurrentlyLoggedIn() method --- .../js/src/common/models/contact.js | 17 ++++++- .../js/test/helpers/globals.helper.js | 2 +- .../mocks/models/instances/session-mock.js | 2 +- .../js/test/models/contact.spec.js | 49 ++++++++++++++----- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/org.civicrm.reqangular/js/src/common/models/contact.js b/org.civicrm.reqangular/js/src/common/models/contact.js index 7dff83b595e..7f1552f4837 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} + */ + getCurrentlyLoggedIn: 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/test/helpers/globals.helper.js b/org.civicrm.reqangular/js/test/helpers/globals.helper.js index 0c2a930c08b..d755f5fec77 100644 --- a/org.civicrm.reqangular/js/test/helpers/globals.helper.js +++ b/org.civicrm.reqangular/js/test/helpers/globals.helper.js @@ -1,5 +1,5 @@ window.Drupal = { settings: { - currentCiviCRMUserId: 1 + currentCiviCRMUserId: '1' } }; diff --git a/org.civicrm.reqangular/js/test/mocks/models/instances/session-mock.js b/org.civicrm.reqangular/js/test/mocks/models/instances/session-mock.js index dfaba9d40bc..de5713b820d 100644 --- a/org.civicrm.reqangular/js/test/mocks/models/instances/session-mock.js +++ b/org.civicrm.reqangular/js/test/mocks/models/instances/session-mock.js @@ -7,7 +7,7 @@ define([ mocks.service('SessionMock', ['$q', function ($q) { var session = { - contactId: 999 + contactId: '1' }; /** diff --git a/org.civicrm.reqangular/js/test/models/contact.spec.js b/org.civicrm.reqangular/js/test/models/contact.spec.js index 9c09e70de74..86aae9b22ee 100644 --- a/org.civicrm.reqangular/js/test/models/contact.spec.js +++ b/org.civicrm.reqangular/js/test/models/contact.spec.js @@ -2,21 +2,23 @@ define([ 'common/lodash', + 'common/mocks/data/contact.data', 'common/angularMocks', 'common/models/contact', 'common/models/group', 'common/models/contact-job-role.model', + 'common/mocks/models/instances/session-mock', 'common/mocks/services/hr-settings-mock', 'common/mocks/services/api/contact-mock', 'common/mocks/services/api/contact-job-role-api.api.mock', 'common/mocks/models/instances/contact-instance-mock' -], function (_) { +], function (_, contactData) { 'use strict'; describe('Contact', function () { - var $provide, $rootScope, Contact, ContactInstanceMock, Group, - ContactJobRole, contactAPI, contactAPIMock, ContactJobRoleAPI, - groupContactAPIMock, contacts, contactJobRoles, groupContacts; + var $provide, $rootScope, Contact, ContactInstanceMock, contactAPI, + contactAPIMock, ContactJobRole, ContactJobRoleAPI, contactJobRoles, + contacts, Group, groupContactAPIMock, groupContacts, SessionMock; beforeEach(function () { module('common.models', 'common.mocks', function (_$provide_) { @@ -34,12 +36,12 @@ define([ }); beforeEach(inject([ - '$rootScope', 'Contact', 'Group', 'ContactJobRole', - 'ContactInstanceMock', 'ContactJobRoleAPI', 'api.contact', - 'api.group-contact.mock', - function (_$rootScope_, _Contact_, _Group_, _ContactJobRole_, - _ContactInstanceMock_, _ContactJobRoleAPI_, _contactAPI_, - _groupContactAPIMock_) { + '$rootScope', 'api.contact', 'api.group-contact.mock', 'Contact', + 'ContactInstanceMock', 'ContactJobRole', 'ContactJobRoleAPI', 'Group', + 'SessionMock', + function (_$rootScope_, _contactAPI_, _groupContactAPIMock_, _Contact_, + _ContactInstanceMock_, _ContactJobRole_, _ContactJobRoleAPI_, _Group_, + _SessionMock_) { $rootScope = _$rootScope_; Contact = _Contact_; Group = _Group_; @@ -48,6 +50,7 @@ define([ contactAPI = _contactAPI_; ContactJobRoleAPI = _ContactJobRoleAPI_; groupContactAPIMock = _groupContactAPIMock_; + SessionMock = _SessionMock_; contactAPI.spyOnMethods(); ContactJobRoleAPI.spyOnMethods(); @@ -59,7 +62,7 @@ define([ ])); it('has the expected api', function () { - expect(Object.keys(Contact)).toEqual(['all', 'find', 'leaveManagees']); + expect(Object.keys(Contact)).toEqual(['all', 'find', 'getCurrentlyLoggedIn', 'leaveManagees']); }); describe('all()', function () { @@ -252,6 +255,30 @@ define([ }); }); + describe('getCurrentlyLoggedIn()', function () { + var result, loggedInContact; + + beforeEach(function () { + var loggedInContactId; + + Contact.getCurrentlyLoggedIn() + .then(function (_result_) { + result = _result_; + }); + SessionMock.get() + .then(function (session) { + loggedInContactId = session.contactId; + }); + $rootScope.$digest(); + + loggedInContact = _.find(contactData.all.values, { id: loggedInContactId }); + }); + + it('resolves with a currently logged in contact', function () { + expect(result).toEqual(loggedInContact); + }); + }); + describe('leaveManagees()', function () { var contactID = '123'; var params = { key: 'value' }; From fe5fbf1f03b827da39109264febefa4808f0a286 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 24 Jul 2018 13:42:04 +0100 Subject: [PATCH 026/151] PCHR-4018: Add checkIfSelfLeaveApprover() method --- .../models/instances/contact-instance.js | 19 +++++- .../models/instances/contact-instance.spec.js | 64 ++++++++++++++++--- 2 files changed, 72 insertions(+), 11 deletions(-) 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..0ea2c4f8baf 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 (contactManagees) { + return !!_.find(contactManagees, { id: this.id }); + }.bind(this)); } }); }]); diff --git a/org.civicrm.reqangular/js/test/models/instances/contact-instance.spec.js b/org.civicrm.reqangular/js/test/models/instances/contact-instance.spec.js index e63613612e2..8029323f5fa 100644 --- a/org.civicrm.reqangular/js/test/models/instances/contact-instance.spec.js +++ b/org.civicrm.reqangular/js/test/models/instances/contact-instance.spec.js @@ -3,35 +3,81 @@ define([ 'common/lodash', 'common/angularMocks', + 'common/mocks/services/api/contact-mock', 'common/models/instances/contact-instance' ], function (_) { 'use strict'; describe('ContactInstance', function () { - var ContactInstance, ModelInstance, ContactAPI; + var $provide, $rootScope, ContactInstance, ModelInstance, ContactAPI; - beforeEach(module('common.models.instances')); - beforeEach(inject(['api.contact', 'ContactInstance', 'ModelInstance', - function (_ContactAPI_, _ContactInstance_, _ModelInstance_) { + beforeEach(function () { + module('common.models.instances', 'common.mocks', function (_$provide_) { + $provide = _$provide_; + }); + inject(['api.contact.mock', function (contactAPIMock) { + $provide.value('api.contact', contactAPIMock); + }]); + }); + + beforeEach(inject(['$rootScope', 'api.contact', 'ContactInstance', 'ModelInstance', + function (_$rootScope_, _ContactAPI_, _ContactInstance_, _ModelInstance_) { + $rootScope = _$rootScope_; ContactInstance = _ContactInstance_; ModelInstance = _ModelInstance_; ContactAPI = _ContactAPI_; } ])); - beforeEach(function () { - spyOn(ContactAPI, 'leaveManagees'); - }); - it('inherits from ModelInstance', function () { expect(_.functions(ContactInstance)).toEqual(jasmine.arrayContaining(_.functions(ModelInstance))); }); - describe('leaveManagees()', function() { + describe('checkIfSelfLeaveApprover()', function () { + var callCheckIfSelfLeaveApprover, result; + + beforeEach(function () { + callCheckIfSelfLeaveApprover = function () { + ContactInstance.checkIfSelfLeaveApprover() + .then(function (_result_) { + result = _result_; + }); + $rootScope.$digest(); + }; + }); + + describe('when leave managees of the contact contain the contact', function () { + beforeEach(function () { + ContactInstance.id = '1'; + + callCheckIfSelfLeaveApprover(); + }); + + it('identifies the contact as a self-approver', function () { + expect(result).toBe(true); + }); + }); + + describe('when leave managees of the contact do not contain the contact', function () { + beforeEach(function () { + ContactInstance.id = '1010011010'; + + callCheckIfSelfLeaveApprover(); + }); + + it('does not identify the contact as a self-approver', function () { + expect(result).toBe(false); + }); + }); + }); + + describe('leaveManagees()', function () { var params = { key: 'someval' }; beforeEach(function () { ContactInstance.id = '101'; + + spyOn(ContactAPI, 'leaveManagees'); ContactInstance.leaveManagees(params); }); From 06c554105438d980f6b4da59bf17c19907a7fd48 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 24 Jul 2018 13:52:30 +0100 Subject: [PATCH 027/151] PCHR-4018: Wrap tests so another case can be written --- .../leave-request-actions.component.spec.js | 784 +++++++++--------- 1 file changed, 393 insertions(+), 391 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js index 949dccd8754..92dd34fd5a9 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js @@ -72,224 +72,52 @@ define([ expect($log.debug).toHaveBeenCalled(); }); - describe('when leave request status is "awaiting for approval"', function () { - beforeEach(function () { - leaveRequest = getRequest('leave', 'awaitingApproval'); - }); - - describe('when the user is admin', function () { - beforeEach(function () { - role = 'admin'; - - compileComponent(); - }); - - it('shows actions "Respond", "Approve", "Reject", "Cancel" and "Delete"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['respond', 'approve', 'reject', 'cancel', 'delete']); - }); - }); - - describe('when the user is manager', function () { - beforeEach(function () { - role = 'manager'; - - compileComponent(); - }); - - it('shows actions "Respond", "Approve", "Reject" and "Cancel"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['respond', 'approve', 'reject', 'cancel']); - }); - }); - - describe('when the user is staff', function () { - beforeEach(function () { - role = 'staff'; - - compileComponent(); - }); - - it('shows actions "Edit", "Cancel"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel']); - }); - }); - }); - - describe('when leave request status is "more information required"', function () { - beforeEach(function () { - leaveRequest = getRequest('leave', 'moreInformationRequired'); - }); - - describe('when the user is admin', function () { - beforeEach(function () { - role = 'admin'; - - compileComponent(); - }); - - it('shows actions "Edit", "Cancel" and "Delete"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel', 'delete']); - }); - }); - - describe('when the user is manager', function () { - beforeEach(function () { - role = 'manager'; - - compileComponent(); - }); - - it('shows actions "Edit" and "Cancel"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel']); - }); - }); - - describe('when the user is staff', function () { - beforeEach(function () { - role = 'staff'; - - compileComponent(); - }); - - it('shows actions "Respond" and "Cancel"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['respond', 'cancel']); - }); - }); - }); - - describe('when leave request status is "approved"', function () { - beforeEach(function () { - leaveRequest = getRequest('leave', 'approved'); - }); - - describe('when the user is admin', function () { - beforeEach(function () { - role = 'admin'; - - compileComponent(); - }); - - it('shows actions "Edit", "Cancel" and "Delete"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel', 'delete']); - }); - }); - - describe('when the user is manager', function () { - beforeEach(function () { - role = 'manager'; - - compileComponent(); - }); - - it('shows actions "Edit"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit']); - }); - }); - - describe('when the user is staff', function () { - beforeEach(function () { - role = 'staff'; - - compileComponent(); - }); - - it('shows actions "View" and "Cancel"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['view', 'cancel']); - }); - }); - }); - - describe('when leave request status is "rejected"', function () { - beforeEach(function () { - leaveRequest = getRequest('leave', 'rejected'); - }); - - describe('when the user is admin', function () { - beforeEach(function () { - role = 'admin'; - - compileComponent(); - }); - - it('shows actions "Edit", "Cancel" and "Delete"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel', 'delete']); - }); - }); - - describe('when the user is manager', function () { + describe('basic tests', function () { + describe('when leave request status is "awaiting for approval"', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); - }); - - it('shows actions "Edit"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit']); - }); - }); - - describe('when the user is staff', function () { - beforeEach(function () { - role = 'staff'; - - compileComponent(); + leaveRequest = getRequest('leave', 'awaitingApproval'); }); - it('shows actions "View" and "Cancel"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['view', 'cancel']); - }); - }); - }); - - describe('when leave request status is "cancelled"', function () { - beforeEach(function () { - leaveRequest = getRequest('leave', 'cancelled'); - }); - - describe('when the user is admin', function () { - beforeEach(function () { - role = 'admin'; + describe('when the user is admin', function () { + beforeEach(function () { + role = 'admin'; - compileComponent(); - }); + compileComponent(); + }); - it('shows actions "Edit" and "Delete"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'delete']); + it('shows actions "Respond", "Approve", "Reject", "Cancel" and "Delete"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['respond', 'approve', 'reject', 'cancel', 'delete']); + }); }); - }); - describe('when the user is manager', function () { - beforeEach(function () { - role = 'manager'; + describe('when the user is manager', function () { + beforeEach(function () { + role = 'manager'; - compileComponent(); - }); + compileComponent(); + }); - it('shows actions "Edit"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['edit']); + it('shows actions "Respond", "Approve", "Reject" and "Cancel"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['respond', 'approve', 'reject', 'cancel']); + }); }); - }); - describe('when the user is staff', function () { - beforeEach(function () { - role = 'staff'; + describe('when the user is staff', function () { + beforeEach(function () { + role = 'staff'; - compileComponent(); - }); + compileComponent(); + }); - it('shows actions "View"', function () { - expect(flattenActions(controller.allowedActions)).toEqual(['view']); + it('shows actions "Edit", "Cancel"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel']); + }); }); }); - }); - - describe('when leave request has TOIL type', function () { - beforeEach(function () { - leaveRequest = getRequest('toil', 'awaitingApproval'); - }); - describe('when not expired', function () { + describe('when leave request status is "more information required"', function () { beforeEach(function () { - makeRequestExpired(leaveRequest, false); + leaveRequest = getRequest('leave', 'moreInformationRequired'); }); describe('when the user is admin', function () { @@ -299,8 +127,8 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Edit", "Cancel" and "Delete"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel', 'delete']); }); }); @@ -311,8 +139,8 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Edit" and "Cancel"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel']); }); }); @@ -323,15 +151,15 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Respond" and "Cancel"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['respond', 'cancel']); }); }); }); - describe('when expired', function () { + describe('when leave request status is "approved"', function () { beforeEach(function () { - makeRequestExpired(leaveRequest, true); + leaveRequest = getRequest('leave', 'approved'); }); describe('when the user is admin', function () { @@ -341,8 +169,8 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Edit", "Cancel" and "Delete"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel', 'delete']); }); }); @@ -353,8 +181,8 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Edit"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit']); }); }); @@ -365,21 +193,15 @@ define([ compileComponent(); }); - it('does not include "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(false); + it('shows actions "View" and "Cancel"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['view', 'cancel']); }); }); }); - }); - - describe('when leave request has Sickness type', function () { - beforeEach(function () { - leaveRequest = getRequest('sick', 'awaitingApproval'); - }); - describe('when not expired', function () { + describe('when leave request status is "rejected"', function () { beforeEach(function () { - makeRequestExpired(leaveRequest, false); + leaveRequest = getRequest('leave', 'rejected'); }); describe('when the user is admin', function () { @@ -389,8 +211,8 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Edit", "Cancel" and "Delete"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'cancel', 'delete']); }); }); @@ -401,8 +223,8 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Edit"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit']); }); }); @@ -413,15 +235,15 @@ define([ compileComponent(); }); - it('does not include "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(false); + it('shows actions "View" and "Cancel"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['view', 'cancel']); }); }); }); - describe('when expired', function () { + describe('when leave request status is "cancelled"', function () { beforeEach(function () { - makeRequestExpired(leaveRequest, true); + leaveRequest = getRequest('leave', 'cancelled'); }); describe('when the user is admin', function () { @@ -431,8 +253,8 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Edit" and "Delete"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit', 'delete']); }); }); @@ -443,8 +265,8 @@ define([ compileComponent(); }); - it('includes "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + it('shows actions "Edit"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['edit']); }); }); @@ -455,241 +277,421 @@ define([ compileComponent(); }); - it('does not include "Cancel" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(false); + it('shows actions "View"', function () { + expect(flattenActions(controller.allowedActions)).toEqual(['view']); }); }); }); - }); - - describe('when the leave request is a public holiday', function () { - beforeEach(function () { - leaveRequest.request_type = 'public_holiday'; - }); - describe('when the user is an admin', function () { + describe('when leave request has TOIL type', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + leaveRequest = getRequest('toil', 'awaitingApproval'); }); - it('includes the "Delete" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'delete')).toBe(true); - }); - }); + describe('when not expired', function () { + beforeEach(function () { + makeRequestExpired(leaveRequest, false); + }); - describe('when the user is a manager', function () { - beforeEach(function () { - role = 'manager'; + describe('when the user is admin', function () { + beforeEach(function () { + role = 'admin'; - compileComponent(); - }); + compileComponent(); + }); - it('does not include the "Delete" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'delete')).toBe(false); - }); - }); + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + }); + }); - describe('when the user is a staff', function () { - beforeEach(function () { - role = 'staff'; + describe('when the user is manager', function () { + beforeEach(function () { + role = 'manager'; - compileComponent(); - }); + compileComponent(); + }); + + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + }); + }); + + describe('when the user is staff', function () { + beforeEach(function () { + role = 'staff'; + + compileComponent(); + }); - it('does not include the "Delete" action', function () { - expect(_.includes(flattenActions(controller.allowedActions), 'delete')).toBe(false); + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + }); + }); }); - }); - }); - describe('when the user wants to change status of leave request', function () { - // Any action, role or request could be specified here - var action = 'approve'; + describe('when expired', function () { + beforeEach(function () { + makeRequestExpired(leaveRequest, true); + }); - beforeEach(function () { - // Any role or request could be specified here - role = 'admin'; - leaveRequest = getRequest(); - compileComponent(); - spyOn($rootScope, '$emit'); - }); + describe('when the user is admin', function () { + beforeEach(function () { + role = 'admin'; - describe('basic tests', function () { - beforeEach(function () { - spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') - .and.callThrough(); + compileComponent(); + }); - controller.action(action); - $rootScope.$digest(); - }); + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + }); + }); - it('checks if the balance has been changed', function () { - expect(controller.leaveRequest.checkIfBalanceChangeNeedsRecalculation) - .toHaveBeenCalled(); + describe('when the user is manager', function () { + beforeEach(function () { + role = 'manager'; + + compileComponent(); + }); + + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + }); + }); + + describe('when the user is staff', function () { + beforeEach(function () { + role = 'staff'; + + compileComponent(); + }); + + it('does not include "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(false); + }); + }); }); }); - describe('when balance change has not been changed', function () { + describe('when leave request has Sickness type', function () { beforeEach(function () { - spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') - .and.returnValue($q.resolve(false)); - resolveDialogWith(null); - controller.action(action); - $rootScope.$digest(); + leaveRequest = getRequest('sick', 'awaitingApproval'); }); - it('shows a loading confirmation dialog', function () { - expect(dialog.open).toHaveBeenCalledWith(jasmine.objectContaining({ - loading: true - })); - }); + describe('when not expired', function () { + beforeEach(function () { + makeRequestExpired(leaveRequest, false); + }); + + describe('when the user is admin', function () { + beforeEach(function () { + role = 'admin'; - it('does not emit an event', function () { - expect($rootScope.$emit).not.toHaveBeenCalled(); + compileComponent(); + }); + + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + }); + }); + + describe('when the user is manager', function () { + beforeEach(function () { + role = 'manager'; + + compileComponent(); + }); + + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + }); + }); + + describe('when the user is staff', function () { + beforeEach(function () { + role = 'staff'; + + compileComponent(); + }); + + it('does not include "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(false); + }); + }); }); - describe('when the user confirms the action', function () { - describe('when the action is successfully executed', function () { + describe('when expired', function () { + beforeEach(function () { + makeRequestExpired(leaveRequest, true); + }); + + describe('when the user is admin', function () { beforeEach(function () { - spyOn(leaveRequest, action).and.returnValue($q.resolve()); - resolveDialogWith(true); - controller.action(action); - $rootScope.$digest(); + role = 'admin'; + + compileComponent(); }); - it('emits an event', function () { - expect(pubSub.publish) - .toHaveBeenCalledWith('LeaveRequest::statusUpdate', { - status: action, - leaveRequest: leaveRequest - }); + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); }); }); - describe('when the action is rejected by server', function () { + describe('when the user is manager', function () { beforeEach(function () { - spyOn(leaveRequest, action).and.returnValue($q.reject()); - spyOn(notification, 'error').and.callThrough(); - resolveDialogWith(true); - controller.action(action); - $rootScope.$digest(); + role = 'manager'; + + compileComponent(); }); - it('does not emit an event', function () { - expect(pubSub.publish).not.toHaveBeenCalled(); + it('includes "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(true); + }); + }); + + describe('when the user is staff', function () { + beforeEach(function () { + role = 'staff'; + + compileComponent(); }); - it('shows a notification', function () { - expect(notification.error).toHaveBeenCalled(); + it('does not include "Cancel" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'cancel')).toBe(false); }); }); }); }); - describe('when balance change has been changed', function () { - var proceedWithBalanceChangeRecalculation; - + describe('when the leave request is a public holiday', function () { beforeEach(function () { - spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') - .and.returnValue($q.resolve(true)); - spyOn(dialog, 'open').and.callFake(function (params) { - params.optionsPromise().then(function (props) { - proceedWithBalanceChangeRecalculation = props.onCloseAfterConfirm; - }); - }); - spyOn(LeaveRequestService, - 'getBalanceChangeRecalculationPromptOptions').and.callThrough(); - controller.action(action); - $rootScope.$digest(); + leaveRequest.request_type = 'public_holiday'; }); - it('prompts if user would like to proceed with balance change recalculation', function () { - expect(LeaveRequestService.getBalanceChangeRecalculationPromptOptions) - .toHaveBeenCalled(); - expect(dialog.open).toHaveBeenCalled(); + describe('when the user is an admin', function () { + beforeEach(function () { + role = 'admin'; + + compileComponent(); + }); + + it('includes the "Delete" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'delete')).toBe(true); + }); }); - describe('when user proceeds with balance change recalculation', function () { - var expectedDefaultStatus = 'approved'; + describe('when the user is a manager', function () { + beforeEach(function () { + role = 'manager'; + + compileComponent(); + }); + it('does not include the "Delete" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'delete')).toBe(false); + }); + }); + + describe('when the user is a staff', function () { beforeEach(function () { - spyOn(LeavePopup, 'openModal'); - proceedWithBalanceChangeRecalculation(); - $rootScope.$digest(); + role = 'staff'; + + compileComponent(); }); - it('opens a leave request modal with this request with a correct default status', function () { - expect(LeavePopup.openModal).toHaveBeenCalledWith({ - leaveRequest: leaveRequest, - leaveType: leaveRequest.request_type, - selectedContactId: leaveRequest.contact_id, - forceRecalculateBalanceChange: true, - defaultStatus: expectedDefaultStatus - }); + it('does not include the "Delete" action', function () { + expect(_.includes(flattenActions(controller.allowedActions), 'delete')).toBe(false); }); }); }); - describe('when the user wants either to cancel, reject or delete the leave request', function () { + describe('when the user wants to change status of leave request', function () { + // Any action, role or request could be specified here + var action = 'approve'; + beforeEach(function () { - spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') - .and.callThrough(); + // Any role or request could be specified here + role = 'admin'; + leaveRequest = getRequest(); + compileComponent(); + spyOn($rootScope, '$emit'); }); - ['cancel', 'reject', 'delete'].forEach(function (action) { + describe('basic tests', function () { beforeEach(function () { + spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') + .and.callThrough(); + controller.action(action); $rootScope.$digest(); }); - it('skips checking of the balance change', function () { + it('checks if the balance has been changed', function () { expect(controller.leaveRequest.checkIfBalanceChangeNeedsRecalculation) - .not.toHaveBeenCalled(); + .toHaveBeenCalled(); }); }); - }); - describe('when request is TOIL', function () { - beforeEach(function () { - leaveRequest = getRequest('toil', 'awaitingApproval'); + describe('when balance change has not been changed', function () { + beforeEach(function () { + spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') + .and.returnValue($q.resolve(false)); + resolveDialogWith(null); + controller.action(action); + $rootScope.$digest(); + }); - compileComponent(); - spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') - .and.callThrough(); - controller.action('approve'); - $rootScope.$digest(); + it('shows a loading confirmation dialog', function () { + expect(dialog.open).toHaveBeenCalledWith(jasmine.objectContaining({ + loading: true + })); + }); + + it('does not emit an event', function () { + expect($rootScope.$emit).not.toHaveBeenCalled(); + }); + + describe('when the user confirms the action', function () { + describe('when the action is successfully executed', function () { + beforeEach(function () { + spyOn(leaveRequest, action).and.returnValue($q.resolve()); + resolveDialogWith(true); + controller.action(action); + $rootScope.$digest(); + }); + + it('emits an event', function () { + expect(pubSub.publish) + .toHaveBeenCalledWith('LeaveRequest::statusUpdate', { + status: action, + leaveRequest: leaveRequest + }); + }); + }); + + describe('when the action is rejected by server', function () { + beforeEach(function () { + spyOn(leaveRequest, action).and.returnValue($q.reject()); + spyOn(notification, 'error').and.callThrough(); + resolveDialogWith(true); + controller.action(action); + $rootScope.$digest(); + }); + + it('does not emit an event', function () { + expect(pubSub.publish).not.toHaveBeenCalled(); + }); + + it('shows a notification', function () { + expect(notification.error).toHaveBeenCalled(); + }); + }); + }); }); - it('skips checking of the balance change', function () { - expect(controller.leaveRequest.checkIfBalanceChangeNeedsRecalculation) - .not.toHaveBeenCalled(); + describe('when balance change has been changed', function () { + var proceedWithBalanceChangeRecalculation; + + beforeEach(function () { + spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') + .and.returnValue($q.resolve(true)); + spyOn(dialog, 'open').and.callFake(function (params) { + params.optionsPromise().then(function (props) { + proceedWithBalanceChangeRecalculation = props.onCloseAfterConfirm; + }); + }); + spyOn(LeaveRequestService, + 'getBalanceChangeRecalculationPromptOptions').and.callThrough(); + controller.action(action); + $rootScope.$digest(); + }); + + it('prompts if user would like to proceed with balance change recalculation', function () { + expect(LeaveRequestService.getBalanceChangeRecalculationPromptOptions) + .toHaveBeenCalled(); + expect(dialog.open).toHaveBeenCalled(); + }); + + describe('when user proceeds with balance change recalculation', function () { + var expectedDefaultStatus = 'approved'; + + beforeEach(function () { + spyOn(LeavePopup, 'openModal'); + proceedWithBalanceChangeRecalculation(); + $rootScope.$digest(); + }); + + it('opens a leave request modal with this request with a correct default status', function () { + expect(LeavePopup.openModal).toHaveBeenCalledWith({ + leaveRequest: leaveRequest, + leaveType: leaveRequest.request_type, + selectedContactId: leaveRequest.contact_id, + forceRecalculateBalanceChange: true, + defaultStatus: expectedDefaultStatus + }); + }); + }); }); - }); - }); - describe('openLeavePopup()', function () { - var event; - var params = { - leaveRequest: { key: 'value' }, - leaveType: 'some_leave_type', - selectedContactId: '101' - }; + describe('when the user wants either to cancel, reject or delete the leave request', function () { + beforeEach(function () { + spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') + .and.callThrough(); + }); - beforeEach(function () { - event = jasmine.createSpyObj('event', ['stopPropagation']); + ['cancel', 'reject', 'delete'].forEach(function (action) { + beforeEach(function () { + controller.action(action); + $rootScope.$digest(); + }); - spyOn(LeavePopup, 'openModal'); - controller.openLeavePopup(event, params); - }); + it('skips checking of the balance change', function () { + expect(controller.leaveRequest.checkIfBalanceChangeNeedsRecalculation) + .not.toHaveBeenCalled(); + }); + }); + }); + + describe('when request is TOIL', function () { + beforeEach(function () { + leaveRequest = getRequest('toil', 'awaitingApproval'); + + compileComponent(); + spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') + .and.callThrough(); + controller.action('approve'); + $rootScope.$digest(); + }); - it('opens the leave request popup', function () { - expect(LeavePopup.openModal).toHaveBeenCalledWith(params); + it('skips checking of the balance change', function () { + expect(controller.leaveRequest.checkIfBalanceChangeNeedsRecalculation) + .not.toHaveBeenCalled(); + }); + }); }); - it('stops the event from propagating', function () { - expect(event.stopPropagation).toHaveBeenCalled(); + describe('openLeavePopup()', function () { + var event; + var params = { + leaveRequest: { key: 'value' }, + leaveType: 'some_leave_type', + selectedContactId: '101' + }; + + beforeEach(function () { + event = jasmine.createSpyObj('event', ['stopPropagation']); + + spyOn(LeavePopup, 'openModal'); + controller.openLeavePopup(event, params); + }); + + it('opens the leave request popup', function () { + expect(LeavePopup.openModal).toHaveBeenCalledWith(params); + }); + + it('stops the event from propagating', function () { + expect(event.stopPropagation).toHaveBeenCalled(); + }); }); }); From b6e5c708592da2c05048a850e777199099377ef9 Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Tue, 24 Jul 2018 15:33:42 +0100 Subject: [PATCH 028/151] PCHR-3345: Unable to create user account for restored contact --- .../HRCore/Form/CreateUserRecordTaskForm.php | 25 ++++++++++++++++++- .../CRM/HRCore/Service/DrupalUserService.php | 13 ++++++++++ .../HRCore/Service/DrupalUserServiceTest.php | 16 ++++++++++++ .../tests/phpunit/drupal_function_mocks.php | 9 ++++++- 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Form/CreateUserRecordTaskForm.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Form/CreateUserRecordTaskForm.php index 162968d0648..ad7ac2a6282 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Form/CreateUserRecordTaskForm.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Form/CreateUserRecordTaskForm.php @@ -44,7 +44,13 @@ public function postProcess() { $contactsToCreate = $this->getValidContactsForCreation(); foreach ($contactsToCreate as $contact) { - $this->createAccount($contact, $roles); + $user = $this->drupalUserService->findUserByEmail($contact['email']); + if (!$user) { + $this->createAccount($contact, $roles); + } + else { + $this->restoreAccount($user, $roles, $contact['id']); + } } $haveAccount = $this->getContactsWithAccount(); @@ -218,4 +224,21 @@ public function validateInput($fields) { return empty($errors) ? TRUE : $errors; } + /** + * Restores user account and update roles after delete. + * Deleting user account does not remove drupal account. + * The user account is just unlinked in the UF match civi table + * + * @param object $user + * @param array $roles + * @param int $contactId + */ + public function restoreAccount($user, $roles, $contactId) { + $this->drupalUserService->addRoles($user->mail, $roles); + + $ufMatch['uf_id'] = $user->uid; + $ufMatch['contact_id'] = $contactId; + $ufMatch['uf_name'] = $user->mail; + civicrm_api3('UFMatch', 'create', $ufMatch); + } } diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/DrupalUserService.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/DrupalUserService.php index 23583b84ef3..7a242cd757a 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/DrupalUserService.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/DrupalUserService.php @@ -51,6 +51,17 @@ public function createNew($email, $active = FALSE, $roles = []) { return $user; } + /** + * Checks if user record exist for email + * + * @param string $email + * + * @return object | boolean + */ + public function findUserByEmail($email) { + return user_load_by_mail($email); + } + /** * @param $email */ @@ -64,6 +75,8 @@ public function sendActivationMail($email) { } /** + * Adds role(s) to user account + * * @param string $email * @param array $roles */ diff --git a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/DrupalUserServiceTest.php b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/DrupalUserServiceTest.php index a484d997969..e8d8e9651ab 100644 --- a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/DrupalUserServiceTest.php +++ b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/DrupalUserServiceTest.php @@ -53,6 +53,22 @@ public function testCreateActiveWithRoles() { $this->assertArrayHasKey(8, $user->roles); } + public function testFindUserByEmailReturnsUserObjectWhenUserEmailExist() { + $roleService = $this->prophesize(DrupalRoleService::class); + $drupalUserService = new DrupalUserService($roleService->reveal()); + $user = $drupalUserService->findUserByEmail('johndoe@test.com'); + + $this->assertInstanceOf(\stdClass::class, $user); + } + + public function testFindUserByEmailReturnsFalseWhenUserEmailDoesNotExist() { + $roleService = $this->prophesize(DrupalRoleService::class); + $drupalUserService = new DrupalUserService($roleService->reveal()); + $userAccount = $drupalUserService->findUserByEmail('test@email.com'); + + $this->assertFalse($userAccount); + } + protected function cleanup() { $user = user_load_by_mail($this->testEmail); if ($user) { diff --git a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/drupal_function_mocks.php b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/drupal_function_mocks.php index 998c5dd054e..d385b4e4d96 100644 --- a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/drupal_function_mocks.php +++ b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/drupal_function_mocks.php @@ -10,7 +10,14 @@ function drupal_anonymous_user() {} function user_password() {} -function user_load_by_mail($email) {} +function user_load_by_mail($email) { + if ($email === 'johndoe@test.com') { + return new stdClass(); + } + else { + return FALSE; + } +} function user_roles() { return [1 => 'Fake Role']; From f797f5a69df43d1d24ab0b30a8dbe95992a8bbf4 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Tue, 24 Jul 2018 18:55:43 +0200 Subject: [PATCH 029/151] PCHR-3955: (Job Contract) Fix unexpected request error in tests --- .../js/test/services/contract-details.service.spec.js | 1 + .../js/test/services/contract-health.service.spec.js | 3 ++- .../js/test/services/contract-hour.service.spec.js | 1 + .../js/test/services/contract-leave.service.spec.js | 1 + .../js/test/services/contract-pension.service.spec.js | 1 + hrjobcontract/js/test/services/utils.service.spec.js | 9 +++++++-- 6 files changed, 13 insertions(+), 3 deletions(-) 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-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/utils.service.spec.js b/hrjobcontract/js/test/services/utils.service.spec.js index 93ef9b176a1..1323256ff22 100644 --- a/hrjobcontract/js/test/services/utils.service.spec.js +++ b/hrjobcontract/js/test/services/utils.service.spec.js @@ -11,7 +11,8 @@ 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_) { $provide = _$provide_; @@ -22,7 +23,8 @@ define([ }); })); - 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 +36,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 () { From 072917811e9724a77a990f2d630b2aeb8939342d Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Tue, 24 Jul 2018 21:12:05 +0200 Subject: [PATCH 030/151] PCHR-3944: (Job Contract) Misc test fixes --- .../js/test/services/contract-pay.service.spec.js | 4 ++-- .../test/services/contract-revision-list.service.spec.js | 7 +++++-- hrjobcontract/js/test/services/utils.service.spec.js | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) 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-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 1323256ff22..ee9f9e4014b 100644 --- a/hrjobcontract/js/test/services/utils.service.spec.js +++ b/hrjobcontract/js/test/services/utils.service.spec.js @@ -14,13 +14,14 @@ define([ 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 (_$httpBackend_, _$rootScope_, _$q_, _$uibModal_, _$window_, _utilsService_, _apiService_, _AbsencePeriod_) { From 742a405cbbd75f47be2a99965df5e0f8ebe12fbb Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Tue, 24 Jul 2018 21:18:57 +0200 Subject: [PATCH 031/151] PCHR-3944: (Contact Summary) Use .templates module to fix failing specs --- contactsummary/js/test/controllers/key-dates.controller.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 () { From 14d020362d5243e6cf81353d8a6c0dd9cf42e95e Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 12:45:28 +0530 Subject: [PATCH 032/151] PCHR-3941: Fix linting issues for HR Career --- hrcareer/js/hrcareer.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hrcareer/js/hrcareer.js b/hrcareer/js/hrcareer.js index a75e544bcdc..991115377a9 100644 --- a/hrcareer/js/hrcareer.js +++ b/hrcareer/js/hrcareer.js @@ -1,11 +1,11 @@ // http://civicrm.org/licensing -CRM.$(function($) { - $('body').on('crmFormLoad', function(event) { - if (event.profileName == 'hrcareer_tab') { +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); + if ($('div#editrow-' + accessName + ' a.helpicon').length === 0) { + var helpIcon = $(""); + $('div#editrow-' + accessName + ' div label').append(helpIcon); } } }); From af99942e00ca22aa00684bfb293d5d8f9a20021f Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 12:47:58 +0530 Subject: [PATCH 033/151] PCHR-3941: Use RequireJS in HR Career --- hrcareer/hrcareer.php | 2 +- hrcareer/js/build.js | 9 + hrcareer/js/dist/hrcareer.min.js | 2 + hrcareer/js/hrcareer.js | 12 - hrcareer/js/src/hrcareer.js | 5 + hrcareer/js/src/hrcareer/app.js | 18 + package-lock.json | 1426 +++--- .../package-lock.json | 3971 ++++++++--------- 8 files changed, 2733 insertions(+), 2712 deletions(-) create mode 100644 hrcareer/js/build.js create mode 100644 hrcareer/js/dist/hrcareer.min.js delete mode 100644 hrcareer/js/hrcareer.js create mode 100644 hrcareer/js/src/hrcareer.js create mode 100644 hrcareer/js/src/hrcareer/app.js 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/js/build.js b/hrcareer/js/build.js new file mode 100644 index 00000000000..e525f473612 --- /dev/null +++ b/hrcareer/js/build.js @@ -0,0 +1,9 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/hrcareer.min.js', + name: 'hrcareer', + skipModuleInsertion: true, + generateSourceMaps: true +}) diff --git a/hrcareer/js/dist/hrcareer.min.js b/hrcareer/js/dist/hrcareer.min.js new file mode 100644 index 00000000000..19bd1b56d86 --- /dev/null +++ b/hrcareer/js/dist/hrcareer.min.js @@ -0,0 +1,2 @@ +define("hrcareer/app",[],function(){"use strict";CRM.$(function(e){e("body").on("crmFormLoad",function(a){if("hrcareer_tab"===a.profileName){var r=e('[data-crm-custom="Career:End_Date"]').attr("name");if(0===e("div#editrow-"+r+" a.helpicon").length){var n=e('');e("div#editrow-"+r+" div label").append(n)}}})})}),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 991115377a9..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..bac78e27fad --- /dev/null +++ b/hrcareer/js/src/hrcareer/app.js @@ -0,0 +1,18 @@ +/* eslint-env amd */ + +define(function () { + 'use strict'; + + 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/package-lock.json b/package-lock.json index 59d508afa9b..a752c6ba895 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", "dev": true, "requires": { - "acorn": "^3.0.4" + "acorn": "3.3.0" }, "dependencies": { "acorn": { @@ -32,10 +32,10 @@ "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" + "co": "4.6.0", + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" } }, "ajv-keywords": { @@ -62,7 +62,7 @@ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "color-convert": "1.9.1" } }, "any-observable": { @@ -83,7 +83,7 @@ "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", "dev": true, "requires": { - "sprintf-js": "~1.0.2" + "sprintf-js": "1.0.3" } }, "arr-diff": { @@ -92,7 +92,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "^1.0.1" + "arr-flatten": "1.1.0" } }, "arr-flatten": { @@ -113,8 +113,8 @@ "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", "dev": true, "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.7.0" + "define-properties": "1.1.2", + "es-abstract": "1.10.0" } }, "array-iterate": { @@ -129,7 +129,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "^1.0.1" + "array-uniq": "1.0.3" } }, "array-uniq": { @@ -162,12 +162,12 @@ "integrity": "sha512-Iq8TRIB+/9eQ8rbGhcP7ct5cYb/3qjNYAR2SnzLCEcwF6rvVOax8+9+fccgXk4bEhQGjOZd5TLhsksmAdsbGqQ==", "dev": true, "requires": { - "browserslist": "^2.11.3", - "caniuse-lite": "^1.0.30000805", - "normalize-range": "^0.1.2", - "num2fraction": "^1.2.2", - "postcss": "^6.0.17", - "postcss-value-parser": "^3.2.3" + "browserslist": "2.11.3", + "caniuse-lite": "1.0.30000808", + "normalize-range": "0.1.2", + "num2fraction": "1.2.2", + "postcss": "6.0.17", + "postcss-value-parser": "3.3.0" } }, "babel-code-frame": { @@ -176,9 +176,9 @@ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" }, "dependencies": { "ansi-styles": { @@ -193,11 +193,11 @@ "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" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "supports-color": { @@ -226,7 +226,7 @@ "integrity": "sha512-/+o3o6OV1cm3WKrO7U4wykU+ZICE6HiMEuravc2d03NIuM/VaRn5iMcoQ7NyxFXjvpmRICP2EER0YOnh4yIapA==", "dev": true, "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -236,9 +236,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" } }, "browserslist": { @@ -247,8 +247,8 @@ "integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30000792", - "electron-to-chromium": "^1.3.30" + "caniuse-lite": "1.0.30000808", + "electron-to-chromium": "1.3.33" } }, "builtin-modules": { @@ -263,7 +263,7 @@ "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", "dev": true, "requires": { - "callsites": "^0.2.0" + "callsites": "0.2.0" } }, "callsites": { @@ -284,9 +284,9 @@ "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", "dev": true, "requires": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" + "camelcase": "4.1.0", + "map-obj": "2.0.0", + "quick-lru": "1.1.0" } }, "caniuse-lite": { @@ -307,9 +307,9 @@ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "dev": true, "requires": { - "ansi-styles": "^3.1.0", - "escape-string-regexp": "^1.0.5", - "supports-color": "^4.0.0" + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" } }, "character-entities": { @@ -360,7 +360,7 @@ "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", "dev": true, "requires": { - "restore-cursor": "^1.0.1" + "restore-cursor": "1.0.1" } }, "cli-spinners": { @@ -376,7 +376,7 @@ "dev": true, "requires": { "slice-ansi": "0.0.4", - "string-width": "^1.0.1" + "string-width": "1.0.2" } }, "cli-width": { @@ -391,9 +391,9 @@ "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", "dev": true, "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "wrap-ansi": "2.1.0" }, "dependencies": { "is-fullwidth-code-point": { @@ -408,8 +408,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" } }, "strip-ansi": { @@ -418,7 +418,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "3.0.0" } } } @@ -429,8 +429,8 @@ "integrity": "sha1-6uCiQT9VwJQvgYwin+/OhF1/Oxw=", "dev": true, "requires": { - "is-regexp": "^1.0.0", - "is-supported-regexp-flag": "^1.0.0" + "is-regexp": "1.0.0", + "is-supported-regexp-flag": "1.0.0" } }, "co": { @@ -457,7 +457,7 @@ "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "dev": true, "requires": { - "color-name": "^1.1.1" + "color-name": "1.1.3" } }, "color-name": { @@ -484,9 +484,9 @@ "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", "dev": true, "requires": { - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" } }, "contains-path": { @@ -513,10 +513,10 @@ "integrity": "sha512-6e5vDdrXZD+t5v0L8CrurPeybg4Fmf+FCSYxXKYVAqLUtyCSbuyqE059d0kDthTNRzKVjL7QMgNpEUlsoYH3iQ==", "dev": true, "requires": { - "is-directory": "^0.3.1", - "js-yaml": "^3.9.0", - "parse-json": "^4.0.0", - "require-from-string": "^2.0.1" + "is-directory": "0.3.1", + "js-yaml": "3.10.0", + "parse-json": "4.0.0", + "require-from-string": "2.0.1" } }, "cross-spawn": { @@ -525,9 +525,9 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" } }, "currently-unhandled": { @@ -536,7 +536,7 @@ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "array-find-index": "^1.0.1" + "array-find-index": "1.0.2" } }, "date-fns": { @@ -572,8 +572,8 @@ "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", "dev": true, "requires": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" + "decamelize": "1.2.0", + "map-obj": "1.0.1" }, "dependencies": { "map-obj": { @@ -602,8 +602,8 @@ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", "dev": true, "requires": { - "foreach": "^2.0.5", - "object-keys": "^1.0.8" + "foreach": "2.0.5", + "object-keys": "1.0.11" } }, "deglob": { @@ -612,12 +612,12 @@ "integrity": "sha1-TUSr4W7zLHebSXK9FBqAMlApoUo=", "dev": true, "requires": { - "find-root": "^1.0.0", - "glob": "^7.0.5", - "ignore": "^3.0.9", - "pkg-config": "^1.1.0", - "run-parallel": "^1.1.2", - "uniq": "^1.0.1" + "find-root": "1.1.0", + "glob": "7.1.2", + "ignore": "3.3.7", + "pkg-config": "1.1.1", + "run-parallel": "1.1.6", + "uniq": "1.0.1" } }, "del": { @@ -626,13 +626,13 @@ "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", "dev": true, "requires": { - "globby": "^5.0.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "rimraf": "^2.2.8" + "globby": "5.0.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.0", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "rimraf": "2.6.2" }, "dependencies": { "pify": { @@ -649,8 +649,8 @@ "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", "dev": true, "requires": { - "arrify": "^1.0.1", - "path-type": "^3.0.0" + "arrify": "1.0.1", + "path-type": "3.0.0" }, "dependencies": { "path-type": { @@ -659,7 +659,7 @@ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "^3.0.0" + "pify": "3.0.0" } } } @@ -670,7 +670,7 @@ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "^2.0.2" + "esutils": "2.0.2" } }, "dom-serializer": { @@ -679,8 +679,8 @@ "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", "dev": true, "requires": { - "domelementtype": "~1.1.1", - "entities": "~1.1.1" + "domelementtype": "1.1.3", + "entities": "1.1.1" }, "dependencies": { "domelementtype": { @@ -703,7 +703,7 @@ "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", "dev": true, "requires": { - "domelementtype": "1" + "domelementtype": "1.3.0" } }, "domutils": { @@ -712,8 +712,8 @@ "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", "dev": true, "requires": { - "dom-serializer": "0", - "domelementtype": "1" + "dom-serializer": "0.1.0", + "domelementtype": "1.3.0" } }, "dot-prop": { @@ -722,7 +722,7 @@ "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", "dev": true, "requires": { - "is-obj": "^1.0.0" + "is-obj": "1.0.1" } }, "electron-to-chromium": { @@ -743,7 +743,7 @@ "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", "dev": true, "requires": { - "iconv-lite": "~0.4.13" + "iconv-lite": "0.4.19" } }, "entities": { @@ -758,7 +758,7 @@ "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true, "requires": { - "is-arrayish": "^0.2.1" + "is-arrayish": "0.2.1" } }, "es-abstract": { @@ -767,11 +767,11 @@ "integrity": "sha512-/uh/DhdqIOSkAWifU+8nG78vlQxdLckUdI/sPgy0VhuXi2qJ7T8czBmqIYtLQVpCIFYafChnsRsB5pyb1JdmCQ==", "dev": true, "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" + "es-to-primitive": "1.1.1", + "function-bind": "1.1.1", + "has": "1.0.1", + "is-callable": "1.1.3", + "is-regex": "1.0.4" } }, "es-to-primitive": { @@ -780,9 +780,9 @@ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", "dev": true, "requires": { - "is-callable": "^1.1.1", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.1" + "is-callable": "1.1.3", + "is-date-object": "1.0.1", + "is-symbol": "1.0.1" } }, "escape-string-regexp": { @@ -797,43 +797,43 @@ "integrity": "sha512-Ul6CSGRjKscEyg0X/EeNs7o2XdnbTEOD1OM8cTjmx85RPcBJQrEhZLevhuJZNAE/vS2iVl5Uhgiqf3h5uLMCJQ==", "dev": true, "requires": { - "ajv": "^5.3.0", - "babel-code-frame": "^6.22.0", - "chalk": "^2.1.0", - "concat-stream": "^1.6.0", - "cross-spawn": "^5.1.0", - "debug": "^3.1.0", - "doctrine": "^2.0.2", - "eslint-scope": "^3.7.1", - "eslint-visitor-keys": "^1.0.0", - "espree": "^3.5.2", - "esquery": "^1.0.0", - "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", - "functional-red-black-tree": "^1.0.1", - "glob": "^7.1.2", - "globals": "^11.0.1", - "ignore": "^3.3.3", - "imurmurhash": "^0.1.4", - "inquirer": "^3.0.6", - "is-resolvable": "^1.0.0", - "js-yaml": "^3.9.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.4", - "minimatch": "^3.0.2", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.2", - "path-is-inside": "^1.0.2", - "pluralize": "^7.0.0", - "progress": "^2.0.0", - "require-uncached": "^1.0.3", - "semver": "^5.3.0", - "strip-ansi": "^4.0.0", - "strip-json-comments": "~2.0.1", - "table": "^4.0.1", - "text-table": "~0.2.0" + "ajv": "5.5.2", + "babel-code-frame": "6.26.0", + "chalk": "2.3.0", + "concat-stream": "1.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.1.0", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "1.0.0", + "espree": "3.5.3", + "esquery": "1.0.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", + "glob": "7.1.2", + "globals": "11.3.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "3.3.0", + "is-resolvable": "1.1.0", + "js-yaml": "3.10.0", + "json-stable-stringify-without-jsonify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.5", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.0", + "require-uncached": "1.0.3", + "semver": "5.5.0", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "4.0.2", + "text-table": "0.2.0" }, "dependencies": { "strip-ansi": { @@ -842,7 +842,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "3.0.0" } } } @@ -871,8 +871,8 @@ "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", "dev": true, "requires": { - "debug": "^2.6.9", - "resolve": "^1.5.0" + "debug": "2.6.9", + "resolve": "1.5.0" }, "dependencies": { "debug": { @@ -892,8 +892,8 @@ "integrity": "sha512-jDI/X5l/6D1rRD/3T43q8Qgbls2nq5km5KSqiwlyUbGo5+04fXhMKdCPhjwbqAa6HXWaMxj8Q4hQDIh7IadJQw==", "dev": true, "requires": { - "debug": "^2.6.8", - "pkg-dir": "^1.0.0" + "debug": "2.6.9", + "pkg-dir": "1.0.0" }, "dependencies": { "debug": { @@ -913,16 +913,16 @@ "integrity": "sha512-Rf7dfKJxZ16QuTgVv1OYNxkZcsu/hULFnC+e+w0Gzi6jMC3guQoWQgxYxc54IDRinlb6/0v5z/PxxIKmVctN+g==", "dev": true, "requires": { - "builtin-modules": "^1.1.1", - "contains-path": "^0.1.0", - "debug": "^2.6.8", + "builtin-modules": "1.1.1", + "contains-path": "0.1.0", + "debug": "2.6.9", "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.1", - "eslint-module-utils": "^2.1.1", - "has": "^1.0.1", - "lodash.cond": "^4.3.0", - "minimatch": "^3.0.3", - "read-pkg-up": "^2.0.0" + "eslint-import-resolver-node": "0.3.2", + "eslint-module-utils": "2.1.1", + "has": "1.0.1", + "lodash.cond": "4.5.2", + "minimatch": "3.0.4", + "read-pkg-up": "2.0.0" }, "dependencies": { "debug": { @@ -940,8 +940,8 @@ "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", "dev": true, "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" + "esutils": "2.0.2", + "isarray": "1.0.0" } } } @@ -952,9 +952,9 @@ "integrity": "sha512-xhPXrh0Vl/b7870uEbaumb2Q+LxaEcOQ3kS1jtIXanBAwpMre1l5q/l2l/hESYJGEFKuI78bp6Uw50hlpr7B+g==", "dev": true, "requires": { - "ignore": "^3.3.6", - "minimatch": "^3.0.4", - "resolve": "^1.3.3", + "ignore": "3.3.7", + "minimatch": "3.0.4", + "resolve": "1.5.0", "semver": "5.3.0" }, "dependencies": { @@ -978,10 +978,10 @@ "integrity": "sha512-YGSjB9Qu6QbVTroUZi66pYky3DfoIPLdHQ/wmrBGyBRnwxQsBXAov9j2rpXt/55i8nyMv6IRWJv2s4d4YnduzQ==", "dev": true, "requires": { - "doctrine": "^2.0.0", - "has": "^1.0.1", - "jsx-ast-utils": "^2.0.0", - "prop-types": "^15.6.0" + "doctrine": "2.1.0", + "has": "1.0.1", + "jsx-ast-utils": "2.0.1", + "prop-types": "15.6.0" } }, "eslint-plugin-standard": { @@ -996,8 +996,8 @@ "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", "dev": true, "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" + "esrecurse": "4.2.0", + "estraverse": "4.2.0" } }, "eslint-visitor-keys": { @@ -1012,8 +1012,8 @@ "integrity": "sha512-Zy3tAJDORxQZLl2baguiRU1syPERAIg0L+JB2MWorORgTu/CplzvxS9WWA7Xh4+Q+eOQihNs/1o1Xep8cvCxWQ==", "dev": true, "requires": { - "acorn": "^5.4.0", - "acorn-jsx": "^3.0.0" + "acorn": "5.4.1", + "acorn-jsx": "3.0.1" } }, "esprima": { @@ -1028,7 +1028,7 @@ "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", "dev": true, "requires": { - "estraverse": "^4.0.0" + "estraverse": "4.2.0" } }, "esrecurse": { @@ -1037,8 +1037,8 @@ "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", "dev": true, "requires": { - "estraverse": "^4.1.0", - "object-assign": "^4.0.1" + "estraverse": "4.2.0", + "object-assign": "4.1.1" } }, "estraverse": { @@ -1059,13 +1059,13 @@ "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", "dev": true, "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" } }, "execall": { @@ -1074,7 +1074,7 @@ "integrity": "sha1-c9CQTjlbPKsGWLCNCewlMH8pu3M=", "dev": true, "requires": { - "clone-regexp": "^1.0.0" + "clone-regexp": "1.0.0" } }, "exit-hook": { @@ -1089,7 +1089,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "^0.1.0" + "is-posix-bracket": "0.1.1" } }, "expand-range": { @@ -1098,7 +1098,7 @@ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "fill-range": "^2.1.0" + "fill-range": "2.2.3" } }, "extend": { @@ -1113,9 +1113,9 @@ "integrity": "sha512-E44iT5QVOUJBKij4IIV3uvxuNlbKS38Tw1HiupxEIHPv9qtC2PrDYohbXV5U+1jnfIXttny8gUhj+oZvflFlzA==", "dev": true, "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", - "tmp": "^0.0.33" + "chardet": "0.4.2", + "iconv-lite": "0.4.19", + "tmp": "0.0.33" } }, "extglob": { @@ -1124,7 +1124,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" }, "dependencies": { "is-extglob": { @@ -1159,13 +1159,13 @@ "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", "dev": true, "requires": { - "core-js": "^1.0.0", - "isomorphic-fetch": "^2.1.1", - "loose-envify": "^1.0.0", - "object-assign": "^4.1.0", - "promise": "^7.1.1", - "setimmediate": "^1.0.5", - "ua-parser-js": "^0.7.9" + "core-js": "1.2.7", + "isomorphic-fetch": "2.2.1", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "promise": "7.3.1", + "setimmediate": "1.0.5", + "ua-parser-js": "0.7.17" } }, "figures": { @@ -1174,8 +1174,8 @@ "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", "dev": true, "requires": { - "escape-string-regexp": "^1.0.5", - "object-assign": "^4.1.0" + "escape-string-regexp": "1.0.5", + "object-assign": "4.1.1" } }, "file-entry-cache": { @@ -1184,8 +1184,8 @@ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", "dev": true, "requires": { - "flat-cache": "^1.2.1", - "object-assign": "^4.0.1" + "flat-cache": "1.3.0", + "object-assign": "4.1.1" } }, "filename-regex": { @@ -1200,11 +1200,11 @@ "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true, "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^1.1.3", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" } }, "find-parent-dir": { @@ -1225,8 +1225,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" } }, "flat-cache": { @@ -1235,10 +1235,10 @@ "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", "dev": true, "requires": { - "circular-json": "^0.3.1", - "del": "^2.0.2", - "graceful-fs": "^4.1.2", - "write": "^0.2.1" + "circular-json": "0.3.3", + "del": "2.2.2", + "graceful-fs": "4.1.11", + "write": "0.2.1" } }, "for-in": { @@ -1253,7 +1253,7 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { - "for-in": "^1.0.1" + "for-in": "1.0.2" } }, "foreach": { @@ -1310,12 +1310,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": 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" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "glob-base": { @@ -1324,8 +1324,8 @@ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" + "glob-parent": "2.0.0", + "is-glob": "2.0.1" }, "dependencies": { "is-extglob": { @@ -1340,7 +1340,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } } } @@ -1351,7 +1351,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "^2.0.0" + "is-glob": "2.0.1" }, "dependencies": { "is-extglob": { @@ -1366,7 +1366,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } } } @@ -1383,12 +1383,12 @@ "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "array-union": "1.0.2", + "arrify": "1.0.1", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" }, "dependencies": { "pify": { @@ -1411,7 +1411,7 @@ "integrity": "sha512-Kjhohco0esHQnOiqqdJeNz/5fyPkOMD/d6XVjwTAoPGUFh0mCollPUTUTa2OZy4dYNAqlPIQdTiNzJTWdd9Htw==", "dev": true, "requires": { - "minimist": "1.1.x" + "minimist": "1.1.3" }, "dependencies": { "minimist": { @@ -1434,7 +1434,7 @@ "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", "dev": true, "requires": { - "function-bind": "^1.0.2" + "function-bind": "1.1.1" } }, "has-ansi": { @@ -1443,7 +1443,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" }, "dependencies": { "ansi-regex": { @@ -1478,12 +1478,12 @@ "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" + "domelementtype": "1.3.0", + "domhandler": "2.4.1", + "domutils": "1.7.0", + "entities": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.3" } }, "husky": { @@ -1492,9 +1492,9 @@ "integrity": "sha512-e21wivqHpstpoiWA/Yi8eFti8E+sQDSS53cpJsPptPs295QTOQR0ZwnHo2TXy1XOpZFD9rPOd3NpmqTK6uMLJA==", "dev": true, "requires": { - "is-ci": "^1.0.10", - "normalize-path": "^1.0.0", - "strip-indent": "^2.0.0" + "is-ci": "1.1.0", + "normalize-path": "1.0.0", + "strip-indent": "2.0.0" } }, "iconv-lite": { @@ -1521,7 +1521,7 @@ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, "requires": { - "repeating": "^2.0.0" + "repeating": "2.0.1" } }, "indexes-of": { @@ -1536,8 +1536,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -1552,20 +1552,20 @@ "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", "dev": true, "requires": { - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^2.0.4", - "figures": "^2.0.0", - "lodash": "^4.3.0", + "ansi-escapes": "3.0.0", + "chalk": "2.3.0", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.1.0", + "figures": "2.0.0", + "lodash": "4.17.5", "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rx-lite": "^4.0.8", - "rx-lite-aggregates": "^4.0.8", - "string-width": "^2.1.0", - "strip-ansi": "^4.0.0", - "through": "^2.3.6" + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" }, "dependencies": { "ansi-escapes": { @@ -1580,7 +1580,7 @@ "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, "requires": { - "restore-cursor": "^2.0.0" + "restore-cursor": "2.0.0" } }, "figures": { @@ -1589,7 +1589,7 @@ "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", "dev": true, "requires": { - "escape-string-regexp": "^1.0.5" + "escape-string-regexp": "1.0.5" } }, "is-fullwidth-code-point": { @@ -1604,7 +1604,7 @@ "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "mimic-fn": "1.2.0" } }, "restore-cursor": { @@ -1613,8 +1613,8 @@ "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", "dev": true, "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" + "onetime": "2.0.1", + "signal-exit": "3.0.2" } }, "string-width": { @@ -1623,8 +1623,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" } }, "strip-ansi": { @@ -1633,7 +1633,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "3.0.0" } } } @@ -1662,8 +1662,8 @@ "integrity": "sha1-37SqTRCF4zvbYcLe6cgOnGwZ9Ts=", "dev": true, "requires": { - "is-alphabetical": "^1.0.0", - "is-decimal": "^1.0.0" + "is-alphabetical": "1.0.1", + "is-decimal": "1.0.1" } }, "is-arrayish": { @@ -1684,7 +1684,7 @@ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { - "builtin-modules": "^1.0.0" + "builtin-modules": "1.1.1" } }, "is-callable": { @@ -1699,7 +1699,7 @@ "integrity": "sha512-c7TnwxLePuqIlxHgr7xtxzycJPegNHFuIrBkwbf8hc58//+Op1CqFkyS+xnIMkwn9UsJIwc174BIjkyBmSpjKg==", "dev": true, "requires": { - "ci-info": "^1.0.0" + "ci-info": "1.1.2" } }, "is-date-object": { @@ -1732,7 +1732,7 @@ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { - "is-primitive": "^2.0.0" + "is-primitive": "2.0.0" } }, "is-extendable": { @@ -1753,7 +1753,7 @@ "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "number-is-nan": "1.0.1" } }, "is-fullwidth-code-point": { @@ -1762,7 +1762,7 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "number-is-nan": "1.0.1" } }, "is-glob": { @@ -1771,7 +1771,7 @@ "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", "dev": true, "requires": { - "is-extglob": "^2.1.1" + "is-extglob": "2.1.1" } }, "is-hexadecimal": { @@ -1786,7 +1786,7 @@ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" } }, "is-obj": { @@ -1801,7 +1801,7 @@ "integrity": "sha1-s2ExHYPG5dcmyr9eJQsCNxBvWuI=", "dev": true, "requires": { - "symbol-observable": "^0.2.2" + "symbol-observable": "0.2.4" } }, "is-path-cwd": { @@ -1816,7 +1816,7 @@ "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", "dev": true, "requires": { - "is-path-inside": "^1.0.0" + "is-path-inside": "1.0.1" } }, "is-path-inside": { @@ -1825,7 +1825,7 @@ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { - "path-is-inside": "^1.0.1" + "path-is-inside": "1.0.2" } }, "is-plain-obj": { @@ -1858,7 +1858,7 @@ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { - "has": "^1.0.1" + "has": "1.0.1" } }, "is-regexp": { @@ -1930,8 +1930,8 @@ "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", "dev": true, "requires": { - "node-fetch": "^1.0.1", - "whatwg-fetch": ">=0.10.0" + "node-fetch": "1.7.3", + "whatwg-fetch": "2.0.3" } }, "jest-get-type": { @@ -1946,10 +1946,10 @@ "integrity": "sha512-k4HLI1rZQjlU+EC682RlQ6oZvLrE5SCh3brseQc24vbZTxzT/k/3urar5QMCVgjadmSO7lECeGdc6YxnM3yEGg==", "dev": true, "requires": { - "chalk": "^2.0.1", - "jest-get-type": "^21.2.0", - "leven": "^2.1.0", - "pretty-format": "^21.2.1" + "chalk": "2.3.0", + "jest-get-type": "21.2.0", + "leven": "2.1.0", + "pretty-format": "21.2.1" } }, "js-base64": { @@ -1970,8 +1970,8 @@ "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "1.0.9", + "esprima": "4.0.0" } }, "json-parse-better-errors": { @@ -1998,7 +1998,7 @@ "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=", "dev": true, "requires": { - "array-includes": "^3.0.3" + "array-includes": "3.0.3" } }, "kind-of": { @@ -2007,7 +2007,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } }, "known-css-properties": { @@ -2022,7 +2022,7 @@ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { - "invert-kv": "^1.0.0" + "invert-kv": "1.0.0" } }, "leven": { @@ -2037,8 +2037,8 @@ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" + "prelude-ls": "1.1.2", + "type-check": "0.3.2" } }, "lint-staged": { @@ -2047,26 +2047,26 @@ "integrity": "sha512-RMB6BUd2bEKaPnj06F7j8RRB8OHM+UP4fQS2LT8lF+X9BjSaezw1oVB5hc4elLhYvzlFCkhAaatzYz+x53YHgw==", "dev": true, "requires": { - "app-root-path": "^2.0.0", - "chalk": "^2.1.0", - "commander": "^2.11.0", - "cosmiconfig": "^4.0.0", - "debug": "^3.1.0", - "dedent": "^0.7.0", - "execa": "^0.8.0", - "find-parent-dir": "^0.3.0", - "is-glob": "^4.0.0", - "jest-validate": "^21.1.0", - "listr": "^0.13.0", - "lodash": "^4.17.4", - "log-symbols": "^2.0.0", - "minimatch": "^3.0.0", - "npm-which": "^3.0.1", - "p-map": "^1.1.1", - "path-is-inside": "^1.0.2", - "pify": "^3.0.0", + "app-root-path": "2.0.1", + "chalk": "2.3.0", + "commander": "2.14.1", + "cosmiconfig": "4.0.0", + "debug": "3.1.0", + "dedent": "0.7.0", + "execa": "0.8.0", + "find-parent-dir": "0.3.0", + "is-glob": "4.0.0", + "jest-validate": "21.2.1", + "listr": "0.13.0", + "lodash": "4.17.5", + "log-symbols": "2.2.0", + "minimatch": "3.0.4", + "npm-which": "3.0.1", + "p-map": "1.2.0", + "path-is-inside": "1.0.2", + "pify": "3.0.0", "staged-git-files": "0.0.4", - "stringify-object": "^3.2.0" + "stringify-object": "3.2.2" } }, "listr": { @@ -2075,23 +2075,23 @@ "integrity": "sha1-ILsLowuuZg7oTMBQPfS+PVYjiH0=", "dev": true, "requires": { - "chalk": "^1.1.3", - "cli-truncate": "^0.2.1", - "figures": "^1.7.0", - "indent-string": "^2.1.0", - "is-observable": "^0.2.0", - "is-promise": "^2.1.0", - "is-stream": "^1.1.0", - "listr-silent-renderer": "^1.1.1", - "listr-update-renderer": "^0.4.0", - "listr-verbose-renderer": "^0.4.0", - "log-symbols": "^1.0.2", - "log-update": "^1.0.2", - "ora": "^0.2.3", - "p-map": "^1.1.1", - "rxjs": "^5.4.2", - "stream-to-observable": "^0.2.0", - "strip-ansi": "^3.0.1" + "chalk": "1.1.3", + "cli-truncate": "0.2.1", + "figures": "1.7.0", + "indent-string": "2.1.0", + "is-observable": "0.2.0", + "is-promise": "2.1.0", + "is-stream": "1.1.0", + "listr-silent-renderer": "1.1.1", + "listr-update-renderer": "0.4.0", + "listr-verbose-renderer": "0.4.1", + "log-symbols": "1.0.2", + "log-update": "1.0.2", + "ora": "0.2.3", + "p-map": "1.2.0", + "rxjs": "5.5.6", + "stream-to-observable": "0.2.0", + "strip-ansi": "3.0.1" }, "dependencies": { "ansi-styles": { @@ -2106,11 +2106,11 @@ "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" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "log-symbols": { @@ -2119,7 +2119,7 @@ "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", "dev": true, "requires": { - "chalk": "^1.0.0" + "chalk": "1.1.3" } }, "supports-color": { @@ -2142,14 +2142,14 @@ "integrity": "sha1-NE2YDaLKLosUW6MFkI8yrj9MyKc=", "dev": true, "requires": { - "chalk": "^1.1.3", - "cli-truncate": "^0.2.1", - "elegant-spinner": "^1.0.1", - "figures": "^1.7.0", - "indent-string": "^3.0.0", - "log-symbols": "^1.0.2", - "log-update": "^1.0.2", - "strip-ansi": "^3.0.1" + "chalk": "1.1.3", + "cli-truncate": "0.2.1", + "elegant-spinner": "1.0.1", + "figures": "1.7.0", + "indent-string": "3.2.0", + "log-symbols": "1.0.2", + "log-update": "1.0.2", + "strip-ansi": "3.0.1" }, "dependencies": { "ansi-styles": { @@ -2164,11 +2164,11 @@ "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" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "indent-string": { @@ -2183,7 +2183,7 @@ "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", "dev": true, "requires": { - "chalk": "^1.0.0" + "chalk": "1.1.3" } }, "supports-color": { @@ -2200,10 +2200,10 @@ "integrity": "sha1-ggb0z21S3cWCfl/RSYng6WWTOjU=", "dev": true, "requires": { - "chalk": "^1.1.3", - "cli-cursor": "^1.0.2", - "date-fns": "^1.27.2", - "figures": "^1.7.0" + "chalk": "1.1.3", + "cli-cursor": "1.0.2", + "date-fns": "1.29.0", + "figures": "1.7.0" }, "dependencies": { "ansi-styles": { @@ -2218,11 +2218,11 @@ "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" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "supports-color": { @@ -2239,10 +2239,10 @@ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" }, "dependencies": { "parse-json": { @@ -2251,7 +2251,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "1.3.1" } }, "pify": { @@ -2268,8 +2268,8 @@ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" + "p-locate": "2.0.0", + "path-exists": "3.0.0" }, "dependencies": { "path-exists": { @@ -2298,7 +2298,7 @@ "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", "dev": true, "requires": { - "chalk": "^2.0.1" + "chalk": "2.3.0" } }, "log-update": { @@ -2307,8 +2307,8 @@ "integrity": "sha1-GZKfZMQJPS0ucHWh2tivWcKWuNE=", "dev": true, "requires": { - "ansi-escapes": "^1.0.0", - "cli-cursor": "^1.0.2" + "ansi-escapes": "1.4.0", + "cli-cursor": "1.0.2" } }, "longest-streak": { @@ -2323,7 +2323,7 @@ "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", "dev": true, "requires": { - "js-tokens": "^3.0.0" + "js-tokens": "3.0.2" } }, "loud-rejection": { @@ -2332,8 +2332,8 @@ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", "dev": true, "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.2" } }, "lru-cache": { @@ -2342,8 +2342,8 @@ "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" + "pseudomap": "1.0.2", + "yallist": "2.1.2" } }, "map-obj": { @@ -2376,8 +2376,8 @@ "integrity": "sha1-zbX4TitqLTEU3zO9BdnLMuPECDo=", "dev": true, "requires": { - "unist-util-modify-children": "^1.0.0", - "unist-util-visit": "^1.1.0" + "unist-util-modify-children": "1.1.1", + "unist-util-visit": "1.3.0" } }, "mem": { @@ -2386,7 +2386,7 @@ "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "mimic-fn": "1.2.0" } }, "meow": { @@ -2395,15 +2395,15 @@ "integrity": "sha512-Me/kel335m6vMKmEmA6c87Z6DUFW3JqkINRnxkbC+A/PUm0D5Fl2dEBQrPKnqCL9Te/CIa1MUt/0InMJhuC/sw==", "dev": true, "requires": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist": "^1.1.3", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0" + "camelcase-keys": "4.2.0", + "decamelize-keys": "1.1.0", + "loud-rejection": "1.6.0", + "minimist": "1.2.0", + "minimist-options": "3.0.2", + "normalize-package-data": "2.4.0", + "read-pkg-up": "3.0.0", + "redent": "2.0.0", + "trim-newlines": "2.0.0" }, "dependencies": { "find-up": { @@ -2412,7 +2412,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "^2.0.0" + "locate-path": "2.0.0" } }, "load-json-file": { @@ -2421,10 +2421,10 @@ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" + "graceful-fs": "4.1.11", + "parse-json": "4.0.0", + "pify": "3.0.0", + "strip-bom": "3.0.0" } }, "minimist": { @@ -2439,7 +2439,7 @@ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "^3.0.0" + "pify": "3.0.0" } }, "read-pkg": { @@ -2448,9 +2448,9 @@ "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" + "load-json-file": "4.0.0", + "normalize-package-data": "2.4.0", + "path-type": "3.0.0" } }, "read-pkg-up": { @@ -2459,8 +2459,8 @@ "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" + "find-up": "2.1.0", + "read-pkg": "3.0.0" } } } @@ -2471,19 +2471,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" }, "dependencies": { "is-extglob": { @@ -2498,7 +2498,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } }, "normalize-path": { @@ -2507,7 +2507,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "^1.0.1" + "remove-trailing-separator": "1.1.0" } } } @@ -2524,7 +2524,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.9" } }, "minimist": { @@ -2539,8 +2539,8 @@ "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" + "arrify": "1.0.1", + "is-plain-obj": "1.1.0" } }, "mkdirp": { @@ -2576,8 +2576,8 @@ "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", "dev": true, "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" + "encoding": "0.1.12", + "is-stream": "1.1.0" } }, "normalize-package-data": { @@ -2586,10 +2586,10 @@ "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" + "hosted-git-info": "2.5.0", + "is-builtin-module": "1.0.0", + "semver": "5.5.0", + "validate-npm-package-license": "3.0.1" } }, "normalize-path": { @@ -2616,7 +2616,7 @@ "integrity": "sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==", "dev": true, "requires": { - "which": "^1.2.10" + "which": "1.3.0" } }, "npm-run-path": { @@ -2625,7 +2625,7 @@ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { - "path-key": "^2.0.0" + "path-key": "2.0.1" } }, "npm-which": { @@ -2634,9 +2634,9 @@ "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", "dev": true, "requires": { - "commander": "^2.9.0", - "npm-path": "^2.0.2", - "which": "^1.2.10" + "commander": "2.14.1", + "npm-path": "2.0.4", + "which": "1.3.0" } }, "num2fraction": { @@ -2669,8 +2669,8 @@ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" + "for-own": "0.1.5", + "is-extendable": "0.1.1" } }, "once": { @@ -2679,7 +2679,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "onetime": { @@ -2694,12 +2694,12 @@ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" } }, "ora": { @@ -2708,10 +2708,10 @@ "integrity": "sha1-N1J9Igrc1Tw5tzVx11QVbV22V6Q=", "dev": true, "requires": { - "chalk": "^1.1.1", - "cli-cursor": "^1.0.2", - "cli-spinners": "^0.1.2", - "object-assign": "^4.0.1" + "chalk": "1.1.3", + "cli-cursor": "1.0.2", + "cli-spinners": "0.1.2", + "object-assign": "4.1.1" }, "dependencies": { "ansi-styles": { @@ -2726,11 +2726,11 @@ "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" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "supports-color": { @@ -2747,9 +2747,9 @@ "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" }, "dependencies": { "execa": { @@ -2758,13 +2758,13 @@ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" } } } @@ -2787,7 +2787,7 @@ "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", "dev": true, "requires": { - "p-try": "^1.0.0" + "p-try": "1.0.0" } }, "p-locate": { @@ -2796,7 +2796,7 @@ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { - "p-limit": "^1.1.0" + "p-limit": "1.2.0" } }, "p-map": { @@ -2817,12 +2817,12 @@ "integrity": "sha1-gRLYhHExnyerrk1klksSL+ThuJA=", "dev": true, "requires": { - "character-entities": "^1.0.0", - "character-entities-legacy": "^1.0.0", - "character-reference-invalid": "^1.0.0", - "is-alphanumerical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-hexadecimal": "^1.0.0" + "character-entities": "1.2.1", + "character-entities-legacy": "1.1.1", + "character-reference-invalid": "1.1.1", + "is-alphanumerical": "1.0.1", + "is-decimal": "1.0.1", + "is-hexadecimal": "1.0.1" } }, "parse-glob": { @@ -2831,10 +2831,10 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" }, "dependencies": { "is-extglob": { @@ -2849,7 +2849,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } } } @@ -2860,8 +2860,8 @@ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "error-ex": "1.3.1", + "json-parse-better-errors": "1.0.1" } }, "path-exists": { @@ -2870,7 +2870,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "^2.0.0" + "pinkie-promise": "2.0.1" } }, "path-is-absolute": { @@ -2903,7 +2903,7 @@ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", "dev": true, "requires": { - "pify": "^2.0.0" + "pify": "2.3.0" }, "dependencies": { "pify": { @@ -2932,7 +2932,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "^2.0.0" + "pinkie": "2.0.4" } }, "pkg-conf": { @@ -2941,8 +2941,8 @@ "integrity": "sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=", "dev": true, "requires": { - "find-up": "^2.0.0", - "load-json-file": "^4.0.0" + "find-up": "2.1.0", + "load-json-file": "4.0.0" }, "dependencies": { "find-up": { @@ -2951,7 +2951,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "^2.0.0" + "locate-path": "2.0.0" } }, "load-json-file": { @@ -2960,10 +2960,10 @@ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" + "graceful-fs": "4.1.11", + "parse-json": "4.0.0", + "pify": "3.0.0", + "strip-bom": "3.0.0" } } } @@ -2974,9 +2974,9 @@ "integrity": "sha1-VX7yLXPaPIg3EHdmxS6tq94pj+Q=", "dev": true, "requires": { - "debug-log": "^1.0.0", - "find-root": "^1.0.0", - "xtend": "^4.0.1" + "debug-log": "1.0.1", + "find-root": "1.1.0", + "xtend": "4.0.1" } }, "pkg-dir": { @@ -2985,7 +2985,7 @@ "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", "dev": true, "requires": { - "find-up": "^1.0.0" + "find-up": "1.1.2" } }, "pluralize": { @@ -3000,9 +3000,9 @@ "integrity": "sha512-Bl1nybsSzWYbP8O4gAVD8JIjZIul9hLNOPTGBIlVmZNUnNAGL+W0cpYWzVwfImZOwumct4c1SDvSbncVWKtXUw==", "dev": true, "requires": { - "chalk": "^2.3.0", - "source-map": "^0.6.1", - "supports-color": "^5.1.0" + "chalk": "2.3.0", + "source-map": "0.6.1", + "supports-color": "5.2.0" }, "dependencies": { "has-flag": { @@ -3017,7 +3017,7 @@ "integrity": "sha512-F39vS48la4YvTZUPVeTqsjsFNrvcMwrV3RLZINsmHo+7djCvuUzSIeXOnZ5hmjef4bajL1dNccN+tg5XAliO5Q==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "3.0.0" } } } @@ -3028,9 +3028,9 @@ "integrity": "sha512-KxKUpj7AY7nlCbLcTOYxdfJnGE7QFAfU2n95ADj1Q90RM/pOLdz8k3n4avOyRFs7MDQHcRzJQWM1dehCwJxisQ==", "dev": true, "requires": { - "htmlparser2": "^3.9.2", - "remark": "^8.0.0", - "unist-util-find-all-after": "^1.0.1" + "htmlparser2": "3.9.2", + "remark": "8.0.0", + "unist-util-find-all-after": "1.0.1" } }, "postcss-less": { @@ -3039,7 +3039,7 @@ "integrity": "sha512-WS0wsQxRm+kmN8wEYAGZ3t4lnoNfoyx9EJZrhiPR1K0lMHR0UNWnz52Ya5QRXChHtY75Ef+kDc05FpnBujebgw==", "dev": true, "requires": { - "postcss": "^5.2.16" + "postcss": "5.2.18" }, "dependencies": { "ansi-styles": { @@ -3054,11 +3054,11 @@ "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" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" }, "dependencies": { "supports-color": { @@ -3081,10 +3081,10 @@ "integrity": "sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==", "dev": true, "requires": { - "chalk": "^1.1.3", - "js-base64": "^2.1.9", - "source-map": "^0.5.6", - "supports-color": "^3.2.3" + "chalk": "1.1.3", + "js-base64": "2.4.3", + "source-map": "0.5.7", + "supports-color": "3.2.3" } }, "source-map": { @@ -3099,7 +3099,7 @@ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { - "has-flag": "^1.0.0" + "has-flag": "1.0.0" } } } @@ -3116,10 +3116,10 @@ "integrity": "sha512-rBkDbaHAu5uywbCR2XE8a25tats3xSOsGNx6mppK6Q9kSFGKc/FyAzfci+fWM2l+K402p1D0pNcfDGxeje5IKg==", "dev": true, "requires": { - "chalk": "^2.0.1", - "lodash": "^4.17.4", - "log-symbols": "^2.0.0", - "postcss": "^6.0.8" + "chalk": "2.3.0", + "lodash": "4.17.5", + "log-symbols": "2.2.0", + "postcss": "6.0.17" } }, "postcss-resolve-nested-selector": { @@ -3134,7 +3134,7 @@ "integrity": "sha1-t1Pv9sfArqXoN1++TN6L+QY/8UI=", "dev": true, "requires": { - "postcss": "^6.0.6" + "postcss": "6.0.17" } }, "postcss-sass": { @@ -3143,8 +3143,8 @@ "integrity": "sha512-cUmYzkP747fPCQE6d+CH2l1L4VSyIlAzZsok3HPjb5Gzsq3jE+VjpAdGlPsnQ310WKWI42sw+ar0UNN59/f3hg==", "dev": true, "requires": { - "gonzales-pe": "^4.0.3", - "postcss": "^6.0.6" + "gonzales-pe": "4.2.3", + "postcss": "6.0.17" } }, "postcss-scss": { @@ -3153,7 +3153,7 @@ "integrity": "sha512-N2ZPDOV5PGEGVwdiB7b1QppxKkmkHodNWkemja7PV+/mHqbUlA6ZcYRreden5Ag5nwBBX8/aRE7lfg1xjdszyg==", "dev": true, "requires": { - "postcss": "^6.0.15" + "postcss": "6.0.17" } }, "postcss-selector-parser": { @@ -3162,9 +3162,9 @@ "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", "dev": true, "requires": { - "dot-prop": "^4.1.1", - "indexes-of": "^1.0.1", - "uniq": "^1.0.1" + "dot-prop": "4.2.0", + "indexes-of": "1.0.1", + "uniq": "1.0.1" } }, "postcss-sorting": { @@ -3173,8 +3173,8 @@ "integrity": "sha512-YCPTcJwGIInF1LpMD1lIYvMHTGUL4s97o/OraA6eKvoauhhk6vjwOWDDjm6uRKqug/kyDPMKEzmYZ6FtW6RDgw==", "dev": true, "requires": { - "lodash": "^4.17.4", - "postcss": "^6.0.13" + "lodash": "4.17.5", + "postcss": "6.0.17" } }, "postcss-value-parser": { @@ -3201,8 +3201,8 @@ "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", "dev": true, "requires": { - "ansi-regex": "^3.0.0", - "ansi-styles": "^3.2.0" + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" } }, "process-nextick-args": { @@ -3223,7 +3223,7 @@ "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "dev": true, "requires": { - "asap": "~2.0.3" + "asap": "2.0.6" } }, "prop-types": { @@ -3232,9 +3232,9 @@ "integrity": "sha1-zq8IMCL8RrSjX2nhPvda7Q1jmFY=", "dev": true, "requires": { - "fbjs": "^0.8.16", - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1" } }, "pseudomap": { @@ -3255,8 +3255,8 @@ "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", "dev": true, "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "is-number": "3.0.0", + "kind-of": "4.0.0" }, "dependencies": { "is-number": { @@ -3265,7 +3265,7 @@ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -3274,7 +3274,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -3285,7 +3285,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -3296,9 +3296,9 @@ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", "dev": true, "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" } }, "read-pkg-up": { @@ -3307,8 +3307,8 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true, "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" + "find-up": "2.1.0", + "read-pkg": "2.0.0" }, "dependencies": { "find-up": { @@ -3317,7 +3317,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "^2.0.0" + "locate-path": "2.0.0" } } } @@ -3328,13 +3328,13 @@ "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" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" } }, "redent": { @@ -3343,8 +3343,8 @@ "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", "dev": true, "requires": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" + "indent-string": "3.2.0", + "strip-indent": "2.0.0" }, "dependencies": { "indent-string": { @@ -3361,7 +3361,7 @@ "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { - "is-equal-shallow": "^0.1.3" + "is-equal-shallow": "0.1.3" } }, "remark": { @@ -3370,9 +3370,9 @@ "integrity": "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw==", "dev": true, "requires": { - "remark-parse": "^4.0.0", - "remark-stringify": "^4.0.0", - "unified": "^6.0.0" + "remark-parse": "4.0.0", + "remark-stringify": "4.0.0", + "unified": "6.1.6" } }, "remark-parse": { @@ -3381,21 +3381,21 @@ "integrity": "sha512-XZgICP2gJ1MHU7+vQaRM+VA9HEL3X253uwUM/BGgx3iv6TH2B3bF3B8q00DKcyP9YrJV+/7WOWEWBFF/u8cIsw==", "dev": true, "requires": { - "collapse-white-space": "^1.0.2", - "is-alphabetical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-whitespace-character": "^1.0.0", - "is-word-character": "^1.0.0", - "markdown-escapes": "^1.0.0", - "parse-entities": "^1.0.2", - "repeat-string": "^1.5.4", - "state-toggle": "^1.0.0", + "collapse-white-space": "1.0.3", + "is-alphabetical": "1.0.1", + "is-decimal": "1.0.1", + "is-whitespace-character": "1.0.1", + "is-word-character": "1.0.1", + "markdown-escapes": "1.0.1", + "parse-entities": "1.1.1", + "repeat-string": "1.6.1", + "state-toggle": "1.0.0", "trim": "0.0.1", - "trim-trailing-lines": "^1.0.0", - "unherit": "^1.0.4", - "unist-util-remove-position": "^1.0.0", - "vfile-location": "^2.0.0", - "xtend": "^4.0.1" + "trim-trailing-lines": "1.1.0", + "unherit": "1.1.0", + "unist-util-remove-position": "1.1.1", + "vfile-location": "2.0.2", + "xtend": "4.0.1" } }, "remark-stringify": { @@ -3404,20 +3404,20 @@ "integrity": "sha512-xLuyKTnuQer3ke9hkU38SUYLiTmS078QOnoFavztmbt/pAJtNSkNtFgR0U//uCcmG0qnyxao+PDuatQav46F1w==", "dev": true, "requires": { - "ccount": "^1.0.0", - "is-alphanumeric": "^1.0.0", - "is-decimal": "^1.0.0", - "is-whitespace-character": "^1.0.0", - "longest-streak": "^2.0.1", - "markdown-escapes": "^1.0.0", - "markdown-table": "^1.1.0", - "mdast-util-compact": "^1.0.0", - "parse-entities": "^1.0.2", - "repeat-string": "^1.5.4", - "state-toggle": "^1.0.0", - "stringify-entities": "^1.0.1", - "unherit": "^1.0.4", - "xtend": "^4.0.1" + "ccount": "1.0.2", + "is-alphanumeric": "1.0.0", + "is-decimal": "1.0.1", + "is-whitespace-character": "1.0.1", + "longest-streak": "2.0.2", + "markdown-escapes": "1.0.1", + "markdown-table": "1.1.1", + "mdast-util-compact": "1.0.1", + "parse-entities": "1.1.1", + "repeat-string": "1.6.1", + "state-toggle": "1.0.0", + "stringify-entities": "1.3.1", + "unherit": "1.1.0", + "xtend": "4.0.1" } }, "remove-trailing-separator": { @@ -3444,7 +3444,7 @@ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { - "is-finite": "^1.0.0" + "is-finite": "1.0.2" } }, "replace-ext": { @@ -3477,8 +3477,8 @@ "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", "dev": true, "requires": { - "caller-path": "^0.1.0", - "resolve-from": "^1.0.0" + "caller-path": "0.1.0", + "resolve-from": "1.0.1" } }, "resolve": { @@ -3487,7 +3487,7 @@ "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", "dev": true, "requires": { - "path-parse": "^1.0.5" + "path-parse": "1.0.5" } }, "resolve-from": { @@ -3502,8 +3502,8 @@ "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", "dev": true, "requires": { - "exit-hook": "^1.0.0", - "onetime": "^1.0.0" + "exit-hook": "1.1.1", + "onetime": "1.1.0" } }, "rimraf": { @@ -3512,7 +3512,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "7.1.2" } }, "run-async": { @@ -3521,7 +3521,7 @@ "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", "dev": true, "requires": { - "is-promise": "^2.1.0" + "is-promise": "2.1.0" } }, "run-parallel": { @@ -3542,7 +3542,7 @@ "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", "dev": true, "requires": { - "rx-lite": "*" + "rx-lite": "4.0.8" } }, "rxjs": { @@ -3574,16 +3574,16 @@ "integrity": "sha512-jykJZVDYWFZ7Hej9bYwynBa+A8yQFksm4zZoli4O+KkqMuQTdlBzkJvtFRER7xufSnB6+XnBS423tjI3Gtrg7Q==", "dev": true, "requires": { - "eslint": "~4.14.0", - "eslint-config-semistandard": "^12.0.0", + "eslint": "4.14.0", + "eslint-config-semistandard": "12.0.0", "eslint-config-standard": "11.0.0-beta.0", - "eslint-config-standard-jsx": "~4.0.2", - "eslint-plugin-import": "~2.8.0", - "eslint-plugin-node": "~5.2.1", - "eslint-plugin-promise": "~3.6.0", - "eslint-plugin-react": "~7.5.1", - "eslint-plugin-standard": "~3.0.1", - "standard-engine": "~7.2.0" + "eslint-config-standard-jsx": "4.0.2", + "eslint-plugin-import": "2.8.0", + "eslint-plugin-node": "5.2.1", + "eslint-plugin-promise": "3.6.0", + "eslint-plugin-react": "7.5.1", + "eslint-plugin-standard": "3.0.1", + "standard-engine": "7.2.0" } }, "semver": { @@ -3610,7 +3610,7 @@ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { - "shebang-regex": "^1.0.0" + "shebang-regex": "1.0.0" } }, "shebang-regex": { @@ -3649,7 +3649,7 @@ "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", "dev": true, "requires": { - "spdx-license-ids": "^1.0.2" + "spdx-license-ids": "1.2.2" } }, "spdx-expression-parse": { @@ -3688,10 +3688,10 @@ "integrity": "sha512-4MTVXRZQjEWeD7tNt8lK1Yh7VLXbmZ/hj34uF9tpSdtYNNPosms2TLCnw/7MUl/rW1Uhx80s7CL8LtBdUtgrtw==", "dev": true, "requires": { - "deglob": "^2.1.0", - "get-stdin": "^5.0.1", - "minimist": "^1.1.0", - "pkg-conf": "^2.0.0" + "deglob": "2.1.0", + "get-stdin": "5.0.1", + "minimist": "1.2.0", + "pkg-conf": "2.1.0" }, "dependencies": { "minimist": { @@ -3714,7 +3714,7 @@ "integrity": "sha1-WdbqOT2HwsDdrBCqDVYbxrpvDhA=", "dev": true, "requires": { - "any-observable": "^0.2.0" + "any-observable": "0.2.0" } }, "string-width": { @@ -3723,9 +3723,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } }, "string_decoder": { @@ -3734,7 +3734,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.1" } }, "stringify-entities": { @@ -3743,10 +3743,10 @@ "integrity": "sha1-sVDsLXKsTBtfMktR+2soyc3/BYw=", "dev": true, "requires": { - "character-entities-html4": "^1.0.0", - "character-entities-legacy": "^1.0.0", - "is-alphanumerical": "^1.0.0", - "is-hexadecimal": "^1.0.0" + "character-entities-html4": "1.1.1", + "character-entities-legacy": "1.1.1", + "is-alphanumerical": "1.0.1", + "is-hexadecimal": "1.0.1" } }, "stringify-object": { @@ -3755,9 +3755,9 @@ "integrity": "sha512-O696NF21oLiDy8PhpWu8AEqoZHw++QW6mUv0UvKZe8gWSdSvMXkiLufK7OmnP27Dro4GU5kb9U7JIO0mBuCRQg==", "dev": true, "requires": { - "get-own-enumerable-property-symbols": "^2.0.1", - "is-obj": "^1.0.1", - "is-regexp": "^1.0.0" + "get-own-enumerable-property-symbols": "2.0.1", + "is-obj": "1.0.1", + "is-regexp": "1.0.0" } }, "strip-ansi": { @@ -3766,7 +3766,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" }, "dependencies": { "ansi-regex": { @@ -3813,45 +3813,45 @@ "integrity": "sha512-56hPH5mTFnk8LzlEuTWq0epa34fHuS54UFYQidBOFt563RJBNi1nz1F2HK2MoT1X1waq47milvRsRahFCCJs/Q==", "dev": true, "requires": { - "autoprefixer": "^7.1.2", - "balanced-match": "^1.0.0", - "chalk": "^2.0.1", - "cosmiconfig": "^3.1.0", - "debug": "^3.0.0", - "execall": "^1.0.0", - "file-entry-cache": "^2.0.0", - "get-stdin": "^5.0.1", - "globby": "^7.0.0", - "globjoin": "^0.1.4", - "html-tags": "^2.0.0", - "ignore": "^3.3.3", - "imurmurhash": "^0.1.4", - "known-css-properties": "^0.5.0", - "lodash": "^4.17.4", - "log-symbols": "^2.0.0", - "mathml-tag-names": "^2.0.1", - "meow": "^4.0.0", - "micromatch": "^2.3.11", - "normalize-selector": "^0.2.0", - "pify": "^3.0.0", - "postcss": "^6.0.6", - "postcss-html": "^0.12.0", - "postcss-less": "^1.1.0", - "postcss-media-query-parser": "^0.2.3", - "postcss-reporter": "^5.0.0", - "postcss-resolve-nested-selector": "^0.1.1", - "postcss-safe-parser": "^3.0.1", - "postcss-sass": "^0.2.0", - "postcss-scss": "^1.0.2", - "postcss-selector-parser": "^3.1.0", - "postcss-value-parser": "^3.3.0", - "resolve-from": "^4.0.0", - "specificity": "^0.3.1", - "string-width": "^2.1.0", - "style-search": "^0.1.0", - "sugarss": "^1.0.0", - "svg-tags": "^1.0.0", - "table": "^4.0.1" + "autoprefixer": "7.2.6", + "balanced-match": "1.0.0", + "chalk": "2.3.0", + "cosmiconfig": "3.1.0", + "debug": "3.1.0", + "execall": "1.0.0", + "file-entry-cache": "2.0.0", + "get-stdin": "5.0.1", + "globby": "7.1.1", + "globjoin": "0.1.4", + "html-tags": "2.0.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "known-css-properties": "0.5.0", + "lodash": "4.17.5", + "log-symbols": "2.2.0", + "mathml-tag-names": "2.0.1", + "meow": "4.0.0", + "micromatch": "2.3.11", + "normalize-selector": "0.2.0", + "pify": "3.0.0", + "postcss": "6.0.17", + "postcss-html": "0.12.0", + "postcss-less": "1.1.3", + "postcss-media-query-parser": "0.2.3", + "postcss-reporter": "5.0.0", + "postcss-resolve-nested-selector": "0.1.1", + "postcss-safe-parser": "3.0.1", + "postcss-sass": "0.2.0", + "postcss-scss": "1.0.3", + "postcss-selector-parser": "3.1.1", + "postcss-value-parser": "3.3.0", + "resolve-from": "4.0.0", + "specificity": "0.3.2", + "string-width": "2.1.1", + "style-search": "0.1.0", + "sugarss": "1.0.1", + "svg-tags": "1.0.0", + "table": "4.0.2" }, "dependencies": { "cosmiconfig": { @@ -3860,10 +3860,10 @@ "integrity": "sha512-zedsBhLSbPBms+kE7AH4vHg6JsKDz6epSv2/+5XHs8ILHlgDciSJfSWf8sX9aQ52Jb7KI7VswUTsLpR/G0cr2Q==", "dev": true, "requires": { - "is-directory": "^0.3.1", - "js-yaml": "^3.9.0", - "parse-json": "^3.0.0", - "require-from-string": "^2.0.1" + "is-directory": "0.3.1", + "js-yaml": "3.10.0", + "parse-json": "3.0.0", + "require-from-string": "2.0.1" } }, "globby": { @@ -3872,12 +3872,12 @@ "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", "dev": true, "requires": { - "array-union": "^1.0.1", - "dir-glob": "^2.0.0", - "glob": "^7.1.2", - "ignore": "^3.3.5", - "pify": "^3.0.0", - "slash": "^1.0.0" + "array-union": "1.0.2", + "dir-glob": "2.0.0", + "glob": "7.1.2", + "ignore": "3.3.7", + "pify": "3.0.0", + "slash": "1.0.0" } }, "is-fullwidth-code-point": { @@ -3892,7 +3892,7 @@ "integrity": "sha1-+m9HsY4jgm6tMvJj50TQ4ehH+xM=", "dev": true, "requires": { - "error-ex": "^1.3.1" + "error-ex": "1.3.1" } }, "resolve-from": { @@ -3907,8 +3907,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" } }, "strip-ansi": { @@ -3917,7 +3917,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "3.0.0" } } } @@ -3934,9 +3934,9 @@ "integrity": "sha512-XwJO7rIAt/hnBJjOsDgEwNSeqw+5jE22da4pVKaePbojM9bGwhOoAWV7Q2BL8caOg81IlTesmYCEf8s0+2Cc5g==", "dev": true, "requires": { - "lodash": "^4.17.4", - "postcss": "^6.0.14", - "postcss-sorting": "^3.1.0" + "lodash": "4.17.5", + "postcss": "6.0.17", + "postcss-sorting": "3.1.0" } }, "stylelint-scss": { @@ -3945,11 +3945,11 @@ "integrity": "sha512-+joZpza5nQxAyGwzRMancFEl0EH9+1Vy88YzBghRMS0wHulzDPE9fEkBi6ZOlz+I3tYIBI4x9NbqO5/LkbeE3Q==", "dev": true, "requires": { - "lodash": "^4.17.4", - "postcss-media-query-parser": "^0.2.3", - "postcss-resolve-nested-selector": "^0.1.1", - "postcss-selector-parser": "^3.1.1", - "postcss-value-parser": "^3.3.0" + "lodash": "4.17.5", + "postcss-media-query-parser": "0.2.3", + "postcss-resolve-nested-selector": "0.1.1", + "postcss-selector-parser": "3.1.1", + "postcss-value-parser": "3.3.0" } }, "sugarss": { @@ -3958,7 +3958,7 @@ "integrity": "sha512-3qgLZytikQQEVn1/FrhY7B68gPUUGY3R1Q1vTiD5xT+Ti1DP/8iZuwFet9ONs5+bmL8pZoDQ6JrQHVgrNlK6mA==", "dev": true, "requires": { - "postcss": "^6.0.14" + "postcss": "6.0.17" } }, "supports-color": { @@ -3967,7 +3967,7 @@ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true, "requires": { - "has-flag": "^2.0.0" + "has-flag": "2.0.0" } }, "svg-tags": { @@ -3988,12 +3988,12 @@ "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", "dev": true, "requires": { - "ajv": "^5.2.3", - "ajv-keywords": "^2.1.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", + "ajv": "5.5.2", + "ajv-keywords": "2.1.1", + "chalk": "2.3.0", + "lodash": "4.17.5", "slice-ansi": "1.0.0", - "string-width": "^2.1.1" + "string-width": "2.1.1" }, "dependencies": { "is-fullwidth-code-point": { @@ -4008,7 +4008,7 @@ "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0" + "is-fullwidth-code-point": "2.0.0" } }, "string-width": { @@ -4017,8 +4017,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" } }, "strip-ansi": { @@ -4027,7 +4027,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "3.0.0" } } } @@ -4050,7 +4050,7 @@ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { - "os-tmpdir": "~1.0.2" + "os-tmpdir": "1.0.2" } }, "trim": { @@ -4083,7 +4083,7 @@ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "prelude-ls": "~1.1.2" + "prelude-ls": "1.1.2" } }, "typedarray": { @@ -4104,8 +4104,8 @@ "integrity": "sha1-a5qu379z3xdWrZ4xbdmBiFhAzX0=", "dev": true, "requires": { - "inherits": "^2.0.1", - "xtend": "^4.0.1" + "inherits": "2.0.3", + "xtend": "4.0.1" } }, "unified": { @@ -4114,13 +4114,13 @@ "integrity": "sha512-pW2f82bCIo2ifuIGYcV12fL96kMMYgw7JKVEgh7ODlrM9rj6vXSY3BV+H6lCcv1ksxynFf582hwWLnA1qRFy4w==", "dev": true, "requires": { - "bail": "^1.0.0", - "extend": "^3.0.0", - "is-plain-obj": "^1.1.0", - "trough": "^1.0.0", - "vfile": "^2.0.0", - "x-is-function": "^1.0.4", - "x-is-string": "^0.1.0" + "bail": "1.0.2", + "extend": "3.0.1", + "is-plain-obj": "1.1.0", + "trough": "1.0.1", + "vfile": "2.3.0", + "x-is-function": "1.0.4", + "x-is-string": "0.1.0" } }, "uniq": { @@ -4135,7 +4135,7 @@ "integrity": "sha1-TlUSq/734GFnga7Pex7XUcAK+Qg=", "dev": true, "requires": { - "unist-util-is": "^2.0.0" + "unist-util-is": "2.1.1" } }, "unist-util-is": { @@ -4150,7 +4150,7 @@ "integrity": "sha1-ZtfmpEnm9nIguXarPLi166w55R0=", "dev": true, "requires": { - "array-iterate": "^1.0.0" + "array-iterate": "1.1.1" } }, "unist-util-remove-position": { @@ -4159,7 +4159,7 @@ "integrity": "sha1-WoXBVV/BugwQG4ZwfRXlD6TIcbs=", "dev": true, "requires": { - "unist-util-visit": "^1.1.0" + "unist-util-visit": "1.3.0" } }, "unist-util-stringify-position": { @@ -4174,7 +4174,7 @@ "integrity": "sha512-9ntYcxPFtl44gnwXrQKZ5bMqXMY0ZHzUpqMFiU4zcc8mmf/jzYm8GhYgezuUlX4cJIM1zIDYaO6fG/fI+L6iiQ==", "dev": true, "requires": { - "unist-util-is": "^2.1.1" + "unist-util-is": "2.1.1" } }, "util-deprecate": { @@ -4189,8 +4189,8 @@ "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", "dev": true, "requires": { - "spdx-correct": "~1.0.0", - "spdx-expression-parse": "~1.0.0" + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" } }, "vfile": { @@ -4199,10 +4199,10 @@ "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", "dev": true, "requires": { - "is-buffer": "^1.1.4", + "is-buffer": "1.1.6", "replace-ext": "1.0.0", - "unist-util-stringify-position": "^1.0.0", - "vfile-message": "^1.0.0" + "unist-util-stringify-position": "1.1.1", + "vfile-message": "1.0.0" } }, "vfile-location": { @@ -4217,7 +4217,7 @@ "integrity": "sha512-HPREhzTOB/sNDc9/Mxf8w0FmHnThg5CRSJdR9VRFkD2riqYWs+fuXlj5z8mIpv2LrD7uU41+oPWFOL4Mjlf+dw==", "dev": true, "requires": { - "unist-util-stringify-position": "^1.1.1" + "unist-util-stringify-position": "1.1.1" } }, "whatwg-fetch": { @@ -4232,7 +4232,7 @@ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "isexe": "^2.0.0" + "isexe": "2.0.0" } }, "which-module": { @@ -4253,8 +4253,8 @@ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" + "string-width": "1.0.2", + "strip-ansi": "3.0.1" } }, "wrappy": { @@ -4269,7 +4269,7 @@ "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", "dev": true, "requires": { - "mkdirp": "^0.5.1" + "mkdirp": "0.5.1" } }, "x-is-function": { @@ -4314,18 +4314,18 @@ "integrity": "sha512-B0vRAp1hRX4jgIOWFtjfNjd9OA9RWYZ6tqGA9/I/IrTMsxmKvtWy+ersM+jzpQqbC3YfLzeABPdeTgcJ9eu1qQ==", "dev": true, "requires": { - "cliui": "^4.0.0", - "decamelize": "^2.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^10.1.0" + "cliui": "4.1.0", + "decamelize": "2.0.0", + "find-up": "3.0.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "4.0.0", + "yargs-parser": "10.1.0" }, "dependencies": { "decamelize": { @@ -4343,7 +4343,7 @@ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { - "locate-path": "^3.0.0" + "locate-path": "3.0.0" } }, "is-fullwidth-code-point": { @@ -4358,8 +4358,8 @@ "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "3.0.0", + "path-exists": "3.0.0" } }, "p-limit": { @@ -4368,7 +4368,7 @@ "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", "dev": true, "requires": { - "p-try": "^2.0.0" + "p-try": "2.0.0" } }, "p-locate": { @@ -4377,7 +4377,7 @@ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { - "p-limit": "^2.0.0" + "p-limit": "2.0.0" } }, "p-try": { @@ -4398,8 +4398,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" } }, "strip-ansi": { @@ -4408,7 +4408,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "3.0.0" } } } @@ -4419,7 +4419,7 @@ "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", "dev": true, "requires": { - "camelcase": "^4.1.0" + "camelcase": "4.1.0" } } } diff --git a/uk.co.compucorp.civicrm.hrcore/package-lock.json b/uk.co.compucorp.civicrm.hrcore/package-lock.json index 19e54fe804e..7889e910649 100644 --- a/uk.co.compucorp.civicrm.hrcore/package-lock.json +++ b/uk.co.compucorp.civicrm.hrcore/package-lock.json @@ -39,7 +39,7 @@ "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", "dev": true, "requires": { - "mime-types": "~2.1.18", + "mime-types": "2.1.18", "negotiator": "0.6.1" } }, @@ -55,7 +55,7 @@ "integrity": "sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ=", "dev": true, "requires": { - "acorn": "^4.0.3" + "acorn": "4.0.13" }, "dependencies": { "acorn": { @@ -85,7 +85,7 @@ "integrity": "sha512-c+R/U5X+2zz2+UCrCFv6odQzJdoqI+YecuhnAJLa1zYaMc13zPfwMwZrr91Pd1DYNo/yPRbiM4WVf9whgwFsIg==", "dev": true, "requires": { - "es6-promisify": "^5.0.0" + "es6-promisify": "5.0.0" } }, "ajv": { @@ -94,10 +94,10 @@ "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" + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" } }, "ajv-keywords": { @@ -112,9 +112,9 @@ "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" }, "dependencies": { "kind-of": { @@ -123,7 +123,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -141,11 +141,11 @@ "dev": true, "optional": true, "requires": { - "bitsyntax": "~0.0.4", - "bluebird": "^3.4.6", + "bitsyntax": "0.0.4", + "bluebird": "3.5.1", "buffer-more-ints": "0.0.2", - "readable-stream": "1.x >=1.1.9", - "safe-buffer": "^5.0.1" + "readable-stream": "1.1.14", + "safe-buffer": "5.1.1" }, "dependencies": { "isarray": { @@ -162,10 +162,10 @@ "dev": true, "optional": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -183,7 +183,7 @@ "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "dev": true, "requires": { - "ansi-wrap": "^0.1.0" + "ansi-wrap": "0.1.0" } }, "ansi-cyan": { @@ -243,8 +243,8 @@ "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", "dev": true, "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" + "micromatch": "3.1.5", + "normalize-path": "2.1.1" } }, "aproba": { @@ -265,8 +265,8 @@ "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", "dev": true, "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" + "delegates": "1.0.0", + "readable-stream": "2.3.3" } }, "arr-diff": { @@ -317,8 +317,8 @@ "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", "dev": true, "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.7.0" + "define-properties": "1.1.2", + "es-abstract": "1.11.0" } }, "array-slice": { @@ -333,7 +333,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "^1.0.1" + "array-uniq": "1.0.3" } }, "array-uniq": { @@ -378,9 +378,9 @@ "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", "dev": true, "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "bn.js": "4.11.8", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" } }, "assert": { @@ -417,7 +417,7 @@ "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", "dev": true, "requires": { - "lodash": "^4.14.0" + "lodash": "4.17.10" } }, "async-chain-proxy": { @@ -426,7 +426,7 @@ "integrity": "sha512-JYUzBrCWkKdBQ02H2f1N8xR4JXeWGcw2V8i2AzJjeXGTz40rqqbKkDmQieL8iHNp70W1M44WXqFsvk4Cx49H1Q==", "dev": true, "requires": { - "babel-polyfill": "^6.23.0" + "babel-polyfill": "6.26.0" } }, "async-each": { @@ -488,7 +488,7 @@ "dev": true, "optional": true, "requires": { - "debug": "^2.2.0" + "debug": "2.6.9" } } } @@ -499,9 +499,9 @@ "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", "dev": true, "requires": { - "babel-runtime": "^6.26.0", - "core-js": "^2.5.0", - "regenerator-runtime": "^0.10.5" + "babel-runtime": "6.26.0", + "core-js": "2.5.5", + "regenerator-runtime": "0.10.5" }, "dependencies": { "core-js": { @@ -518,8 +518,8 @@ "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" + "core-js": "2.5.5", + "regenerator-runtime": "0.11.1" }, "dependencies": { "core-js": { @@ -548,7 +548,7 @@ "integrity": "sha512-sENfpossNAbVKZjTzBU6bkbR1vIb7t6brjqH9ZMEIYh/RyCIGFM3BSgERzh+tdwpAVXHSbIV1gQRrtzBYzUrjw==", "dev": true, "requires": { - "react": "^15.6.2" + "react": "15.6.2" } }, "backstopjs": { @@ -557,35 +557,35 @@ "integrity": "sha512-VLpW9z8T3AbKsFIh3RcvV4Fuo0zFWTRzOpiincO9zheqlI6tXskZeHwotTc3dsBYbI1YSxMPyn8Ytam7eN07Dg==", "dev": true, "requires": { - "backstop-twentytwenty": "^1.0.4", - "casperjs": "^1.1.0-beta5", - "chalk": "^1.1.3", + "backstop-twentytwenty": "1.0.4", + "casperjs": "1.1.4", + "chalk": "1.1.3", "chromy": "0.5.11", - "fs-extra": "^0.30.0", - "jump.js": "^1.0.2", - "junitwriter": "~0.3.1", - "lodash": "^4.17.4", - "minimist": "^1.2.0", - "node-resemble-js": "^0.2.0", + "fs-extra": "0.30.0", + "jump.js": "1.0.2", + "junitwriter": "0.3.1", + "lodash": "4.17.10", + "minimist": "1.2.0", + "node-resemble-js": "0.2.0", "object-hash": "1.1.5", "open": "0.0.5", - "os": "^0.1.1", - "p-map": "^1.1.1", - "path": "^0.12.7", - "phantomjs-prebuilt": "^2.1.7", - "puppeteer": "^1.2.0-next.1523485686787", - "react": "^15.6.1", - "react-dom": "^15.6.1", - "react-modal": "^3.0.3", - "react-redux": "^5.0.6", - "react-sticky": "^6.0.1", - "react-toggle-button": "^2.1.0", - "redux": "^3.7.2", - "sinon": "^1.17.7", - "styled-components": "^2.1.2", - "temp": "^0.8.3", - "webpack": "^3.5.6", - "webpack-dev-server": "^2.7.1" + "os": "0.1.1", + "p-map": "1.2.0", + "path": "0.12.7", + "phantomjs-prebuilt": "2.1.16", + "puppeteer": "1.3.0", + "react": "15.6.2", + "react-dom": "15.6.2", + "react-modal": "3.4.4", + "react-redux": "5.0.7", + "react-sticky": "6.0.2", + "react-toggle-button": "2.2.0", + "redux": "3.7.2", + "sinon": "1.17.7", + "styled-components": "2.4.0", + "temp": "0.8.3", + "webpack": "3.11.0", + "webpack-dev-server": "2.11.2" } }, "balanced-match": { @@ -600,13 +600,13 @@ "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" + "cache-base": "1.0.1", + "class-utils": "0.3.6", + "component-emitter": "1.2.1", + "define-property": "1.0.0", + "isobject": "3.0.1", + "mixin-deep": "1.3.0", + "pascalcase": "0.1.1" } }, "base64-arraybuffer": { @@ -640,7 +640,7 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "^0.14.3" + "tweetnacl": "0.14.5" } }, "beeper": { @@ -699,7 +699,7 @@ "dev": true, "optional": true, "requires": { - "readable-stream": "~2.0.5" + "readable-stream": "2.0.6" }, "dependencies": { "readable-stream": { @@ -709,12 +709,12 @@ "dev": true, "optional": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" } }, "string_decoder": { @@ -738,7 +738,7 @@ "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true, "requires": { - "inherits": "~2.0.0" + "inherits": "2.0.3" } }, "bluebird": { @@ -766,15 +766,15 @@ "dev": true, "requires": { "bytes": "3.0.0", - "content-type": "~1.0.4", + "content-type": "1.0.4", "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", + "depd": "1.1.2", + "http-errors": "1.6.3", "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", + "on-finished": "2.3.0", "qs": "6.5.1", "raw-body": "2.3.2", - "type-is": "~1.6.15" + "type-is": "1.6.16" }, "dependencies": { "iconv-lite": { @@ -791,12 +791,12 @@ "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", "dev": true, "requires": { - "array-flatten": "^2.1.0", - "deep-equal": "^1.0.1", - "dns-equal": "^1.0.0", - "dns-txt": "^2.0.2", - "multicast-dns": "^6.0.1", - "multicast-dns-service-types": "^1.1.0" + "array-flatten": "2.1.1", + "deep-equal": "1.0.1", + "dns-equal": "1.0.0", + "dns-txt": "2.0.2", + "multicast-dns": "6.2.3", + "multicast-dns-service-types": "1.1.0" } }, "boom": { @@ -805,7 +805,7 @@ "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "dev": true, "requires": { - "hoek": "4.x.x" + "hoek": "4.2.1" } }, "brace-expansion": { @@ -814,7 +814,7 @@ "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -824,17 +824,17 @@ "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" + "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.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.1" } }, "brorand": { @@ -849,12 +849,12 @@ "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "buffer-xor": "1.0.3", + "cipher-base": "1.0.4", + "create-hash": "1.2.0", + "evp_bytestokey": "1.0.3", + "inherits": "2.0.3", + "safe-buffer": "5.1.1" } }, "browserify-cipher": { @@ -863,9 +863,9 @@ "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", "dev": true, "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" + "browserify-aes": "1.2.0", + "browserify-des": "1.0.1", + "evp_bytestokey": "1.0.3" } }, "browserify-des": { @@ -874,9 +874,9 @@ "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", "dev": true, "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1" + "cipher-base": "1.0.4", + "des.js": "1.0.0", + "inherits": "2.0.3" } }, "browserify-rsa": { @@ -885,8 +885,8 @@ "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" + "bn.js": "4.11.8", + "randombytes": "2.0.6" } }, "browserify-sign": { @@ -895,13 +895,13 @@ "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", "dev": true, "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" + "bn.js": "4.11.8", + "browserify-rsa": "4.0.1", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "elliptic": "6.4.0", + "inherits": "2.0.3", + "parse-asn1": "5.1.1" } }, "browserify-zlib": { @@ -910,7 +910,7 @@ "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", "dev": true, "requires": { - "pako": "~1.0.5" + "pako": "1.0.6" } }, "buffer": { @@ -919,8 +919,8 @@ "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==", "dev": true, "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" + "base64-js": "1.3.0", + "ieee754": "1.1.11" } }, "buffer-equal": { @@ -987,15 +987,15 @@ "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" + "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" } }, "callsite": { @@ -1016,9 +1016,9 @@ "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", "dev": true, "requires": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" + "camelcase": "4.1.0", + "map-obj": "2.0.0", + "quick-lru": "1.1.0" } }, "caseless": { @@ -1039,8 +1039,8 @@ "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", "dev": true, "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" + "align-text": "0.1.4", + "lazy-cache": "1.0.4" }, "dependencies": { "lazy-cache": { @@ -1057,11 +1057,11 @@ "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" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "child-process-promise": { @@ -1070,9 +1070,9 @@ "integrity": "sha1-RzChHvYQ+tRQuPIjx50x172tgHQ=", "dev": true, "requires": { - "cross-spawn": "^4.0.2", - "node-version": "^1.0.0", - "promise-polyfill": "^6.0.1" + "cross-spawn": "4.0.2", + "node-version": "1.1.3", + "promise-polyfill": "6.1.0" } }, "chokidar": { @@ -1081,18 +1081,18 @@ "integrity": "sha512-zW8iXYZtXMx4kux/nuZVXjkLP+CyIK5Al5FHnj1OgTKGZfp4Oy6/ymtMSKFv3GD8DviEmUPmJg9eFdJ/JzudMg==", "dev": true, "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.0", - "braces": "^2.3.0", - "fsevents": "^1.1.2", - "glob-parent": "^3.1.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^2.1.1", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0", - "upath": "^1.0.0" + "anymatch": "2.0.0", + "async-each": "1.0.1", + "braces": "2.3.0", + "fsevents": "1.2.2", + "glob-parent": "3.1.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "4.0.0", + "normalize-path": "2.1.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.1.0", + "upath": "1.0.4" }, "dependencies": { "is-glob": { @@ -1101,7 +1101,7 @@ "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", "dev": true, "requires": { - "is-extglob": "^2.1.1" + "is-extglob": "2.1.1" } } } @@ -1112,14 +1112,14 @@ "integrity": "sha512-E+kTHlGgtitPPu8Rci0E4XBasirKtTn6DjqFn8tTLp/7xCUzqb6lig9Il+HLkcudzKvT/aLxJbzbyNCe03w1AA==", "dev": true, "requires": { - "@types/core-js": "^0.9.41", - "@types/mkdirp": "^0.3.29", - "@types/node": "^9.3.0", - "@types/rimraf": "^0.0.28", - "is-wsl": "^1.1.0", - "lighthouse-logger": "^1.0.0", + "@types/core-js": "0.9.46", + "@types/mkdirp": "0.3.29", + "@types/node": "9.6.7", + "@types/rimraf": "0.0.28", + "is-wsl": "1.1.0", + "lighthouse-logger": "1.0.1", "mkdirp": "0.5.1", - "rimraf": "^2.6.1" + "rimraf": "2.6.2" } }, "chrome-remote-interface": { @@ -1128,8 +1128,8 @@ "integrity": "sha512-JACehSDwNwanDgWIO1Nvji9Td4KyCUUbQze10dNb8DAG72LmqH3uz7vdgujFKjmax8Q6yu1Xwapb8GODZykTDQ==", "dev": true, "requires": { - "commander": "2.11.x", - "ws": "3.3.x" + "commander": "2.11.0", + "ws": "3.3.3" } }, "chromy": { @@ -1138,12 +1138,12 @@ "integrity": "sha512-SBz5/xPYgeQiwFGMixPNQcbgnzsRHGCJnZKNJ5S0SmauSUY77/mqA8NjotQa12SZ3tZy0NX2gyGP41BAUWI6Rg==", "dev": true, "requires": { - "async-chain-proxy": "^0.1.5", - "babel-runtime": "^6.26.0", - "chrome-launcher": "^0.10.2", - "chrome-remote-interface": "^0.25.5", - "jimp": "^0.2.28", - "uuid": "^3.2.1" + "async-chain-proxy": "0.1.5", + "babel-runtime": "6.26.0", + "chrome-launcher": "0.10.2", + "chrome-remote-interface": "0.25.5", + "jimp": "0.2.28", + "uuid": "3.2.1" } }, "cipher-base": { @@ -1152,8 +1152,8 @@ "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", "dev": true, "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "2.0.3", + "safe-buffer": "5.1.1" } }, "circular-json": { @@ -1168,15 +1168,14 @@ "integrity": "sha1-prn+pVahci1Km3ChHGSHVXGmNKg=", "dev": true, "requires": { - "child-process-promise": "^2.1.3" + "child-process-promise": "2.2.1" } }, "civicrm-scssroot": { "version": "git://github.com/totten/civicrm-scssroot.git#3fc126e91ea503420daedc82425e9b85085707f6", - "from": "git://github.com/totten/civicrm-scssroot.git#v0.1.1", "dev": true, "requires": { - "civicrm-cv": "^0.1.2" + "civicrm-cv": "0.1.2" } }, "class-utils": { @@ -1185,10 +1184,10 @@ "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" + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "static-extend": "0.1.2" }, "dependencies": { "define-property": { @@ -1197,7 +1196,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "is-accessor-descriptor": { @@ -1206,7 +1205,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -1215,7 +1214,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -1226,7 +1225,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -1235,7 +1234,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -1246,9 +1245,9 @@ "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" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" } }, "kind-of": { @@ -1265,8 +1264,8 @@ "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", + "center-align": "0.1.3", + "right-align": "0.1.3", "wordwrap": "0.0.2" } }, @@ -1294,9 +1293,9 @@ "integrity": "sha1-pikNQT8hemEjL5XkWP84QYz7ARc=", "dev": true, "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^1.0.6", - "through2": "^2.0.1" + "inherits": "2.0.3", + "process-nextick-args": "1.0.7", + "through2": "2.0.3" } }, "co": { @@ -1317,8 +1316,8 @@ "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", "dev": true, "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" + "map-visit": "1.0.0", + "object-visit": "1.0.1" } }, "color-support": { @@ -1339,7 +1338,7 @@ "integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=", "dev": true, "requires": { - "lodash": "^4.5.0" + "lodash": "4.17.10" } }, "combined-stream": { @@ -1348,7 +1347,7 @@ "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, "requires": { - "delayed-stream": "~1.0.0" + "delayed-stream": "1.0.0" } }, "commander": { @@ -1381,7 +1380,7 @@ "integrity": "sha1-DRAgq5JLL9tNYnmHXH1tq6a6p6k=", "dev": true, "requires": { - "mime-db": ">= 1.33.0 < 2" + "mime-db": "1.33.0" } }, "compression": { @@ -1390,13 +1389,13 @@ "integrity": "sha1-qv+81qr4VLROuygDU9WtFlH1mmk=", "dev": true, "requires": { - "accepts": "~1.3.4", + "accepts": "1.3.5", "bytes": "3.0.0", - "compressible": "~2.0.13", + "compressible": "2.0.13", "debug": "2.6.9", - "on-headers": "~1.0.1", + "on-headers": "1.0.1", "safe-buffer": "5.1.1", - "vary": "~1.1.2" + "vary": "1.1.2" } }, "concat-map": { @@ -1411,9 +1410,9 @@ "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", "dev": true, "requires": { - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" } }, "connect": { @@ -1424,7 +1423,7 @@ "requires": { "debug": "2.6.9", "finalhandler": "1.1.0", - "parseurl": "~1.3.2", + "parseurl": "1.3.2", "utils-merge": "1.0.1" }, "dependencies": { @@ -1435,12 +1434,12 @@ "dev": true, "requires": { "debug": "2.6.9", - "encodeurl": "~1.0.1", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.3.1", - "unpipe": "~1.0.0" + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "statuses": "1.3.1", + "unpipe": "1.0.0" } }, "statuses": { @@ -1463,7 +1462,7 @@ "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", "dev": true, "requires": { - "date-now": "^0.1.4" + "date-now": "0.1.4" } }, "console-control-strings": { @@ -1526,8 +1525,8 @@ "integrity": "sha512-iZvCCg8XqHQZ1ioNBTzXS/cQSkqkqcPs8xSX4upNB+DAk9Ht3uzQf2J32uAHNCne8LDmKr29AgZrEs4oIrwLuQ==", "dev": true, "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.0.0" + "bn.js": "4.11.8", + "elliptic": "6.4.0" } }, "create-hash": { @@ -1536,11 +1535,11 @@ "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" + "cipher-base": "1.0.4", + "inherits": "2.0.3", + "md5.js": "1.3.4", + "ripemd160": "2.0.2", + "sha.js": "2.4.11" } }, "create-hmac": { @@ -1549,12 +1548,12 @@ "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "cipher-base": "1.0.4", + "create-hash": "1.2.0", + "inherits": "2.0.3", + "ripemd160": "2.0.2", + "safe-buffer": "5.1.1", + "sha.js": "2.4.11" } }, "create-react-class": { @@ -1563,9 +1562,9 @@ "integrity": "sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg==", "dev": true, "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1" }, "dependencies": { "object-assign": { @@ -1582,8 +1581,8 @@ "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", "dev": true, "requires": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" + "lru-cache": "4.1.2", + "which": "1.3.0" } }, "cryptiles": { @@ -1592,7 +1591,7 @@ "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", "dev": true, "requires": { - "boom": "5.x.x" + "boom": "5.2.0" }, "dependencies": { "boom": { @@ -1601,7 +1600,7 @@ "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", "dev": true, "requires": { - "hoek": "4.x.x" + "hoek": "4.2.1" } } } @@ -1612,17 +1611,17 @@ "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", "dev": true, "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" + "browserify-cipher": "1.0.1", + "browserify-sign": "4.0.4", + "create-ecdh": "4.0.1", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "diffie-hellman": "5.0.3", + "inherits": "2.0.3", + "pbkdf2": "3.0.16", + "public-encrypt": "4.0.2", + "randombytes": "2.0.6", + "randomfill": "1.0.4" } }, "css-color-keywords": { @@ -1637,9 +1636,9 @@ "integrity": "sha512-akxvxNPNm+Qb7kGswgWhD8rLENM8857NVIn1lX0Dr9BQuju8vx6ypet7KvwvqBC01FUEne5V/jvt7FJXWJPtgw==", "dev": true, "requires": { - "css-color-keywords": "^1.0.0", - "fbjs": "^0.8.5", - "postcss-value-parser": "^3.3.0" + "css-color-keywords": "1.0.0", + "fbjs": "0.8.16", + "postcss-value-parser": "3.3.0" } }, "currently-unhandled": { @@ -1648,7 +1647,7 @@ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "array-find-index": "^1.0.1" + "array-find-index": "1.0.2" } }, "custom-event": { @@ -1663,7 +1662,7 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "^0.10.9" + "es5-ext": "0.10.42" } }, "dashdash": { @@ -1672,7 +1671,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "^1.0.0" + "assert-plus": "1.0.0" } }, "data-uri-to-buffer": { @@ -1700,8 +1699,8 @@ "integrity": "sha1-8ny+56ASu/uC6gUVYtOXf2CT27E=", "dev": true, "requires": { - "get-stdin": "*", - "meow": "*" + "get-stdin": "6.0.0", + "meow": "5.0.0" } }, "debug": { @@ -1725,8 +1724,8 @@ "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", "dev": true, "requires": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" + "decamelize": "1.2.0", + "map-obj": "1.0.1" }, "dependencies": { "map-obj": { @@ -1762,7 +1761,7 @@ "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", "dev": true, "requires": { - "clone": "^1.0.2" + "clone": "1.0.3" } }, "define-properties": { @@ -1771,8 +1770,8 @@ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", "dev": true, "requires": { - "foreach": "^2.0.5", - "object-keys": "^1.0.8" + "foreach": "2.0.5", + "object-keys": "1.0.11" }, "dependencies": { "object-keys": { @@ -1789,7 +1788,7 @@ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "is-descriptor": "^1.0.0" + "is-descriptor": "1.0.2" } }, "degenerator": { @@ -1799,9 +1798,9 @@ "dev": true, "optional": true, "requires": { - "ast-types": "0.x.x", - "escodegen": "1.x.x", - "esprima": "3.x.x" + "ast-types": "0.11.3", + "escodegen": "1.9.1", + "esprima": "3.1.3" } }, "del": { @@ -1810,12 +1809,12 @@ "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", "dev": true, "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" + "globby": "6.1.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.1", + "p-map": "1.2.0", + "pify": "3.0.0", + "rimraf": "2.6.2" } }, "delayed-stream": { @@ -1848,8 +1847,8 @@ "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", "dev": true, "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" } }, "destroy": { @@ -1870,7 +1869,7 @@ "integrity": "sha1-oIUEZefD68/5eda2U1rTRLgN18U=", "dev": true, "requires": { - "get-installed-path": "^2.0.3" + "get-installed-path": "2.1.1" } }, "detect-node": { @@ -1891,9 +1890,9 @@ "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" + "bn.js": "4.11.8", + "miller-rabin": "4.0.1", + "randombytes": "2.0.6" } }, "dns-equal": { @@ -1908,8 +1907,8 @@ "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", "dev": true, "requires": { - "ip": "^1.1.0", - "safe-buffer": "^5.0.1" + "ip": "1.1.5", + "safe-buffer": "5.1.1" } }, "dns-txt": { @@ -1918,7 +1917,7 @@ "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", "dev": true, "requires": { - "buffer-indexof": "^1.0.0" + "buffer-indexof": "1.1.1" } }, "dom-serialize": { @@ -1927,10 +1926,10 @@ "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", "dev": true, "requires": { - "custom-event": "~1.0.0", - "ent": "~2.2.0", - "extend": "^3.0.0", - "void-elements": "^2.0.0" + "custom-event": "1.0.1", + "ent": "2.2.0", + "extend": "3.0.1", + "void-elements": "2.0.1" } }, "dom-walk": { @@ -1958,7 +1957,7 @@ "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", "dev": true, "requires": { - "readable-stream": "~1.1.9" + "readable-stream": "1.1.14" }, "dependencies": { "isarray": { @@ -1973,10 +1972,10 @@ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -1994,7 +1993,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "~0.1.0" + "jsbn": "0.1.1" } }, "ee-first": { @@ -2009,13 +2008,13 @@ "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "dev": true, "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "bn.js": "4.11.8", + "brorand": "1.1.0", + "hash.js": "1.1.3", + "hmac-drbg": "1.0.1", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1", + "minimalistic-crypto-utils": "1.0.1" } }, "emojis-list": { @@ -2036,7 +2035,7 @@ "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", "dev": true, "requires": { - "iconv-lite": "~0.4.13" + "iconv-lite": "0.4.21" } }, "end-of-stream": { @@ -2045,7 +2044,7 @@ "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", "dev": true, "requires": { - "once": "~1.3.0" + "once": "1.3.3" }, "dependencies": { "once": { @@ -2054,7 +2053,7 @@ "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } } } @@ -2065,13 +2064,13 @@ "integrity": "sha512-D06ivJkYxyRrcEe0bTpNnBQNgP9d3xog+qZlLbui8EsMr/DouQpf5o9FzJnWYHEYE0YsFHllUv2R1dkgYZXHcA==", "dev": true, "requires": { - "accepts": "~1.3.4", + "accepts": "1.3.5", "base64id": "1.0.0", "cookie": "0.3.1", - "debug": "~3.1.0", - "engine.io-parser": "~2.1.0", - "uws": "~9.14.0", - "ws": "~3.3.1" + "debug": "3.1.0", + "engine.io-parser": "2.1.2", + "uws": "9.14.0", + "ws": "3.3.3" }, "dependencies": { "debug": { @@ -2093,14 +2092,14 @@ "requires": { "component-emitter": "1.2.1", "component-inherit": "0.0.3", - "debug": "~3.1.0", - "engine.io-parser": "~2.1.1", + "debug": "3.1.0", + "engine.io-parser": "2.1.2", "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", + "ws": "3.3.3", + "xmlhttprequest-ssl": "1.5.5", "yeast": "0.1.2" }, "dependencies": { @@ -2122,10 +2121,10 @@ "dev": true, "requires": { "after": "0.8.2", - "arraybuffer.slice": "~0.0.7", + "arraybuffer.slice": "0.0.7", "base64-arraybuffer": "0.1.5", "blob": "0.0.4", - "has-binary2": "~1.0.2" + "has-binary2": "1.0.2" } }, "enhanced-resolve": { @@ -2134,10 +2133,10 @@ "integrity": "sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", - "object-assign": "^4.0.1", - "tapable": "^0.2.7" + "graceful-fs": "4.1.11", + "memory-fs": "0.4.1", + "object-assign": "4.1.1", + "tapable": "0.2.8" }, "dependencies": { "object-assign": { @@ -2160,7 +2159,7 @@ "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", "dev": true, "requires": { - "prr": "~1.0.1" + "prr": "1.0.1" } }, "error-ex": { @@ -2169,7 +2168,7 @@ "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true, "requires": { - "is-arrayish": "^0.2.1" + "is-arrayish": "0.2.1" } }, "es-abstract": { @@ -2178,11 +2177,11 @@ "integrity": "sha512-ZnQrE/lXTTQ39ulXZ+J1DTFazV9qBy61x2bY071B+qGco8Z8q1QddsLdt/EF8Ai9hcWH72dWS0kFqXLxOxqslA==", "dev": true, "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" + "es-to-primitive": "1.1.1", + "function-bind": "1.1.1", + "has": "1.0.1", + "is-callable": "1.1.3", + "is-regex": "1.0.4" } }, "es-to-primitive": { @@ -2191,9 +2190,9 @@ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", "dev": true, "requires": { - "is-callable": "^1.1.1", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.1" + "is-callable": "1.1.3", + "is-date-object": "1.0.1", + "is-symbol": "1.0.1" } }, "es5-ext": { @@ -2202,9 +2201,9 @@ "integrity": "sha512-AJxO1rmPe1bDEfSR6TJ/FgMFYuTBhR5R57KW58iCkYACMyFbrkqVyzXSurYoScDGvgyMpk7uRF/lPUPPTmsRSA==", "dev": true, "requires": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.1", - "next-tick": "1" + "es6-iterator": "2.0.3", + "es6-symbol": "3.1.1", + "next-tick": "1.0.0" } }, "es6-iterator": { @@ -2213,9 +2212,9 @@ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "dev": true, "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" + "d": "1.0.0", + "es5-ext": "0.10.42", + "es6-symbol": "3.1.1" } }, "es6-map": { @@ -2224,12 +2223,12 @@ "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", "dev": true, "requires": { - "d": "1", - "es5-ext": "~0.10.14", - "es6-iterator": "~2.0.1", - "es6-set": "~0.1.5", - "es6-symbol": "~3.1.1", - "event-emitter": "~0.3.5" + "d": "1.0.0", + "es5-ext": "0.10.42", + "es6-iterator": "2.0.3", + "es6-set": "0.1.5", + "es6-symbol": "3.1.1", + "event-emitter": "0.3.5" } }, "es6-promise": { @@ -2244,7 +2243,7 @@ "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "dev": true, "requires": { - "es6-promise": "^4.0.3" + "es6-promise": "4.2.4" } }, "es6-set": { @@ -2253,11 +2252,11 @@ "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", "dev": true, "requires": { - "d": "1", - "es5-ext": "~0.10.14", - "es6-iterator": "~2.0.1", + "d": "1.0.0", + "es5-ext": "0.10.42", + "es6-iterator": "2.0.3", "es6-symbol": "3.1.1", - "event-emitter": "~0.3.5" + "event-emitter": "0.3.5" } }, "es6-symbol": { @@ -2266,8 +2265,8 @@ "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "dev": true, "requires": { - "d": "1", - "es5-ext": "~0.10.14" + "d": "1.0.0", + "es5-ext": "0.10.42" } }, "es6-weak-map": { @@ -2276,10 +2275,10 @@ "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" + "d": "1.0.0", + "es5-ext": "0.10.42", + "es6-iterator": "2.0.3", + "es6-symbol": "3.1.1" } }, "escape-html": { @@ -2301,11 +2300,11 @@ "dev": true, "optional": true, "requires": { - "esprima": "^3.1.3", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" + "esprima": "3.1.3", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.6.1" }, "dependencies": { "source-map": { @@ -2323,10 +2322,10 @@ "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", "dev": true, "requires": { - "es6-map": "^0.1.3", - "es6-weak-map": "^2.0.1", - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" + "es6-map": "0.1.5", + "es6-weak-map": "2.0.2", + "esrecurse": "4.2.1", + "estraverse": "4.2.0" } }, "esprima": { @@ -2341,7 +2340,7 @@ "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", "dev": true, "requires": { - "estraverse": "^4.1.0" + "estraverse": "4.2.0" } }, "estraverse": { @@ -2369,8 +2368,8 @@ "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", "dev": true, "requires": { - "d": "1", - "es5-ext": "~0.10.14" + "d": "1.0.0", + "es5-ext": "0.10.42" } }, "eventemitter3": { @@ -2391,7 +2390,7 @@ "integrity": "sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI=", "dev": true, "requires": { - "original": ">=0.0.5" + "original": "1.0.0" } }, "evp_bytestokey": { @@ -2400,8 +2399,8 @@ "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "dev": true, "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" + "md5.js": "1.3.4", + "safe-buffer": "5.1.1" } }, "execa": { @@ -2410,13 +2409,13 @@ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" }, "dependencies": { "cross-spawn": { @@ -2425,9 +2424,9 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" + "lru-cache": "4.1.2", + "shebang-command": "1.2.0", + "which": "1.3.0" } } } @@ -2450,9 +2449,9 @@ "integrity": "sha1-SIsdHSRRyz06axks/AMPRMWFX+o=", "dev": true, "requires": { - "array-slice": "^0.2.3", - "array-unique": "^0.2.1", - "braces": "^0.1.2" + "array-slice": "0.2.3", + "array-unique": "0.2.1", + "braces": "0.1.5" }, "dependencies": { "array-slice": { @@ -2473,7 +2472,7 @@ "integrity": "sha1-wIVxEIUpHYt1/ddOqw+FlygHEeY=", "dev": true, "requires": { - "expand-range": "^0.1.0" + "expand-range": "0.1.1" } }, "expand-range": { @@ -2482,8 +2481,8 @@ "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", "dev": true, "requires": { - "is-number": "^0.1.1", - "repeat-string": "^0.2.2" + "is-number": "0.1.1", + "repeat-string": "0.2.2" } }, "is-number": { @@ -2506,13 +2505,13 @@ "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" + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" }, "dependencies": { "define-property": { @@ -2521,7 +2520,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "is-accessor-descriptor": { @@ -2530,7 +2529,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -2539,7 +2538,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -2550,7 +2549,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -2559,7 +2558,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -2570,9 +2569,9 @@ "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" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" } }, "kind-of": { @@ -2589,7 +2588,7 @@ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "fill-range": "^2.1.0" + "fill-range": "2.2.3" }, "dependencies": { "fill-range": { @@ -2598,11 +2597,11 @@ "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true, "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^1.1.3", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" } }, "is-number": { @@ -2611,7 +2610,7 @@ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" } }, "isobject": { @@ -2629,7 +2628,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -2640,7 +2639,7 @@ "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", "dev": true, "requires": { - "homedir-polyfill": "^1.0.1" + "homedir-polyfill": "1.0.1" } }, "express": { @@ -2649,36 +2648,36 @@ "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", "dev": true, "requires": { - "accepts": "~1.3.5", + "accepts": "1.3.5", "array-flatten": "1.1.1", "body-parser": "1.18.2", "content-disposition": "0.5.2", - "content-type": "~1.0.4", + "content-type": "1.0.4", "cookie": "0.3.1", "cookie-signature": "1.0.6", "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", + "depd": "1.1.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", "finalhandler": "1.1.1", "fresh": "0.5.2", "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.2", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", + "proxy-addr": "2.0.3", "qs": "6.5.1", - "range-parser": "~1.2.0", + "range-parser": "1.2.0", "safe-buffer": "5.1.1", "send": "0.16.2", "serve-static": "1.13.2", "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", + "statuses": "1.4.0", + "type-is": "1.6.16", "utils-merge": "1.0.1", - "vary": "~1.1.2" + "vary": "1.1.2" }, "dependencies": { "array-flatten": { @@ -2701,7 +2700,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } }, "extglob": { @@ -2710,14 +2709,14 @@ "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" + "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" } }, "extract-zip": { @@ -2761,9 +2760,9 @@ "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", "dev": true, "requires": { - "ansi-gray": "^0.1.1", - "color-support": "^1.1.3", - "time-stamp": "^1.0.0" + "ansi-gray": "0.1.1", + "color-support": "1.1.3", + "time-stamp": "1.1.0" } }, "fast-deep-equal": { @@ -2791,7 +2790,7 @@ "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", "dev": true, "requires": { - "websocket-driver": ">=0.5.1" + "websocket-driver": "0.7.0" } }, "fbjs": { @@ -2800,13 +2799,13 @@ "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", "dev": true, "requires": { - "core-js": "^1.0.0", - "isomorphic-fetch": "^2.1.1", - "loose-envify": "^1.0.0", - "object-assign": "^4.1.0", - "promise": "^7.1.1", - "setimmediate": "^1.0.5", - "ua-parser-js": "^0.7.9" + "core-js": "1.2.7", + "isomorphic-fetch": "2.2.1", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "promise": "7.3.1", + "setimmediate": "1.0.5", + "ua-parser-js": "0.7.17" }, "dependencies": { "object-assign": { @@ -2823,7 +2822,7 @@ "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", "dev": true, "requires": { - "pend": "~1.2.0" + "pend": "1.2.0" } }, "file-type": { @@ -2851,10 +2850,10 @@ "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" + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" } }, "finalhandler": { @@ -2864,12 +2863,12 @@ "dev": true, "requires": { "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "statuses": "1.4.0", + "unpipe": "1.0.0" } }, "find": { @@ -2878,7 +2877,7 @@ "integrity": "sha1-S3Px/55WrZG3bnFkB/5f/mVUu4w=", "dev": true, "requires": { - "traverse-chain": "~0.1.0" + "traverse-chain": "0.1.0" } }, "find-index": { @@ -2893,7 +2892,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "^2.0.0" + "locate-path": "2.0.0" } }, "findup-sync": { @@ -2902,10 +2901,10 @@ "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" + "detect-file": "1.0.0", + "is-glob": "3.1.0", + "micromatch": "3.1.5", + "resolve-dir": "1.0.1" } }, "fined": { @@ -2914,11 +2913,11 @@ "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" + "expand-tilde": "2.0.2", + "is-plain-object": "2.0.4", + "object.defaults": "1.1.0", + "object.pick": "1.3.0", + "parse-filepath": "1.0.2" } }, "first-chunk-stream": { @@ -2939,7 +2938,7 @@ "integrity": "sha512-uxYePVPogtya1ktGnAAXOacnbIuRMB4dkvqeNz2qTtTQsuzSfbDolV+wMMKxAmCx0bLgAKLbBOkjItMbbkR1vg==", "dev": true, "requires": { - "debug": "^3.1.0" + "debug": "3.1.0" }, "dependencies": { "debug": { @@ -2959,7 +2958,7 @@ "integrity": "sha1-LEBFC5NI6X8oEyJZO6lnBLmr1NQ=", "dev": true, "requires": { - "is-function": "~1.0.0" + "is-function": "1.0.1" } }, "for-in": { @@ -2974,7 +2973,7 @@ "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", "dev": true, "requires": { - "for-in": "^1.0.1" + "for-in": "1.0.2" } }, "foreach": { @@ -2995,9 +2994,9 @@ "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "dev": true, "requires": { - "asynckit": "^0.4.0", + "asynckit": "0.4.0", "combined-stream": "1.0.6", - "mime-types": "^2.1.12" + "mime-types": "2.1.18" } }, "formatio": { @@ -3006,7 +3005,7 @@ "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", "dev": true, "requires": { - "samsam": "~1.1" + "samsam": "1.1.2" } }, "forwarded": { @@ -3021,7 +3020,7 @@ "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", "dev": true, "requires": { - "map-cache": "^0.2.2" + "map-cache": "0.2.2" } }, "fresh": { @@ -3036,7 +3035,7 @@ "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", "dev": true, "requires": { - "null-check": "^1.0.0" + "null-check": "1.0.0" } }, "fs-extra": { @@ -3045,11 +3044,11 @@ "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" + "graceful-fs": "4.1.11", + "jsonfile": "2.4.0", + "klaw": "1.3.1", + "path-is-absolute": "1.0.1", + "rimraf": "2.6.2" } }, "fs.realpath": { @@ -3065,8 +3064,8 @@ "dev": true, "optional": true, "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.9.0" + "nan": "2.10.0", + "node-pre-gyp": "0.9.1" }, "dependencies": { "abbrev": { @@ -3096,8 +3095,8 @@ "dev": true, "optional": true, "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" + "delegates": "1.0.0", + "readable-stream": "2.3.6" } }, "balanced-match": { @@ -3112,7 +3111,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -3186,7 +3185,7 @@ "dev": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "2.2.4" } }, "fs.realpath": { @@ -3203,14 +3202,14 @@ "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" + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" } }, "glob": { @@ -3220,12 +3219,12 @@ "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" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "has-unicode": { @@ -3242,7 +3241,7 @@ "dev": true, "optional": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": "2.1.2" } }, "ignore-walk": { @@ -3252,7 +3251,7 @@ "dev": true, "optional": true, "requires": { - "minimatch": "^3.0.4" + "minimatch": "3.0.4" } }, "inflight": { @@ -3262,8 +3261,8 @@ "dev": true, "optional": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -3285,7 +3284,7 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "number-is-nan": "1.0.1" } }, "isarray": { @@ -3301,7 +3300,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { @@ -3316,8 +3315,8 @@ "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "dev": true, "requires": { - "safe-buffer": "^5.1.1", - "yallist": "^3.0.0" + "safe-buffer": "5.1.1", + "yallist": "3.0.2" } }, "minizlib": { @@ -3327,7 +3326,7 @@ "dev": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "2.2.4" } }, "mkdirp": { @@ -3353,9 +3352,9 @@ "dev": true, "optional": true, "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" + "debug": "2.6.9", + "iconv-lite": "0.4.21", + "sax": "1.2.4" } }, "node-pre-gyp": { @@ -3365,16 +3364,16 @@ "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" + "detect-libc": "1.0.3", + "mkdirp": "0.5.1", + "needle": "2.2.0", + "nopt": "4.0.1", + "npm-packlist": "1.1.10", + "npmlog": "4.1.2", + "rc": "1.2.6", + "rimraf": "2.6.2", + "semver": "5.5.0", + "tar": "4.4.1" } }, "nopt": { @@ -3384,8 +3383,8 @@ "dev": true, "optional": true, "requires": { - "abbrev": "1", - "osenv": "^0.1.4" + "abbrev": "1.1.1", + "osenv": "0.1.5" } }, "npm-bundled": { @@ -3402,8 +3401,8 @@ "dev": true, "optional": true, "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" + "ignore-walk": "3.0.1", + "npm-bundled": "1.0.3" } }, "npmlog": { @@ -3413,10 +3412,10 @@ "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" + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" } }, "number-is-nan": { @@ -3438,7 +3437,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "os-homedir": { @@ -3462,8 +3461,8 @@ "dev": true, "optional": true, "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" } }, "path-is-absolute": { @@ -3487,10 +3486,10 @@ "dev": true, "optional": true, "requires": { - "deep-extend": "~0.4.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" + "deep-extend": "0.4.2", + "ini": "1.3.5", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" }, "dependencies": { "minimist": { @@ -3509,13 +3508,13 @@ "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" + "core-util-is": "1.0.2", + "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.2" } }, "rimraf": { @@ -3525,7 +3524,7 @@ "dev": true, "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "7.1.2" } }, "safe-buffer": { @@ -3575,9 +3574,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } }, "string_decoder": { @@ -3587,7 +3586,7 @@ "dev": true, "optional": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.1" } }, "strip-ansi": { @@ -3596,7 +3595,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "strip-json-comments": { @@ -3613,13 +3612,13 @@ "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" + "chownr": "1.0.1", + "fs-minipass": "1.2.5", + "minipass": "2.2.4", + "minizlib": "1.1.0", + "mkdirp": "0.5.1", + "safe-buffer": "5.1.1", + "yallist": "3.0.2" } }, "util-deprecate": { @@ -3636,7 +3635,7 @@ "dev": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "1.0.2" } }, "wrappy": { @@ -3659,10 +3658,10 @@ "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.2" } }, "ftp": { @@ -3672,7 +3671,7 @@ "dev": true, "optional": true, "requires": { - "readable-stream": "1.1.x", + "readable-stream": "1.1.14", "xregexp": "2.0.0" }, "dependencies": { @@ -3690,10 +3689,10 @@ "dev": true, "optional": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -3717,14 +3716,14 @@ "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": 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" + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" }, "dependencies": { "object-assign": { @@ -3739,9 +3738,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } } } @@ -3752,7 +3751,7 @@ "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", "dev": true, "requires": { - "globule": "~0.1.0" + "globule": "0.1.0" } }, "generate-function": { @@ -3767,7 +3766,7 @@ "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", "dev": true, "requires": { - "is-property": "^1.0.0" + "is-property": "1.0.2" } }, "get-caller-file": { @@ -3804,12 +3803,12 @@ "dev": true, "optional": true, "requires": { - "data-uri-to-buffer": "1", - "debug": "2", - "extend": "3", - "file-uri-to-path": "1", - "ftp": "~0.3.10", - "readable-stream": "2" + "data-uri-to-buffer": "1.2.0", + "debug": "2.6.9", + "extend": "3.0.1", + "file-uri-to-path": "1.0.0", + "ftp": "0.3.10", + "readable-stream": "2.3.3" } }, "get-value": { @@ -3824,7 +3823,7 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "^1.0.0" + "assert-plus": "1.0.0" } }, "glob": { @@ -3833,12 +3832,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": 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" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "glob-base": { @@ -3847,8 +3846,8 @@ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" + "glob-parent": "2.0.0", + "is-glob": "2.0.1" }, "dependencies": { "glob-parent": { @@ -3857,7 +3856,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "^2.0.0" + "is-glob": "2.0.1" } }, "is-extglob": { @@ -3872,7 +3871,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } } } @@ -3883,8 +3882,8 @@ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" + "is-glob": "3.1.0", + "path-dirname": "1.0.2" } }, "glob-stream": { @@ -3893,12 +3892,12 @@ "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" + "glob": "4.5.3", + "glob2base": "0.0.12", + "minimatch": "2.0.10", + "ordered-read-streams": "0.1.0", + "through2": "0.6.5", + "unique-stream": "1.0.0" }, "dependencies": { "glob": { @@ -3907,10 +3906,10 @@ "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", "dev": true, "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^2.0.1", - "once": "^1.3.0" + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "2.0.10", + "once": "1.4.0" } }, "isarray": { @@ -3925,7 +3924,7 @@ "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", "dev": true, "requires": { - "brace-expansion": "^1.0.0" + "brace-expansion": "1.1.8" } }, "readable-stream": { @@ -3934,10 +3933,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -3952,8 +3951,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "readable-stream": "1.0.34", + "xtend": "4.0.1" } } } @@ -3964,7 +3963,7 @@ "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", "dev": true, "requires": { - "gaze": "^0.5.1" + "gaze": "0.5.2" } }, "glob2base": { @@ -3973,7 +3972,7 @@ "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", "dev": true, "requires": { - "find-index": "^0.1.1" + "find-index": "0.1.1" } }, "global": { @@ -3982,8 +3981,8 @@ "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", "dev": true, "requires": { - "min-document": "^2.19.0", - "process": "~0.5.1" + "min-document": "2.19.0", + "process": "0.5.2" } }, "global-modules": { @@ -3992,9 +3991,9 @@ "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" + "global-prefix": "1.0.2", + "is-windows": "1.0.1", + "resolve-dir": "1.0.1" } }, "global-prefix": { @@ -4003,11 +4002,11 @@ "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" + "expand-tilde": "2.0.2", + "homedir-polyfill": "1.0.1", + "ini": "1.3.5", + "is-windows": "1.0.1", + "which": "1.3.0" } }, "globby": { @@ -4016,11 +4015,11 @@ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "array-union": "1.0.2", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" }, "dependencies": { "object-assign": { @@ -4043,9 +4042,9 @@ "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", "dev": true, "requires": { - "glob": "~3.1.21", - "lodash": "~1.0.1", - "minimatch": "~0.2.11" + "glob": "3.1.21", + "lodash": "1.0.2", + "minimatch": "0.2.14" }, "dependencies": { "glob": { @@ -4054,9 +4053,9 @@ "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", "dev": true, "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" + "graceful-fs": "1.2.3", + "inherits": "1.0.2", + "minimatch": "0.2.14" } }, "graceful-fs": { @@ -4089,8 +4088,8 @@ "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", "dev": true, "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "lru-cache": "2.7.3", + "sigmund": "1.0.1" } } } @@ -4101,7 +4100,7 @@ "integrity": "sha1-f+DxmfV6yQbPUS/urY+Q7kooT8U=", "dev": true, "requires": { - "sparkles": "^1.0.0" + "sparkles": "1.0.0" } }, "graceful-fs": { @@ -4122,19 +4121,19 @@ "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" + "archy": "1.0.0", + "chalk": "1.1.3", + "deprecated": "0.0.1", + "gulp-util": "3.0.8", + "interpret": "1.1.0", + "liftoff": "2.5.0", + "minimist": "1.2.0", + "orchestrator": "0.3.8", + "pretty-hrtime": "1.0.3", + "semver": "4.3.6", + "tildify": "1.2.0", + "v8flags": "2.1.1", + "vinyl-fs": "0.3.14" }, "dependencies": { "semver": { @@ -4151,11 +4150,11 @@ "integrity": "sha512-DARK8rNMo4lHOFLGTiHEJdf19GuoBDHqGUaypz+fOhrvOs3iFO7ntdYtdpNxv+AzSJBx/JfypF0yEj9ks1IStQ==", "dev": true, "requires": { - "fancy-log": "^1.3.2", - "plugin-error": "^0.1.2", - "rimraf": "^2.6.2", - "through2": "^2.0.3", - "vinyl": "^2.1.0" + "fancy-log": "1.3.2", + "plugin-error": "0.1.2", + "rimraf": "2.6.2", + "through2": "2.0.3", + "vinyl": "2.1.0" }, "dependencies": { "arr-diff": { @@ -4164,8 +4163,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "^1.0.1", - "array-slice": "^0.2.3" + "arr-flatten": "1.1.0", + "array-slice": "0.2.3" } }, "arr-union": { @@ -4198,7 +4197,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "^1.1.0" + "kind-of": "1.1.0" } }, "kind-of": { @@ -4213,11 +4212,11 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "^0.1.1", - "ansi-red": "^0.1.1", - "arr-diff": "^1.0.1", - "arr-union": "^2.0.1", - "extend-shallow": "^1.1.2" + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" } }, "replace-ext": { @@ -4232,12 +4231,12 @@ "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" + "clone": "2.1.1", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.0.0", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" } } } @@ -4254,8 +4253,8 @@ "integrity": "sha1-RRNWoqxQicbbkaBEQlKgVDZXAGs=", "dev": true, "requires": { - "through2": "^0.4.1", - "vinyl": "^2.1.0" + "through2": "0.4.2", + "vinyl": "2.1.0" }, "dependencies": { "clone": { @@ -4282,10 +4281,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "replace-ext": { @@ -4306,8 +4305,8 @@ "integrity": "sha1-2/WGYDEVHsg1K7bE22SiKSqEC5s=", "dev": true, "requires": { - "readable-stream": "~1.0.17", - "xtend": "~2.1.1" + "readable-stream": "1.0.34", + "xtend": "2.1.2" } }, "vinyl": { @@ -4316,12 +4315,12 @@ "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" + "clone": "2.1.1", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.0.0", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" } }, "xtend": { @@ -4330,7 +4329,7 @@ "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", "dev": true, "requires": { - "object-keys": "~0.4.0" + "object-keys": "0.4.0" } } } @@ -4341,13 +4340,13 @@ "integrity": "sha512-qEocs1UVoDKKUjfsxJNMNwkRla0PbsyJwsqNNXpzYWsLQ29LhxRMY3wnTGZcc4hMHtalnvah/Dwlwb4NijH/0A==", "dev": true, "requires": { - "ansi-colors": "^1.0.1", - "fancy-log": "^1.3.2", - "lodash.template": "^4.4.0", - "node-notifier": "^5.2.1", - "node.extend": "^2.0.0", - "plugin-error": "^0.1.2", - "through2": "^2.0.3" + "ansi-colors": "1.1.0", + "fancy-log": "1.3.2", + "lodash.template": "4.4.0", + "node-notifier": "5.2.1", + "node.extend": "2.0.0", + "plugin-error": "0.1.2", + "through2": "2.0.3" }, "dependencies": { "arr-diff": { @@ -4356,8 +4355,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "^1.0.1", - "array-slice": "^0.2.3" + "arr-flatten": "1.1.0", + "array-slice": "0.2.3" } }, "arr-union": { @@ -4378,7 +4377,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "^1.1.0" + "kind-of": "1.1.0" } }, "kind-of": { @@ -4393,8 +4392,8 @@ "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", "dev": true, "requires": { - "lodash._reinterpolate": "~3.0.0", - "lodash.templatesettings": "^4.0.0" + "lodash._reinterpolate": "3.0.0", + "lodash.templatesettings": "4.1.0" } }, "lodash.templatesettings": { @@ -4403,7 +4402,7 @@ "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", "dev": true, "requires": { - "lodash._reinterpolate": "~3.0.0" + "lodash._reinterpolate": "3.0.0" } }, "plugin-error": { @@ -4412,11 +4411,11 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "^0.1.1", - "ansi-red": "^0.1.1", - "arr-diff": "^1.0.1", - "arr-union": "^2.0.1", - "extend-shallow": "^1.1.2" + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" } } } @@ -4434,8 +4433,8 @@ "dev": true, "requires": { "istextorbinary": "1.0.2", - "readable-stream": "^2.0.1", - "replacestream": "^4.0.0" + "readable-stream": "2.3.3", + "replacestream": "4.0.3" } }, "gulp-sass": { @@ -4444,11 +4443,11 @@ "integrity": "sha512-UATbRpSDsyXCnpYSPBUEvdvtSEzksJs7/oQ0CujIpzKqKrO6vlnYwhX2UTsGrf4rNLwqlSSaM271It0uHYvJ3Q==", "dev": true, "requires": { - "gulp-util": "^3.0", - "lodash.clonedeep": "^4.3.2", - "node-sass": "^4.8.3", - "through2": "^2.0.0", - "vinyl-sourcemaps-apply": "^0.2.0" + "gulp-util": "3.0.8", + "lodash.clonedeep": "4.5.0", + "node-sass": "4.9.0", + "through2": "2.0.3", + "vinyl-sourcemaps-apply": "0.2.1" } }, "gulp-sass-bulk-import": { @@ -4457,9 +4456,9 @@ "integrity": "sha1-AvHW0xDgGOae/iUlgRpOc4E5ZCM=", "dev": true, "requires": { - "glob": "^4.0.6", - "through2": "^0.6.3", - "vinyl-fs": "^0.3.9" + "glob": "4.5.3", + "through2": "0.6.5", + "vinyl-fs": "0.3.14" }, "dependencies": { "glob": { @@ -4468,10 +4467,10 @@ "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", "dev": true, "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^2.0.1", - "once": "^1.3.0" + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "2.0.10", + "once": "1.4.0" } }, "isarray": { @@ -4486,7 +4485,7 @@ "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", "dev": true, "requires": { - "brace-expansion": "^1.0.0" + "brace-expansion": "1.1.8" } }, "readable-stream": { @@ -4495,10 +4494,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -4513,8 +4512,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "readable-stream": "1.0.34", + "xtend": "4.0.1" } } } @@ -4525,7 +4524,7 @@ "integrity": "sha512-c+p+EcyBl1UCpbfFA/vUD6MuC7uxoY6Y4g2lq9lLtzOHh9o1wijAQ4o0TIRQ14C7cG6zR6Zi+bpA0cW78CFt6g==", "dev": true, "requires": { - "thunks": "^4.9.0" + "thunks": "4.9.0" } }, "gulp-strip-css-comments": { @@ -4534,9 +4533,9 @@ "integrity": "sha512-K6QMBcuGHTwY1gjerGQ3uXo1VQfN1KM7I5wvjJYvggJ+bmXSWJHmEdBwK2NO524e2cu0AXHHRs0QrwjnvrrZtA==", "dev": true, "requires": { - "plugin-error": "^0.1.2", - "strip-css-comments": "^3.0.0", - "through2": "^2.0.0" + "plugin-error": "0.1.2", + "strip-css-comments": "3.0.0", + "through2": "2.0.3" }, "dependencies": { "arr-diff": { @@ -4545,8 +4544,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "^1.0.1", - "array-slice": "^0.2.3" + "arr-flatten": "1.1.0", + "array-slice": "0.2.3" } }, "arr-union": { @@ -4567,7 +4566,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "^1.1.0" + "kind-of": "1.1.0" } }, "kind-of": { @@ -4582,11 +4581,11 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "^0.1.1", - "ansi-red": "^0.1.1", - "arr-diff": "^1.0.1", - "arr-union": "^2.0.1", - "extend-shallow": "^1.1.2" + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" } } } @@ -4597,24 +4596,24 @@ "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", + "array-differ": "1.0.0", + "array-uniq": "1.0.3", + "beeper": "1.1.1", + "chalk": "1.1.3", + "dateformat": "2.2.0", + "fancy-log": "1.3.2", + "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.6.2", + "minimist": "1.2.0", + "multipipe": "0.1.2", + "object-assign": "3.0.0", "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl": "^0.5.0" + "through2": "2.0.3", + "vinyl": "0.5.3" }, "dependencies": { "dateformat": { @@ -4631,7 +4630,7 @@ "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", "dev": true, "requires": { - "glogg": "^1.0.0" + "glogg": "1.0.0" } }, "handle-thing": { @@ -4652,8 +4651,8 @@ "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "dev": true, "requires": { - "ajv": "^5.1.0", - "har-schema": "^2.0.0" + "ajv": "5.5.2", + "har-schema": "2.0.0" } }, "has": { @@ -4662,7 +4661,7 @@ "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", "dev": true, "requires": { - "function-bind": "^1.0.2" + "function-bind": "1.1.1" } }, "has-ansi": { @@ -4671,7 +4670,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "has-binary2": { @@ -4709,7 +4708,7 @@ "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", "dev": true, "requires": { - "sparkles": "^1.0.0" + "sparkles": "1.0.0" } }, "has-unicode": { @@ -4724,9 +4723,9 @@ "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", "dev": true, "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" } }, "has-values": { @@ -4735,8 +4734,8 @@ "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true, "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "is-number": "3.0.0", + "kind-of": "4.0.0" }, "dependencies": { "kind-of": { @@ -4745,7 +4744,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -4756,8 +4755,8 @@ "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "dev": true, "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "2.0.3", + "safe-buffer": "5.1.1" } }, "hash.js": { @@ -4766,8 +4765,8 @@ "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", "dev": true, "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" } }, "hasha": { @@ -4776,8 +4775,8 @@ "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", "dev": true, "requires": { - "is-stream": "^1.0.1", - "pinkie-promise": "^2.0.0" + "is-stream": "1.1.0", + "pinkie-promise": "2.0.1" } }, "hawk": { @@ -4786,10 +4785,10 @@ "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "dev": true, "requires": { - "boom": "4.x.x", - "cryptiles": "3.x.x", - "hoek": "4.x.x", - "sntp": "2.x.x" + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.1", + "sntp": "2.1.0" } }, "hipchat-notifier": { @@ -4799,8 +4798,8 @@ "dev": true, "optional": true, "requires": { - "lodash": "^4.0.0", - "request": "^2.0.0" + "lodash": "4.17.10", + "request": "2.85.0" } }, "hmac-drbg": { @@ -4809,9 +4808,9 @@ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "dev": true, "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" + "hash.js": "1.1.3", + "minimalistic-assert": "1.0.1", + "minimalistic-crypto-utils": "1.0.1" } }, "hoek": { @@ -4832,7 +4831,7 @@ "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", "dev": true, "requires": { - "parse-passwd": "^1.0.0" + "parse-passwd": "1.0.0" } }, "hosted-git-info": { @@ -4847,10 +4846,10 @@ "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", "dev": true, "requires": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" + "inherits": "2.0.3", + "obuf": "1.1.2", + "readable-stream": "2.3.3", + "wbuf": "1.7.3" } }, "html-entities": { @@ -4871,10 +4870,10 @@ "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "dev": true, "requires": { - "depd": "~1.1.2", + "depd": "1.1.2", "inherits": "2.0.3", "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" + "statuses": "1.4.0" } }, "http-parser-js": { @@ -4889,9 +4888,9 @@ "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", "dev": true, "requires": { - "eventemitter3": "^3.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" + "eventemitter3": "3.1.0", + "follow-redirects": "1.4.1", + "requires-port": "1.0.0" } }, "http-proxy-agent": { @@ -4900,9 +4899,9 @@ "integrity": "sha1-zBzjjkU7+YSg93AtLdWcc9CBKEo=", "dev": true, "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3" + "agent-base": "2.1.1", + "debug": "2.6.9", + "extend": "3.0.1" }, "dependencies": { "agent-base": { @@ -4911,8 +4910,8 @@ "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "dev": true, "requires": { - "extend": "~3.0.0", - "semver": "~5.0.1" + "extend": "3.0.1", + "semver": "5.0.3" } }, "semver": { @@ -4929,10 +4928,10 @@ "integrity": "sha1-ZC6ISIUdZvCdTxJJEoRtuutBuDM=", "dev": true, "requires": { - "http-proxy": "^1.16.2", - "is-glob": "^3.1.0", - "lodash": "^4.17.2", - "micromatch": "^2.3.11" + "http-proxy": "1.17.0", + "is-glob": "3.1.0", + "lodash": "4.17.10", + "micromatch": "2.3.11" }, "dependencies": { "arr-diff": { @@ -4941,7 +4940,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "^1.0.1" + "arr-flatten": "1.1.0" } }, "array-unique": { @@ -4956,9 +4955,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" } }, "expand-brackets": { @@ -4967,7 +4966,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "^0.1.0" + "is-posix-bracket": "0.1.1" } }, "extglob": { @@ -4976,7 +4975,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } }, "is-extglob": { @@ -4991,7 +4990,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } }, "micromatch": { @@ -5000,19 +4999,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" }, "dependencies": { "is-glob": { @@ -5021,7 +5020,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } } } @@ -5034,9 +5033,9 @@ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.14.1" } }, "httpntlm": { @@ -5045,8 +5044,8 @@ "integrity": "sha1-rQFScUOi6Hc8+uapb1hla7UqNLI=", "dev": true, "requires": { - "httpreq": ">=0.4.22", - "underscore": "~1.7.0" + "httpreq": "0.4.24", + "underscore": "1.7.0" } }, "httpreq": { @@ -5067,8 +5066,8 @@ "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", "dev": true, "requires": { - "agent-base": "^4.1.0", - "debug": "^3.1.0" + "agent-base": "4.2.0", + "debug": "3.1.0" }, "dependencies": { "debug": { @@ -5088,7 +5087,7 @@ "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", "dev": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": "2.1.2" } }, "ieee754": { @@ -5103,8 +5102,8 @@ "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", "dev": true, "requires": { - "pkg-dir": "^2.0.0", - "resolve-cwd": "^2.0.0" + "pkg-dir": "2.0.0", + "resolve-cwd": "2.0.0" } }, "in-publish": { @@ -5138,8 +5137,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -5160,7 +5159,7 @@ "integrity": "sha1-rp+/k7mEh4eF1QqN4bNWlWBYz1w=", "dev": true, "requires": { - "meow": "^3.3.0" + "meow": "3.7.0" }, "dependencies": { "camelcase": { @@ -5175,8 +5174,8 @@ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" + "camelcase": "2.1.1", + "map-obj": "1.0.1" } }, "find-up": { @@ -5185,8 +5184,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" } }, "get-stdin": { @@ -5201,7 +5200,7 @@ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, "requires": { - "repeating": "^2.0.0" + "repeating": "2.0.1" } }, "load-json-file": { @@ -5210,11 +5209,11 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" } }, "map-obj": { @@ -5229,16 +5228,16 @@ "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" + "camelcase-keys": "2.1.0", + "decamelize": "1.2.0", + "loud-rejection": "1.6.0", + "map-obj": "1.0.1", + "minimist": "1.2.0", + "normalize-package-data": "2.4.0", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "redent": "1.0.0", + "trim-newlines": "1.0.0" } }, "object-assign": { @@ -5253,7 +5252,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "1.3.1" } }, "path-exists": { @@ -5262,7 +5261,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "^2.0.0" + "pinkie-promise": "2.0.1" } }, "path-type": { @@ -5271,9 +5270,9 @@ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" } }, "pify": { @@ -5288,9 +5287,9 @@ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" } }, "read-pkg-up": { @@ -5299,8 +5298,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" + "find-up": "1.1.2", + "read-pkg": "1.1.0" } }, "redent": { @@ -5309,8 +5308,8 @@ "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", "dev": true, "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" + "indent-string": "2.1.0", + "strip-indent": "1.0.1" } }, "strip-bom": { @@ -5319,7 +5318,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "^0.2.0" + "is-utf8": "0.2.1" } }, "strip-indent": { @@ -5328,7 +5327,7 @@ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", "dev": true, "requires": { - "get-stdin": "^4.0.1" + "get-stdin": "4.0.1" } }, "trim-newlines": { @@ -5351,7 +5350,7 @@ "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", "dev": true, "requires": { - "loose-envify": "^1.0.0" + "loose-envify": "1.3.1" } }, "invert-kv": { @@ -5390,8 +5389,8 @@ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" + "is-relative": "1.0.0", + "is-windows": "1.0.1" } }, "is-accessor-descriptor": { @@ -5400,7 +5399,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-arrayish": { @@ -5415,7 +5414,7 @@ "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", "dev": true, "requires": { - "binary-extensions": "^1.0.0" + "binary-extensions": "1.11.0" } }, "is-buffer": { @@ -5430,7 +5429,7 @@ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { - "builtin-modules": "^1.0.0" + "builtin-modules": "1.1.1" } }, "is-callable": { @@ -5445,7 +5444,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-date-object": { @@ -5460,9 +5459,9 @@ "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-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" } }, "is-dotfile": { @@ -5477,7 +5476,7 @@ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { - "is-primitive": "^2.0.0" + "is-primitive": "2.0.0" } }, "is-extendable": { @@ -5498,7 +5497,7 @@ "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "number-is-nan": "1.0.1" } }, "is-fullwidth-code-point": { @@ -5507,7 +5506,7 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "number-is-nan": "1.0.1" } }, "is-function": { @@ -5522,7 +5521,7 @@ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { - "is-extglob": "^2.1.0" + "is-extglob": "2.1.1" } }, "is-my-ip-valid": { @@ -5537,11 +5536,11 @@ "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", "dev": true, "requires": { - "generate-function": "^2.0.0", - "generate-object-property": "^1.1.0", - "is-my-ip-valid": "^1.0.0", - "jsonpointer": "^4.0.0", - "xtend": "^4.0.0" + "generate-function": "2.0.0", + "generate-object-property": "1.2.0", + "is-my-ip-valid": "1.0.0", + "jsonpointer": "4.0.1", + "xtend": "4.0.1" } }, "is-number": { @@ -5550,7 +5549,7 @@ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -5559,7 +5558,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -5570,7 +5569,7 @@ "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", "dev": true, "requires": { - "is-number": "^3.0.0" + "is-number": "3.0.0" } }, "is-path-cwd": { @@ -5585,7 +5584,7 @@ "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", "dev": true, "requires": { - "is-path-inside": "^1.0.0" + "is-path-inside": "1.0.1" } }, "is-path-inside": { @@ -5594,7 +5593,7 @@ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { - "path-is-inside": "^1.0.1" + "path-is-inside": "1.0.2" } }, "is-plain-obj": { @@ -5609,7 +5608,7 @@ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { - "isobject": "^3.0.1" + "isobject": "3.0.1" } }, "is-posix-bracket": { @@ -5636,7 +5635,7 @@ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { - "has": "^1.0.1" + "has": "1.0.1" } }, "is-regexp": { @@ -5651,7 +5650,7 @@ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { - "is-unc-path": "^1.0.0" + "is-unc-path": "1.0.0" } }, "is-stream": { @@ -5678,7 +5677,7 @@ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { - "unc-path-regex": "^0.1.2" + "unc-path-regex": "0.1.2" } }, "is-utf8": { @@ -5729,8 +5728,8 @@ "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", "dev": true, "requires": { - "node-fetch": "^1.0.1", - "whatwg-fetch": ">=0.10.0" + "node-fetch": "1.7.3", + "whatwg-fetch": "2.0.4" } }, "isstream": { @@ -5745,8 +5744,8 @@ "integrity": "sha1-rOGTVNGpoBc+/rEITOD4ewrX3s8=", "dev": true, "requires": { - "binaryextensions": "~1.0.0", - "textextensions": "~1.0.0" + "binaryextensions": "1.0.1", + "textextensions": "1.0.2" } }, "jasmine-core": { @@ -5761,22 +5760,22 @@ "integrity": "sha1-3VKak3GQ9ClXp5N9Gsw6d2KZbqI=", "dev": true, "requires": { - "bignumber.js": "^2.1.0", + "bignumber.js": "2.4.0", "bmp-js": "0.0.3", - "es6-promise": "^3.0.2", - "exif-parser": "^0.1.9", - "file-type": "^3.1.0", - "jpeg-js": "^0.2.0", - "load-bmfont": "^1.2.3", - "mime": "^1.3.4", + "es6-promise": "3.3.1", + "exif-parser": "0.1.12", + "file-type": "3.9.0", + "jpeg-js": "0.2.0", + "load-bmfont": "1.3.0", + "mime": "1.6.0", "mkdirp": "0.5.1", - "pixelmatch": "^4.0.0", - "pngjs": "^3.0.0", - "read-chunk": "^1.0.1", - "request": "^2.65.0", - "stream-to-buffer": "^0.1.0", - "tinycolor2": "^1.1.2", - "url-regex": "^3.0.0" + "pixelmatch": "4.0.2", + "pngjs": "3.3.3", + "read-chunk": "1.0.1", + "request": "2.85.0", + "stream-to-buffer": "0.1.0", + "tinycolor2": "1.4.1", + "url-regex": "3.2.0" }, "dependencies": { "es6-promise": { @@ -5860,7 +5859,7 @@ "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { - "graceful-fs": "^4.1.6" + "graceful-fs": "4.1.11" } }, "jsonpointer": { @@ -5926,7 +5925,7 @@ "integrity": "sha1-+Rb20Q1F3BcbG+Lm5nP7bgzDXQo=", "dev": true, "requires": { - "lodash": "~3.5.0" + "lodash": "3.5.0" } } } @@ -5937,31 +5936,31 @@ "integrity": "sha1-TS25QChQpmVR+nhLAWT7CCTtjEs=", "dev": true, "requires": { - "bluebird": "^3.3.0", - "body-parser": "^1.16.1", - "chokidar": "^1.4.1", - "colors": "^1.1.0", - "combine-lists": "^1.0.0", - "connect": "^3.6.0", - "core-js": "^2.2.0", - "di": "^0.0.1", - "dom-serialize": "^2.2.0", - "expand-braces": "^0.1.1", - "glob": "^7.1.1", - "graceful-fs": "^4.1.2", - "http-proxy": "^1.13.0", - "isbinaryfile": "^3.0.0", - "lodash": "^4.17.4", - "log4js": "^2.3.9", - "mime": "^1.3.4", - "minimatch": "^3.0.2", - "optimist": "^0.6.1", - "qjobs": "^1.1.4", - "range-parser": "^1.2.0", - "rimraf": "^2.6.0", - "safe-buffer": "^5.0.1", + "bluebird": "3.5.1", + "body-parser": "1.18.2", + "chokidar": "1.7.0", + "colors": "1.2.1", + "combine-lists": "1.0.1", + "connect": "3.6.6", + "core-js": "2.5.5", + "di": "0.0.1", + "dom-serialize": "2.2.1", + "expand-braces": "0.1.2", + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "http-proxy": "1.17.0", + "isbinaryfile": "3.0.2", + "lodash": "4.17.10", + "log4js": "2.5.3", + "mime": "1.6.0", + "minimatch": "3.0.4", + "optimist": "0.6.1", + "qjobs": "1.2.0", + "range-parser": "1.2.0", + "rimraf": "2.6.2", + "safe-buffer": "5.1.1", "socket.io": "2.0.4", - "source-map": "^0.6.1", + "source-map": "0.6.1", "tmp": "0.0.33", "useragent": "2.2.1" }, @@ -5972,8 +5971,8 @@ "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", "dev": true, "requires": { - "micromatch": "^2.1.5", - "normalize-path": "^2.0.0" + "micromatch": "2.3.11", + "normalize-path": "2.1.1" } }, "arr-diff": { @@ -5982,7 +5981,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "^1.0.1" + "arr-flatten": "1.1.0" } }, "array-unique": { @@ -5997,9 +5996,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" } }, "chokidar": { @@ -6008,15 +6007,15 @@ "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", "dev": true, "requires": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "fsevents": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" + "anymatch": "1.3.2", + "async-each": "1.0.1", + "fsevents": "1.2.2", + "glob-parent": "2.0.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "2.0.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.1.0" } }, "core-js": { @@ -6031,7 +6030,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "^0.1.0" + "is-posix-bracket": "0.1.1" } }, "extglob": { @@ -6040,7 +6039,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } }, "glob-parent": { @@ -6049,7 +6048,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "^2.0.0" + "is-glob": "2.0.1" } }, "is-extglob": { @@ -6064,7 +6063,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } }, "kind-of": { @@ -6073,7 +6072,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } }, "micromatch": { @@ -6082,19 +6081,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" } }, "source-map": { @@ -6111,8 +6110,8 @@ "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", "dev": true, "requires": { - "fs-access": "^1.0.0", - "which": "^1.2.1" + "fs-access": "1.0.1", + "which": "1.3.0" } }, "karma-jasmine": { @@ -6127,7 +6126,7 @@ "integrity": "sha1-T5xAzt+xo5X4rvh2q/lhiZF8Y5Y=", "dev": true, "requires": { - "path-is-absolute": "^1.0.0", + "path-is-absolute": "1.0.1", "xmlbuilder": "8.2.2" }, "dependencies": { @@ -6157,7 +6156,7 @@ "integrity": "sha1-LpxyB+pyZ3EmAln4K+y1QyCeRAo=", "dev": true, "requires": { - "colors": "^1.1.2" + "colors": "1.2.1" } }, "kew": { @@ -6184,7 +6183,7 @@ "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", "dev": true, "requires": { - "graceful-fs": "^4.1.9" + "graceful-fs": "4.1.11" } }, "lazy-cache": { @@ -6193,7 +6192,7 @@ "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", "dev": true, "requires": { - "set-getter": "^0.1.0" + "set-getter": "0.1.0" } }, "lcid": { @@ -6202,7 +6201,7 @@ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { - "invert-kv": "^1.0.0" + "invert-kv": "1.0.0" } }, "levn": { @@ -6212,8 +6211,8 @@ "dev": true, "optional": true, "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" + "prelude-ls": "1.1.2", + "type-check": "0.3.2" } }, "libbase64": { @@ -6253,14 +6252,14 @@ "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" + "extend": "3.0.1", + "findup-sync": "2.0.0", + "fined": "1.1.0", + "flagged-respawn": "1.0.0", + "is-plain-object": "2.0.4", + "object.map": "1.0.1", + "rechoir": "0.6.2", + "resolve": "1.5.0" } }, "lighthouse-logger": { @@ -6269,7 +6268,7 @@ "integrity": "sha1-8HPYP3rLyWcpvxAKEhyPAGmRrmE=", "dev": true, "requires": { - "debug": "^2.6.8" + "debug": "2.6.9" } }, "load-bmfont": { @@ -6279,12 +6278,12 @@ "dev": true, "requires": { "buffer-equal": "0.0.1", - "mime": "^1.3.4", - "parse-bmfont-ascii": "^1.0.3", - "parse-bmfont-binary": "^1.0.5", - "parse-bmfont-xml": "^1.1.0", - "xhr": "^2.0.1", - "xtend": "^4.0.0" + "mime": "1.6.0", + "parse-bmfont-ascii": "1.0.6", + "parse-bmfont-binary": "1.0.6", + "parse-bmfont-xml": "1.1.3", + "xhr": "2.4.1", + "xtend": "4.0.1" } }, "load-json-file": { @@ -6293,10 +6292,10 @@ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" + "graceful-fs": "4.1.11", + "parse-json": "4.0.0", + "pify": "3.0.0", + "strip-bom": "3.0.0" } }, "loader-runner": { @@ -6311,9 +6310,9 @@ "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", "dev": true, "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0" + "big.js": "3.2.0", + "emojis-list": "2.1.0", + "json5": "0.5.1" } }, "locate-path": { @@ -6322,8 +6321,8 @@ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" + "p-locate": "2.0.0", + "path-exists": "3.0.0" } }, "lodash": { @@ -6410,7 +6409,7 @@ "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", "dev": true, "requires": { - "lodash._root": "^3.0.0" + "lodash._root": "3.0.1" } }, "lodash.isarguments": { @@ -6431,9 +6430,9 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" } }, "lodash.mergewith": { @@ -6454,15 +6453,15 @@ "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._basecopy": "3.0.1", + "lodash._basetostring": "3.0.1", + "lodash._basevalues": "3.0.0", + "lodash._isiterateecall": "3.0.9", + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0", + "lodash.keys": "3.1.2", + "lodash.restparam": "3.6.1", + "lodash.templatesettings": "3.1.1" } }, "lodash.templatesettings": { @@ -6471,8 +6470,8 @@ "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", "dev": true, "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0" } }, "log4js": { @@ -6481,19 +6480,19 @@ "integrity": "sha512-YL/qpTxYtK0iWWbuKCrevDZz5lh+OjyHHD+mICqpjnYGKdNRBvPeh/1uYjkKUemT1CSO4wwLOwphWMpKAnD9kw==", "dev": true, "requires": { - "amqplib": "^0.5.2", - "axios": "^0.15.3", - "circular-json": "^0.5.1", - "date-format": "^1.2.0", - "debug": "^3.1.0", - "hipchat-notifier": "^1.1.0", - "loggly": "^1.1.0", - "mailgun-js": "^0.7.0", - "nodemailer": "^2.5.0", - "redis": "^2.7.1", - "semver": "^5.3.0", - "slack-node": "~0.2.0", - "streamroller": "^0.7.0" + "amqplib": "0.5.2", + "axios": "0.15.3", + "circular-json": "0.5.3", + "date-format": "1.2.0", + "debug": "3.1.0", + "hipchat-notifier": "1.1.0", + "loggly": "1.1.1", + "mailgun-js": "0.7.15", + "nodemailer": "2.7.2", + "redis": "2.8.0", + "semver": "5.5.0", + "slack-node": "0.2.0", + "streamroller": "0.7.0" }, "dependencies": { "debug": { @@ -6514,9 +6513,9 @@ "dev": true, "optional": true, "requires": { - "json-stringify-safe": "5.0.x", - "request": "2.75.x", - "timespan": "2.3.x" + "json-stringify-safe": "5.0.1", + "request": "2.75.0", + "timespan": "2.3.0" }, "dependencies": { "assert-plus": { @@ -6539,7 +6538,7 @@ "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "dev": true, "requires": { - "hoek": "2.x.x" + "hoek": "2.16.3" } }, "caseless": { @@ -6556,7 +6555,7 @@ "dev": true, "optional": true, "requires": { - "boom": "2.x.x" + "boom": "2.10.1" } }, "form-data": { @@ -6566,9 +6565,9 @@ "dev": true, "optional": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.11" + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" } }, "har-validator": { @@ -6578,10 +6577,10 @@ "dev": true, "optional": true, "requires": { - "chalk": "^1.1.1", - "commander": "^2.9.0", - "is-my-json-valid": "^2.12.4", - "pinkie-promise": "^2.0.0" + "chalk": "1.1.3", + "commander": "2.11.0", + "is-my-json-valid": "2.17.2", + "pinkie-promise": "2.0.1" } }, "hawk": { @@ -6591,10 +6590,10 @@ "dev": true, "optional": true, "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" } }, "hoek": { @@ -6610,9 +6609,9 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.14.1" } }, "node-uuid": { @@ -6636,27 +6635,27 @@ "dev": true, "optional": true, "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "bl": "~1.1.2", - "caseless": "~0.11.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.0.0", - "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", - "node-uuid": "~1.4.7", - "oauth-sign": "~0.8.1", - "qs": "~6.2.0", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "~0.4.1" + "aws-sign2": "0.6.0", + "aws4": "1.7.0", + "bl": "1.1.2", + "caseless": "0.11.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.0.0", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "node-uuid": "1.4.8", + "oauth-sign": "0.8.2", + "qs": "6.2.3", + "stringstream": "0.0.5", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.4.3" } }, "sntp": { @@ -6666,7 +6665,7 @@ "dev": true, "optional": true, "requires": { - "hoek": "2.x.x" + "hoek": "2.16.3" } }, "tunnel-agent": { @@ -6702,7 +6701,7 @@ "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", "dev": true, "requires": { - "js-tokens": "^3.0.0" + "js-tokens": "3.0.2" } }, "loud-rejection": { @@ -6711,8 +6710,8 @@ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", "dev": true, "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.2" } }, "lru-cache": { @@ -6721,8 +6720,8 @@ "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", "dev": true, "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" + "pseudomap": "1.0.2", + "yallist": "2.1.2" } }, "mailcomposer": { @@ -6743,15 +6742,15 @@ "dev": true, "optional": true, "requires": { - "async": "~2.1.2", - "debug": "~2.2.0", - "form-data": "~2.1.1", - "inflection": "~1.10.0", - "is-stream": "^1.1.0", - "path-proxy": "~1.0.0", - "proxy-agent": "~2.0.0", - "q": "~1.4.0", - "tsscmp": "~1.0.0" + "async": "2.1.5", + "debug": "2.2.0", + "form-data": "2.1.4", + "inflection": "1.10.0", + "is-stream": "1.1.0", + "path-proxy": "1.0.0", + "proxy-agent": "2.0.0", + "q": "1.4.1", + "tsscmp": "1.0.5" }, "dependencies": { "async": { @@ -6761,7 +6760,7 @@ "dev": true, "optional": true, "requires": { - "lodash": "^4.14.0" + "lodash": "4.17.10" } }, "debug": { @@ -6781,9 +6780,9 @@ "dev": true, "optional": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" } }, "ms": { @@ -6801,7 +6800,7 @@ "integrity": "sha1-V7713IXSOSO6I3ZzJNjo+PPZaUs=", "dev": true, "requires": { - "kind-of": "^3.1.0" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -6810,7 +6809,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -6833,7 +6832,7 @@ "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true, "requires": { - "object-visit": "^1.0.0" + "object-visit": "1.0.1" } }, "md5.js": { @@ -6842,8 +6841,8 @@ "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "dev": true, "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" + "hash-base": "3.0.4", + "inherits": "2.0.3" } }, "media-typer": { @@ -6858,7 +6857,7 @@ "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "mimic-fn": "1.2.0" } }, "memory-fs": { @@ -6867,8 +6866,8 @@ "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", "dev": true, "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" + "errno": "0.1.7", + "readable-stream": "2.3.3" } }, "meow": { @@ -6877,15 +6876,15 @@ "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", "dev": true, "requires": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0", - "yargs-parser": "^10.0.0" + "camelcase-keys": "4.2.0", + "decamelize-keys": "1.1.0", + "loud-rejection": "1.6.0", + "minimist-options": "3.0.2", + "normalize-package-data": "2.4.0", + "read-pkg-up": "3.0.0", + "redent": "2.0.0", + "trim-newlines": "2.0.0", + "yargs-parser": "10.0.0" } }, "merge": { @@ -6912,19 +6911,19 @@ "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" + "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.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.7", + "object.pick": "1.3.0", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" } }, "miller-rabin": { @@ -6933,8 +6932,8 @@ "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", "dev": true, "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" + "bn.js": "4.11.8", + "brorand": "1.1.0" } }, "mime": { @@ -6955,7 +6954,7 @@ "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "dev": true, "requires": { - "mime-db": "~1.33.0" + "mime-db": "1.33.0" } }, "mimic-fn": { @@ -6970,7 +6969,7 @@ "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", "dev": true, "requires": { - "dom-walk": "^0.1.0" + "dom-walk": "0.1.1" } }, "minimalistic-assert": { @@ -6991,7 +6990,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.8" } }, "minimist": { @@ -7006,8 +7005,8 @@ "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" + "arrify": "1.0.1", + "is-plain-obj": "1.1.0" } }, "mixin-deep": { @@ -7016,8 +7015,8 @@ "integrity": "sha512-dgaCvoh6i1nosAUBKb0l0pfJ78K8+S9fluyIR2YvAeUD/QuMahnFnF3xYty5eYXMjhGSsB0DsW6A0uAZyetoAg==", "dev": true, "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" + "for-in": "1.0.2", + "is-extendable": "1.0.1" }, "dependencies": { "is-extendable": { @@ -7026,7 +7025,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "^2.0.4" + "is-plain-object": "2.0.4" } } } @@ -7060,8 +7059,8 @@ "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", "dev": true, "requires": { - "dns-packet": "^1.3.1", - "thunky": "^1.0.2" + "dns-packet": "1.3.1", + "thunky": "1.0.2" } }, "multicast-dns-service-types": { @@ -7091,17 +7090,17 @@ "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" + "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.1.0", + "object.pick": "1.3.0", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" }, "dependencies": { "kind-of": { @@ -7149,8 +7148,8 @@ "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", "dev": true, "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" + "encoding": "0.1.12", + "is-stream": "1.1.0" } }, "node-forge": { @@ -7165,19 +7164,19 @@ "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" + "fstream": "1.0.11", + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "nopt": "3.0.6", + "npmlog": "4.1.2", + "osenv": "0.1.5", + "request": "2.85.0", + "rimraf": "2.6.2", + "semver": "5.3.0", + "tar": "2.2.1", + "which": "1.3.0" }, "dependencies": { "semver": { @@ -7194,28 +7193,28 @@ "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", "dev": true, "requires": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^1.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", + "assert": "1.4.1", + "browserify-zlib": "0.2.0", + "buffer": "4.9.1", + "console-browserify": "1.1.0", + "constants-browserify": "1.0.0", + "crypto-browserify": "3.12.0", + "domain-browser": "1.2.0", + "events": "1.1.1", + "https-browserify": "1.0.0", + "os-browserify": "0.3.0", "path-browserify": "0.0.0", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", + "process": "0.11.10", + "punycode": "1.4.1", + "querystring-es3": "0.2.1", + "readable-stream": "2.3.3", + "stream-browserify": "2.0.1", + "stream-http": "2.8.1", + "string_decoder": "1.0.3", + "timers-browserify": "2.0.10", "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.10.3", + "url": "0.11.0", + "util": "0.10.3", "vm-browserify": "0.0.4" }, "dependencies": { @@ -7225,9 +7224,9 @@ "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" + "base64-js": "1.3.0", + "ieee754": "1.1.11", + "isarray": "1.0.0" } }, "process": { @@ -7244,10 +7243,10 @@ "integrity": "sha512-MIBs+AAd6dJ2SklbbE8RUDRlIVhU8MaNLh1A9SUZDUHPiZkWLFde6UNwG41yQHZEToHgJMXqyVZ9UcS/ReOVTg==", "dev": true, "requires": { - "growly": "^1.3.0", - "semver": "^5.4.1", - "shellwords": "^0.1.1", - "which": "^1.3.0" + "growly": "1.3.0", + "semver": "5.5.0", + "shellwords": "0.1.1", + "which": "1.3.0" } }, "node-resemble-js": { @@ -7257,7 +7256,7 @@ "dev": true, "requires": { "jpeg-js": "0.2.0", - "pngjs": "~2.2.0" + "pngjs": "2.2.0" }, "dependencies": { "pngjs": { @@ -7274,25 +7273,25 @@ "integrity": "sha512-QFHfrZl6lqRU3csypwviz2XLgGNOoWQbo2GOvtsfQqOfL4cy1BtWnhx/XUeAO9LT3ahBzSRXcEO6DdvAH9DzSg==", "dev": true, "requires": { - "async-foreach": "^0.1.3", - "chalk": "^1.1.1", - "cross-spawn": "^3.0.0", - "gaze": "^1.0.0", - "get-stdin": "^4.0.1", - "glob": "^7.0.3", - "in-publish": "^2.0.0", - "lodash.assign": "^4.2.0", - "lodash.clonedeep": "^4.3.2", - "lodash.mergewith": "^4.6.0", - "meow": "^3.7.0", - "mkdirp": "^0.5.1", - "nan": "^2.10.0", - "node-gyp": "^3.3.1", - "npmlog": "^4.0.0", - "request": "~2.79.0", - "sass-graph": "^2.2.4", - "stdout-stream": "^1.4.0", - "true-case-path": "^1.0.2" + "async-foreach": "0.1.3", + "chalk": "1.1.3", + "cross-spawn": "3.0.1", + "gaze": "1.1.2", + "get-stdin": "4.0.1", + "glob": "7.1.2", + "in-publish": "2.0.0", + "lodash.assign": "4.2.0", + "lodash.clonedeep": "4.5.0", + "lodash.mergewith": "4.6.1", + "meow": "3.7.0", + "mkdirp": "0.5.1", + "nan": "2.10.0", + "node-gyp": "3.6.2", + "npmlog": "4.1.2", + "request": "2.79.0", + "sass-graph": "2.2.4", + "stdout-stream": "1.4.0", + "true-case-path": "1.0.2" }, "dependencies": { "assert-plus": { @@ -7313,7 +7312,7 @@ "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "dev": true, "requires": { - "hoek": "2.x.x" + "hoek": "2.16.3" } }, "camelcase": { @@ -7328,8 +7327,8 @@ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" + "camelcase": "2.1.1", + "map-obj": "1.0.1" } }, "caseless": { @@ -7344,8 +7343,8 @@ "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", "dev": true, "requires": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" + "lru-cache": "4.1.2", + "which": "1.3.0" } }, "cryptiles": { @@ -7354,7 +7353,7 @@ "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", "dev": true, "requires": { - "boom": "2.x.x" + "boom": "2.10.1" } }, "find-up": { @@ -7363,8 +7362,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" } }, "form-data": { @@ -7373,9 +7372,9 @@ "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", "dev": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" } }, "gaze": { @@ -7384,7 +7383,7 @@ "integrity": "sha1-hHIkZ3rbiHDWeSV+0ziP22HkAQU=", "dev": true, "requires": { - "globule": "^1.0.0" + "globule": "1.2.0" } }, "get-stdin": { @@ -7399,9 +7398,9 @@ "integrity": "sha1-HcScaCLdnoovoAuiopUAboZkvQk=", "dev": true, "requires": { - "glob": "~7.1.1", - "lodash": "~4.17.4", - "minimatch": "~3.0.2" + "glob": "7.1.2", + "lodash": "4.17.10", + "minimatch": "3.0.4" } }, "har-validator": { @@ -7410,10 +7409,10 @@ "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", "dev": true, "requires": { - "chalk": "^1.1.1", - "commander": "^2.9.0", - "is-my-json-valid": "^2.12.4", - "pinkie-promise": "^2.0.0" + "chalk": "1.1.3", + "commander": "2.11.0", + "is-my-json-valid": "2.17.2", + "pinkie-promise": "2.0.1" } }, "hawk": { @@ -7422,10 +7421,10 @@ "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", "dev": true, "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" } }, "hoek": { @@ -7440,9 +7439,9 @@ "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", "dev": true, "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.14.1" } }, "indent-string": { @@ -7451,7 +7450,7 @@ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, "requires": { - "repeating": "^2.0.0" + "repeating": "2.0.1" } }, "load-json-file": { @@ -7460,11 +7459,11 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" } }, "map-obj": { @@ -7479,16 +7478,16 @@ "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" + "camelcase-keys": "2.1.0", + "decamelize": "1.2.0", + "loud-rejection": "1.6.0", + "map-obj": "1.0.1", + "minimist": "1.2.0", + "normalize-package-data": "2.4.0", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "redent": "1.0.0", + "trim-newlines": "1.0.0" } }, "object-assign": { @@ -7503,7 +7502,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "1.3.1" } }, "path-exists": { @@ -7512,7 +7511,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "^2.0.0" + "pinkie-promise": "2.0.1" } }, "path-type": { @@ -7521,9 +7520,9 @@ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" } }, "pify": { @@ -7544,9 +7543,9 @@ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" } }, "read-pkg-up": { @@ -7555,8 +7554,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" + "find-up": "1.1.2", + "read-pkg": "1.1.0" } }, "redent": { @@ -7565,8 +7564,8 @@ "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", "dev": true, "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" + "indent-string": "2.1.0", + "strip-indent": "1.0.1" } }, "request": { @@ -7575,26 +7574,26 @@ "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" + "aws-sign2": "0.6.0", + "aws4": "1.7.0", + "caseless": "0.11.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "qs": "6.3.2", + "stringstream": "0.0.5", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.4.3", + "uuid": "3.2.1" } }, "sntp": { @@ -7603,7 +7602,7 @@ "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", "dev": true, "requires": { - "hoek": "2.x.x" + "hoek": "2.16.3" } }, "strip-bom": { @@ -7612,7 +7611,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "^0.2.0" + "is-utf8": "0.2.1" } }, "strip-indent": { @@ -7621,7 +7620,7 @@ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", "dev": true, "requires": { - "get-stdin": "^4.0.1" + "get-stdin": "4.0.1" } }, "trim-newlines": { @@ -7650,7 +7649,7 @@ "integrity": "sha1-dSWih1Z36lNHhKXhCseJVhOWFN8=", "dev": true, "requires": { - "is": "^3.2.1" + "is": "3.2.1" } }, "nodemailer": { @@ -7676,8 +7675,8 @@ "dev": true, "optional": true, "requires": { - "ip": "^1.1.2", - "smart-buffer": "^1.0.4" + "ip": "1.1.5", + "smart-buffer": "1.1.15" } } } @@ -7744,7 +7743,7 @@ "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", "dev": true, "requires": { - "abbrev": "1" + "abbrev": "1.1.1" } }, "normalize-package-data": { @@ -7753,10 +7752,10 @@ "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" + "hosted-git-info": "2.6.0", + "is-builtin-module": "1.0.0", + "semver": "5.5.0", + "validate-npm-package-license": "3.0.3" } }, "normalize-path": { @@ -7765,7 +7764,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "^1.0.1" + "remove-trailing-separator": "1.1.0" } }, "npm-run-path": { @@ -7774,7 +7773,7 @@ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { - "path-key": "^2.0.0" + "path-key": "2.0.1" } }, "npmlog": { @@ -7783,10 +7782,10 @@ "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" } }, "null-check": { @@ -7825,9 +7824,9 @@ "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", "dev": true, "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.2.2" }, "dependencies": { "define-property": { @@ -7836,7 +7835,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "is-accessor-descriptor": { @@ -7845,7 +7844,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" } }, "is-data-descriptor": { @@ -7854,7 +7853,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" } }, "is-descriptor": { @@ -7863,9 +7862,9 @@ "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" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" }, "dependencies": { "kind-of": { @@ -7882,7 +7881,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -7905,7 +7904,7 @@ "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", "dev": true, "requires": { - "isobject": "^3.0.0" + "isobject": "3.0.1" } }, "object.defaults": { @@ -7914,10 +7913,10 @@ "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" + "array-each": "1.0.1", + "array-slice": "1.1.0", + "for-own": "1.0.0", + "isobject": "3.0.1" } }, "object.map": { @@ -7926,8 +7925,8 @@ "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", "dev": true, "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" + "for-own": "1.0.0", + "make-iterator": "1.0.0" } }, "object.omit": { @@ -7936,8 +7935,8 @@ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" + "for-own": "0.1.5", + "is-extendable": "0.1.1" }, "dependencies": { "for-own": { @@ -7946,7 +7945,7 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { - "for-in": "^1.0.1" + "for-in": "1.0.2" } } } @@ -7957,7 +7956,7 @@ "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "dev": true, "requires": { - "isobject": "^3.0.1" + "isobject": "3.0.1" } }, "obuf": { @@ -7987,7 +7986,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "open": { @@ -8002,7 +8001,7 @@ "integrity": "sha512-bYJHo/LOmoTd+pfiYhfZDnf9zekVJrY+cnS2a5F2x+w5ppvTqObojTP7WiFG+kVZs9Inw+qQ/lw7TroWwhdd2g==", "dev": true, "requires": { - "is-wsl": "^1.1.0" + "is-wsl": "1.1.0" } }, "optimist": { @@ -8011,8 +8010,8 @@ "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" + "minimist": "0.0.10", + "wordwrap": "0.0.2" }, "dependencies": { "minimist": { @@ -8030,12 +8029,12 @@ "dev": true, "optional": true, "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" }, "dependencies": { "wordwrap": { @@ -8053,9 +8052,9 @@ "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", "dev": true, "requires": { - "end-of-stream": "~0.1.5", - "sequencify": "~0.0.7", - "stream-consume": "~0.1.0" + "end-of-stream": "0.1.5", + "sequencify": "0.0.7", + "stream-consume": "0.1.0" } }, "ordered-read-streams": { @@ -8070,7 +8069,7 @@ "integrity": "sha1-kUf5P6FpbQS+YeAb1QuurKZWvTs=", "dev": true, "requires": { - "url-parse": "1.0.x" + "url-parse": "1.0.5" }, "dependencies": { "url-parse": { @@ -8079,8 +8078,8 @@ "integrity": "sha1-CFSGBCKv3P7+tsllxmLUgAFpkns=", "dev": true, "requires": { - "querystringify": "0.0.x", - "requires-port": "1.0.x" + "querystringify": "0.0.4", + "requires-port": "1.0.0" } } } @@ -8109,9 +8108,9 @@ "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" } }, "os-tmpdir": { @@ -8126,8 +8125,8 @@ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" } }, "p-finally": { @@ -8142,7 +8141,7 @@ "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", "dev": true, "requires": { - "p-try": "^1.0.0" + "p-try": "1.0.0" } }, "p-locate": { @@ -8151,7 +8150,7 @@ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { - "p-limit": "^1.1.0" + "p-limit": "1.2.0" } }, "p-map": { @@ -8173,15 +8172,15 @@ "dev": true, "optional": true, "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3", - "get-uri": "2", - "http-proxy-agent": "1", - "https-proxy-agent": "1", - "pac-resolver": "~2.0.0", - "raw-body": "2", - "socks-proxy-agent": "2" + "agent-base": "2.1.1", + "debug": "2.6.9", + "extend": "3.0.1", + "get-uri": "2.0.1", + "http-proxy-agent": "1.0.0", + "https-proxy-agent": "1.0.0", + "pac-resolver": "2.0.0", + "raw-body": "2.3.2", + "socks-proxy-agent": "2.1.1" }, "dependencies": { "agent-base": { @@ -8190,8 +8189,8 @@ "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "dev": true, "requires": { - "extend": "~3.0.0", - "semver": "~5.0.1" + "extend": "3.0.1", + "semver": "5.0.3" } }, "https-proxy-agent": { @@ -8201,9 +8200,9 @@ "dev": true, "optional": true, "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3" + "agent-base": "2.1.1", + "debug": "2.6.9", + "extend": "3.0.1" } }, "semver": { @@ -8221,11 +8220,11 @@ "dev": true, "optional": true, "requires": { - "co": "~3.0.6", - "degenerator": "~1.0.2", + "co": "3.0.6", + "degenerator": "1.0.4", "ip": "1.0.1", - "netmask": "~1.0.4", - "thunkify": "~2.1.1" + "netmask": "1.0.6", + "thunkify": "2.1.2" }, "dependencies": { "co": { @@ -8256,11 +8255,11 @@ "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "dev": true, "requires": { - "asn1.js": "^4.0.0", - "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3" + "asn1.js": "4.10.1", + "browserify-aes": "1.2.0", + "create-hash": "1.2.0", + "evp_bytestokey": "1.0.3", + "pbkdf2": "3.0.16" } }, "parse-bmfont-ascii": { @@ -8281,8 +8280,8 @@ "integrity": "sha1-1rZqNxr9OcUAfZ8O6yYqTyzOe3w=", "dev": true, "requires": { - "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" + "xml-parse-from-string": "1.0.1", + "xml2js": "0.4.19" } }, "parse-filepath": { @@ -8291,9 +8290,9 @@ "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", "dev": true, "requires": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" + "is-absolute": "1.0.0", + "map-cache": "0.2.2", + "path-root": "0.1.1" } }, "parse-glob": { @@ -8302,10 +8301,10 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" }, "dependencies": { "is-extglob": { @@ -8320,7 +8319,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } } } @@ -8331,7 +8330,7 @@ "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", "dev": true, "requires": { - "for-each": "^0.3.2", + "for-each": "0.3.2", "trim": "0.0.1" } }, @@ -8341,8 +8340,8 @@ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "error-ex": "1.3.1", + "json-parse-better-errors": "1.0.2" } }, "parse-passwd": { @@ -8357,7 +8356,7 @@ "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", "dev": true, "requires": { - "better-assert": "~1.0.0" + "better-assert": "1.0.2" } }, "parseuri": { @@ -8366,7 +8365,7 @@ "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", "dev": true, "requires": { - "better-assert": "~1.0.0" + "better-assert": "1.0.2" } }, "parseurl": { @@ -8387,8 +8386,8 @@ "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", "dev": true, "requires": { - "process": "^0.11.1", - "util": "^0.10.3" + "process": "0.11.10", + "util": "0.10.3" }, "dependencies": { "process": { @@ -8448,7 +8447,7 @@ "dev": true, "optional": true, "requires": { - "inflection": "~1.3.0" + "inflection": "1.3.8" }, "dependencies": { "inflection": { @@ -8466,7 +8465,7 @@ "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", "dev": true, "requires": { - "path-root-regex": "^0.1.0" + "path-root-regex": "0.1.2" } }, "path-root-regex": { @@ -8487,7 +8486,7 @@ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "^3.0.0" + "pify": "3.0.0" } }, "pbkdf2": { @@ -8496,11 +8495,11 @@ "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", "dev": true, "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "ripemd160": "2.0.2", + "safe-buffer": "5.1.1", + "sha.js": "2.4.11" } }, "pend": { @@ -8521,15 +8520,15 @@ "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=", "dev": true, "requires": { - "es6-promise": "^4.0.3", - "extract-zip": "^1.6.5", - "fs-extra": "^1.0.0", - "hasha": "^2.2.0", - "kew": "^0.7.0", - "progress": "^1.1.8", - "request": "^2.81.0", - "request-progress": "^2.0.1", - "which": "^1.2.10" + "es6-promise": "4.2.4", + "extract-zip": "1.6.6", + "fs-extra": "1.0.0", + "hasha": "2.2.0", + "kew": "0.7.0", + "progress": "1.1.8", + "request": "2.85.0", + "request-progress": "2.0.1", + "which": "1.3.0" }, "dependencies": { "fs-extra": { @@ -8538,9 +8537,9 @@ "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0" + "graceful-fs": "4.1.11", + "jsonfile": "2.4.0", + "klaw": "1.3.1" } } } @@ -8563,7 +8562,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "^2.0.0" + "pinkie": "2.0.4" } }, "pixelmatch": { @@ -8572,7 +8571,7 @@ "integrity": "sha1-j0fc7FARtHe2fbA8JDvB8wheiFQ=", "dev": true, "requires": { - "pngjs": "^3.0.0" + "pngjs": "3.3.3" } }, "pkg-dir": { @@ -8581,7 +8580,7 @@ "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", "dev": true, "requires": { - "find-up": "^2.1.0" + "find-up": "2.1.0" } }, "plugin-error": { @@ -8590,10 +8589,10 @@ "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==", "dev": true, "requires": { - "ansi-colors": "^1.0.1", - "arr-diff": "^4.0.0", - "arr-union": "^3.1.0", - "extend-shallow": "^3.0.2" + "ansi-colors": "1.1.0", + "arr-diff": "4.0.0", + "arr-union": "3.1.0", + "extend-shallow": "3.0.2" }, "dependencies": { "extend-shallow": { @@ -8602,8 +8601,8 @@ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" } }, "is-extendable": { @@ -8612,7 +8611,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "^2.0.4" + "is-plain-object": "2.0.4" } } } @@ -8629,9 +8628,9 @@ "integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=", "dev": true, "requires": { - "async": "^1.5.2", - "debug": "^2.2.0", - "mkdirp": "0.5.x" + "async": "1.5.2", + "debug": "2.6.9", + "mkdirp": "0.5.1" }, "dependencies": { "async": { @@ -8696,7 +8695,7 @@ "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "dev": true, "requires": { - "asap": "~2.0.3" + "asap": "2.0.6" } }, "promise-polyfill": { @@ -8711,9 +8710,9 @@ "integrity": "sha512-4ec7bY1Y66LymSUOH/zARVYObB23AT2h8cf6e/O6ZALB/N0sqZFEx7rq6EYPX2MkOdKORuooI/H5k9TlR4q7kQ==", "dev": true, "requires": { - "fbjs": "^0.8.16", - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1" }, "dependencies": { "object-assign": { @@ -8730,7 +8729,7 @@ "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", "dev": true, "requires": { - "forwarded": "~0.1.2", + "forwarded": "0.1.2", "ipaddr.js": "1.6.0" } }, @@ -8741,14 +8740,14 @@ "dev": true, "optional": true, "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3", - "http-proxy-agent": "1", - "https-proxy-agent": "1", - "lru-cache": "~2.6.5", - "pac-proxy-agent": "1", - "socks-proxy-agent": "2" + "agent-base": "2.1.1", + "debug": "2.6.9", + "extend": "3.0.1", + "http-proxy-agent": "1.0.0", + "https-proxy-agent": "1.0.0", + "lru-cache": "2.6.5", + "pac-proxy-agent": "1.1.0", + "socks-proxy-agent": "2.1.1" }, "dependencies": { "agent-base": { @@ -8757,8 +8756,8 @@ "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "dev": true, "requires": { - "extend": "~3.0.0", - "semver": "~5.0.1" + "extend": "3.0.1", + "semver": "5.0.3" } }, "https-proxy-agent": { @@ -8768,9 +8767,9 @@ "dev": true, "optional": true, "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3" + "agent-base": "2.1.1", + "debug": "2.6.9", + "extend": "3.0.1" } }, "lru-cache": { @@ -8812,11 +8811,11 @@ "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", "dev": true, "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1" + "bn.js": "4.11.8", + "browserify-rsa": "4.0.1", + "create-hash": "1.2.0", + "parse-asn1": "5.1.1", + "randombytes": "2.0.6" } }, "punycode": { @@ -8831,14 +8830,14 @@ "integrity": "sha512-wx10aPQPpGJVxdB6yoDSLm9p4rCwARUSLMVV0bx++owuqkvviXKyiFM3EWsywaFmjOKNPXacIjplF7xhHiFP3w==", "dev": true, "requires": { - "debug": "^2.6.8", - "extract-zip": "^1.6.5", - "https-proxy-agent": "^2.1.0", - "mime": "^1.3.4", - "progress": "^2.0.0", - "proxy-from-env": "^1.0.0", - "rimraf": "^2.6.1", - "ws": "^3.0.0" + "debug": "2.6.9", + "extract-zip": "1.6.6", + "https-proxy-agent": "2.2.1", + "mime": "1.6.0", + "progress": "2.0.0", + "proxy-from-env": "1.0.0", + "rimraf": "2.6.2", + "ws": "3.3.3" }, "dependencies": { "progress": { @@ -8898,7 +8897,7 @@ "integrity": "sha512-pDP/NMRAXoTfrhCfyfSEwJAKLaxBU9eApMeBPB1TkDouZmvPerIClV8lTAd+uF8ZiTaVl69e1FCxQrAd/VTjGw==", "dev": true, "requires": { - "performance-now": "^2.1.0" + "performance-now": "2.1.0" } }, "randomatic": { @@ -8907,8 +8906,8 @@ "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", "dev": true, "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "is-number": "3.0.0", + "kind-of": "4.0.0" }, "dependencies": { "kind-of": { @@ -8917,7 +8916,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -8928,7 +8927,7 @@ "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", "dev": true, "requires": { - "safe-buffer": "^5.1.0" + "safe-buffer": "5.1.1" } }, "randomfill": { @@ -8937,8 +8936,8 @@ "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", "dev": true, "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" + "randombytes": "2.0.6", + "safe-buffer": "5.1.1" } }, "range-parser": { @@ -8974,7 +8973,7 @@ "depd": "1.1.1", "inherits": "2.0.3", "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" + "statuses": "1.4.0" } }, "iconv-lite": { @@ -8997,11 +8996,11 @@ "integrity": "sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=", "dev": true, "requires": { - "create-react-class": "^15.6.0", - "fbjs": "^0.8.9", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.0", - "prop-types": "^15.5.10" + "create-react-class": "15.6.3", + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "prop-types": "15.6.1" }, "dependencies": { "object-assign": { @@ -9018,10 +9017,10 @@ "integrity": "sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=", "dev": true, "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.0", - "prop-types": "^15.5.10" + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "prop-types": "15.6.1" }, "dependencies": { "object-assign": { @@ -9044,10 +9043,10 @@ "integrity": "sha512-5VYNvy301Z0xxGBQhPmDdzOcyEkUG8sU7bpRsAPI4OHgEUkbBFrpjzs/ocNI0m824/lOqTxddXzwgmDJXx3s3Q==", "dev": true, "requires": { - "exenv": "^1.2.0", - "prop-types": "^15.5.10", - "react-lifecycles-compat": "^3.0.0", - "warning": "^3.0.0" + "exenv": "1.2.2", + "prop-types": "15.6.1", + "react-lifecycles-compat": "3.0.2", + "warning": "3.0.0" } }, "react-motion": { @@ -9056,9 +9055,9 @@ "integrity": "sha512-9q3YAvHoUiWlP3cK0v+w1N5Z23HXMj4IF4YuvjvWegWqNPfLXsOBE/V7UvQGpXxHFKRQQcNcVQE31g9SB/6qgQ==", "dev": true, "requires": { - "performance-now": "^0.2.0", - "prop-types": "^15.5.8", - "raf": "^3.1.0" + "performance-now": "0.2.0", + "prop-types": "15.6.1", + "raf": "3.4.0" }, "dependencies": { "performance-now": { @@ -9075,12 +9074,12 @@ "integrity": "sha512-5VI8EV5hdgNgyjfmWzBbdrqUkrVRKlyTKk1sGH3jzM2M2Mhj/seQgPXaz6gVAj2lz/nz688AdTqMO18Lr24Zhg==", "dev": true, "requires": { - "hoist-non-react-statics": "^2.5.0", - "invariant": "^2.0.0", - "lodash": "^4.17.5", - "lodash-es": "^4.17.5", - "loose-envify": "^1.1.0", - "prop-types": "^15.6.0" + "hoist-non-react-statics": "2.5.0", + "invariant": "2.2.4", + "lodash": "4.17.10", + "lodash-es": "4.17.10", + "loose-envify": "1.3.1", + "prop-types": "15.6.1" } }, "react-sticky": { @@ -9089,8 +9088,8 @@ "integrity": "sha512-eXsij6ifE2k1d6eCwQzil0JRS3VLP6BYfiF7qEbVPL3GLqciedGJfbavpXx5T95x5HvhuAA4FChYEDv83r1NyQ==", "dev": true, "requires": { - "prop-types": "^15.5.8", - "raf": "^3.3.0" + "prop-types": "15.6.1", + "raf": "3.4.0" } }, "react-toggle-button": { @@ -9099,8 +9098,8 @@ "integrity": "sha1-obkhQ6oN9BRkL8sUHwh59UW8Wok=", "dev": true, "requires": { - "prop-types": "^15.6.0", - "react-motion": "^0.5.2" + "prop-types": "15.6.1", + "react-motion": "0.5.2" } }, "read-chunk": { @@ -9115,9 +9114,9 @@ "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" + "load-json-file": "4.0.0", + "normalize-package-data": "2.4.0", + "path-type": "3.0.0" } }, "read-pkg-up": { @@ -9126,8 +9125,8 @@ "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" + "find-up": "2.1.0", + "read-pkg": "3.0.0" } }, "readable-stream": { @@ -9136,13 +9135,13 @@ "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" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" } }, "readdirp": { @@ -9151,10 +9150,10 @@ "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" + "graceful-fs": "4.1.11", + "minimatch": "3.0.4", + "readable-stream": "2.3.3", + "set-immediate-shim": "1.0.1" } }, "rechoir": { @@ -9163,7 +9162,7 @@ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { - "resolve": "^1.1.6" + "resolve": "1.5.0" } }, "redent": { @@ -9172,8 +9171,8 @@ "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", "dev": true, "requires": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" + "indent-string": "3.2.0", + "strip-indent": "2.0.0" } }, "redis": { @@ -9183,9 +9182,9 @@ "dev": true, "optional": true, "requires": { - "double-ended-queue": "^2.1.0-0", - "redis-commands": "^1.2.0", - "redis-parser": "^2.6.0" + "double-ended-queue": "2.1.0-0", + "redis-commands": "1.3.5", + "redis-parser": "2.6.0" } }, "redis-commands": { @@ -9208,10 +9207,10 @@ "integrity": "sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==", "dev": true, "requires": { - "lodash": "^4.2.1", - "lodash-es": "^4.2.1", - "loose-envify": "^1.1.0", - "symbol-observable": "^1.0.3" + "lodash": "4.17.10", + "lodash-es": "4.17.10", + "loose-envify": "1.3.1", + "symbol-observable": "1.2.0" } }, "regenerator-runtime": { @@ -9226,7 +9225,7 @@ "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { - "is-equal-shallow": "^0.1.3" + "is-equal-shallow": "0.1.3" } }, "regex-not": { @@ -9235,7 +9234,7 @@ "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", "dev": true, "requires": { - "extend-shallow": "^2.0.1" + "extend-shallow": "2.0.1" } }, "remove-trailing-separator": { @@ -9262,7 +9261,7 @@ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { - "is-finite": "^1.0.0" + "is-finite": "1.0.2" } }, "replace-ext": { @@ -9277,9 +9276,9 @@ "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==", "dev": true, "requires": { - "escape-string-regexp": "^1.0.3", - "object-assign": "^4.0.1", - "readable-stream": "^2.0.2" + "escape-string-regexp": "1.0.5", + "object-assign": "4.1.1", + "readable-stream": "2.3.3" }, "dependencies": { "object-assign": { @@ -9296,28 +9295,28 @@ "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "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", - "hawk": "~6.0.2", - "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", - "stringstream": "~0.0.5", - "tough-cookie": "~2.3.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" + "aws-sign2": "0.7.0", + "aws4": "1.7.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" } }, "request-progress": { @@ -9326,7 +9325,7 @@ "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", "dev": true, "requires": { - "throttleit": "^1.0.0" + "throttleit": "1.0.0" } }, "requestretry": { @@ -9336,10 +9335,10 @@ "dev": true, "optional": true, "requires": { - "extend": "^3.0.0", - "lodash": "^4.15.0", - "request": "^2.74.0", - "when": "^3.7.7" + "extend": "3.0.1", + "lodash": "4.17.10", + "request": "2.85.0", + "when": "3.7.8" } }, "require-directory": { @@ -9372,7 +9371,7 @@ "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", "dev": true, "requires": { - "path-parse": "^1.0.5" + "path-parse": "1.0.5" } }, "resolve-cwd": { @@ -9381,7 +9380,7 @@ "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", "dev": true, "requires": { - "resolve-from": "^3.0.0" + "resolve-from": "3.0.0" } }, "resolve-dir": { @@ -9390,8 +9389,8 @@ "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", "dev": true, "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" + "expand-tilde": "2.0.2", + "global-modules": "1.0.0" } }, "resolve-from": { @@ -9412,7 +9411,7 @@ "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, "requires": { - "align-text": "^0.1.1" + "align-text": "0.1.4" } }, "rimraf": { @@ -9421,7 +9420,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "7.1.2" } }, "ripemd160": { @@ -9430,8 +9429,8 @@ "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", "dev": true, "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" + "hash-base": "3.0.4", + "inherits": "2.0.3" } }, "safe-buffer": { @@ -9458,10 +9457,10 @@ "integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=", "dev": true, "requires": { - "glob": "^7.0.0", - "lodash": "^4.0.0", - "scss-tokenizer": "^0.2.3", - "yargs": "^7.0.0" + "glob": "7.1.2", + "lodash": "4.17.10", + "scss-tokenizer": "0.2.3", + "yargs": "7.1.0" }, "dependencies": { "camelcase": { @@ -9476,9 +9475,9 @@ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" } }, "find-up": { @@ -9487,8 +9486,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" } }, "load-json-file": { @@ -9497,11 +9496,11 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" } }, "os-locale": { @@ -9510,7 +9509,7 @@ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { - "lcid": "^1.0.0" + "lcid": "1.0.0" } }, "parse-json": { @@ -9519,7 +9518,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "1.3.1" } }, "path-exists": { @@ -9528,7 +9527,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "^2.0.0" + "pinkie-promise": "2.0.1" } }, "path-type": { @@ -9537,9 +9536,9 @@ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" } }, "pify": { @@ -9554,9 +9553,9 @@ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" } }, "read-pkg-up": { @@ -9565,8 +9564,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" + "find-up": "1.1.2", + "read-pkg": "1.1.0" } }, "string-width": { @@ -9575,9 +9574,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } }, "strip-bom": { @@ -9586,7 +9585,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "^0.2.0" + "is-utf8": "0.2.1" } }, "which-module": { @@ -9601,19 +9600,19 @@ "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" + "camelcase": "3.0.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "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": { @@ -9622,7 +9621,7 @@ "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", "dev": true, "requires": { - "camelcase": "^3.0.0" + "camelcase": "3.0.0" } } } @@ -9639,8 +9638,8 @@ "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", "dev": true, "requires": { - "js-base64": "^2.1.8", - "source-map": "^0.4.2" + "js-base64": "2.4.3", + "source-map": "0.4.4" }, "dependencies": { "source-map": { @@ -9649,7 +9648,7 @@ "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { - "amdefine": ">=0.0.4" + "amdefine": "1.0.1" } } } @@ -9682,18 +9681,18 @@ "dev": true, "requires": { "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", + "depd": "1.1.2", + "destroy": "1.0.4", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", "fresh": "0.5.2", - "http-errors": "~1.6.2", + "http-errors": "1.6.3", "mime": "1.4.1", "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" + "on-finished": "2.3.0", + "range-parser": "1.2.0", + "statuses": "1.4.0" }, "dependencies": { "mime": { @@ -9716,13 +9715,13 @@ "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", "dev": true, "requires": { - "accepts": "~1.3.4", + "accepts": "1.3.5", "batch": "0.6.1", "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" + "escape-html": "1.0.3", + "http-errors": "1.6.3", + "mime-types": "2.1.18", + "parseurl": "1.3.2" } }, "serve-static": { @@ -9731,9 +9730,9 @@ "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", "dev": true, "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "parseurl": "1.3.2", "send": "0.16.2" } }, @@ -9749,7 +9748,7 @@ "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", "dev": true, "requires": { - "to-object-path": "^0.3.0" + "to-object-path": "0.3.0" } }, "set-immediate-shim": { @@ -9764,10 +9763,10 @@ "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" + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" } }, "setimmediate": { @@ -9788,8 +9787,8 @@ "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "2.0.3", + "safe-buffer": "5.1.1" } }, "shebang-command": { @@ -9798,7 +9797,7 @@ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { - "shebang-regex": "^1.0.0" + "shebang-regex": "1.0.0" } }, "shebang-regex": { @@ -9834,7 +9833,7 @@ "formatio": "1.1.1", "lolex": "1.3.2", "samsam": "1.1.2", - "util": ">=0.10.3 <1" + "util": "0.10.3" } }, "slack-node": { @@ -9844,7 +9843,7 @@ "dev": true, "optional": true, "requires": { - "requestretry": "^1.2.2" + "requestretry": "1.13.0" } }, "smart-buffer": { @@ -9869,14 +9868,14 @@ "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" + "base": "0.11.2", + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.7", + "source-map-resolve": "0.5.1", + "use": "2.0.2" }, "dependencies": { "define-property": { @@ -9885,7 +9884,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "is-accessor-descriptor": { @@ -9894,7 +9893,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -9903,7 +9902,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -9914,7 +9913,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -9923,7 +9922,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -9934,9 +9933,9 @@ "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" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" } }, "kind-of": { @@ -9953,9 +9952,9 @@ "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" } }, "snapdragon-util": { @@ -9964,7 +9963,7 @@ "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { - "kind-of": "^3.2.0" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -9973,7 +9972,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -9984,7 +9983,7 @@ "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "dev": true, "requires": { - "hoek": "4.x.x" + "hoek": "4.2.1" } }, "socket.io": { @@ -9993,11 +9992,11 @@ "integrity": "sha1-waRZDO/4fs8TxyZS8Eb3FrKeYBQ=", "dev": true, "requires": { - "debug": "~2.6.6", - "engine.io": "~3.1.0", - "socket.io-adapter": "~1.1.0", + "debug": "2.6.9", + "engine.io": "3.1.5", + "socket.io-adapter": "1.1.1", "socket.io-client": "2.0.4", - "socket.io-parser": "~3.1.1" + "socket.io-parser": "3.1.3" } }, "socket.io-adapter": { @@ -10016,14 +10015,14 @@ "base64-arraybuffer": "0.1.5", "component-bind": "1.0.0", "component-emitter": "1.2.1", - "debug": "~2.6.4", - "engine.io-client": "~3.1.0", + "debug": "2.6.9", + "engine.io-client": "3.1.6", "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.1.1", + "socket.io-parser": "3.1.3", "to-array": "0.1.4" } }, @@ -10034,8 +10033,8 @@ "dev": true, "requires": { "component-emitter": "1.2.1", - "debug": "~3.1.0", - "has-binary2": "~1.0.2", + "debug": "3.1.0", + "has-binary2": "1.0.2", "isarray": "2.0.1" }, "dependencies": { @@ -10062,8 +10061,8 @@ "integrity": "sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw==", "dev": true, "requires": { - "faye-websocket": "^0.10.0", - "uuid": "^3.0.1" + "faye-websocket": "0.10.0", + "uuid": "3.2.1" } }, "sockjs-client": { @@ -10072,12 +10071,12 @@ "integrity": "sha1-W6vjhrd15M8U51IJEUUmVAFsixI=", "dev": true, "requires": { - "debug": "^2.6.6", + "debug": "2.6.9", "eventsource": "0.1.6", - "faye-websocket": "~0.11.0", - "inherits": "^2.0.1", - "json3": "^3.3.2", - "url-parse": "^1.1.8" + "faye-websocket": "0.11.1", + "inherits": "2.0.3", + "json3": "3.3.2", + "url-parse": "1.4.0" }, "dependencies": { "faye-websocket": { @@ -10086,7 +10085,7 @@ "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", "dev": true, "requires": { - "websocket-driver": ">=0.5.1" + "websocket-driver": "0.7.0" } } } @@ -10097,8 +10096,8 @@ "integrity": "sha1-W4t/x8jzQcU+0FbpKbe/Tei6e1o=", "dev": true, "requires": { - "ip": "^1.1.4", - "smart-buffer": "^1.0.13" + "ip": "1.1.5", + "smart-buffer": "1.1.15" } }, "socks-proxy-agent": { @@ -10107,9 +10106,9 @@ "integrity": "sha512-sFtmYqdUK5dAMh85H0LEVFUCO7OhJJe1/z2x/Z6mxp3s7/QPf1RkZmpZy+BpuU0bEjcV9npqKjq9Y3kwFUjnxw==", "dev": true, "requires": { - "agent-base": "2", - "extend": "3", - "socks": "~1.1.5" + "agent-base": "2.1.1", + "extend": "3.0.1", + "socks": "1.1.10" }, "dependencies": { "agent-base": { @@ -10118,8 +10117,8 @@ "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "dev": true, "requires": { - "extend": "~3.0.0", - "semver": "~5.0.1" + "extend": "3.0.1", + "semver": "5.0.3" } }, "semver": { @@ -10148,11 +10147,11 @@ "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" + "atob": "2.0.3", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" } }, "source-map-url": { @@ -10173,8 +10172,8 @@ "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", "dev": true, "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" + "spdx-expression-parse": "3.0.0", + "spdx-license-ids": "3.0.0" } }, "spdx-exceptions": { @@ -10189,8 +10188,8 @@ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" + "spdx-exceptions": "2.1.0", + "spdx-license-ids": "3.0.0" } }, "spdx-license-ids": { @@ -10205,12 +10204,12 @@ "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=", "dev": true, "requires": { - "debug": "^2.6.8", - "handle-thing": "^1.2.5", - "http-deceiver": "^1.2.7", - "safe-buffer": "^5.0.1", - "select-hose": "^2.0.0", - "spdy-transport": "^2.0.18" + "debug": "2.6.9", + "handle-thing": "1.2.5", + "http-deceiver": "1.2.7", + "safe-buffer": "5.1.1", + "select-hose": "2.0.0", + "spdy-transport": "2.1.0" } }, "spdy-transport": { @@ -10219,13 +10218,13 @@ "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==", "dev": true, "requires": { - "debug": "^2.6.8", - "detect-node": "^2.0.3", - "hpack.js": "^2.1.6", - "obuf": "^1.1.1", - "readable-stream": "^2.2.9", - "safe-buffer": "^5.0.1", - "wbuf": "^1.7.2" + "debug": "2.6.9", + "detect-node": "2.0.3", + "hpack.js": "2.1.6", + "obuf": "1.1.2", + "readable-stream": "2.3.3", + "safe-buffer": "5.1.1", + "wbuf": "1.7.3" } }, "split-string": { @@ -10234,7 +10233,7 @@ "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { - "extend-shallow": "^3.0.0" + "extend-shallow": "3.0.2" }, "dependencies": { "extend-shallow": { @@ -10243,8 +10242,8 @@ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" } }, "is-extendable": { @@ -10253,7 +10252,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "^2.0.4" + "is-plain-object": "2.0.4" } } } @@ -10264,14 +10263,14 @@ "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", "dev": 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", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" } }, "static-extend": { @@ -10280,8 +10279,8 @@ "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", "dev": true, "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" + "define-property": "0.2.5", + "object-copy": "0.1.0" }, "dependencies": { "define-property": { @@ -10290,7 +10289,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "is-accessor-descriptor": { @@ -10299,7 +10298,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -10308,7 +10307,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -10319,7 +10318,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -10328,7 +10327,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -10339,9 +10338,9 @@ "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" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" } }, "kind-of": { @@ -10364,7 +10363,7 @@ "integrity": "sha1-osfIWH5U2UJ+qe2zrD8s1SLfN4s=", "dev": true, "requires": { - "readable-stream": "^2.0.1" + "readable-stream": "2.3.3" } }, "stream-browserify": { @@ -10373,8 +10372,8 @@ "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", "dev": true, "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" + "inherits": "2.0.3", + "readable-stream": "2.3.3" } }, "stream-consume": { @@ -10389,11 +10388,11 @@ "integrity": "sha512-cQ0jo17BLca2r0GfRdZKYAGLU6JRoIWxqSOakUMuKOT6MOK7AAlE856L33QuDmAy/eeOrhLee3dZKX0Uadu93A==", "dev": true, "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.3", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" + "builtin-status-codes": "3.0.0", + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "to-arraybuffer": "1.0.1", + "xtend": "4.0.1" } }, "stream-to": { @@ -10408,7 +10407,7 @@ "integrity": "sha1-JnmdkDqyAlyb1VCsRxcbAPjdgKk=", "dev": true, "requires": { - "stream-to": "~0.2.0" + "stream-to": "0.2.2" } }, "streamroller": { @@ -10417,10 +10416,10 @@ "integrity": "sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ==", "dev": true, "requires": { - "date-format": "^1.2.0", - "debug": "^3.1.0", - "mkdirp": "^0.5.1", - "readable-stream": "^2.3.0" + "date-format": "1.2.0", + "debug": "3.1.0", + "mkdirp": "0.5.1", + "readable-stream": "2.3.3" }, "dependencies": { "debug": { @@ -10440,8 +10439,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" }, "dependencies": { "ansi-regex": { @@ -10462,7 +10461,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "3.0.0" } } } @@ -10473,7 +10472,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.1" } }, "stringstream": { @@ -10488,7 +10487,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "strip-bom": { @@ -10503,7 +10502,7 @@ "integrity": "sha1-elYl7/iisibPiUehElTaluE9rok=", "dev": true, "requires": { - "is-regexp": "^1.0.0" + "is-regexp": "1.0.0" } }, "strip-eof": { @@ -10524,14 +10523,14 @@ "integrity": "sha512-bLW0/lQxTgJ0y+TEllctly+/B0Hz2N82e5AhubP+FIVPSisyOzyFnZzWdqRml7RDwRCsT+EGNN8YYa0VFutT+w==", "dev": true, "requires": { - "buffer": "^5.0.3", - "css-to-react-native": "^2.0.3", - "fbjs": "^0.8.9", - "hoist-non-react-statics": "^1.2.0", - "is-plain-object": "^2.0.1", - "prop-types": "^15.5.4", - "stylis": "^3.4.0", - "supports-color": "^3.2.3" + "buffer": "5.1.0", + "css-to-react-native": "2.1.2", + "fbjs": "0.8.16", + "hoist-non-react-statics": "1.2.0", + "is-plain-object": "2.0.4", + "prop-types": "15.6.1", + "stylis": "3.5.0", + "supports-color": "3.2.3" }, "dependencies": { "hoist-non-react-statics": { @@ -10546,7 +10545,7 @@ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { - "has-flag": "^1.0.0" + "has-flag": "1.0.0" } } } @@ -10581,9 +10580,9 @@ "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" } }, "temp": { @@ -10592,8 +10591,8 @@ "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", "dev": true, "requires": { - "os-tmpdir": "^1.0.0", - "rimraf": "~2.2.6" + "os-tmpdir": "1.0.2", + "rimraf": "2.2.8" }, "dependencies": { "rimraf": { @@ -10622,8 +10621,8 @@ "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", "dev": true, "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" + "readable-stream": "2.3.3", + "xtend": "4.0.1" } }, "thunkify": { @@ -10651,7 +10650,7 @@ "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", "dev": true, "requires": { - "os-homedir": "^1.0.0" + "os-homedir": "1.0.2" } }, "time-stamp": { @@ -10666,7 +10665,7 @@ "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", "dev": true, "requires": { - "setimmediate": "^1.0.4" + "setimmediate": "1.0.5" } }, "timespan": { @@ -10688,7 +10687,7 @@ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { - "os-tmpdir": "~1.0.2" + "os-tmpdir": "1.0.2" } }, "to-array": { @@ -10709,7 +10708,7 @@ "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -10718,7 +10717,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -10729,9 +10728,9 @@ "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", "dev": true, "requires": { - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "regex-not": "^1.0.0" + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "regex-not": "1.0.0" }, "dependencies": { "define-property": { @@ -10740,7 +10739,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "is-accessor-descriptor": { @@ -10749,7 +10748,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -10758,7 +10757,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -10769,7 +10768,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -10778,7 +10777,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -10789,9 +10788,9 @@ "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" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" } }, "kind-of": { @@ -10808,8 +10807,8 @@ "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", "dev": true, "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" + "is-number": "3.0.0", + "repeat-string": "1.6.1" } }, "tough-cookie": { @@ -10818,7 +10817,7 @@ "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "dev": true, "requires": { - "punycode": "^1.4.1" + "punycode": "1.4.1" } }, "traverse-chain": { @@ -10845,7 +10844,7 @@ "integrity": "sha1-fskRMJJHZsf1c74wIMNPj9/QDWI=", "dev": true, "requires": { - "glob": "^6.0.4" + "glob": "6.0.4" }, "dependencies": { "glob": { @@ -10854,11 +10853,11 @@ "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", "dev": true, "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } } } @@ -10882,7 +10881,7 @@ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "requires": { - "safe-buffer": "^5.0.1" + "safe-buffer": "5.1.1" } }, "tweetnacl": { @@ -10898,7 +10897,7 @@ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "prelude-ls": "~1.1.2" + "prelude-ls": "1.1.2" } }, "type-is": { @@ -10908,7 +10907,7 @@ "dev": true, "requires": { "media-typer": "0.3.0", - "mime-types": "~2.1.18" + "mime-types": "2.1.18" } }, "typedarray": { @@ -10929,9 +10928,9 @@ "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", "dev": true, "requires": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" }, "dependencies": { "camelcase": { @@ -10946,9 +10945,9 @@ "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", "window-size": "0.1.0" } } @@ -10967,9 +10966,9 @@ "integrity": "sha1-uVH0q7a9YX5m9j64kUmOORdj4wk=", "dev": true, "requires": { - "source-map": "^0.5.6", - "uglify-js": "^2.8.29", - "webpack-sources": "^1.0.1" + "source-map": "0.5.7", + "uglify-js": "2.8.29", + "webpack-sources": "1.1.0" } }, "ultron": { @@ -10996,10 +10995,10 @@ "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" + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" }, "dependencies": { "set-value": { @@ -11008,10 +11007,10 @@ "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" + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" } } } @@ -11034,8 +11033,8 @@ "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", "dev": true, "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" + "has-value": "0.3.1", + "isobject": "3.0.1" }, "dependencies": { "has-value": { @@ -11044,9 +11043,9 @@ "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", "dev": true, "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" }, "dependencies": { "isobject": { @@ -11080,7 +11079,7 @@ "integrity": "sha1-+QuFhQf4HepNz7s8TD2/orVX+qo=", "dev": true, "requires": { - "punycode": "^2.1.0" + "punycode": "2.1.0" }, "dependencies": { "punycode": { @@ -11121,8 +11120,8 @@ "integrity": "sha512-ERuGxDiQ6Xw/agN4tuoCRbmwRuZP0cJ1lJxJubXr5Q/5cDa78+Dc4wfvtxzhzhkm5VvmW6Mf8EVj9SPGN4l8Lg==", "dev": true, "requires": { - "querystringify": "^2.0.0", - "requires-port": "^1.0.0" + "querystringify": "2.0.0", + "requires-port": "1.0.0" }, "dependencies": { "querystringify": { @@ -11139,7 +11138,7 @@ "integrity": "sha1-260eDJ4p4QXdCx8J9oYvf9tIJyQ=", "dev": true, "requires": { - "ip-regex": "^1.0.1" + "ip-regex": "1.0.3" } }, "use": { @@ -11148,9 +11147,9 @@ "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", "dev": true, "requires": { - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "lazy-cache": "^2.0.2" + "define-property": "0.2.5", + "isobject": "3.0.1", + "lazy-cache": "2.0.2" }, "dependencies": { "define-property": { @@ -11159,7 +11158,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "is-accessor-descriptor": { @@ -11168,7 +11167,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -11177,7 +11176,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -11188,7 +11187,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -11197,7 +11196,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -11208,9 +11207,9 @@ "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" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" } }, "kind-of": { @@ -11233,8 +11232,8 @@ "integrity": "sha1-z1k+9PLRdYdei7ZY6pLhik/QbY4=", "dev": true, "requires": { - "lru-cache": "2.2.x", - "tmp": "0.0.x" + "lru-cache": "2.2.4", + "tmp": "0.0.33" }, "dependencies": { "lru-cache": { @@ -11293,7 +11292,7 @@ "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", "dev": true, "requires": { - "user-home": "^1.1.1" + "user-home": "1.1.1" } }, "validate-npm-package-license": { @@ -11302,8 +11301,8 @@ "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", "dev": true, "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" + "spdx-correct": "3.0.0", + "spdx-expression-parse": "3.0.0" } }, "vary": { @@ -11318,9 +11317,9 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "^1.0.0", + "assert-plus": "1.0.0", "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" + "extsprintf": "1.3.0" } }, "vinyl": { @@ -11329,8 +11328,8 @@ "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", "dev": true, "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", + "clone": "1.0.3", + "clone-stats": "0.0.1", "replace-ext": "0.0.1" } }, @@ -11340,14 +11339,14 @@ "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" + "defaults": "1.0.3", + "glob-stream": "3.1.18", + "glob-watcher": "0.0.6", + "graceful-fs": "3.0.11", + "mkdirp": "0.5.1", + "strip-bom": "1.0.0", + "through2": "0.6.5", + "vinyl": "0.4.6" }, "dependencies": { "clone": { @@ -11362,7 +11361,7 @@ "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", "dev": true, "requires": { - "natives": "^1.1.0" + "natives": "1.1.1" } }, "isarray": { @@ -11377,10 +11376,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -11395,8 +11394,8 @@ "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", "dev": true, "requires": { - "first-chunk-stream": "^1.0.0", - "is-utf8": "^0.2.0" + "first-chunk-stream": "1.0.0", + "is-utf8": "0.2.1" } }, "through2": { @@ -11405,8 +11404,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "readable-stream": "1.0.34", + "xtend": "4.0.1" } }, "vinyl": { @@ -11415,8 +11414,8 @@ "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", "dev": true, "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" + "clone": "0.2.0", + "clone-stats": "0.0.1" } } } @@ -11427,7 +11426,7 @@ "integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=", "dev": true, "requires": { - "source-map": "^0.5.1" + "source-map": "0.5.7" } }, "vm-browserify": { @@ -11451,7 +11450,7 @@ "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=", "dev": true, "requires": { - "loose-envify": "^1.0.0" + "loose-envify": "1.3.1" } }, "watchpack": { @@ -11460,9 +11459,9 @@ "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", "dev": true, "requires": { - "chokidar": "^2.0.2", - "graceful-fs": "^4.1.2", - "neo-async": "^2.5.0" + "chokidar": "2.0.3", + "graceful-fs": "4.1.11", + "neo-async": "2.5.1" } }, "wbuf": { @@ -11471,7 +11470,7 @@ "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", "dev": true, "requires": { - "minimalistic-assert": "^1.0.0" + "minimalistic-assert": "1.0.1" } }, "webpack": { @@ -11480,28 +11479,28 @@ "integrity": "sha512-3kOFejWqj5ISpJk4Qj/V7w98h9Vl52wak3CLiw/cDOfbVTq7FeoZ0SdoHHY9PYlHr50ZS42OfvzE2vB4nncKQg==", "dev": true, "requires": { - "acorn": "^5.0.0", - "acorn-dynamic-import": "^2.0.0", - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0", - "async": "^2.1.2", - "enhanced-resolve": "^3.4.0", - "escope": "^3.6.0", - "interpret": "^1.0.0", - "json-loader": "^0.5.4", - "json5": "^0.5.1", - "loader-runner": "^2.3.0", - "loader-utils": "^1.1.0", - "memory-fs": "~0.4.1", - "mkdirp": "~0.5.0", - "node-libs-browser": "^2.0.0", - "source-map": "^0.5.3", - "supports-color": "^4.2.1", - "tapable": "^0.2.7", - "uglifyjs-webpack-plugin": "^0.4.6", - "watchpack": "^1.4.0", - "webpack-sources": "^1.0.1", - "yargs": "^8.0.2" + "acorn": "5.5.3", + "acorn-dynamic-import": "2.0.2", + "ajv": "6.4.0", + "ajv-keywords": "3.1.0", + "async": "2.6.0", + "enhanced-resolve": "3.4.1", + "escope": "3.6.0", + "interpret": "1.1.0", + "json-loader": "0.5.7", + "json5": "0.5.1", + "loader-runner": "2.3.0", + "loader-utils": "1.1.0", + "memory-fs": "0.4.1", + "mkdirp": "0.5.1", + "node-libs-browser": "2.1.0", + "source-map": "0.5.7", + "supports-color": "4.5.0", + "tapable": "0.2.8", + "uglifyjs-webpack-plugin": "0.4.6", + "watchpack": "1.6.0", + "webpack-sources": "1.1.0", + "yargs": "8.0.2" }, "dependencies": { "ajv": { @@ -11510,10 +11509,10 @@ "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=", "dev": true, "requires": { - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0", - "uri-js": "^3.0.2" + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1", + "uri-js": "3.0.2" } }, "cliui": { @@ -11522,9 +11521,9 @@ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" }, "dependencies": { "string-width": { @@ -11533,9 +11532,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } } } @@ -11552,10 +11551,10 @@ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" } }, "parse-json": { @@ -11564,7 +11563,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "1.3.1" } }, "path-type": { @@ -11573,7 +11572,7 @@ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", "dev": true, "requires": { - "pify": "^2.0.0" + "pify": "2.3.0" } }, "pify": { @@ -11588,9 +11587,9 @@ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", "dev": true, "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" } }, "read-pkg-up": { @@ -11599,8 +11598,8 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true, "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" + "find-up": "2.1.0", + "read-pkg": "2.0.0" } }, "supports-color": { @@ -11609,7 +11608,7 @@ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true, "requires": { - "has-flag": "^2.0.0" + "has-flag": "2.0.0" } }, "yargs": { @@ -11618,19 +11617,19 @@ "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", "dev": true, "requires": { - "camelcase": "^4.1.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "read-pkg-up": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^7.0.0" + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" } }, "yargs-parser": { @@ -11639,7 +11638,7 @@ "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", "dev": true, "requires": { - "camelcase": "^4.1.0" + "camelcase": "4.1.0" } } } @@ -11650,11 +11649,11 @@ "integrity": "sha512-FCrqPy1yy/sN6U/SaEZcHKRXGlqU0DUaEBL45jkUYoB8foVb6wCnbIJ1HKIx+qUFTW+3JpVcCJCxZ8VATL4e+A==", "dev": true, "requires": { - "memory-fs": "~0.4.1", - "mime": "^1.5.0", - "path-is-absolute": "^1.0.0", - "range-parser": "^1.0.3", - "time-stamp": "^2.0.0" + "memory-fs": "0.4.1", + "mime": "1.6.0", + "path-is-absolute": "1.0.1", + "range-parser": "1.2.0", + "time-stamp": "2.0.0" }, "dependencies": { "time-stamp": { @@ -11672,30 +11671,30 @@ "dev": true, "requires": { "ansi-html": "0.0.7", - "array-includes": "^3.0.3", - "bonjour": "^3.5.0", - "chokidar": "^2.0.0", - "compression": "^1.5.2", - "connect-history-api-fallback": "^1.3.0", - "debug": "^3.1.0", - "del": "^3.0.0", - "express": "^4.16.2", - "html-entities": "^1.2.0", - "http-proxy-middleware": "~0.17.4", - "import-local": "^1.0.0", + "array-includes": "3.0.3", + "bonjour": "3.5.0", + "chokidar": "2.0.3", + "compression": "1.7.2", + "connect-history-api-fallback": "1.5.0", + "debug": "3.1.0", + "del": "3.0.0", + "express": "4.16.3", + "html-entities": "1.2.1", + "http-proxy-middleware": "0.17.4", + "import-local": "1.0.0", "internal-ip": "1.2.0", - "ip": "^1.1.5", - "killable": "^1.0.0", - "loglevel": "^1.4.1", - "opn": "^5.1.0", - "portfinder": "^1.0.9", - "selfsigned": "^1.9.1", - "serve-index": "^1.7.2", + "ip": "1.1.5", + "killable": "1.0.0", + "loglevel": "1.6.1", + "opn": "5.3.0", + "portfinder": "1.0.13", + "selfsigned": "1.10.2", + "serve-index": "1.9.1", "sockjs": "0.3.19", "sockjs-client": "1.1.4", - "spdy": "^3.4.1", - "strip-ansi": "^3.0.0", - "supports-color": "^5.1.0", + "spdy": "3.4.7", + "strip-ansi": "3.0.1", + "supports-color": "5.4.0", "webpack-dev-middleware": "1.12.2", "yargs": "6.6.0" }, @@ -11712,9 +11711,9 @@ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" } }, "debug": { @@ -11732,8 +11731,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" } }, "has-flag": { @@ -11748,11 +11747,11 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" } }, "os-locale": { @@ -11761,7 +11760,7 @@ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { - "lcid": "^1.0.0" + "lcid": "1.0.0" } }, "parse-json": { @@ -11770,7 +11769,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "1.3.1" } }, "path-exists": { @@ -11779,7 +11778,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "^2.0.0" + "pinkie-promise": "2.0.1" } }, "path-type": { @@ -11788,9 +11787,9 @@ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" } }, "pify": { @@ -11805,9 +11804,9 @@ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" } }, "read-pkg-up": { @@ -11816,8 +11815,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" + "find-up": "1.1.2", + "read-pkg": "1.1.0" } }, "string-width": { @@ -11826,9 +11825,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } }, "strip-bom": { @@ -11837,7 +11836,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "^0.2.0" + "is-utf8": "0.2.1" } }, "supports-color": { @@ -11846,7 +11845,7 @@ "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "3.0.0" } }, "which-module": { @@ -11861,19 +11860,19 @@ "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", "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": "^4.2.0" + "camelcase": "3.0.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "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.1" } }, "yargs-parser": { @@ -11882,7 +11881,7 @@ "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", "dev": true, "requires": { - "camelcase": "^3.0.0" + "camelcase": "3.0.0" } } } @@ -11893,8 +11892,8 @@ "integrity": "sha512-aqYp18kPphgoO5c/+NaUvEeACtZjMESmDChuD3NBciVpah3XpMEU9VAAtIaB1BsfJWWTSdv8Vv1m3T0aRk2dUw==", "dev": true, "requires": { - "source-list-map": "^2.0.0", - "source-map": "~0.6.1" + "source-list-map": "2.0.0", + "source-map": "0.6.1" }, "dependencies": { "source-map": { @@ -11911,8 +11910,8 @@ "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", "dev": true, "requires": { - "http-parser-js": ">=0.4.0", - "websocket-extensions": ">=0.1.1" + "http-parser-js": "0.4.12", + "websocket-extensions": "0.1.3" } }, "websocket-extensions": { @@ -11940,7 +11939,7 @@ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "isexe": "^2.0.0" + "isexe": "2.0.0" } }, "which-module": { @@ -11955,7 +11954,7 @@ "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", "dev": true, "requires": { - "string-width": "^1.0.2" + "string-width": "1.0.2" }, "dependencies": { "string-width": { @@ -11964,9 +11963,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } } } @@ -11989,8 +11988,8 @@ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" + "string-width": "1.0.2", + "strip-ansi": "3.0.1" }, "dependencies": { "string-width": { @@ -11999,9 +11998,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } } } @@ -12018,9 +12017,9 @@ "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", "dev": true, "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" + "async-limiter": "1.0.0", + "safe-buffer": "5.1.1", + "ultron": "1.1.1" } }, "xhr": { @@ -12029,10 +12028,10 @@ "integrity": "sha512-pAIU5vBr9Hiy5cpFIbPnwf0C18ZF86DBsZKrlsf87N5De/JbA6RJ83UP/cv+aljl4S40iRVMqP4pr4sF9Dnj0A==", "dev": true, "requires": { - "global": "~4.3.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" + "global": "4.3.2", + "is-function": "1.0.1", + "parse-headers": "2.0.1", + "xtend": "4.0.1" } }, "xml-parse": { @@ -12053,8 +12052,8 @@ "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", "dev": true, "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" + "sax": "1.2.4", + "xmlbuilder": "9.0.7" } }, "xmlbuilder": { @@ -12100,7 +12099,7 @@ "integrity": "sha512-+DHejWujTVYeMHLff8U96rLc4uE4Emncoftvn5AjhB1Jw1pWxLzgBUT/WYbPrHmy6YPEBTZQx5myHhVcuuu64g==", "dev": true, "requires": { - "camelcase": "^4.1.0" + "camelcase": "4.1.0" } }, "yauzl": { @@ -12109,7 +12108,7 @@ "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", "dev": true, "requires": { - "fd-slicer": "~1.0.1" + "fd-slicer": "1.0.1" } }, "yeast": { From 840808592f103d8e0bfa83060418c8469fe2e908 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 12:56:00 +0530 Subject: [PATCH 034/151] PCHR-3941: Fix linting issues for HR Qual --- hrqual/js/hrqual.js | 109 ++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 55 deletions(-) diff --git a/hrqual/js/hrqual.js b/hrqual/js/hrqual.js index d06ef0a8aa8..06c465c72a2 100644 --- a/hrqual/js/hrqual.js +++ b/hrqual/js/hrqual.js @@ -1,32 +1,32 @@ // Copyright CiviCRM LLC 2013. See http://civicrm.org/licensing (function ($, _) { - $(document).ajaxSuccess(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) + renderSelectBox(oGroups, nameID, categoryDefault, select, nameDefault); - $('.crm-profile-name-hrqual_tab #custom_' + categoryID).change(function() { + $('.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) { + // 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) { + $(':radio[name="' + elementNameCertificationAcquired + '"]').change(function () { + if ($(this).val() == 0) { hideCertificationFields(); - } else if($(this).val()==1) { + } else if ($(this).val() == 1) { showCertificationFields(); } }); @@ -34,62 +34,61 @@ } }); -/** -* 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) { + /** + * 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-")); + 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-")); + } else { + select.find('option').remove().end().append($('').val('').html('-select-')); } select.removeAttr('name').attr('name', 'custom_' + nameID).removeAttr('style'); - $("#custom_" + nameID).replaceWith(select); + $('#custom_' + nameID).replaceWith(select); - //assign the defaults to the "name" field in the Edit mode. + // 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 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(); + 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._)); From e875692e942d3c7849b7ab57d4303405947375d5 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 13:13:03 +0530 Subject: [PATCH 035/151] PCHR-3941: Use RequireJS in HR Qual --- hrqual/hrqual.php | 2 +- hrqual/js/build.js | 9 ++++ hrqual/js/dist/hrqual.min.js | 2 + hrqual/js/hrqual.js | 94 ---------------------------------- hrqual/js/src/hrqual.js | 5 ++ hrqual/js/src/hrqual/app.js | 98 ++++++++++++++++++++++++++++++++++++ 6 files changed, 115 insertions(+), 95 deletions(-) create mode 100644 hrqual/js/build.js create mode 100644 hrqual/js/dist/hrqual.min.js delete mode 100644 hrqual/js/hrqual.js create mode 100644 hrqual/js/src/hrqual.js create mode 100644 hrqual/js/src/hrqual/app.js 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/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 06c465c72a2..00000000000 --- a/hrqual/js/hrqual.js +++ /dev/null @@ -1,94 +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._)); From 307b586e61ef9cba8431e11a522bfa04b9e9ecf5 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 14:11:56 +0530 Subject: [PATCH 036/151] PCHR-3941: Fix linting issues for HR IM --- hrim/js/hrim.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/hrim/js/hrim.js b/hrim/js/hrim.js index d6fc200bb4d..d02b37dfd7c 100644 --- a/hrim/js/hrim.js +++ b/hrim/js/hrim.js @@ -1,45 +1,45 @@ // for contact edit screen (function ($, _) { - $(document).ready(function() { - // Call contactImLink function on page load + $(document).ready(function () { + // Call contactImLink function on page load contactImLink(); }); // for inline edit - $(document).ajaxSuccess(function(event, xhr, settings) { + $(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) { + if (settings.url.search('class_name=CRM_Contact_Page_Inline_IM') > 0) { contactImLink(); } }); - function 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:' + '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() { + $('#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]) { + if (imName) { + var providerName = providerLabel.substr(0, providerLabel.match(/\s[(]/).index); + if (params[providerName]) { // build links of IM address - clickableIM = ''+ imName + ''; + var clickableIM = '' + imName + ''; $(this).find('.crm-contact_im').html(clickableIM); } } } }); - $('.crm-contact_im a').on('click',function() { + $('.crm-contact_im a').on('click', function () { CRM.alert("Having trouble? Click here to discuss", 'Experimental: Instant Messaging', 'notice'); }); } From 51b3ca4c5968726501fd8769fc8a1197f413b154 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 14:16:44 +0530 Subject: [PATCH 037/151] PCHR-3941: Use RequireJS in HR IM --- hrim/hrim.php | 8 +++---- hrim/js/build.js | 9 +++++++ hrim/js/dist/hrim.min.js | 2 ++ hrim/js/hrim.js | 46 ----------------------------------- hrim/js/src/hrim.js | 5 ++++ hrim/js/src/hrim/app.js | 52 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 72 insertions(+), 50 deletions(-) create mode 100644 hrim/js/build.js create mode 100644 hrim/js/dist/hrim.min.js delete mode 100644 hrim/js/hrim.js create mode 100644 hrim/js/src/hrim.js create mode 100644 hrim/js/src/hrim/app.js 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/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 d02b37dfd7c..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 - 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/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._)); From 253fef93eb507365680587a6ca30673b27490fe2 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 14:53:57 +0530 Subject: [PATCH 038/151] PCHR-3941: Use RequireJS in Contact Actions --- .../css/contactactions.css | 2 +- .../hrcontactactionsmenu.php | 2 +- .../js/build.js | 12 ++++ .../js/contactactions.js | 53 ---------------- .../js/dist/contact-actions.min.js | 2 + .../js/src/contact-actions.js | 5 ++ .../js/src/contact-actions/app.js | 61 +++++++++++++++++++ 7 files changed, 82 insertions(+), 55 deletions(-) create mode 100644 uk.co.compucorp.civicrm.hrcontactactionsmenu/js/build.js delete mode 100644 uk.co.compucorp.civicrm.hrcontactactionsmenu/js/contactactions.js create mode 100644 uk.co.compucorp.civicrm.hrcontactactionsmenu/js/dist/contact-actions.min.js create mode 100644 uk.co.compucorp.civicrm.hrcontactactionsmenu/js/src/contact-actions.js create mode 100644 uk.co.compucorp.civicrm.hrcontactactionsmenu/js/src/contact-actions/app.js diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/css/contactactions.css b/uk.co.compucorp.civicrm.hrcontactactionsmenu/css/contactactions.css index a4942b01922..4538a8db599 100644 --- a/uk.co.compucorp.civicrm.hrcontactactionsmenu/css/contactactions.css +++ b/uk.co.compucorp.civicrm.hrcontactactionsmenu/css/contactactions.css @@ -1 +1 @@ -#crm-contact-actions-link.active,#crm-contact-actions-link.active span i{background:#E8EEF0 !important;color:#0071BD !important}.crm_contact-actions{background:#E8EEF0}.crm_contact-actions::before{background:#E8EEF0 !important;border-bottom:none !important;height:20px !important;left:0 !important;top:-15px !important;width:113px !important}.crm_contact-actions .btn{word-break:break-word;white-space:normal !important}.crm_contact-actions span.fa-question-circle{color:#0071BD}.crm_contact-actions__edit-roles{cursor:pointer;display:inline-block;font-size:15px;margin-left:5px;vertical-align:middle}.crm_contact-actions__group .crm_contact-actions__action:not(:last-child){margin-bottom:10px}.crm_contact-actions__panel{display:flex;flex-direction:column;justify-content:space-between;padding:15px}.crm_contact-actions__panel__body{display:flex;min-height:250px}.crm_contact-actions__panel__footer{border-top:1px solid #D3DEE2;margin-top:30px;padding-top:20px}.crm_contact-actions__panel--primary{flex-shrink:0;width:345px}.crm_contact-actions__panel--primary .crm_contact-actions__panel__body{flex-direction:column}.crm_contact-actions__panel--primary .crm_contact-actions__group{width:100%}.crm_contact-actions__panel--primary .crm_contact-actions__group:not(:last-child){margin-bottom:15px}.crm_contact-actions__panel--secondary{background:#fff;min-width:225px}.crm_contact-actions__panel--secondary .crm_contact-actions__panel__body{flex-direction:row}.crm_contact-actions__panel--secondary .crm_contact-actions__group{width:220px}.crm_contact-actions__panel--secondary .crm_contact-actions__group:not(:last-child){margin-right:30px}.crm_contact-actions__user-info{margin-bottom:10px}.crm_contact-actions__wrapper{display:flex} +#crm-contact-actions-link.active,#crm-contact-actions-link.active span i{background:#e8eef0 !important;color:#0071bd !important}.crm_contact-actions{background:#e8eef0}.crm_contact-actions::before{background:#e8eef0 !important;border-bottom:none !important;height:20px !important;left:0 !important;top:-15px !important;width:113px !important}.crm_contact-actions .btn{word-break:break-word;white-space:normal !important}.crm_contact-actions span.fa-question-circle{color:#0071bd}.crm_contact-actions__edit-roles{cursor:pointer;display:inline-block;font-size:15px;margin-left:5px;vertical-align:middle}.crm_contact-actions__group .crm_contact-actions__action:not(:last-child){margin-bottom:10px}.crm_contact-actions__panel{display:flex;flex-direction:column;justify-content:space-between;padding:15px}.crm_contact-actions__panel__body{display:flex;min-height:250px}.crm_contact-actions__panel__footer{border-top:1px solid #d3dee2;margin-top:30px;padding-top:20px}.crm_contact-actions__panel--primary{flex-shrink:0;width:345px}.crm_contact-actions__panel--primary .crm_contact-actions__panel__body{flex-direction:column}.crm_contact-actions__panel--primary .crm_contact-actions__group{width:100%}.crm_contact-actions__panel--primary .crm_contact-actions__group:not(:last-child){margin-bottom:15px}.crm_contact-actions__panel--secondary{background:#fff;min-width:225px}.crm_contact-actions__panel--secondary .crm_contact-actions__panel__body{flex-direction:row}.crm_contact-actions__panel--secondary .crm_contact-actions__group{width:220px}.crm_contact-actions__panel--secondary .crm_contact-actions__group:not(:last-child){margin-right:30px}.crm_contact-actions__user-info{margin-bottom:10px}.crm_contact-actions__wrapper{display:flex} diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/hrcontactactionsmenu.php b/uk.co.compucorp.civicrm.hrcontactactionsmenu/hrcontactactionsmenu.php index 44db818424c..7fe36bd5935 100644 --- a/uk.co.compucorp.civicrm.hrcontactactionsmenu/hrcontactactionsmenu.php +++ b/uk.co.compucorp.civicrm.hrcontactactionsmenu/hrcontactactionsmenu.php @@ -65,7 +65,7 @@ function hrcontactactionsmenu_civicrm_pageRun(&$page) { $page->assign('contactInfo', $contactInfo); CRM_Core_Resources::singleton()->addStyleFile($extName, 'css/contactactions.css'); - CRM_Core_Resources::singleton()->addScriptFile($extName, 'js/contactactions.js'); + CRM_Core_Resources::singleton()->addScriptFile($extName, 'js/dist/contact-actions.min.js', 1000); CRM_Core_Region::instance('contact-page-inline-actions')->update('default', [ 'disabled' => TRUE, diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/build.js b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/build.js new file mode 100644 index 00000000000..e5c9cc8f631 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/build.js @@ -0,0 +1,12 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/contact-actions.min.js', + name: 'contact-actions', + skipModuleInsertion: true, + generateSourceMaps: true, + paths: { + 'common': 'empty:' + } +}) diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/contactactions.js b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/contactactions.js deleted file mode 100644 index c83bf906703..00000000000 --- a/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/contactactions.js +++ /dev/null @@ -1,53 +0,0 @@ -(function ($) { - $(document).ready(function () { - bootstrapContactAccessRightsAppOnReadyEvent(); - markMenuButtonAsActiveWhenPressed(); - showConfirmationDialogWhenDeletingUserAccount(); - }); - - /** - * Listens to the "ready" event once the resources for the - * contact access rights app have been loaded, and then bootstraps it - */ - function bootstrapContactAccessRightsAppOnReadyEvent () { - document.addEventListener('accessRightsReady', function () { - angular.bootstrap('[data-contact-access-rights]', ['access-rights']); - }); - } - - /** - * Toggles the "active" class in "Actions" button - * - * @param {Object} event - */ - function markMenuButtonAsActiveWhenPressed (event) { - $(document).on('click', function (event) { - var $button = $('#crm-contact-actions-link'); - var $target = $(event.target); - - if ($target.is($button) || $button.has($target).length) { - $button.addClass('active'); - } else { - $button.removeClass('active'); - } - }); - } - - /** - * Displays confirmation dialog before deleting user account - */ - function showConfirmationDialogWhenDeletingUserAccount () { - $('[data-delete-user-url]').on('click', function () { - var url = $(this).attr('data-delete-user-url'); - - CRM - .confirm({ - 'title': 'Confirm', - 'message': 'Are you sure you want to delete the user account?' - }) - .on('crmConfirm:yes', function () { - window.location = url; - }); - }); - } -}(CRM.$)); diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/dist/contact-actions.min.js b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/dist/contact-actions.min.js new file mode 100644 index 00000000000..046599ba9a3 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/dist/contact-actions.min.js @@ -0,0 +1,2 @@ +!function(t){define("contact-actions/app",["common/angular"],function(n){"use strict";function c(){document.addEventListener("accessRightsReady",function(){n.bootstrap("[data-contact-access-rights]",["access-rights"])})}function e(n){t(document).on("click",function(n){var c=t("#crm-contact-actions-link"),e=t(n.target);e.is(c)||c.has(e).length?c.addClass("active"):c.removeClass("active")})}function o(){t("[data-delete-user-url]").on("click",function(){var n=t(this).attr("data-delete-user-url");CRM.confirm({title:"Confirm",message:"Are you sure you want to delete the user account?"}).on("crmConfirm:yes",function(){window.location=n})})}t(document).ready(function(){c(),e(),o()})})}(CRM.$),function(t){t(["contact-actions/app"])}(require); +//# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/dist/contact-actions.min.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/src/contact-actions.js b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/src/contact-actions.js new file mode 100644 index 00000000000..fc421cca1b7 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/src/contact-actions.js @@ -0,0 +1,5 @@ +/* eslint-env amd */ + +(function (require) { + require(['contact-actions/app']); +})(require); diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/src/contact-actions/app.js b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/src/contact-actions/app.js new file mode 100644 index 00000000000..f640c497215 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcontactactionsmenu/js/src/contact-actions/app.js @@ -0,0 +1,61 @@ +/* eslint-env amd */ + +(function ($) { + define([ + 'common/angular' + ], function (angular) { + 'use strict'; + + $(document).ready(function () { + bootstrapContactAccessRightsAppOnReadyEvent(); + markMenuButtonAsActiveWhenPressed(); + showConfirmationDialogWhenDeletingUserAccount(); + }); + + /** + * Listens to the "ready" event once the resources for the + * contact access rights app have been loaded, and then bootstraps it + */ + function bootstrapContactAccessRightsAppOnReadyEvent () { + document.addEventListener('accessRightsReady', function () { + angular.bootstrap('[data-contact-access-rights]', ['access-rights']); + }); + } + + /** + * Toggles the "active" class in "Actions" button + * + * @param {Object} event + */ + function markMenuButtonAsActiveWhenPressed (event) { + $(document).on('click', function (event) { + var $button = $('#crm-contact-actions-link'); + var $target = $(event.target); + + if ($target.is($button) || $button.has($target).length) { + $button.addClass('active'); + } else { + $button.removeClass('active'); + } + }); + } + + /** + * Displays confirmation dialog before deleting user account + */ + function showConfirmationDialogWhenDeletingUserAccount () { + $('[data-delete-user-url]').on('click', function () { + var url = $(this).attr('data-delete-user-url'); + + CRM + .confirm({ + 'title': 'Confirm', + 'message': 'Are you sure you want to delete the user account?' + }) + .on('crmConfirm:yes', function () { + window.location = url; + }); + }); + } + }); +}(CRM.$)); From cf6485aa3904f2213132154057817cae9b07e7d8 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 15:23:17 +0530 Subject: [PATCH 039/151] PCHR-3941: Use RequireJS in HR CORE --- .../CRM/HRCore/Page/Reports.php | 2 +- uk.co.compucorp.civicrm.hrcore/hrcore.php | 2 +- uk.co.compucorp.civicrm.hrcore/js/build.js | 9 +++++ .../js/dist/hrcore.min.js | 2 + uk.co.compucorp.civicrm.hrcore/js/hrcore.js | 32 ---------------- .../js/src/hrcore.js | 5 +++ .../js/src/hrcore/app.js | 37 +++++++++++++++++++ .../hrcore}/vendor/iframeResizer.min.js | 0 8 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 uk.co.compucorp.civicrm.hrcore/js/build.js create mode 100644 uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js delete mode 100644 uk.co.compucorp.civicrm.hrcore/js/hrcore.js create mode 100644 uk.co.compucorp.civicrm.hrcore/js/src/hrcore.js create mode 100644 uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js rename uk.co.compucorp.civicrm.hrcore/js/{crm => src/hrcore}/vendor/iframeResizer.min.js (100%) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Page/Reports.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Page/Reports.php index 36e85e8b7e0..6d5fbf9cbc4 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Page/Reports.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Page/Reports.php @@ -6,7 +6,7 @@ class CRM_HRCore_Page_Reports extends CRM_Core_Page { * {@inheritdoc} */ public function run() { - CRM_Core_Resources::singleton()->addScriptFile('uk.co.compucorp.civicrm.hrcore', 'js/crm/vendor/iframeResizer.min.js'); + CRM_Core_Resources::singleton()->addScriptFile('uk.co.compucorp.civicrm.hrcore', 'js/src/hrcore/vendor/iframeResizer.min.js'); $this->assign('reportName', $this->getReportName()); diff --git a/uk.co.compucorp.civicrm.hrcore/hrcore.php b/uk.co.compucorp.civicrm.hrcore/hrcore.php index 5f9183ccb4b..628d7b5cbab 100644 --- a/uk.co.compucorp.civicrm.hrcore/hrcore.php +++ b/uk.co.compucorp.civicrm.hrcore/hrcore.php @@ -297,7 +297,7 @@ function hrcore_civicrm_pageRun($page) { * Implements hook_civicrm_coreResourceList(). */ function hrcore_civicrm_coreResourceList(&$items, $region) { - CRM_Core_Resources::singleton()->addScriptFile('uk.co.compucorp.civicrm.hrcore', 'js/hrcore.js'); + CRM_Core_Resources::singleton()->addScriptFile('uk.co.compucorp.civicrm.hrcore', 'js/dist/hrcore.min.js', 1010); } /** diff --git a/uk.co.compucorp.civicrm.hrcore/js/build.js b/uk.co.compucorp.civicrm.hrcore/js/build.js new file mode 100644 index 00000000000..b185e80fe31 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/js/build.js @@ -0,0 +1,9 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/hrcore.min.js', + name: 'hrcore', + skipModuleInsertion: true, + generateSourceMaps: true +}) diff --git a/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js b/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js new file mode 100644 index 00000000000..e29955f90af --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js @@ -0,0 +1,2 @@ +!function(e,a,t){define("hrcore/app",[],function(){"use strict";!function(){var n;t&&(n=e.location.pathname+"?reset=1&cid="+a.contactId,a.$("#mainTabContainer").on("tabsactivate",function(e,a){var i=a.newTab[0].id.replace("tab_","");t.push({event:"virtual-pageview",virtualPageviewPath:n+"&selectedChild="+i})}))}()})}(window,CRM,"undefined"!=typeof dataLayer?dataLayer:null),function(e){e(["hrcore/app"])}(require); +//# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrcore/js/hrcore.js b/uk.co.compucorp.civicrm.hrcore/js/hrcore.js deleted file mode 100644 index 7e702892113..00000000000 --- a/uk.co.compucorp.civicrm.hrcore/js/hrcore.js +++ /dev/null @@ -1,32 +0,0 @@ -/* global dataLayer */ - -(function (window, CRM, dataLayer) { - trackContactTabVirtualPageviews(); - - /** - * Sends a virtual pageview to Google Analytics whenever the user clicks on - * any of the tabs of the Contact Summary page - * - * The path of the pageview is the Contact Summary page path + the selectedChild - * param's value of the selected tab, thus simulating the user landing - * directly on the tab - */ - function trackContactTabVirtualPageviews () { - var contactPagePath; - - if (!dataLayer) { - return; - } - - contactPagePath = window.location.pathname + '?reset=1&cid=' + CRM.contactId; - - CRM.$('#mainTabContainer').on('tabsactivate', function (event, ui) { - var tabName = ui.newTab[0].id.replace('tab_', ''); - - dataLayer.push({ - event: 'virtual-pageview', - virtualPageviewPath: contactPagePath + '&selectedChild=' + tabName - }); - }); - } -}(window, CRM, (typeof dataLayer !== 'undefined' ? dataLayer : null))); diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore.js new file mode 100644 index 00000000000..47493ee3ec1 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore.js @@ -0,0 +1,5 @@ +/* eslint-env amd */ + +(function (require) { + require(['hrcore/app']); +})(require); diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js new file mode 100644 index 00000000000..8209b285e91 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js @@ -0,0 +1,37 @@ +/* global dataLayer */ +/* eslint-env amd */ + +(function (window, CRM, dataLayer) { + define(function () { + 'use strict'; + + trackContactTabVirtualPageviews(); + + /** + * Sends a virtual pageview to Google Analytics whenever the user clicks on + * any of the tabs of the Contact Summary page + * + * The path of the pageview is the Contact Summary page path + the selectedChild + * param's value of the selected tab, thus simulating the user landing + * directly on the tab + */ + function trackContactTabVirtualPageviews () { + var contactPagePath; + + if (!dataLayer) { + return; + } + + contactPagePath = window.location.pathname + '?reset=1&cid=' + CRM.contactId; + + CRM.$('#mainTabContainer').on('tabsactivate', function (event, ui) { + var tabName = ui.newTab[0].id.replace('tab_', ''); + + dataLayer.push({ + event: 'virtual-pageview', + virtualPageviewPath: contactPagePath + '&selectedChild=' + tabName + }); + }); + } + }); +}(window, CRM, (typeof dataLayer !== 'undefined' ? dataLayer : null))); diff --git a/uk.co.compucorp.civicrm.hrcore/js/crm/vendor/iframeResizer.min.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/vendor/iframeResizer.min.js similarity index 100% rename from uk.co.compucorp.civicrm.hrcore/js/crm/vendor/iframeResizer.min.js rename to uk.co.compucorp.civicrm.hrcore/js/src/hrcore/vendor/iframeResizer.min.js From 7701ebe60feb34fb988a742e1e040b330c0b53e8 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 16:42:30 +0530 Subject: [PATCH 040/151] PCHR-3941: Use RequireJS in HR UI --- hrui/gulp-tasks/requirejs.js | 31 -- hrui/hrui.php | 2 +- hrui/js/build.js | 9 + hrui/js/dist/hrui.min.js | 7 +- hrui/js/src/civihr-popup/attrchange.js | 30 -- hrui/js/src/civihr-popup/civihr-popup.js | 99 ----- hrui/js/src/contact.js | 63 ---- hrui/js/src/hrui.js | 342 +----------------- hrui/js/src/hrui/civihr-popup/attrchange.js | 35 ++ hrui/js/src/hrui/civihr-popup/civihr-popup.js | 102 ++++++ hrui/js/src/hrui/contact.js | 67 ++++ hrui/js/src/hrui/main.js | 334 +++++++++++++++++ 12 files changed, 560 insertions(+), 561 deletions(-) delete mode 100644 hrui/gulp-tasks/requirejs.js create mode 100644 hrui/js/build.js delete mode 100644 hrui/js/src/civihr-popup/attrchange.js delete mode 100644 hrui/js/src/civihr-popup/civihr-popup.js delete mode 100644 hrui/js/src/contact.js create mode 100644 hrui/js/src/hrui/civihr-popup/attrchange.js create mode 100644 hrui/js/src/hrui/civihr-popup/civihr-popup.js create mode 100644 hrui/js/src/hrui/contact.js create mode 100755 hrui/js/src/hrui/main.js 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..35b0829daee 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'); } } 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..1875de55c6c 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,l(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function o(n){1===t(n).length&&t(n).on("change",u)}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(n){"contactForm"!==CRM.formName&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a",n.target).text("Personal Details"),f(n.target),p(n.target))}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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 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 l(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var o=t(n),i=t("
    ");i.attr("id",e),i.append(t("#civicrm-menu")),i.append(o),i.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(n){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",n).closest("div.crm-summary-row").hide(),t("input#employer_id, input#job_title","form#Contact").parent("td").hide(),t(".HRJobContract_Summary",n).insertBefore(t(".crm-summary-contactinfo-block")),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()}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(){t(".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()}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(t){o("input[type='file']"),c(),a(t),r(),m()}).ready(function(){e(),n(),i(),y(),g()})})}(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.js",[],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.js",[],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=l.clone(!0).appendTo(n).addClass("civihr-popup")}function i(){m.data("attrchange-is-on")||(m.data("attrchange-is-on",!0),m.attrchange(function(){m.hasClass("btn-slide-active")||e()}))}function a(){r.find("a").click(function(){var n=t(this).parent().index();l.find("li:nth("+n+") a").click()})}function c(){var t=m.offset();r.css({left:+t.left-(r.width()-m.outerWidth()),top:+t.top+m.outerHeight()}),r.show(),n.addClass("civihr-popup-open")}var r,m=t(this),l=m.children("ul.panel");!function(){e(),o(),c(),a(),i()}()})})}(CRM.$),function(t){t(["hrui/main","hrui/contact","hrui/civihr-popup/attrchange.js","hrui/civihr-popup/civihr-popup.js"])}(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..59431e168b9 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.js', + 'hrui/civihr-popup/civihr-popup.js' + ]); +})(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..439ba22958e --- /dev/null +++ b/hrui/js/src/hrui/main.js @@ -0,0 +1,334 @@ +/* global Ps */ +/* eslint-env amd */ + +(function ($, _) { + define(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._)); From 2b837013aa568f5b7e64fca783ef517875f5a510 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 16:50:22 +0530 Subject: [PATCH 041/151] PCHR-3941: Remove js file for HR CASE --- hrcase/hrcase.php | 1 - hrcase/js/hrcase.js | 97 ------------------- .../CRM/HRRecruitment/Page/CasePipeline.php | 4 +- 3 files changed, 1 insertion(+), 101 deletions(-) delete mode 100644 hrcase/js/hrcase.js 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/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/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"; } } - From dbd097c3ed837ff32682c0d78e5ac5023feeb419 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 18:49:52 +0530 Subject: [PATCH 042/151] PCHR-3941: Fix linting issues for HR MED --- hrmed/js/hrmed.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hrmed/js/hrmed.js b/hrmed/js/hrmed.js index 3a70d02e5d5..077c4187199 100644 --- a/hrmed/js/hrmed.js +++ b/hrmed/js/hrmed.js @@ -1,12 +1,12 @@ // Copyright CiviCRM LLC 2013. See http://civicrm.org/licensing -(function($, _) { +(function ($, _) { // add helpicon for conitions - $('body').on('crmFormLoad', function(event) { - if (event.profileName == 'hrmed_tab') { + $('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); + if ($('div#editrow-' + accessName + ' a.helpicon').length === 0) { + var helpIcon = $(""); + $('div#editrow-' + accessName + ' div label').append(helpIcon); } } }); From 3053d24c77c7d6390d9024e84ee81a3d67543bc4 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 18:59:59 +0530 Subject: [PATCH 043/151] PCHR-3941: Use RequireJS in HR MED --- hrmed/hrmed.php | 2 +- hrmed/js/build.js | 9 +++++++++ hrmed/js/dist/hrmed.min.js | 2 ++ hrmed/js/hrmed.js | 13 ------------- hrmed/js/src/hrmed.js | 5 +++++ hrmed/js/src/hrmed/app.js | 17 +++++++++++++++++ 6 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 hrmed/js/build.js create mode 100644 hrmed/js/dist/hrmed.min.js delete mode 100644 hrmed/js/hrmed.js create mode 100644 hrmed/js/src/hrmed.js create mode 100644 hrmed/js/src/hrmed/app.js 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/js/build.js b/hrmed/js/build.js new file mode 100644 index 00000000000..7ee245b290a --- /dev/null +++ b/hrmed/js/build.js @@ -0,0 +1,9 @@ +/* eslint-disable */ + +({ + baseUrl: 'src', + out: 'dist/hrmed.min.js', + name: 'hrmed', + skipModuleInsertion: true, + generateSourceMaps: true +}) diff --git a/hrmed/js/dist/hrmed.min.js b/hrmed/js/dist/hrmed.min.js new file mode 100644 index 00000000000..6905d78844f --- /dev/null +++ b/hrmed/js/dist/hrmed.min.js @@ -0,0 +1,2 @@ +!function(e,i){define("hrmed/app",[],function(){"use strict";e("body").on("crmFormLoad",function(i){if("hrmed_tab"===i.profileName){var n=e('[data-crm-custom="Medical_Disability:Condition"]').attr("name");if(0===e("div#editrow-"+n+" a.helpicon").length){var a=e('');e("div#editrow-"+n+" div label").append(a)}}})})}(CRM.$,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 077c4187199..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..1f4232dce7b --- /dev/null +++ b/hrmed/js/src/hrmed/app.js @@ -0,0 +1,17 @@ +/* eslint-env amd */ + +(function ($, _) { + define(function () { + 'use strict'; + // 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._)); From b37126c7c4a62e0bbc7889ad0da4fef3fd4fe4a4 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 19 Jul 2018 19:01:17 +0530 Subject: [PATCH 044/151] PCHR-3941: PR Feedback --- hrui/js/dist/hrui.min.js | 2 +- hrui/js/src/hrui.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hrui/js/dist/hrui.min.js b/hrui/js/dist/hrui.min.js index 1875de55c6c..97b1932ae14 100644 --- a/hrui/js/dist/hrui.min.js +++ b/hrui/js/dist/hrui.min.js @@ -1,2 +1,2 @@ -!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,l(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function o(n){1===t(n).length&&t(n).on("change",u)}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(n){"contactForm"!==CRM.formName&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a",n.target).text("Personal Details"),f(n.target),p(n.target))}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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 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 l(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var o=t(n),i=t("
    ");i.attr("id",e),i.append(t("#civicrm-menu")),i.append(o),i.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(n){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",n).closest("div.crm-summary-row").hide(),t("input#employer_id, input#job_title","form#Contact").parent("td").hide(),t(".HRJobContract_Summary",n).insertBefore(t(".crm-summary-contactinfo-block")),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()}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(){t(".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()}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(t){o("input[type='file']"),c(),a(t),r(),m()}).ready(function(){e(),n(),i(),y(),g()})})}(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.js",[],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.js",[],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=l.clone(!0).appendTo(n).addClass("civihr-popup")}function i(){m.data("attrchange-is-on")||(m.data("attrchange-is-on",!0),m.attrchange(function(){m.hasClass("btn-slide-active")||e()}))}function a(){r.find("a").click(function(){var n=t(this).parent().index();l.find("li:nth("+n+") a").click()})}function c(){var t=m.offset();r.css({left:+t.left-(r.width()-m.outerWidth()),top:+t.top+m.outerHeight()}),r.show(),n.addClass("civihr-popup-open")}var r,m=t(this),l=m.children("ul.panel");!function(){e(),o(),c(),a(),i()}()})})}(CRM.$),function(t){t(["hrui/main","hrui/contact","hrui/civihr-popup/attrchange.js","hrui/civihr-popup/civihr-popup.js"])}(require); +!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,l(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function o(n){1===t(n).length&&t(n).on("change",u)}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(n){"contactForm"!==CRM.formName&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a",n.target).text("Personal Details"),f(n.target),p(n.target))}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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 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 l(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var o=t(n),i=t("
    ");i.attr("id",e),i.append(t("#civicrm-menu")),i.append(o),i.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(n){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",n).closest("div.crm-summary-row").hide(),t("input#employer_id, input#job_title","form#Contact").parent("td").hide(),t(".HRJobContract_Summary",n).insertBefore(t(".crm-summary-contactinfo-block")),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()}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(){t(".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()}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(t){o("input[type='file']"),c(),a(t),r(),m()}).ready(function(){e(),n(),i(),y(),g()})})}(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=l.clone(!0).appendTo(n).addClass("civihr-popup")}function i(){m.data("attrchange-is-on")||(m.data("attrchange-is-on",!0),m.attrchange(function(){m.hasClass("btn-slide-active")||e()}))}function a(){r.find("a").click(function(){var n=t(this).parent().index();l.find("li:nth("+n+") a").click()})}function c(){var t=m.offset();r.css({left:+t.left-(r.width()-m.outerWidth()),top:+t.top+m.outerHeight()}),r.show(),n.addClass("civihr-popup-open")}var r,m=t(this),l=m.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/hrui.js b/hrui/js/src/hrui.js index 59431e168b9..8f51f6c8bf2 100755 --- a/hrui/js/src/hrui.js +++ b/hrui/js/src/hrui.js @@ -4,7 +4,7 @@ require([ 'hrui/main', 'hrui/contact', - 'hrui/civihr-popup/attrchange.js', - 'hrui/civihr-popup/civihr-popup.js' + 'hrui/civihr-popup/attrchange', + 'hrui/civihr-popup/civihr-popup' ]); })(require); From e1d4470df5ea8f492daf8c76674ba9c6d2a161ab Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Tue, 24 Jul 2018 18:21:05 +0530 Subject: [PATCH 045/151] PCHR-3941: Fix HRUI --- hrui/js/dist/hrui.min.js | 2 +- hrui/js/src/hrui/main.js | 41 ++++++++---------- org.civicrm.reqangular/reqangular.php | 61 ++++++++++++++++++++------- 3 files changed, 65 insertions(+), 39 deletions(-) diff --git a/hrui/js/dist/hrui.min.js b/hrui/js/dist/hrui.min.js index 97b1932ae14..9a87565159a 100644 --- a/hrui/js/dist/hrui.min.js +++ b/hrui/js/dist/hrui.min.js @@ -1,2 +1,2 @@ -!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,l(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function o(n){1===t(n).length&&t(n).on("change",u)}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(n){"contactForm"!==CRM.formName&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a",n.target).text("Personal Details"),f(n.target),p(n.target))}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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 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 l(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var o=t(n),i=t("
    ");i.attr("id",e),i.append(t("#civicrm-menu")),i.append(o),i.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(n){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",n).closest("div.crm-summary-row").hide(),t("input#employer_id, input#job_title","form#Contact").parent("td").hide(),t(".HRJobContract_Summary",n).insertBefore(t(".crm-summary-contactinfo-block")),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()}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(){t(".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()}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(t){o("input[type='file']"),c(),a(t),r(),m()}).ready(function(){e(),n(),i(),y(),g()})})}(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=l.clone(!0).appendTo(n).addClass("civihr-popup")}function i(){m.data("attrchange-is-on")||(m.data("attrchange-is-on",!0),m.attrchange(function(){m.hasClass("btn-slide-active")||e()}))}function a(){r.find("a").click(function(){var n=t(this).parent().index();l.find("li:nth("+n+") a").click()})}function c(){var t=m.offset();r.css({left:+t.left-(r.width()-m.outerWidth()),top:+t.top+m.outerHeight()}),r.show(),n.addClass("civihr-popup-open")}var r,m=t(this),l=m.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); +!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,m(n,C(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function i(n){1===t(n).length&&t(n).on("change",u)}function o(){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(){t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a").text("Personal Details"),f(),r()}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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(){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 m(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var i=t(n),o=t("
    ");o.attr("id",e),o.append(t("#civicrm-menu")),o.append(i),o.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&_(),t("#customFields").length<1&&b()}function p(){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(),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()}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(),i=t("");i.append(n.find("label")),i.append(t("
    ")),i.append(e.html()),t("#nick_name").parent().after(i)})}function _(){t(".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()}function C(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(){p()}).ready(function(){i("input[type='file']"),e(),o(),n(),a(),c(),l(),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,i){void 0!==i.contract&&n(i.contract),void 0!==i.roles&&e(i.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},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){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 i(){r=m.clone(!0).appendTo(n).addClass("civihr-popup")}function o(){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(),i(),c(),a(),o()}()})})}(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/hrui/main.js b/hrui/js/src/hrui/main.js index 439ba22958e..714c9545832 100755 --- a/hrui/js/src/hrui/main.js +++ b/hrui/js/src/hrui/main.js @@ -4,19 +4,19 @@ (function ($, _) { define(function () { $(document) - .on('crmLoad', function (e) { - addUploadFileListener("input[type='file']"); - amendVacancyForm(); - amendContactPageAndForm(e); - applyMiscChanges(); - changeContactSourceFieldHelpText(); + .on('crmLoad', function () { + miscContactPageChanges(); }) .ready(function () { + addUploadFileListener("input[type='file']"); addUserMenuToMainMenu(); - amendAppLogoMenuItem(); amendApplicationForm(); - useFontAwesomeArrowsInSubMenuItems(); + amendAppLogoMenuItem(); + amendContactPageAndForm(); + amendVacancyForm(); + changeContactSourceFieldHelpText(); toggleActiveClassOnHoverOnAnyMainMenuItem(); + useFontAwesomeArrowsInSubMenuItems(); }); /** @@ -65,17 +65,15 @@ /** * 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); + function amendContactPageAndForm () { + // 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'); } + + manipulateDOMOfInlineCustomData(); + applyMiscChanges(); } /** @@ -200,18 +198,15 @@ /** * Misc changes to the page (hiding elements, inserting new ones, etc) */ - function miscContactPageChanges (target) { + function miscContactPageChanges () { // 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(); + $('form#ContactInfo input#employer_id, form#ContactInfo input#job_title').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(); diff --git a/org.civicrm.reqangular/reqangular.php b/org.civicrm.reqangular/reqangular.php index d99de8067c2..589e9bf0e65 100755 --- a/org.civicrm.reqangular/reqangular.php +++ b/org.civicrm.reqangular/reqangular.php @@ -107,6 +107,18 @@ function reqangular_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { _reqangular_civix_civicrm_alterSettingsFolders($metaDataFolders); } +/** + * Implements hook_civicrm_buildForm(). + * + * @param string $formName + * @param CRM_Core_Form $form + */ +function reqangular_civicrm_buildForm($formName, &$form) { + if(_reqangular_checkIfFormRequiresReqangular($formName)) { + _attach_reqangular(); + } +} + /** * Implementation of hook_civicrm_pageRun */ @@ -121,21 +133,7 @@ function reqangular_civicrm_pageRun($page) { * figure out a better solution to avoid having our own copy of angular in CiviHR */ if (!_reqangular_isAngularCorePage($page)) { - $url = CRM_Extension_System::singleton()->getMapper()->keyToUrl('org.civicrm.reqangular'); - - CRM_Core_Resources::singleton()->addVars('reqAngular', array( - 'baseUrl' => $url, - 'angular' => "$url/js/src/common/vendor/angular/angular.min", - 'angularAnimate' => "$url/js/src/common/vendor/angular/angular-animate.min", - 'angularBootstrap' => "$url/js/src/common/vendor/angular/ui-bootstrap", - 'angularFileUpload' => "$url/js/src/common/vendor/angular/angular-file-upload", - 'angularResource' => "$url/js/src/common/vendor/angular/angular-resource.min", - 'angularRoute' => "$url/js/src/common/vendor/angular/angular-route.min", - 'requireLib' => "$url/js/src/common/vendor/require.min", - 'reqangular' => "$url/js/dist/reqangular.min", - )); - - CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.reqangular', 'js/dist/reqangular.min.js', 1000); + _attach_reqangular(); } } @@ -150,3 +148,36 @@ function reqangular_civicrm_pageRun($page) { function _reqangular_isAngularCorePage($page) { return ($page instanceof CRM_Core_Page_Angular) || ($page instanceof Civi\Angular\Page\Main); } + +/** + * Checks if the given form requires reqangular.min.js + * + * @param [string] $formName + * @return boolean + */ +function _reqangular_checkIfFormRequiresReqangular($formName) { + $listOfFormName = ['CRM_Contact_Form_Contact', 'CRM_HRRecruitment_Form_HRVacancy', 'CRM_HRRecruitment_Form_Application']; + + return in_array($formName, $listOfFormName); +} + +/** + * Adds reqangular Javascript files + */ +function _attach_reqangular() { + $url = CRM_Extension_System::singleton()->getMapper()->keyToUrl('org.civicrm.reqangular'); + + CRM_Core_Resources::singleton()->addVars('reqAngular', array( + 'baseUrl' => $url, + 'angular' => "$url/js/src/common/vendor/angular/angular.min", + 'angularAnimate' => "$url/js/src/common/vendor/angular/angular-animate.min", + 'angularBootstrap' => "$url/js/src/common/vendor/angular/ui-bootstrap", + 'angularFileUpload' => "$url/js/src/common/vendor/angular/angular-file-upload", + 'angularResource' => "$url/js/src/common/vendor/angular/angular-resource.min", + 'angularRoute' => "$url/js/src/common/vendor/angular/angular-route.min", + 'requireLib' => "$url/js/src/common/vendor/require.min", + 'reqangular' => "$url/js/dist/reqangular.min", + )); + + CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.reqangular', 'js/dist/reqangular.min.js', 1000); +} From 20ba08b36db937fbfc33ea93a37b6025378d68f5 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 25 Jul 2018 07:44:33 +0200 Subject: [PATCH 046/151] PCHR-3944: Use in notificationBadge and fix spec --- .../src/common/components/notification-badge.component.js | 6 ++++-- .../js/test/components/notification-badge.component.spec.js | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) 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/test/components/notification-badge.component.spec.js b/org.civicrm.reqangular/js/test/components/notification-badge.component.spec.js index c08f0c893c1..18eede533f2 100644 --- a/org.civicrm.reqangular/js/test/components/notification-badge.component.spec.js +++ b/org.civicrm.reqangular/js/test/components/notification-badge.component.spec.js @@ -92,6 +92,8 @@ define([ refreshCountEventName: eventName, filters: filters }); + + controller.$onInit(); $rootScope.$digest(); } }); From a32bd89108e6e09a41ecc6f84541336c925e7ece Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 25 Jul 2018 08:53:04 +0200 Subject: [PATCH 047/151] PCHR-3944: (L&A) Use hook in components --- .../absence-tab-container.component.js | 6 +++-- ...tab-custom-work-pattern-modal.component.js | 22 ++++++++------- .../absence-tab-entitlements.component.js | 6 +++-- .../absence-tab-work-patterns.component.js | 27 ++++++++++--------- ...annual-entitlement-change-log.component.js | 6 +++-- .../annual-entitlements.component.js | 5 ++-- .../contract-entitlements.component.js | 6 +++-- ...alendar-feeds-dropdown-button.component.js | 5 ++-- .../manager-notification-badge.component.js | 6 +++-- .../components/leave-balance-tab.component.js | 5 ++-- .../leave-calendar-day.component.js | 5 ++-- .../leave-calendar-legend.component.js | 5 ++-- .../leave-calendar-month.component.js | 5 ++-- .../components/leave-calendar.component.js | 5 ++-- .../leave-request-actions.component.js | 5 ++-- ...ve-request-popup-comments-tab.component.js | 5 ++-- ...ave-request-popup-details-tab.component.js | 13 ++++++--- .../leave-request-popup-files-tab.js | 5 ++-- .../leave-request-record-actions.component.js | 5 ++-- ...et-absence-types-amount-taken.component.js | 5 ++-- ...sence-types-available-balance.component.js | 5 ++-- .../leave-widget-next-leave.component.js | 5 ++-- .../leave-widget/leave-widget.component.js | 7 +++-- .../manage-leave-requests.component.js | 5 ++-- .../staff-leave-report.component.js | 5 ++-- 25 files changed, 109 insertions(+), 70 deletions(-) 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/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-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/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..eecf79f7faa 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 @@ -117,13 +117,14 @@ define([ vm.allowedActions = []; + vm.$onInit = $onInit; vm.action = action; vm.openLeavePopup = openLeavePopup; - (function init () { + function $onInit () { indexSupportData(); setAllowedActions(); - }()); + } /** * Performs an action on a given leave request 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..2b19df8caa4 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 @@ -53,11 +53,12 @@ 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([ loadStatuses(), loadAbsenceTypes(), @@ -78,7 +79,7 @@ define([ }); registerEvents(); - })(); + } /** * Adds a leave request to the provided section's data and index. From a0159896369eacd9010c3781a795572cdb20471c Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 25 Jul 2018 08:53:33 +0200 Subject: [PATCH 048/151] PCHR-3944: (L&A) Fix return value in update() method --- .../js/src/leave-absences/shared/apis/leave-request.api.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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) From 4fe427efe7254b21e76e5afcab39b2f88a60c157 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 25 Jul 2018 08:54:58 +0200 Subject: [PATCH 049/151] PCHR-3944: (L&A) Fix tests --- .../absence-tab-container.component.spec.js | 4 +++- ...ab-custom-work-pattern-modal.component.spec.js | 2 ++ .../absence-tab-entitlements.component.spec.js | 1 + .../absence-tab-work-patterns.component.spec.js | 1 + ...nnual-entitlement-change-log.component.spec.js | 2 ++ .../annual-entitlements.component.spec.js | 1 + .../contract-entitlements.component.spec.js | 1 + ...lendar-feeds-dropdown-button.component.spec.js | 1 + .../manager-notification-badge.component.spec.js | 2 ++ .../js/test/shared/apis/leave-request.api.spec.js | 15 ++++++++++----- .../leave-balance-tab.component.spec.js | 5 ++++- .../leave-calendar-day.component.spec.js | 1 + .../leave-calendar-legend.component.spec.js | 1 + .../leave-calendar-month.component.spec.js | 1 + .../components/leave-calendar.component.spec.js | 1 + .../leave-request-actions.component.spec.js | 1 + ...e-request-popup-comments-tab.component.spec.js | 1 + ...ve-request-popup-details-tab.component.spec.js | 5 ++++- .../leave-request-popup-files-tab.spec.js | 1 + ...leave-request-record-actions.component.spec.js | 1 + ...t-absence-types-amount-taken.component.spec.js | 1 + ...ence-types-available-balance.component.spec.js | 1 + .../leave-widget-next-leave.component.spec.js | 1 + .../leave-widget/leave-widget.component.spec.js | 1 + .../manage-leave-requests.component.spec.js | 1 + .../staff-leave-report.component.spec.js | 5 ++++- ...request-modal-details-leave.controller.spec.js | 1 + ...uest-modal-details-sickness.controller.spec.js | 1 + .../request-modal-details-toil.controller.spec.js | 5 ++++- .../instances/leave-request.instance.spec.js | 4 ++++ 30 files changed, 59 insertions(+), 10 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-container.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-container.component.spec.js index 05646e14bb4..31350a19d95 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-container.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-container.component.spec.js @@ -26,7 +26,9 @@ }); function compileComponent () { - $componentController('absenceTabContainer'); + var ctrl = $componentController('absenceTabContainer'); + + ctrl.$onInit(); $rootScope.$digest(); } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-custom-work-pattern-modal.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-custom-work-pattern-modal.component.spec.js index 0f1d0b2174a..d9afa51f2d9 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-custom-work-pattern-modal.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-custom-work-pattern-modal.component.spec.js @@ -164,6 +164,8 @@ contactId: CRM.vars.leaveAndAbsences.contactId, dismiss: jasmine.createSpy('dismiss') }); + + controller.$onInit(); $rootScope.$digest(); } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-entitlements.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-entitlements.component.spec.js index 09aa29001de..f37bef1273e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-entitlements.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-entitlements.component.spec.js @@ -88,6 +88,7 @@ define([ */ function compileComponent () { controller = $componentController('absenceTabEntitlements', null, { contactId: '202' }); + controller.$onInit(); } }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-work-patterns.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-work-patterns.component.spec.js index bf1befc94ff..e8b4b2bdc51 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-work-patterns.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/absence-tab-work-patterns.component.spec.js @@ -136,6 +136,7 @@ contactId = CRM.vars.leaveAndAbsences.contactId; controller = $componentController('absenceTabWorkPatterns', null, { contactId: contactId }); + controller.$onInit(); $rootScope.$digest(); } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/annual-entitlement-change-log.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/annual-entitlement-change-log.component.spec.js index 6f63e48f680..d719249511f 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/annual-entitlement-change-log.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/annual-entitlement-change-log.component.spec.js @@ -298,6 +298,8 @@ define([ contactId: contactId, periodId: periodId }); + + ctrl.$onInit(); } }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/annual-entitlements.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/annual-entitlements.component.spec.js index 3cd58957c6d..57e38ee9b79 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/annual-entitlements.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/annual-entitlements.component.spec.js @@ -186,6 +186,7 @@ define([ absenceTypes: absenceTypes }); + controller.$onInit(); $rootScope.$digest(); } diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/contract-entitlements.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/contract-entitlements.component.spec.js index bd46e10bbd6..e929e9e97ab 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/contract-entitlements.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/absence-tab/components/contract-entitlements.component.spec.js @@ -122,6 +122,7 @@ define([ contactId: contactId }); + controller.$onInit(); $rootScope.$digest(); } diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component.spec.js index ce66cc6d22e..9e01df1788e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/calendar-feeds/dropdown-button/components/calendar-feeds-dropdown-button.component.spec.js @@ -127,6 +127,7 @@ define([ $componentController('calendarFeedsDropdownButton', {}, { dropdownPosition: dropdownPositionParameter }); + CalendarFeedsDropdownButton.$onInit(); } }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/manager-notification-badge/component/manager-notification-badge.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/manager-notification-badge/component/manager-notification-badge.component.spec.js index efffec59320..6863dcca720 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/manager-notification-badge/component/manager-notification-badge.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/manager-notification-badge/component/manager-notification-badge.component.spec.js @@ -42,6 +42,8 @@ define([ function compileComponent () { controller = $componentController('managerNotificationBadge', null, {}); + + controller.$onInit(); $rootScope.$digest(); } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/apis/leave-request.api.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/apis/leave-request.api.spec.js index a9b70933bd3..0dc00d1930b 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/apis/leave-request.api.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/apis/leave-request.api.spec.js @@ -396,15 +396,20 @@ define([ describe('error handling', function () { describe('when the leave request id is not set', function () { - beforeEach(function () { + var result; + + beforeEach(function (done) { delete requestData.id; - promise = LeaveRequestAPI.update(requestData); + + LeaveRequestAPI.update(requestData).catch(function (_result_) { + result = _result_; + }).finally(done); + + $rootScope.$digest(); }); it('rejects the promise', function () { - promise.catch(function (result) { - expect(result).toBe('id is mandatory field'); - }); + expect(result).toBe('id is mandatory field'); }); }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-balance-tab.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-balance-tab.component.spec.js index 6328fd25790..50966bc38b7 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-balance-tab.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-balance-tab.component.spec.js @@ -30,8 +30,10 @@ define([ beforeEach(module('common.services', 'leave-absences.mocks', 'leave-absences.models', 'leave-absences.components', - function (_$provide_) { + function (_$provide_, $qProvider) { $provide = _$provide_; + + $qProvider.errorOnUnhandledRejections(false); } )); @@ -358,6 +360,7 @@ define([ $scope = $rootScope.$new(); ctrl = $componentController('leaveBalanceTab', { $scope: $scope }); + ctrl.$onInit(); } }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-day.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-day.component.spec.js index 287cdecddc7..bc2df6a16de 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-day.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-day.component.spec.js @@ -310,6 +310,7 @@ define([ calculationUnits: calculationUnits } }); + controller.$onInit(); } }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-legend.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-legend.component.spec.js index 5d3db391fda..c4e2db67b1c 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-legend.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-legend.component.spec.js @@ -155,6 +155,7 @@ define([ function compileComponent () { controller = $componentController('leaveCalendarLegend', null, { absenceTypes: mockedAbsenceTypes }); + controller.$onInit(); } }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-month.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-month.component.spec.js index bd92bef6898..891f7802802 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-month.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar-month.component.spec.js @@ -1053,6 +1053,7 @@ }, contactIdsToReduceTo: contactIdsToReduceTo }); + controller.$onInit(); !!sendSignal && sendShowMonthSignal(); } diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar.component.spec.js index 4ebac68ce7c..a555e747639 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-calendar.component.spec.js @@ -804,6 +804,7 @@ function compileComponent (skipDigest, bindings) { controller = $componentController('leaveCalendar', null, _.assign({ contactId: currentContact.id }, bindings)); + controller.$onInit(); !skipDigest && $rootScope.$digest(); } diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js index 949dccd8754..29932ca204b 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js @@ -777,6 +777,7 @@ define([ absenceTypes: absenceTypes, leaveRequestStatuses: leaveRequestStatuses }); + controller.$onInit(); } }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-comments-tab.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-comments-tab.component.spec.js index e33acc9772a..e0f10b0042a 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-comments-tab.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-comments-tab.component.spec.js @@ -281,6 +281,7 @@ define([ request: request } ); + controller.$onInit(); $rootScope.$digest(); } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-details-tab.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-details-tab.component.spec.js index dd70fdae580..69110965331 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-details-tab.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-details-tab.component.spec.js @@ -34,9 +34,11 @@ define([ var date2017ToInServerFormat = moment(date2017To, 'D/MM/YYYY').format('YYYY-MM-D'); // Must match the date of `date2017To` beforeEach(module('common.mocks', 'leave-absences.templates', 'leave-absences.mocks', 'manager-leave', - function (_$controllerProvider_, _$provide_) { + function (_$controllerProvider_, _$provide_, $qProvider) { $controllerProvider = _$controllerProvider_; $provide = _$provide_; + + $qProvider.errorOnUnhandledRejections(false); })); beforeEach(inject(function (_AbsenceTypeAPIMock_, _LeaveRequestAPIMock_, _PublicHolidayAPIMock_, _OptionGroupAPIMock_, _WorkPatternAPIMock_) { @@ -1674,6 +1676,7 @@ define([ { $scope: $scope }, params ); + controller.$onInit(); $rootScope.$digest(); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-files-tab.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-files-tab.spec.js index fcfb1f6a605..2cf2cec55ef 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-files-tab.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-popup-files-tab.spec.js @@ -108,6 +108,7 @@ define([ request: request } ); + controller.$onInit(); $rootScope.$digest(); } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-record-actions.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-record-actions.component.spec.js index c1efd52fdba..b81d7bf5abb 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-record-actions.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-record-actions.component.spec.js @@ -132,6 +132,7 @@ define([ function compileComponent () { controller = $componentController('leaveRequestRecordActions', null, { contactId: contactId }); + controller.$onInit(); $rootScope.$digest(); } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component.spec.js index 88904c46157..0bea7367133 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-absence-types-amount-taken.component.spec.js @@ -55,6 +55,7 @@ define([ $scope: $scope }); controllerOnChanges.setupController(ctrl); + ctrl.$onInit(); }); it('should be defined', function () { diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-absence-types-available-balance.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-absence-types-available-balance.component.spec.js index 93bfaa1a363..c16c265a6c5 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-absence-types-available-balance.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-absence-types-available-balance.component.spec.js @@ -48,6 +48,7 @@ define([ $scope: $scope }); controllerOnChanges.setupController(ctrl); + ctrl.$onInit(); }); it('should be defined', function () { diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-next-leave.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-next-leave.component.spec.js index bc646eaee9d..ec1fb7132c2 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-next-leave.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget-next-leave.component.spec.js @@ -48,6 +48,7 @@ define([ $scope: $scope }); controllerOnChanges.setupController(ctrl); + ctrl.$onInit(); }); it('should be defined', function () { diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget.component.spec.js index 3e7b080b8cb..d5d7dbcab1e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-widget/leave-widget.component.spec.js @@ -55,6 +55,7 @@ define([ { $scope: $scope }, { contactId: contactId } ); + ctrl.$onInit(); }); it('should be defined', function () { diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/manage-leave-requests.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/manage-leave-requests.component.spec.js index 2fb365a9284..830bf8eebb8 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/manage-leave-requests.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/manage-leave-requests.component.spec.js @@ -885,6 +885,7 @@ define([ function compileComponent () { controller = $componentController('manageLeaveRequests', null, { contactId: contactId }); + controller.$onInit(); $rootScope.$digest(); } }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/staff-leave-report.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/staff-leave-report.component.spec.js index d8f18a7e322..5ec9bd32d5b 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/staff-leave-report.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/staff-leave-report.component.spec.js @@ -38,8 +38,10 @@ beforeEach(module('common.services', 'leave-absences.templates', 'my-leave', 'leave-absences.mocks', 'leave-absences.settings', - function (_$provide_) { + function (_$provide_, $qProvider) { $provide = _$provide_; + + $qProvider.errorOnUnhandledRejections(false); })); beforeEach(inject(function (_$componentController_, _$q_, _$log_, _$rootScope_) { @@ -892,6 +894,7 @@ function compileComponent () { controller = $componentController('staffLeaveReport', null, { contactId: contactId }); + controller.$onInit(); } /** diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-leave.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-leave.controller.spec.js index 2f2ee7d706c..93a065da6ee 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-leave.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-leave.controller.spec.js @@ -460,6 +460,7 @@ define([ params ); + controller.$onInit(); $rootScope.$digest(); return params; diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-sickness.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-sickness.controller.spec.js index 180382682e7..2bb2a2a62e7 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-sickness.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-sickness.controller.spec.js @@ -263,6 +263,7 @@ define([ params ); + controller.$onInit(); $rootScope.$digest(); return params; diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-toil.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-toil.controller.spec.js index 8750d3b2664..58a60e80bf7 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-toil.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/sub-controllers/request-modal-details-toil.controller.spec.js @@ -32,8 +32,10 @@ define([ var date2017 = '01/02/2017'; var date2017Server = '2017-01-02'; - beforeEach(module('common.mocks', 'leave-absences.templates', 'leave-absences.mocks', 'manager-leave', function (_$provide_) { + beforeEach(module('common.mocks', 'leave-absences.templates', 'leave-absences.mocks', 'manager-leave', function (_$provide_, $qProvider) { $provide = _$provide_; + + $qProvider.errorOnUnhandledRejections(false); })); beforeEach(inject(function (_AbsenceTypeAPIMock_, _WorkPatternAPIMock_, _PublicHolidayAPIMock_, _LeaveRequestAPIMock_, _OptionGroupAPIMock_) { @@ -850,6 +852,7 @@ define([ params ); + controller.$onInit(); $rootScope.$digest(); return params; diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/instances/leave-request.instance.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/instances/leave-request.instance.spec.js index 61dd10d8671..17f0b4e7cf6 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/instances/leave-request.instance.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/instances/leave-request.instance.spec.js @@ -184,6 +184,10 @@ define([ function commonSetup (methodName) { instance = LeaveRequestInstance.init(helper.createRandomLeaveRequest()); + instance.id = _.random(1, 10); + + spyOn(instance, 'update').and.callThrough(); + promise = instance[methodName](); } From f777f4661d7a8596c27b8765ea07d3a8f745c9d7 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Wed, 25 Jul 2018 13:12:26 +0530 Subject: [PATCH 050/151] PCHR-3941: PR Feedback - HRUI --- hrui/js/dist/hrui.min.js | 2 +- hrui/js/src/hrui/main.js | 16 +++++++++------- org.civicrm.reqangular/reqangular.php | 22 ++++------------------ 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/hrui/js/dist/hrui.min.js b/hrui/js/dist/hrui.min.js index 9a87565159a..2d830f3e190 100644 --- a/hrui/js/dist/hrui.min.js +++ b/hrui/js/dist/hrui.min.js @@ -1,2 +1,2 @@ -!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,m(n,C(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function i(n){1===t(n).length&&t(n).on("change",u)}function o(){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(){t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a").text("Personal Details"),f(),r()}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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(){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 m(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var i=t(n),o=t("
    ");o.attr("id",e),o.append(t("#civicrm-menu")),o.append(i),o.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&_(),t("#customFields").length<1&&b()}function p(){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(),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()}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(),i=t("");i.append(n.find("label")),i.append(t("
    ")),i.append(e.html()),t("#nick_name").parent().after(i)})}function _(){t(".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()}function C(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(){p()}).ready(function(){i("input[type='file']"),e(),o(),n(),a(),c(),l(),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,i){void 0!==i.contract&&n(i.contract),void 0!==i.roles&&e(i.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},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){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 i(){r=m.clone(!0).appendTo(n).addClass("civihr-popup")}function o(){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(),i(),c(),a(),o()}()})})}(CRM.$),function(t){t(["hrui/main","hrui/contact","hrui/civihr-popup/attrchange","hrui/civihr-popup/civihr-popup"])}(require); +!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,m(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function i(n){1===t(n).length&&t(n).on("change",u)}function o(){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&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a").text("Personal Details"),f())}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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(){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 m(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var i=t(n),o=t("
    ");o.attr("id",e),o.append(t("#civicrm-menu")),o.append(i),o.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(){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(),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()}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(),i=t("");i.append(n.find("label")),i.append(t("
    ")),i.append(e.html()),t("#nick_name").parent().after(i)})}function C(){t(".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()}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(){p()}).ready(function(){i("input[type='file']"),e(),o(),n(),a(),c(),r(),l(),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,i){void 0!==i.contract&&n(i.contract),void 0!==i.roles&&e(i.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},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){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 i(){r=m.clone(!0).appendTo(n).addClass("civihr-popup")}function o(){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(),i(),c(),a(),o()}()})})}(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/hrui/main.js b/hrui/js/src/hrui/main.js index 714c9545832..85f4755c186 100755 --- a/hrui/js/src/hrui/main.js +++ b/hrui/js/src/hrui/main.js @@ -14,6 +14,7 @@ amendAppLogoMenuItem(); amendContactPageAndForm(); amendVacancyForm(); + applyMiscChanges(); changeContactSourceFieldHelpText(); toggleActiveClassOnHoverOnAnyMainMenuItem(); useFontAwesomeArrowsInSubMenuItems(); @@ -66,14 +67,15 @@ * Amends the contact page and the contact form */ function amendContactPageAndForm () { - // 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 (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').text('Personal Details'); + } - manipulateDOMOfInlineCustomData(); - applyMiscChanges(); + manipulateDOMOfInlineCustomData(); + } } /** diff --git a/org.civicrm.reqangular/reqangular.php b/org.civicrm.reqangular/reqangular.php index 589e9bf0e65..4b9aebeef68 100755 --- a/org.civicrm.reqangular/reqangular.php +++ b/org.civicrm.reqangular/reqangular.php @@ -114,9 +114,7 @@ function reqangular_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { * @param CRM_Core_Form $form */ function reqangular_civicrm_buildForm($formName, &$form) { - if(_reqangular_checkIfFormRequiresReqangular($formName)) { - _attach_reqangular(); - } + _reqangular_inject_reqangular(); } /** @@ -133,7 +131,7 @@ function reqangular_civicrm_pageRun($page) { * figure out a better solution to avoid having our own copy of angular in CiviHR */ if (!_reqangular_isAngularCorePage($page)) { - _attach_reqangular(); + _reqangular_inject_reqangular(); } } @@ -150,21 +148,9 @@ function _reqangular_isAngularCorePage($page) { } /** - * Checks if the given form requires reqangular.min.js - * - * @param [string] $formName - * @return boolean - */ -function _reqangular_checkIfFormRequiresReqangular($formName) { - $listOfFormName = ['CRM_Contact_Form_Contact', 'CRM_HRRecruitment_Form_HRVacancy', 'CRM_HRRecruitment_Form_Application']; - - return in_array($formName, $listOfFormName); -} - -/** - * Adds reqangular Javascript files + * Injects reqangular Javascript files */ -function _attach_reqangular() { +function _reqangular_inject_reqangular() { $url = CRM_Extension_System::singleton()->getMapper()->keyToUrl('org.civicrm.reqangular'); CRM_Core_Resources::singleton()->addVars('reqAngular', array( From 018145c9aa624e465aa392e78ccffda014e23f57 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Wed, 25 Jul 2018 10:43:18 +0100 Subject: [PATCH 051/151] PCHR-4018: Treat contact as admin if self-approver --- .../js/dist/reqangular.min.js | 4 +- .../js/dist/reqangular.mocks.min.js | 2 +- .../js/dist/absence-tab.min.js | 8 +- .../js/dist/admin-dashboard.min.js | 8 +- .../js/dist/manager-leave.min.js | 10 +- .../js/dist/my-leave.min.js | 6 +- .../leave-request-actions.component.js | 64 ++++- .../leave-request-actions.component.spec.js | 242 ++++++++++-------- .../components/leave-request-actions.html | 10 +- 9 files changed, 219 insertions(+), 135 deletions(-) diff --git a/org.civicrm.reqangular/js/dist/reqangular.min.js b/org.civicrm.reqangular/js/dist/reqangular.min.js index 3e6b48592e3..ab0c1b1c9bd 100644 --- a/org.civicrm.reqangular/js/dist/reqangular.min.js +++ b/org.civicrm.reqangular/js/dist/reqangular.min.js @@ -123,6 +123,6 @@ n=null==n?0:+n||0,0>n&&(n=-n>i?0:i+n),r=r===$||r>i?i:+r||0,0>r&&(r+=i),i=n>r?0:r ;this._milliseconds=+c+1e3*u+6e4*l+36e5*s,this._days=+a+7*o,this._months=+i+3*r+12*n,this._data={},this._locale=k(),this._bubble()}function Re(e){return e instanceof Ne}function Ie(e,t){R(e,0,0,function(){var e=this.utcOffset(),n="+";return 0>e&&(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)}); +return k.transition!==q?S:(k.transition=null,a=e.$broadcast("$stateChangeError",t.self,n,u.self,f,r),a.defaultPrevented||m.update(),i.reject(r))});return q},k.is=function(e,t,r){r=L({relative:k.$current},r||{});var i=d(e,r.relative);return N(i)?k.$current===i&&(!t||u(i.params.$$values(t),p)):n},k.includes=function(e,t,r){if(r=L({relative:k.$current},r||{}),I(e)&&v(e)){if(!y(e))return!1;e=k.$current.name}var i=d(e,r.relative);return N(i)?!!N(k.$current.includes[i.name])&&(!t||u(i.params.$$values(t),p,a(t))):n},k.href=function(e,t,r){r=L({lossy:!0,inherit:!0,absolute:!1,relative:k.$current},r||{});var i=d(e,r.relative);if(!N(i))return null;r.inherit&&(t=l(p,t||{},k.$current,i));var o=i&&r.lossy?i.navigable:i;return o&&o.url!==n&&null!==o.url?m.href(o.url,c(i.params.$$keys().concat("#"),t||{}),{absolute:r.absolute}):null},k.get=function(e,t){if(0===arguments.length)return h(a(E),function(e){return E[e].self});var n=d(e,t||k.$current);return n&&n.self?n.self:null},k}function x(e,t,n,r,i,o){return!(o.reload||e!==n||!(i===n.locals||!1===e.self.reloadOnSearch&&function(e,t,n){function r(t){return"search"!=e.params[t].location}var i=e.params.$$keys().filter(r),o=f.apply({},[e.params].concat(i));return new H.ParamSet(o).$$equals(t,n)}(n,r,t)))||void 0}var C,k,E={},S={},_="abstract",M={parent:function(e){if(N(e.parent)&&e.parent)return d(e.parent);var t=/^(.+)\.[^.]+$/.exec(e.name);return t?d(t[1]):C},data:function(e){return e.parent&&e.parent.data&&(e.data=e.self.data=L({},e.parent.data,e.data)),e.data},url:function(e){var t=e.url,n={params:e.params||{}};if(I(t))return"^"==t.charAt(0)?i.compile(t.substring(1),n):(e.parent.navigable||C).url.concat(t,n);if(!t||i.isMatcher(t))return t;throw new Error("Invalid url '"+t+"' in state '"+e+"'")},navigable:function(e){return e.url?e:e.parent?e.parent.navigable:null},ownParams:function(e){var t=e.url&&e.url.params||new H.ParamSet;return j(e.params||{},function(e,n){t[n]||(t[n]=new H.Param(n,null,e,"config"))}),t},params:function(e){return e.parent&&e.parent.params?L(e.parent.params.$$new(),e.ownParams):new H.ParamSet},views:function(e){var t={};return j(N(e.views)?e.views:{"":e},function(n,r){r.indexOf("@")<0&&(r+="@"+e.parent.name),t[r]=n}),t},path:function(e){return e.parent?e.parent.path.concat(e):[]},includes:function(e){var t=e.parent?L({},e.parent.includes):{};return t[e.name]=!0,t},$delegates:{}};C=g({name:"",url:"^",views:null,abstract:!0}),C.navigable=null,this.decorator=b,this.state=$,this.$get=w,w.$inject=["$rootScope","$q","$view","$injector","$resolve","$stateParams","$urlRouter","$location","$urlMatcherFactory"]}function x(){function e(e,t){return{load:function(n,r){var i;return r=L({template:null,controller:null,view:null,locals:null,notify:!0,async:!0,params:{}},r),r.view&&(i=t.fromConfig(r.view,r.params,r.locals)),i&&r.notify&&e.$broadcast("$viewContentLoading",r),i}}}this.$get=e,e.$inject=["$rootScope","$templateFactory"]}function C(){var e=!1;this.useAnchorScroll=function(){e=!0},this.$get=["$anchorScroll","$timeout",function(t,n){return e?t:function(e){return n(function(){e[0].scrollIntoView()},0,!1)}}]}function k(e,n,r,i){function o(e,t){if(l)return{enter:function(e,t,n){var r=l.enter(e,null,t,n);r&&r.then&&r.then(n)},leave:function(e,t){var n=l.leave(e,t);n&&n.then&&n.then(t)}};if(s){var n=s&&s(t,e);return{enter:function(e,t,r){n.enter(e,null,t),r()},leave:function(e,t){n.leave(e),t()}}}return function(){return{enter:function(e,t,n){t.after(e),n()},leave:function(e,t){e.remove(),t()}}}()}var a=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}}}(),s=a("$animator"),l=a("$animate");return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(n,a,s){return function(n,a,l){function u(){f&&(f.remove(),f=null),p&&(p.$destroy(),p=null),d&&(v.leave(d,function(){f=null}),f=d,d=null)}function c(o){var c,f=S(n,l,a,i),y=f&&e.$current&&e.$current.locals[f];if(o||y!==h){c=n.$new(),h=e.$current.locals[f];var b=s(c,function(e){v.enter(e,a,function(){p&&p.$emit("$viewContentAnimationEnded"),(t.isDefined(g)&&!g||n.$eval(g))&&r(e)}),u()});d=b,p=c,p.$emit("$viewContentLoaded"),p.$eval(m)}}var f,d,p,h,m=l.onload||"",g=l.autoscroll,v=o(l,n);n.$on("$stateChangeSuccess",function(){c(!1)}),n.$on("$viewContentLoading",function(){c(!1)}),c(!0)}}}}function E(e,t,n,r){return{restrict:"ECA",priority:-400,compile:function(i){var o=i.html();return function(i,a,s){var l=n.$current,u=S(i,s,a,r),c=l&&l.locals[u];if(c){a.data("$uiView",{name:u,state:c.$$state}),a.html(c.$template?c.$template:o);var f=e(a.contents());if(c.$$controller){c.$scope=i,c.$element=a;var d=t(c.$$controller,c);c.$$controllerAs&&(i[c.$$controllerAs]=d),a.data("$ngControllerController",d),a.children().data("$ngControllerController",d)}f(i)}}}}}function S(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 _(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)})}})}])}),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)})},getCurrentlyLoggedIn: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/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..0969164dc51 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(){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,O(!0)})}function b(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(B(),E(),O())})}function g(e){W.injectMonth=!0,U("injected").then(function(){O(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 S(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&f(),M(),E(),L("month")}function k(e){var t="previous"===e?"subtract":"add";B(n(W.selectedMonth.moment)[t](1,"month")),E(),L("month")}function L(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 O(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=S,W.paginateMonth=k,W.refresh=L,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:k()},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)&&L()}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!==k().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/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(n){I=w.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===w.leaveRequest.request_type?i.open(y(n)):v(n)}function p(){return"admin"===w.role&&"public_holiday"===w.leaveRequest.request_type}function h(t){var a=w.absenceTypes[w.leaveRequest.type_id].allow_request_cancelation;return"admin"===w.role||("manager"===w.role?e.includes([S.awaitingApproval,S.moreInformationRequired],t):"3"===a?n().isBefore(w.leaveRequest.from_date):"2"===a)}function v(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(){T(n)}}):y(n)})}})}function b(){return s.find(R).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return R===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 y(e){var n=k[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(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return m.get().then(function(e){R=e.contactId})}function C(e,n){e.stopPropagation(),r.openModal(n)}function T(e){r.openModal({leaveRequest:w.leaveRequest,leaveType:w.leaveRequest.request_type,selectedContactId:w.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[L[e]]})}function A(n){var t=e.find(w.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;I===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:w.leaveRequest})}function D(){var n=w.leaveRequestStatuses[w.leaveRequest.status_id].name,t=e.compact(e.map(k,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!h(n)&&e.pull(t,"cancel"),"admin"!==w.role&&e.pull(t,"delete"),"staff"===w.role&&e.pull(t,"approve","reject"),"staff"!==w.role&&P(t),p()&&t.push("delete"),w.allowedActions=e.map(t,function(e){return{key:e,label:k[e].label,isDirectAction:k[e].isDirectAction}})}function P(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 R,I,w=this,S=l.statusNames,k={edit:{label:"Edit",allowedStatuses:[S.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[S.moreInformationRequired]},view:{label:"View",allowedStatuses:[S.approved,S.rejected,S.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[S.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[S.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[S.awaitingApproval,S.approved,S.rejected,S.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[S.awaitingApproval,S.moreInformationRequired,S.approved,S.rejected,S.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},L={approve:"approved"};w.allowedActions=[],w.loading={component:!0},w.action=f,w.openLeavePopup=C,function(){a.resolve().then(_).then(q).then(function(){if(g())return b().then(function(e){e&&(w.role="admin")})}).then(D).finally(function(){w.loading.component=!1})}()}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(){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(),k("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,k("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 S(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function k(e){return ne.selectedAbsenceType.calculation_unit_name===e}function L(e){return ne.request.request_type===e}function O(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")&&(L("sickness")||k("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),(k("hours")||L("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=k,ne.isLeaveType=L,ne.isNotWorkingDay=O,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(S).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 S.fileUploader&&S.fileUploader.queue.length>0}function m(){return S.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return S.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||S.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=D,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=m,S.formatDateTime=f,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",S),g(),a.all([T(),q()]).then(_).finally(function(){S.filesLoaded=!0})}(),S}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 S(){return t.all(Object.values(G.sections).filter(function(e){return e.open}).map(M))}function k(){return w("other",{status_id:{in:[H(m.statusNames.rejected),H(m.statusNames.cancelled)]}})}function L(){return w("pending",{status_id:{in:[H(m.statusNames.awaitingApproval),H(m.statusNames.moreInformationRequired)]}})}function O(){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([S(),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:O},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k}},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),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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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;ke.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 S(){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 k(){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 L(){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 O(){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(ke,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=+Oe==+t.get(Ee,"leaveRequest.contact_id"),a=!t.get(Ee,"leaveRequest.id");Ee.isSelfRecord=e&&(n||a)}function J(){Le.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(){Se++})),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:Oe}),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){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=t.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 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"]=ke[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(){ke=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,k(),D(),Ee.request.isValid().then(te()&&L).then($).then(O()&&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===Se&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Se>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function De(){Le.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={},Se=0,ke={},Le=[],Oe="",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=S,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(){}); //# 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..219c648a293 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 @@ -7,8 +7,8 @@ !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(){}); +;return!0===t?0===m(a,s).length:o(a)}}this.encode=i(a(e,"encode")),this.decode=i(a(e,"decode")),this.is=i(a(e,"is"),!0),this.equals=function(e){return function(t,n){var a=r(t),o=r(n);if(a.length!==o.length)return!1;for(var s=0;sWhen 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/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,r,o,s,i,u,c,l,d,f){function m(t){D=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([S.awaitingApproval,S.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(P).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return P===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=I[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){P=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;D===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(I,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&T(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:I[e].label,isDirectAction:I[e].isDirectAction}})}function T(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 P,D,R=this,S=l.statusNames,I={edit:{label:"Edit",allowedStatuses:[S.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[S.moreInformationRequired]},view:{label:"View",allowedStatuses:[S.approved,S.rejected,S.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[S.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[S.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[S.awaitingApproval,S.approved,S.rejected,S.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[S.awaitingApproval,S.moreInformationRequired,S.approved,S.rejected,S.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},O={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){if(g())return b().then(function(e){e&&(R.role="admin")})}).then(w).finally(function(){R.loading.component=!1})}()}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,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(){}); //# 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..15d750f7778 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 @@ -6,9 +6,9 @@ */ -!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(){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 k(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 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(),E(),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(),E(),I("month")}function O(e){var n="previous"===e?"subtract":"add";B(t(H.selectedMonth.moment)[n](1,"month")),E(),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&&E).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 k(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(){k("previous"),k("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(),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: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 k(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 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=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/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,r,o,s,i,u,c,l,d,f){function m(t){D=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===S.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(n){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([R.awaitingApproval,R.moreInformationRequired],n):"3"===a?t().isBefore(S.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function g(){return o.find(P).then(function(e){return e.checkIfSelfLeaveApprover()})}function b(){return P===S.leaveRequest.contact_id}function y(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function _(e){var t=O[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){P=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[I[e]]})}function A(t){var n=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;D===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:S.leaveRequest})}function w(){var t=S.leaveRequestStatuses[S.leaveRequest.status_id].name,n=e.compact(e.map(O,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==S.role&&e.pull(n,"delete"),"staff"===S.role&&e.pull(n,"approve","reject"),"staff"!==S.role&&T(n),p()&&n.push("delete"),S.allowedActions=e.map(n,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function T(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 P,D,S=this,R=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[R.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[R.moreInformationRequired]},view:{label:"View",allowedStatuses:[R.approved,R.rejected,R.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[R.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[R.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[R.awaitingApproval,R.approved,R.rejected,R.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[R.awaitingApproval,R.moreInformationRequired,R.approved,R.rejected,R.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},I={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=m,S.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){if(b())return g().then(function(e){e&&(S.role="admin")})}).then(w).finally(function(){S.loading.component=!1})}()}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,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 E();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(w).finally(_)}function g(){return G(),E()}function b(){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,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?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 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 k(){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 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(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:k},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=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(),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:k(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 k(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 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=E,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 k(){u.setRequestDateTimesAndDateTypes(),l(),x(),u.isCalculationUnit("hours")?I():u.request.toil_to_accrue=null}function E(){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=k,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,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"===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;Oe.status_id===e&&e!==Ee.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return ke.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return ke.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 O(){Ee.isSelfRecord?Ee.request.status_id=Ee.requestStatuses[_.statusNames.awaitingApproval].value:Ee.canManage&&(Ee.request.status_id=Ee.newStatusOnSave||Ee.request.status_id)}function I(){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 x(){return"toil"!==U()&&!Ee.request.change_balance}function L(){Ee.errors=[]}function M(){return Ee.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function k(){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 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(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(Oe,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(ge).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!==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 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=+xe==+n.get(Ee,"leaveRequest.contact_id"),a=!n.get(Ee,"leaveRequest.id");Ee.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",Ee.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){ke.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:xe}),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(j()).then(v.loadCalculationUnits).then(function(e){De={types:e,ids:e.map(function(e){return e.id})}})}function le(){return Ee.loading.entitlements=!0,g.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){xe=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!==xe})}):m.find(xe).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"]=Oe[e+"_date"]})}function ge(e){if(Ee.absenceTypes=pe(De.types,e),!Ee.absenceTypes.length)return r.reject(Le)}function be(){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(){Oe=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,O(),w(),Ee.request.isValid().then(ne()&&I).then(k).then(x()&&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(ke.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 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,Se={},Re=0,Oe={},Ie=[],xe="",Le="No entitlement",Me="",ke=[],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=S,Ee.canSubmit=R,Ee.closeAlert=L,Ee.deleteLeaveRequest=E,Ee.dismissModal=B,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(be).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"]}),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(){}); //# 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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index 56b86983c1c..06db66874ab 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 @@ -8,7 +8,7 @@ !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(){}); +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/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,r,o,s,i,u,c,l,d,m){function f(t){D=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===S.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(n){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([R.awaitingApproval,R.moreInformationRequired],n):"3"===a?t().isBefore(S.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(P).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return P===S.leaveRequest.contact_id}function y(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function _(e){var t=I[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){w(e)}).catch(function(e){d.error("Error:",e)})}}}function $(){return m.get().then(function(e){P=e.contactId})}function q(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[x[e]]})}function w(t){var n=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;D===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:S.leaveRequest})}function A(){var t=S.leaveRequestStatuses[S.leaveRequest.status_id].name,n=e.compact(e.map(I,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==S.role&&e.pull(n,"delete"),"staff"===S.role&&e.pull(n,"approve","reject"),"staff"!==S.role&&T(n),p()&&n.push("delete"),S.allowedActions=e.map(n,function(e){return{key:e,label:I[e].label,isDirectAction:I[e].isDirectAction}})}function T(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 P,D,S=this,R=l.statusNames,I={edit:{label:"Edit",allowedStatuses:[R.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[R.moreInformationRequired]},view:{label:"View",allowedStatuses:[R.approved,R.rejected,R.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[R.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[R.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[R.awaitingApproval,R.approved,R.rejected,R.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[R.awaitingApproval,R.moreInformationRequired,R.approved,R.rejected,R.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},x={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=f,S.openLeavePopup=q,function(){a.resolve().then(y).then($).then(function(){if(g())return b().then(function(e){e&&(S.role="admin")})}).then(A).finally(function(){S.loading.component=!1})}()}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,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(){}); //# 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/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..56cee9d92ae 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,13 +120,31 @@ define([ }; vm.allowedActions = []; + vm.loading = { component: true }; vm.action = action; vm.openLeavePopup = openLeavePopup; (function init () { - indexSupportData(); - setAllowedActions(); + $q.resolve() + .then(indexSupportData) + .then(loadCurrentlyLoggedInContactId) + .then(function () { + if (!checkIfOwnLeaveRequest()) { + return; + } + + return checkIfContactIsSelfLeaveApprover() + .then(function (isSelfLeaveApprover) { + if (isSelfLeaveApprover) { + vm.role = 'admin'; + } + }); + }) + .then(setAllowedActions) + .finally(function () { + vm.loading.component = false; + }); }()); /** @@ -215,6 +237,25 @@ 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 + */ + 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 +297,16 @@ define([ }; } + /** + * Gets and sets the ID of the currently logged in contact + */ + function loadCurrentlyLoggedInContactId () { + return Session.get() + .then(function (session) { + currentlyLoggedInContactId = session.contactId; + }); + } + /** * Opens the leave request popup * @@ -313,7 +364,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; diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js index 92dd34fd5a9..6267a4f1a8c 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js @@ -7,6 +7,7 @@ define([ 'leave-absences/mocks/data/option-group.data', 'leave-absences/mocks/data/absence-type.data', 'leave-absences/mocks/data/leave-request.data', + 'common/mocks/services/api/contact-mock', 'common/services/notification.service', 'common/services/pub-sub', 'leave-absences/mocks/apis/absence-type-api-mock', @@ -19,8 +20,8 @@ define([ 'use strict'; describe('leaveRequestActions', function () { - var $componentController, $log, $provide, $q, $rootScope, controller, - LeaveRequestInstance, dialog, sharedSettings, role, leaveRequest, + var $componentController, $log, $provide, $q, $rootScope, controller, Contact, + ContactInstance, LeaveRequestInstance, dialog, sharedSettings, leaveRequest, LeavePopup, LeaveRequestService, notification, pubSub; var absenceTypes = _.indexBy(absenceTypeData.all().values, 'id'); var leaveRequestStatuses = _.indexBy(optionGroupMock.getCollection('hrleaveandabsences_leave_request_status'), 'value'); @@ -29,6 +30,15 @@ define([ $provide = _$provide_; })); + beforeEach(function () { + inject([ + 'api.contact.mock', + function (contactAPIMock) { + $provide.value('api.contact', contactAPIMock); + } + ]); + }); + beforeEach(inject(function (_AbsenceTypeAPIMock_, _LeaveRequestAPIMock_, _OptionGroupAPIMock_) { $provide.value('AbsenceTypeAPI', _AbsenceTypeAPIMock_); $provide.value('LeaveRequestAPI', _LeaveRequestAPIMock_); @@ -40,11 +50,14 @@ define([ }])); beforeEach(inject(function (_$componentController_, _$log_, _$q_, _$rootScope_, - _dialog_, _LeaveRequestInstance_, _LeavePopup_, _LeaveRequestService_, _notificationService_, _pubSub_) { + _dialog_, _Contact_, _ContactInstance_, _LeaveRequestInstance_, _LeavePopup_, + _LeaveRequestService_, _notificationService_, _pubSub_) { $componentController = _$componentController_; $log = _$log_; $q = _$q_; $rootScope = _$rootScope_; + Contact = _Contact_; + ContactInstance = _ContactInstance_; dialog = _dialog_; LeaveRequestInstance = _LeaveRequestInstance_; LeavePopup = _LeavePopup_; @@ -60,19 +73,38 @@ define([ spyOn(pubSub, 'publish').and.callThrough(); }); - beforeEach(function () { - role = 'staff'; - leaveRequest = getRequest(); + describe('initiation', function () { + beforeEach(function () { + leaveRequest = getRequest(); - makeRequestExpired(leaveRequest, false); - compileComponent(); - }); + compileComponent('staff'); + }); - it('is initialized', function () { - expect($log.debug).toHaveBeenCalled(); + it('is initialized', function () { + expect($log.debug).toHaveBeenCalled(); + }); + + it('shows that it is loading', function () { + expect(controller.loading.component).toBe(true); + }); }); describe('basic tests', function () { + beforeEach(function () { + makeRequestExpired(leaveRequest, false); + spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.returnValue(false); + }); + + describe('when the component is ready to show the actions', function () { + beforeEach(function () { + compileComponentAndDigest(); + }); + + it('shows that is it loaded', function () { + expect(controller.loading.component).toBe(false); + }); + }); + describe('when leave request status is "awaiting for approval"', function () { beforeEach(function () { leaveRequest = getRequest('leave', 'awaitingApproval'); @@ -80,9 +112,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('shows actions "Respond", "Approve", "Reject", "Cancel" and "Delete"', function () { @@ -92,9 +122,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('shows actions "Respond", "Approve", "Reject" and "Cancel"', function () { @@ -104,9 +132,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('shows actions "Edit", "Cancel"', function () { @@ -122,9 +148,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('shows actions "Edit", "Cancel" and "Delete"', function () { @@ -134,9 +158,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('shows actions "Edit" and "Cancel"', function () { @@ -146,9 +168,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('shows actions "Respond" and "Cancel"', function () { @@ -164,9 +184,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('shows actions "Edit", "Cancel" and "Delete"', function () { @@ -176,9 +194,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('shows actions "Edit"', function () { @@ -188,9 +204,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('shows actions "View" and "Cancel"', function () { @@ -206,9 +220,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('shows actions "Edit", "Cancel" and "Delete"', function () { @@ -218,9 +230,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('shows actions "Edit"', function () { @@ -230,9 +240,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('shows actions "View" and "Cancel"', function () { @@ -248,9 +256,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('shows actions "Edit" and "Delete"', function () { @@ -260,9 +266,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('shows actions "Edit"', function () { @@ -272,9 +276,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('shows actions "View"', function () { @@ -295,9 +297,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('includes "Cancel" action', function () { @@ -307,9 +307,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('includes "Cancel" action', function () { @@ -319,9 +317,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('includes "Cancel" action', function () { @@ -337,9 +333,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('includes "Cancel" action', function () { @@ -349,9 +343,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('includes "Cancel" action', function () { @@ -361,9 +353,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('does not include "Cancel" action', function () { @@ -385,9 +375,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('includes "Cancel" action', function () { @@ -397,9 +385,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('includes "Cancel" action', function () { @@ -409,9 +395,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('does not include "Cancel" action', function () { @@ -427,9 +411,7 @@ define([ describe('when the user is admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('includes "Cancel" action', function () { @@ -439,9 +421,7 @@ define([ describe('when the user is manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('includes "Cancel" action', function () { @@ -451,9 +431,7 @@ define([ describe('when the user is staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('does not include "Cancel" action', function () { @@ -470,9 +448,7 @@ define([ describe('when the user is an admin', function () { beforeEach(function () { - role = 'admin'; - - compileComponent(); + compileComponentAndDigest('admin'); }); it('includes the "Delete" action', function () { @@ -482,9 +458,7 @@ define([ describe('when the user is a manager', function () { beforeEach(function () { - role = 'manager'; - - compileComponent(); + compileComponentAndDigest('manager'); }); it('does not include the "Delete" action', function () { @@ -494,9 +468,7 @@ define([ describe('when the user is a staff', function () { beforeEach(function () { - role = 'staff'; - - compileComponent(); + compileComponentAndDigest('staff'); }); it('does not include the "Delete" action', function () { @@ -510,10 +482,10 @@ define([ var action = 'approve'; beforeEach(function () { - // Any role or request could be specified here - role = 'admin'; leaveRequest = getRequest(); - compileComponent(); + + // Any role or request could be specified here + compileComponentAndDigest('admin'); spyOn($rootScope, '$emit'); }); @@ -656,7 +628,7 @@ define([ beforeEach(function () { leaveRequest = getRequest('toil', 'awaitingApproval'); - compileComponent(); + compileComponentAndDigest(); spyOn(controller.leaveRequest, 'checkIfBalanceChangeNeedsRecalculation') .and.callThrough(); controller.action('approve'); @@ -682,6 +654,7 @@ define([ event = jasmine.createSpyObj('event', ['stopPropagation']); spyOn(LeavePopup, 'openModal'); + compileComponentAndDigest(); controller.openLeavePopup(event, params); }); @@ -695,6 +668,46 @@ define([ }); }); + describe('self approving', function () { + beforeEach(function () { + leaveRequest = getRequest('leave', 'awaitingApproval'); + + makeRequestExpired(leaveRequest, false); + }); + + describe('when own leave request', function () { + beforeEach(function () { + spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.returnValue(true); + compileComponentAndDigest(); + }); + + it('shows same actions as "admin" role will see', function () { + expect(flattenActions(controller.allowedActions)).toEqual( + ['respond', 'approve', 'reject', 'cancel', 'delete']); + }); + }); + + describe('when other contact\'s leave request', function () { + beforeEach(function () { + leaveRequest.contact_id = '112358'; + + spyOn(Contact, 'getCurrentlyLoggedIn').and.callThrough(); + spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.callThrough(); + compileComponentAndDigest(); + }); + + it('does not check if the contact can approve their own requests', function () { + expect(Contact.getCurrentlyLoggedIn).not.toHaveBeenCalled(); + expect(ContactInstance.checkIfSelfLeaveApprover).not.toHaveBeenCalled(); + }); + + it('does not amend the actions', function () { + expect(flattenActions(controller.allowedActions)).toEqual( + ['edit', 'cancel']); + }); + }); + }); + /** * Flattens actions object into an array of actions keys * @@ -772,7 +785,14 @@ define([ }); } - function compileComponent () { + /** + * Compiles the component for a specific role and sets the controller + * + * @param {String} [role] admin|manager|staff, defaults to "staff" + */ + function compileComponent (role) { + role = role || 'staff'; + controller = $componentController('leaveRequestActions', null, { leaveRequest: leaveRequest, role: role, @@ -780,5 +800,15 @@ define([ leaveRequestStatuses: leaveRequestStatuses }); } + + /** + * Compiles the component for a specific role and digests the scope + * + * @param {String} [role] admin|manager|staff, defaults to "staff" + */ + function compileComponentAndDigest (role) { + compileComponent(role); + $rootScope.$digest(); + } }); }); 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 @@ -
    +
    -
    ").append(e).html();try{return e[0].nodeType===Rr?dr(t):t.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(e,t){return"<"+dr(t)})}catch(e){return dr(t)}}function G(e){try{return decodeURIComponent(e)}catch(e){}}function K(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=G(r),y(r)&&(i=!y(i)||G(i),fr.call(t,r)?Cr(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))}),t}function Z(e){var t=[];return o(e,function(e,n){Cr(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 J(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 X(e,t){var n,r,i=Dr.length;for(r=0;r protocol indicates an extension, document.location.href does not match."))}function te(t,n,r){b(r)||(r={}),r=c({strictDi:!1},r);var i=function(){if(t=ar(t),t.injector()){var i=t[0]===e.document?"document":W(t);throw yr("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=ze(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,""),br.resumeBootstrap=function(e){return o(e,function(e){n.push(e)}),i()},S(br.resumeDeferredBootstrap)&&br.resumeDeferredBootstrap()}function ne(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function re(e){if(!(e=br.element(e).injector()))throw yr("test");return e.get("$$testability")}function ie(e,t){return t=t||"_",e.replace(Or,function(e,n){return(n?t:"")+e.toLowerCase()})}function oe(e,t,n){if(!e)throw yr("areq",t||"?",n||"required");return e}function ae(e,t,n){return n&&Cr(e)&&(e=e[e.length-1]),oe(S(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function se(e,t){if("hasOwnProperty"===e)throw yr("badname",t)}function le(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=U(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 ye(t){if(t instanceof ye)return t;var n;if(x(t)&&(t=Er(t),n=!0),!(this instanceof ye)){if(n&&"<"!==t.charAt(0))throw Hr("nosel");return new ye(t)}if(n){n=e.document;var r;t=(r=qr.exec(t))?[n.createElement(r[1])]:(r=$e(t,n))?r.childNodes:[],Te(this,t)}else S(t)?Ie(t):Te(this,t)}function be(e){return e.cloneNode(!0)}function we(e,t){!t&&ve(e)&&ar.cleanData([e]),e.querySelectorAll&&ar.cleanData(e.querySelectorAll("*"))}function xe(e,t,n,r){if(y(r))throw Hr("offargs");var i=(r=ke(e))&&r.events,a=r&&r.handle;if(a)if(t){var s=function(t){var r=i[t];y(n)&&I(r||[],n),y(n)&&r&&0u&&this.remove(p.key),t}},get:function(e){if(u",t=Me.firstChild.attributes;var r=t[0];t.removeNamedItem(r.name),r.value=n,e.attributes.setNamedItem(r)}function z(e,t){try{e.addClass(t)}catch(e){}}function Y(e,t,n,r,i){e instanceof ar||(e=ar(e));var o=G(e,t,e,n,r,i);Y.$$addScopeClass(e);var a=null;return function(t,n,r){if(!e)throw hi("multilink");oe(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"!==R(r)&&vr.call(r).match(/SVG/)?"svg":"html"),r="html"!==a?ar(ge(a,ar("
    ").append(e).html())):n?Gr.clone.call(e):e,l)for(var u in l)r.data("$"+u+"Controller",l[u].instance);return Y.$$addScopeInfo(r,t),n&&n(r,t),o&&o(t,r,r,s),n||(e=o=null),r}}function G(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((y=h.scope)&&(h.templateUrl||(b(y)?(he("new/isolated scope",k||x,h,N),k=h):he("new/isolated scope",k,h,N)),x=x||h),m=h.name,!P&&(h.replace&&(h.templateUrl||h.template)||h.transclude&&!h.$$tlb)){for(y=L+1;P=e[y++];)if(P.transclude&&!P.$$tlb||P.replace&&(P.templateUrl||P.template)){F=!0;break}P=!0}if(!h.templateUrl&&h.controller&&(C=C||ce(),he("'"+m+"' controller",C[m],h,N),C[m]=h),y=h.transclude)if(D=!0,h.$$tlb||(he("transclusion",_,h,N),_=h),"element"===y)O=!0,w=h.priority,g=N,N=n.$$element=ar(Y.$$createComment(m,n[m])),t=N[0],ye(a,hr.call(g,0),t),g[0].$$parentNode=g[0].parentNode,I=te(F,g,r,w,s&&s.name,{nonTlbTranscludeDirective:_});else{var B=ce();if(b(y)){g=[];var z=ce(),G=ce();o(y,function(e,t){var n="?"===e.charAt(0);e=n?e.substring(1):e,z[e]=t,B[t]=null,G[t]=n}),o(N.contents(),function(e){var t=z[nt(R(e))];t?(G[t]=!0,B[t]=B[t]||[],B[t].push(e)):g.push(e)}),o(G,function(e,t){if(!e)throw hi("reqslot",t)});for(var K in B)B[K]&&(B[K]=te(F,B[K],r))}else g=ar(be(t)).contents();N.empty(),I=te(F,g,r,void 0,void 0,{needsNewScope:h.$$isolateScope||h.$$newScope}),I.$$slots=B}if(h.template)if(A=!0,he("template",E,h,N),E=h,y=S(h.template)?h.template(N,n):h.template,y=Ne(y),h.replace){if(s=h,g=Vr.test(y)?it(ge(h.templateNamespace,Er(y))):[],t=g[0],1!==g.length||1!==t.nodeType)throw hi("tplrt",m,"");ye(a,N,t),U={$attr:{}},y=J(t,[],U);var Z=e.splice(L+1,e.length-(L+1));(k||x)&&se(y,k,x),e=e.concat(y).concat(Z),fe(n,U),U=e.length}else N.html(y);if(h.templateUrl)A=!0,he("template",E,h,N),E=h,h.replace&&(s=h),p=de(e.splice(L,e.length-L),N,n,a,D&&I,l,u,{controllerDirectives:C,newScopeDirective:x!==h&&x,newIsolateScopeDirective:k,templateDirective:E,nonTlbTranscludeDirective:_}),U=e.length;else if(h.compile)try{v=h.compile(N,n,I);var Q=h.$$originalDirective||h;S(v)?d(null,j(Q,v),H,q):v&&d(j(Q,v.pre),j(Q,v.post),H,q)}catch(e){i(e,W(N))}h.terminal&&(p.terminal=!0,w=Math.max(w,h.priority))}return p.scope=x&&!0===x.scope,p.transcludeOnThisElement=D,p.templateOnThisElement=A,p.transclude=I,f.hasElementTranscludeDirective=O,p}function re(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 hi("ctreq",t,e)}else if(Cr(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 hi("noctrl",m);c=c.$$bindings=g,b(c.isolateScope)&&(n.$$isolateBindings=c.isolateScope)}e.push(n),c=n}}return c}function ue(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 ve(e,t){if("srcdoc"===t)return N.HTML;var n=R(e);if("src"===t||"ngSrc"===t){if(-1===["img","video","audio","source","track"].indexOf(n))return N.RESOURCE_URL}else if("xlinkHref"===t||"form"===n&&"action"===t||"link"===n&&"href"===t)return N.RESOURCE_URL}function $e(e,t,r,i,o){var a=ve(e,i),s=d[i]||o,l=n(r,!o,a,s);if(l){if("multiple"===i&&"select"===R(e))throw hi("selmulti",W(e));if(w.test(i))throw hi("nodomevents");t.push({priority:100,compile:function(){return{pre:function(e,t,o){t=o.$$observers||(o.$$observers=ce());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 ye(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===Rr&&""===n.nodeValue.trim())&&mr.call(e,t,1)}return e}function ot(e,t){if(t&&x(t))return t;if(x(e)){var n=yi.exec(e);if(n)return n[3]}}function at(){var e={},t=!1;this.has=function(t){return e.hasOwnProperty(t)},this.register=function(t,n){se(t,"controller"),b(t)?c(e,t):e[t]=n},this.allowGlobals=function(){t=!0},this.$get=["$injector","$window",function(n,i){function o(e,t,n,i){if(!e||!b(e.$scope))throw r("$controller")("noscp",i,t);e.$scope[t]=n}return function(r,a,s,l){var u,f,d;if(s=!0===s,l&&x(l)&&(d=l),x(r)){if(!(l=r.match(yi)))throw $i("ctrlfmt",r);if(f=l[1],d=d||l[3],!(r=e.hasOwnProperty(f)?e[f]:le(a.$scope,f,!0)||(t?le(i,f,!0):void 0)))throw $i("ctrlreg",f);ae(r,f,!0)}return s?(s=(Cr(r)?r[r.length-1]:r).prototype,u=Object.create(s||null),d&&o(a,d,u,f||r.name),c(function(){var e=n.invoke(r,u,a,f);return e!==u&&(b(e)||S(e))&&(u=e,d&&o(a,d,u,f||r.name)),u},{instance:u,identifier:d})):(u=n.instantiate(r,a,f),d&&o(a,d,u,f||r.name),u)}}]}function st(){this.$get=["$window",function(e){return ar(e.document)}]}function lt(){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 ut(){this.$get=["$log",function(e){return function(t,n){e.error.apply(e,arguments)}}]}function ct(e){return b(e)?k(e)?e.toISOString():q(e):e}function ft(){this.$get=function(){return function(e){if(!e)return"";var t=[];return a(e,function(e,n){null===e||$(e)||S(e)||(Cr(e)?o(e,function(e){t.push(Q(n)+"="+Q(ct(e)))}):t.push(Q(n)+"="+Q(ct(e))))}),t.join("&")}}}function dt(){this.$get=function(){return function(e){function t(e,r,i){null===e||$(e)||(Cr(e)?o(e,function(e,n){t(e,r+"["+(b(e)?n:"")+"]")}):b(e)&&!k(e)?a(e,function(e,n){t(e,r+(i?"":"[")+n+(i?"":"]"))}):n.push(Q(r)+"="+Q(ct(e))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function pt(e,t){if(x(e)){var n=e.replace(Ei,"").trim();if(n){var r,i=t("Content-Type"),i=i&&0===i.indexOf(wi);if((r=i)||(r=(r=n.match(Ci))&&ki[r[0]].test(n)),r)try{e=V(n)}catch(t){if(!i)return e;throw Si("baddata",e,t)}}}return e}function ht(e){var t,n=ce();return x(e)?o(e.split("\n"),function(e){t=e.indexOf(":");var r=dr(Er(e.substr(0,t)));e=Er(e.substr(t+1)),r&&(n[r]=n[r]?n[r]+", "+e:e)}):b(e)&&o(e,function(e,t){var r=dr(t),i=Er(e);r&&(n[r]=n[r]?n[r]+", "+i:i)}),n}function mt(e){var t;return function(n){return t||(t=ht(e)),n?(n=t[dr(n)],void 0===n&&(n=null),n):t}}function gt(e,t,n,r){return S(r)?r(e,t,n):(o(r,function(r){e=r(e,t,n)}),e)}function vt(){var e=this.defaults={transformResponse:[pt],transformRequest:[function(e){return b(e)&&"[object File]"!==vr.call(e)&&"[object Blob]"!==vr.call(e)&&"[object FormData]"!==vr.call(e)?q(e):e}],headers:{common:{Accept:"application/json, text/plain, */*"},post:pe(xi),put:pe(xi),patch:pe(xi)},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[dr(t.method)]);e:for(n in a){r=dr(n);for(o in s)if(dr(o)===r)continue e;s[n]=a[n]}return i(s,pe(t))}(t),l.method=pr(l.method),l.paramSerializer=x(l.paramSerializer)?p.get(l.paramSerializer):l.paramSerializer,a.$$incOutstandingRequestCount();var u=[],f=[];return t=d.resolve(l),o(E,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=gt(t.data,mt(n),void 0,t.transformRequest);return $(r)&&o(n,function(e,t){"content-type"===dr(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(A,[e,n,ht(r),i,o]):h.remove(A)),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?E.resolve:E.reject)({data:e,status:t,headers:mt(r),config:n,statusText:i,xhrStatus:o})}function c(e){u(e.data,e.status,pe(e.headers()),e.statusText,e.xhrStatus)}function p(){var e=g.pendingRequests.indexOf(n);-1!==e&&g.pendingRequests.splice(e,1)}var h,v,E=d.defer(),_=E.promise,T=n.headers,D="jsonp"===dr(n.method),A=n.url;return D?A=m.getTrustedResourceUrl(A):x(A)||(A=m.valueOf(A)),A=w(A,n.paramSerializer(n.params)),D&&(A=C(A,n.jsonpCallbackParam)),g.pendingRequests.push(n),_.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:k),h&&(v=h.get(A),y(v)?v&&S(v.then)?v.then(c,c):Cr(v)?u(v[1],v[0],pe(v[2]),v[3],v[4]):u(v,200,{},"OK","complete"):h.put(A,_)),$(v)&&((v=M(n.url)?l()[n.xsrfCookieName||e.xsrfCookieName]:void 0)&&(T[n.xsrfHeaderName||e.xsrfHeaderName]=v),s(n.method,A,r,a,T,n.timeout,n.withCredentials,n.responseType,i(n.eventHandlers),i(n.uploadEventHandlers))),_}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){return!!(e&&e.$$intervalId in a)&&(a[e.$$intervalId].promise.$$state.pur=!0,a[e.$$intervalId].reject("canceled"),t.clearInterval(e.$$intervalId),delete a[e.$$intervalId],!0)},o}]}function Ct(e){e=e.split("/");for(var t=e.length;t--;)e[t]=J(e[t].replace(/%2F/g,"/"));return e.join("/")}function kt(e,t){var n=fn(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=d(n.port)||Di[n.protocol]||null}function Et(e,t,n){if(Oi.test(e))throw Ai("badpath",e);var r="/"!==e.charAt(0);r&&(e="/"+e),e=fn(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=K(e.search),t.$$hash=decodeURIComponent(e.hash),t.$$path&&"/"!==t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function St(e,t){return e.slice(0,t.length)===t}function Mt(e,t){if(St(t,e))return t.substr(e.length)}function _t(e){var t=e.indexOf("#");return-1===t?e:e.substr(0,t)}function Tt(e){return e.replace(/(#.+)|#$/,"$1")}function Dt(e,t,n){this.$$html5=!0,n=n||"",kt(e,this),this.$$parse=function(e){var n=Mt(t,e);if(!x(n))throw Ai("ipthprfx",e,t);Et(n,this,!0),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=Z(this.$$search),n=this.$$hash?"#"+J(this.$$hash):"";this.$$url=Ct(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=Mt(e,r))?(a=o,a=n&&y(o=Mt(n,o))?t+(Mt("/",o)||o):e+a):y(o=Mt(t,r))?a=t+o:t===r+"/"&&(a=t),a&&this.$$parse(a),!!a}}function At(e,t,n){kt(e,this),this.$$parse=function(r){var i,o=Mt(e,r)||Mt(t,r);$(o)||"#"!==o.charAt(0)?this.$$html5?i=o:(i="",$(o)&&(e=r,this.replace())):(i=Mt(n,o),$(i)&&(i=o)),Et(i,this,!1),r=this.$$path;var o=e,a=/^\/[A-Z]:(\/.*)/;St(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=Z(this.$$search),r=this.$$hash?"#"+J(this.$$hash):"";this.$$url=Ct(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+(this.$$url?n+this.$$url:""),this.$$urlUpdatedByLocation=!0},this.$$parseLinkUrl=function(t,n){return _t(e)===_t(t)&&(this.$$parse(t),!0)}}function Ot(e,t,n){this.$$html5=!0,At.apply(this,arguments),this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return e===_t(r)?o=r:(a=Mt(t,r))?o=e+n+a:t===r+"/"&&(o=t),o&&this.$$parse(o),!!o},this.$$compose=function(){var t=Z(this.$$search),r=this.$$hash?"#"+J(this.$$hash):"";this.$$url=Ct(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+n+this.$$url,this.$$urlUpdatedByLocation=!0}}function Nt(e){return function(){return this[e]}}function Rt(e,t){return function(n){return $(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function It(){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 D(e)?(t.enabled=e,this):b(e)?(D(e.enabled)&&(t.enabled=e.enabled),D(e.requireBase)&&(t.requireBase=e.requireBase),(D(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 Ai("nobase");f=d.substring(0,d.indexOf("/",d.indexOf("//")+2))+(c||"/"),c=i.history?Dt:Ot}else f=_t(d),c=At;var p=f.substr(0,_t(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 s=ar(e.target);"a"!==R(s[0]);)if(s[0]===o[0]||!(s=s.parent())[0])return;if(!x(i)||!$(s.attr(i))){var i=s.prop("href"),l=s.attr("href")||s.attr("xlink:href");b(i)&&"[object SVGAnimatedString]"===i.toString()&&(i=fn(i.animVal).href),h.test(i)||!i||s.attr("target")||e.isDefaultPrevented()||!u.$$parseLinkUrl(i,l)||(e.preventDefault(),u.absUrl()!==r.url()&&(n.$apply(),a.angular["ff-684208-preventDefault"]=!0))}}}),Tt(u.absUrl())!==Tt(d)&&r.url(u.absUrl(),!0);var m=!0;return r.onUrlChange(function(e,t){St(e,p)?(n.$evalAsync(function(){var r,i=u.absUrl(),o=u.$$state;e=Tt(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=Tt(r.url()),t=Tt(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 Pt(){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 E(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=or||/\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 Ft(e){return e+""}function Lt(e,t){return void 0!==e?e:t}function Ut(e,t){return void 0===e?t:void 0===t?e:e+t}function jt(e,t){switch(e.type){case Ui.MemberExpression:if(e.computed)return!1;break;case Ui.UnaryExpression:return 1;case Ui.BinaryExpression:return"+"!==e.operator&&1;case Ui.CallExpression:return!1}return void 0===t?ji:t}function Ht(e,t,n){var r,i,a=e.isPure=jt(e,n);switch(e.type){case Ui.Program:r=!0,o(e.body,function(e){Ht(e.expression,t,a),r=r&&e.expression.constant}),e.constant=r;break;case Ui.Literal:e.constant=!0,e.toWatch=[];break;case Ui.UnaryExpression:Ht(e.argument,t,a),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case Ui.BinaryExpression:Ht(e.left,t,a),Ht(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case Ui.LogicalExpression:Ht(e.left,t,a),Ht(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case Ui.ConditionalExpression:Ht(e.test,t,a),Ht(e.alternate,t,a),Ht(e.consequent,t,a),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case Ui.Identifier:e.constant=!1,e.toWatch=[e];break;case Ui.MemberExpression:Ht(e.object,t,a),e.computed&&Ht(e.property,t,a),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=e.constant?[]:[e];break;case Ui.CallExpression:r=n=!!e.filter&&!t(e.callee.name).$stateful,i=[],o(e.arguments,function(e){Ht(e,t,a),r=r&&e.constant,i.push.apply(i,e.toWatch)}),e.constant=r,e.toWatch=n?i:[e];break;case Ui.AssignmentExpression:Ht(e.left,t,a),Ht(e.right,t,a),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case Ui.ArrayExpression:r=!0,i=[],o(e.elements,function(e){Ht(e,t,a),r=r&&e.constant,i.push.apply(i,e.toWatch)}),e.constant=r,e.toWatch=i;break;case Ui.ObjectExpression:r=!0,i=[],o(e.properties,function(e){Ht(e.value,t,a),r=r&&e.value.constant,i.push.apply(i,e.value.toWatch),e.computed&&(Ht(e.key,t,!1),r=r&&e.key.constant,i.push.apply(i,e.key.toWatch))}),e.constant=r,e.toWatch=i;break;case Ui.ThisExpression:e.constant=!1,e.toWatch=[];break;case Ui.LocalsExpression:e.constant=!1,e.toWatch=[]}}function qt(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 Vt(e){return e.type===Ui.Identifier||e.type===Ui.MemberExpression}function Bt(e){if(1===e.body.length&&Vt(e.body[0].expression))return{type:Ui.AssignmentExpression,left:e.body[0].expression,right:{type:Ui.NGValueParameter},operator:"="}}function zt(e){this.$filter=e}function Yt(e){this.$filter=e}function Wt(e,t,n){this.ast=new Ui(e,n),this.astCompiler=n.csp?new Yt(t):new zt(t)}function Gt(e){return S(e.valueOf)?e.valueOf():Ii.call(e)}function Kt(){var e,t,n=ce(),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 Li(p),r=new Wt(r,i,p).parse(e),r.constant?r.$$watchDelegate=f:r.oneTime?r.$$watchDelegate=r.literal?c:u:r.inputs&&(r.$$watchDelegate=l),n[o]=r),d(r,t);case"function":return d(e,t);default:return d(h,t)}}function s(e,t,n){return null==e||null==t?e===t:!("object"==typeof e&&"object"==typeof(e=Gt(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&&Gt(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)fr.call(r,t)||(m--,delete o[t])}else o!==r&&(o=r,c++);return c}}n.$stateful=!0;var r,o,a,s=this,u=1$&&(m=4-$,b[m]||(b[m]=[]),b[m].push({msg:S(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!==this&&h.$$nextSibling))for(;h!==this&&!(f=h.$$nextSibling);)h=h.$parent}while(h=f);if((d||C.length)&&!$--)throw x.$$phase=null,n("infdig",t,b)}while(d||C.length);for(x.$$phase=null;Mor)throw Hi("iequirks");var r=pe(qi);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(qi,function(e,t){var n=dr(t);r[("parse_as_"+n).replace(Vi,me)]=function(t){return i(e,t)},r[("get_trusted_"+n).replace(Vi,me)]=function(t){return a(e,t)},r[("trust_as_"+n).replace(Vi,me)]=function(t){return s(e,t)}}),r}]}function sn(){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(dr((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&&or)return!1;if($(n[e])){var t=a.createElement("div");n[e]="on"+e in t}return n[e]},csp:Mr(),transitions:l,animations:u,android:i}}]}function ln(){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 Cr(u)?u=u.filter(function(e){return e!==pt}):u===pt&&(u=null),r.get(s,c({cache:n,transformResponse:u},e)).finally(function(){a.totalPendingRequests--}).then(function(e){return n.put(s,e.data),e.data},function(e){return l||(e=Bi("tpload",s,e.status,e.statusText),t(e)),i.reject(e)})}return a.totalPendingRequests=0,a}]}function un(){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=br.element(e).data("$binding");i&&o(i,function(i){n?new RegExp("(^|\\s)"+Sr(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)===Ki;r++);if(r===(o=e.length))t=[0],n=1;else{for(o--;e.charAt(o)===Ki;)o--;for(n-=r,t=[],i=0;r<=o;r++,i++)t[i]=+e.charAt(r)}return n>Wi&&(t=t.splice(0,Wi-1),a=n-1,n=1),{d:t,e:a,i:n}}function En(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 Mn(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),Mn(o,t,r,i)}}function Tn(e,t,n){return function(r,i){var o=r["get"+e]();return i[pr((n?"STANDALONE":"")+(t?"SHORT":"")+e)][o]}}function Dn(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(4>=t?5:12)-t)}function An(e){return function(t){var n=Dn(t.getFullYear());return t=+new Date(t.getFullYear(),t.getMonth(),t.getDate()+(4-t.getDay()))-+n,t=1+Math.round(t/6048e5),Mn(t,e)}}function On(e,t){return 0>=e.getFullYear()?t.ERAS[0]:t.ERAS[1]}function Nn(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=Qi.test(n)?d(n):t(n)),C(n)&&(n=new Date(n)),!k(n)||!isFinite(n.getTime()))return n;for(;r;)(s=Ji.exec(r))?(u=U(u,s,1),r=u.pop()):(u.push(r),r=null);var c=n.getTimezoneOffset();return i&&(c=B(i,c),n=Y(n,i,!0)),o(u,function(t){a=Zi[t],l+=a?a(n,e.DATETIME_FORMATS,c):"''"===t?"'":t.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),l}}function Rn(){return function(e,t){return $(t)&&(t=2),q(e,t)}}function In(){return function(e,t,n){return t=1/0===Math.abs(Number(t))?Number(t):d(t),xr(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?Pn(e,n,n+t):0===n?Pn(e,t,e.length):Pn(e,Math.max(0,n+t),n)):e)}}function Pn(e,t,n){return x(e)?e.slice(t,n):hr.call(e,t,n)}function Fn(e){function t(t){return t.map(function(t){var n=1,r=m;if(S(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),vo[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 zn(e,t){return function(n,r){var i,a;if(k(n))return n;if(x(n)){if('"'===n.charAt(0)&&'"'===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),so.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){n=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 Wn(e,t,n,r){(r.$$hasNativeValidators=b(t[0].validity))&&r.$parsers.push(function(e){var n=t.prop("validity")||{};return n.badInput||n.typeMismatch?void 0:e})}function Gn(e){e.$$parserName="number",e.$parsers.push(function(t){return e.$isEmpty(t)?null:co.test(t)?parseFloat(t):void 0}),e.$formatters.push(function(t){if(!e.$isEmpty(t)){if(!C(t))throw qo("numfmt",t);t=t.toString()}return t})}function Kn(e){return y(e)&&!C(e)&&(e=parseFloat(e)),xr(e)?void 0:e}function Zn(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 Jn(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?Zn(e):0,s=i?Zn(t):0,l=o?Zn(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 Qn(e,t,n,r,i){if(y(r)){if(e=e(r),!e.constant)throw qo("constexpr",n,r);return e(t)}return i}function Xn(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>|)$/,Vr=/<|&#?\w+;/,Br=/<([\w:-]+)/,zr=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Yr={option:[1,'"],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};Yr.optgroup=Yr.option,Yr.tbody=Yr.tfoot=Yr.colgroup=Yr.caption=Yr.thead,Yr.th=Yr.td;var Wr=e.Node.prototype.contains||function(e){return!!(16&this.compareDocumentPosition(e))},Gr=ye.prototype={ready:Ie,toString:function(){var e=[];return o(this,function(t){e.push(""+t)}),"["+e.join(", ")+"]"},eq:function(e){return ar(0<=e?this[e]:this[this.length+e])},length:0,push:gr,sort:[].sort,splice:[].splice},Kr={};o("multiple selected checked disabled readOnly required open".split(" "),function(e){Kr[dr(e)]=e});var Zr={};o("input select option textarea button form details".split(" "),function(e){Zr[e]=!0});var Jr={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};o({data:Ee,removeData:Ce,hasData:function(e){for(var t in Pr[e.ng339])return!0;return!1},cleanData:function(e){for(var t=0,n=e.length;t/,ni=/^[^(]*\(\s*([^)]*)\)/m,ri=/,/,ii=/^\s*(_?)(\S+?)\1\s*$/,oi=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,ai=r("$injector");ze.$$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||Be(e)),ai("strictdi",n);t=Ve(e),o(t[1].split(ri),function(e){e.replace(ii,function(e,t,n){r.push(n)})})}e.$inject=r}}else Cr(e)?(t=e.length-1,ae(e[t],"fn"),r=e.slice(0,t)):ae(e,"fn",!0);return r};var si=r("$animate"),li=function(){this.$get=h},ui=function(){var e=new Xr,t=[];this.$get=["$$AnimateRunner","$rootScope",function(n,r){function i(e,t,n){var r=!1;return t&&(t=x(t)?t.split(" "):Cr(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=Ge(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&&_e(e,i),a&&Me(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}}}]},ci=["$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 si("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=S(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,si("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){Pi[e]=!0});var Fi={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Li=function(e){this.options=e};Li.prototype={constructor:Li,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,Ri("lexerr",e,t,this.text)},readNumber:function(){for(var e="",t=this.index;this.index","<=",">=");)t={type:Ui.BinaryExpression,operator:e.text,left:t,right:this.additive()};return t},additive:function(){for(var e,t=this.multiplicative();e=this.expect("+","-");)t={type:Ui.BinaryExpression,operator:e.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t={type:Ui.BinaryExpression,operator:e.text,left:t,right:this.unary()};return t},unary:function(){var e;return(e=this.expect("+","-","!"))?{type:Ui.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=P(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:Ui.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:Ui.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(")")):"["===t.text?(e={type:Ui.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume("]")):"."===t.text?e={type:Ui.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return e},filter:function(e){e=[e];for(var t={type:Ui.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:Ui.Identifier,name:e.text}},constant:function(){return{type:Ui.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:Ui.ArrayExpression,elements:e}},object:function(){var e,t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;e={type:Ui.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:Ui.ObjectExpression,properties:t}},throwError:function(e,t){throw Ri("syntax",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw Ri("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 Ri("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:Ui.ThisExpression},$locals:{type:Ui.LocalsExpression}}};var ji=2;zt.prototype={compile:function(e){var t=this;this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},Ht(e,t.$filter);var n,r="";return this.stage="assign",(n=Bt(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=qt(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,Ft,Lt,Ut),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 Ui.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 Ui.Literal:c=this.escape(e.value),this.assign(t,c),r(t||c);break;case Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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 Ui.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===Ui.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===Ui.Identifier?t.key.name:""+t.key.value)+":"+e)})}),c="{"+u.join(",")+"}",this.assign(t,c)),r(t||c);break;case Ui.ThisExpression:this.assign(t,"s"),r(t||"s");break;case Ui.LocalsExpression:this.assign(t,"l"),r(t||"l");break;case Ui.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 Ri("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]}},Yt.prototype={compile:function(e){var t=this;Ht(e,t.$filter);var n,r;(n=Bt(e))&&(r=this.recurse(n)),n=qt(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 Ui.Literal:return this.value(e.value,t);case Ui.UnaryExpression:return i=this.recurse(e.argument),this["unary"+e.operator](i,t);case Ui.BinaryExpression:case Ui.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this["binary"+e.operator](r,i,t);case Ui.ConditionalExpression:return this["ternary?:"](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case Ui.Identifier:return s.identifier(e.name,t,n);case Ui.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 Ui.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)}}},Wt.prototype={constructor:Wt,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===Ui.Literal||n.body[0].expression.type===Ui.ArrayExpression||n.body[0].expression.type===Ui.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 Hi=r("$sce"),qi={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Vi=/_([a-z])/g,Bi=r("$compile"),zi=e.document.createElement("a"),Yi=fn(e.location.href);mn.$inject=["$document"],vn.$inject=["$provide"];var Wi=22,Gi=".",Ki="0";xn.$inject=["$locale"],Cn.$inject=["$locale"];var Zi={yyyy:_n("FullYear",4,0,!1,!0),yy:_n("FullYear",2,0,!0,!0),y:_n("FullYear",1,0,!1,!0),MMMM:Tn("Month"),MMM:Tn("Month",!0),MM:_n("Month",2,1),M:_n("Month",1,1),LLLL:Tn("Month",!1,!0),dd:_n("Date",2),d:_n("Date",1),HH:_n("Hours",2),H:_n("Hours",1),hh:_n("Hours",2,-12),h:_n("Hours",1,-12),mm:_n("Minutes",2),m:_n("Minutes",1),ss:_n("Seconds",2),s:_n("Seconds",1),sss:_n("Milliseconds",3),EEEE:Tn("Day"),EEE:Tn("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?"+":"")+(Mn(Math[0=e.getFullYear()?t.ERANAMES[0]:t.ERANAMES[1]}},Ji=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,Qi=/^-?\d+$/;Nn.$inject=["$locale"];var Xi=g(dr),eo=g(pr);Fn.$inject=["$parse"];var to=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]"===vr.call(t.prop("href"))?"xlink:href":"href";t.on("click",function(e){t.attr(n)||e.preventDefault()})}}}}),no={};o(Kr,function(e,t){function n(e,n,i){e.$watch(i[r],function(e){i.$set(t,!!e)})}if("multiple"!==e){var r=nt("ng-"+t),i=n;"checked"===e&&(i=function(e,t,i){i.ngModel!==i[r]&&n(e,t,i)}),no[r]=function(){return{restrict:"A",priority:100,link:i}}}}),o(Jr,function(e,t){no[t]=function(){return{priority:100,link:function(e,n,r){if("ngPattern"===t&&"/"===r.ngPattern.charAt(0)&&(n=r.ngPattern.match(cr)))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=nt("ng-"+e);no[t]=function(){return{priority:99,link:function(n,r,i){var o=e,a=e;"href"===e&&"[object SVGAnimatedString]"===vr.call(r.prop("href"))&&(a="xlinkHref",i.$attr[a]="xlink:href",o=null),i.$observe(t,function(t){t?(i.$set(a,t),or&&o&&r.prop(o,i[a])):"href"===e&&i.$set(a,null)})}}}});var ro={$addControl:h,$$renameControl:function(e,t){e.$name=t},$removeControl:h,$setValidity:h,$setDirty:h,$setPristine:h,$setSubmitted:h};Un.$inject=["$element","$attrs","$scope","$animate","$interpolate"],Un.prototype={$rollbackViewValue:function(){o(this.$$controls,function(e){e.$rollbackViewValue()})},$commitViewValue:function(){o(this.$$controls,function(e){e.$commitViewValue()})},$addControl:function(e){se(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),I(this.$$controls,e),e.$$parentForm=ro},$setDirty:function(){this.$$animate.removeClass(this.$$element,jo),this.$$animate.addClass(this.$$element,Ho),this.$dirty=!0,this.$pristine=!1,this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,jo,Ho+" 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(){this.$$animate.addClass(this.$$element,"ng-submitted"),this.$submitted=!0,this.$$parentForm.$setSubmitted()}},Hn({clazz:Un,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&&(I(r,n),0===r.length&&delete e[t])}});var io=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:Un,compile:function(n,i){n.addClass(jo).addClass(Lo);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,ro)})}}}}}]},oo=io(),ao=io(!0),so=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,lo=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:\/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,uo=/^(?=.{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])?)*$/,co=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,fo=/^(\d{4,})-(\d{2})-(\d{2})$/,po=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ho=/^(\d{4,})-W(\d\d)$/,mo=/^(\d{4,})-(\d\d)$/,go=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,vo=ce();o(["date","datetime-local","month","time","week"],function(e){vo[e]=!0});var $o={text:function(e,t,n,r,i,o){Bn(e,t,n,r,i,o),Vn(r)},date:Yn("date",fo,zn(fo,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":Yn("datetimelocal",po,zn(po,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:Yn("time",go,zn(go,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:Yn("week",ho,function(e,t){if(k(e))return e;if(x(e)){ho.lastIndex=0;var n=ho.exec(e);if(n){var r=+n[1],i=+n[2],o=n=0,a=0,s=0,l=Dn(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:Yn("month",mo,zn(mo,["yyyy","MM"]),"yyyy-MM"),number:function(e,t,n,r,i,o){Wn(e,t,n,r),Gn(r),Bn(e,t,n,r,i,o);var a,s;if((y(n.min)||n.ngMin)&&(r.$validators.min=function(e){return r.$isEmpty(e)||$(a)||e>=a},n.$observe("min",function(e){a=Kn(e),r.$validate()})),(y(n.max)||n.ngMax)&&(r.$validators.max=function(e){return r.$isEmpty(e)||$(s)||e<=s},n.$observe("max",function(e){s=Kn(e),r.$validate()})),y(n.step)||n.ngStep){var l;r.$validators.step=function(e,t){return r.$isEmpty(t)||$(l)||Jn(t,a||0,l)},n.$observe("step",function(e){l=Kn(e),r.$validate()})}},url:function(e,t,n,r,i,o){Bn(e,t,n,r,i,o),Vn(r),r.$$parserName="url",r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||lo.test(n)}},email:function(e,t,n,r,i,o){Bn(e,t,n,r,i,o),Vn(r),r.$$parserName="email",r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||uo.test(n)}},radio:function(e,t,n,r){var i=!n.ngTrim||"false"!==Er(n.ngTrim);$(n.name)&&t.attr("name",++wr),t.on("click",function(e){var o;t[0].checked&&(o=n.value,i&&(o=Er(o)),r.$setViewValue(o,e&&e.type))}),r.$render=function(){var e=n.value;i&&(e=Er(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=Kn(e),xr(r.$modelValue)||(c?(e=t.val(),f>e&&(e=f,t.val(e)),r.$setViewValue(e)):r.$validate())}function l(e){d=Kn(e),xr(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)||Jn(t,f||0,p)},a("step",u))},checkbox:function(e,t,n,r,i,o,a,s){var l=Qn(s,e,"ngTrueValue",n.ngTrueValue,!0),u=Qn(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 L(e,l)}),r.$parsers.push(function(e){return e?l:u})},hidden:h,button:h,submit:h,reset:h,file:h},yo=["$browser","$sniffer","$filter","$parse",function(e,t,n,r){return{restrict:"E",require:["?ngModel"],link:{pre:function(i,o,a,s){s[0]&&($o[dr(a.type)]||$o.text)(i,o,a,s[0],t,e,n,r)}}}}],bo=/^(true|false|\d+)$/,wo=function(){function e(e,t,n){var r=y(n)?n:9===or?"":null;e.prop("value",r),t.$set("value",n)}return{restrict:"A",priority:100,compile:function(t,n){return bo.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)})}}}},xo=["$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=fe(e)})}}}}],Co=["$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})}}}}],ko=["$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)||"")})}}}}],Eo=g({restrict:"A",require:"ngModel",link:function(e,t,n,r){r.$viewChangeListeners.push(function(){e.$eval(n.ngChange)})}}),So=Xn("",!0),Mo=Xn("Odd",0),_o=Xn("Even",1),To=Ln({compile:function(e,t){t.$set("ngCloak",void 0),e.removeClass("ng-cloak")}}),Do=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Ao={},Oo={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=nt("ng-"+e);Ao[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})};Oo[e]&&r.$$phase?t.$evalAsync(i):t.$apply(i)})}}}}]});var No=["$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=ue(s.clone),e.leave(u).done(function(e){!1!==e&&(u=null)}),s=null))})}}}],Ro=["$templateRequest","$anchorScroll","$animate",function(e,t,n){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:br.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)})}}}}],Io=["$compile",function(t){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(n,r,i,o){vr.call(r[0]).match(/SVG/)?(r.empty(),t($e(o.template,e.document).childNodes)(n,function(e){r.append(e)},{futureParentElement:r})):(r.html(o.template),t(r.contents())(n))}}}],Po=Ln({priority:450,compile:function(){return{pre:function(e,t,n){e.$eval(n.ngInit)}}}}),Fo=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(e,t,n,r){var i=n.ngList||", ",a="false"!==n.ngTrim,s=a?Er(i):i;r.$parsers.push(function(e){if(!$(e)){var t=[];return e&&o(e.split(s),function(e){e&&t.push(a?Er(e):e)}),t}}),r.$formatters.push(function(e){if(Cr(e))return e.join(i)}),r.$isEmpty=function(e){return!e||!e.length}}}},Lo="ng-valid",Uo="ng-invalid",jo="ng-pristine",Ho="ng-dirty",qo=r("ngModel");er.$inject="$scope $exceptionHandler $attrs $element $parse $animate $timeout $q $interpolate".split(" "),er.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 S(n)&&(n=e(t)),n},this.$$ngModelSet=function(e,n){S(this.$$parsedNgModel(e))?t(e,{$$$p:n}):this.$$parsedNgModelAssign(e,n)}}else if(!this.$$parsedNgModel.assign)throw qo("nonassign",this.$$attr.ngModel,W(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,Ho),this.$$animate.addClass(this.$$element,jo)},$setDirty:function(){this.$dirty=!0,this.$pristine=!1,this.$$animate.removeClass(this.$$element,jo),this.$$animate.addClass(this.$$element,Ho),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(!xr(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||"parse";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(s.then))throw qo("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)for(var n=0;ni||r.$isEmpty(t)||t.length<=i}}}}},ma=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(!Nr){var n=_r();(sr=$(n)?e.jQuery:n?e[n]:void 0)&&sr.fn.on?(ar=sr,c(sr.fn,{scope:Gr.scope,isolateScope:Gr.isolateScope,controller:Gr.controller,injector:Gr.injector,inheritedData:Gr.inheritedData}),t=sr.cleanData,sr.cleanData=function(e){for(var n,r,i=0;null!=(r=e[i]);i++)(n=sr._data(r,"events"))&&n.$destroy&&sr(r).triggerHandler("$destroy");t(e)}):ar=ye,br.element=ar,Nr=!0}}(),function(n){c(n,{errorHandlingConfig:t,bootstrap:te,copy:P,extend:c,merge:f,equals:L,element:ar,forEach:o,injector:ze,noop:h,bind:j,toJson:q,fromJson:V,identity:m,isUndefined:$,isDefined:y,isString:x,isFunction:S,isObject:b,isNumber:C,isElement:O,isArray:Cr,version:Ir,isDate:k,lowercase:dr,uppercase:pr,callbacks:{$$counter:0},getTestability:re,reloadWithDebugInfo:ne,$$minErr:r,$$csp:Mr,$$encodeUriSegment:J,$$encodeUriQuery:Q,$$stringify:fe}),lr=de(e),lr("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:tn}),e.provider("$compile",et).directive({a:to,input:yo,textarea:yo,form:oo,script:sa,select:ca,option:fa,ngBind:xo,ngBindHtml:ko,ngBindTemplate:Co,ngClass:So,ngClassEven:_o,ngClassOdd:Mo,ngCloak:To,ngController:Do,ngForm:ao,ngHide:ea,ngIf:No,ngInclude:Ro,ngInit:Po,ngNonBindable:Wo,ngPluralize:Jo,ngRepeat:Qo,ngShow:Xo,ngStyle:ta,ngSwitch:na,ngSwitchWhen:ra,ngSwitchDefault:ia,ngOptions:Zo,ngTransclude:aa,ngModel:Bo,ngList:Fo,ngChange:Eo,pattern:pa,ngPattern:pa,required:da,ngRequired:da,minlength:ma,ngMinlength:ma,maxlength:ha,ngMaxlength:ha,ngValue:wo,ngModelOptions:Yo}).directive({ngInclude:Io}).directive(no).directive(Ao),e.provider({$anchorScroll:Ye,$animate:ci,$animateCss:pi,$$animateJs:li,$$animateQueue:ui,$$AnimateRunner:di,$$animateAsyncRun:fi,$browser:Je,$cacheFactory:Qe,$controller:at,$document:st,$$isDocumentHidden:lt,$exceptionHandler:ut,$filter:vn,$$forceReflow:bi,$interpolate:wt,$interval:xt,$http:vt,$httpParamSerializer:ft,$httpParamSerializerJQLike:dt,$httpBackend:yt,$xhrFactory:$t,$jsonpCallbacks:_i,$location:It,$log:Pt,$parse:Kt,$rootScope:en,$q:Zt,$$q:Jt,$sce:an,$sceDelegate:on,$sniffer:sn,$templateCache:Xe,$templateRequest:ln,$$testability:un,$timeout:cn,$window:hn,$$rAF:Xt,$$jqLite:je,$$Map:ei,$$cookieReader:gn})}]).info({angularVersion:"1.6.10"})}(br),br.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"}})}]),ar(function(){ee(e.document,te)}))}(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=M(q,de,he),$e=ve.maxDelay,X=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(" "),L),j.to&&(j.cleanupStyles&&_(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"),_.attr("ng-model-options","ngModelOptions")):I=null,_.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":S}),T=angular.element(_.children()[0]),T.attr("template-url",M),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(_)(e),_.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",b),s.off("click",y),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",y);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",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 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=$;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"},k=0,E=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),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&&($=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"})),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(),$=u.endSymbol(),y="
    ';return{compile:function(e,t){var n=o(y);return function(e,t,r,o){function u(){L.isOpen?g():d()}function d(){F&&!e.$eval(r[c+"Enable"])||(b(),C(),L.popupDelay?A||(A=a(v,L.popupDelay,!1)):v())}function g(){$(),L.popupCloseDelay?O||(O=a(y,L.popupCloseDelay,!1)):y()}function v(){if($(),b(),!L.content)return angular.noop;w(),L.$evalAsync(function(){L.isOpen=!0,k(!0),V()})}function $(){A&&(a.cancel(A),A=null),N&&(a.cancel(N),N=null)}function y(){L&&L.$evalAsync(function(){L&&(L.isOpen=!1,k(!1),L.animation?D||(D=a(x,150,!1)):x())})}function b(){O&&(a.cancel(O),O=null),D&&(a.cancel(D),D=null)}function w(){_||(T=L.$new(),_=n(T,function(e){I?s.find("body").append(e):t.after(e)}),E())}function x(){$(),b(),S(),_&&(_.remove(),_=null),T&&(T.$destroy(),T=null)}function C(){L.title=r[c+"Title"],L.content=H?H(e):r[i],L.popupClass=r[c+"Class"],L.placement=angular.isDefined(r[c+"Placement"])?r[c+"Placement"]:p.placement;var t=l.parsePlacement(L.placement);R=t[1]?t[0]+"-"+t[1]:t[0];var n=parseInt(r[c+"PopupDelay"],10),o=parseInt(r[c+"PopupCloseDelay"],10);L.popupDelay=isNaN(n)?p.popupDelay:n,L.popupCloseDelay=isNaN(o)?p.popupCloseDelay:o}function k(t){j&&angular.isFunction(j.assign)&&j.assign(e,t)}function E(){q.length=0,H?(q.push(e.$watch(H,function(e){L.content=e,!e&&L.isOpen&&y()})),q.push(T.$watch(function(){U||(U=!0,T.$$postDigest(function(){U=!1,L&&L.isOpen&&V()}))}))):q.push(r.$observe(i,function(e){L.content=e,!e&&L.isOpen?y():V()})),q.push(r.$observe(c+"Title",function(e){L.title=e,L.isOpen&&V()})),q.push(r.$observe(c+"Placement",function(e){L.placement=e||p.placement,L.isOpen&&V()}))}function S(){q.length&&(angular.forEach(q,function(e){e()}),q.length=0)}function M(e){L&&L.isOpen&&_&&(t[0].contains(e.target)||_[0].contains(e.target)||g())}var _,T,D,A,O,N,R,I=!!angular.isDefined(p.appendToBody)&&p.appendToBody,P=m(void 0),F=angular.isDefined(r[c+"Enable"]),L=e.$new(!0),U=!1,j=!!angular.isDefined(r[c+"IsOpen"])&&f(r[c+"IsOpen"]),H=!!p.useContentExp&&f(r[i]),q=[],V=function(){_&&_.html()&&(N||(N=a(function(){var e=l.positionElements(t,_,L.placement,I);_.css({top:e.top+"px",left:e.left+"px"}),_.hasClass(e.placement.split("-")[0])||(_.removeClass(R.split("-")[0]),_.addClass(e.placement.split("-")[0])),_.hasClass(p.placementClassPrefix+e.placement)||(_.removeClass(p.placementClassPrefix+R),_.addClass(p.placementClassPrefix+e.placement)),_.hasClass("uib-position-measure")?(l.positionArrow(_,e.placement),_.removeClass("uib-position-measure")):R!==e.placement&&l.positionArrow(_,e.placement),R=e.placement,N=null},0,!1)))};L.origScope=e,L.isOpen=!1,h.add(L,{close:y}),L.contentExp=function(){return L.content},r.$observe("disabled",function(e){e&&$(),e&&L.isOpen&&y()}),j&&e.$watch(j,function(e){L&&!e===L.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",M):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",M)):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"]);L.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(L),L=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 k=a.minuteStep;n.minuteStep&&y.push(e.$parent.$watch(r(n.minuteStep),function(e){k=+e}));var E;y.push(e.$parent.$watch(r(n.min),function(e){var t=new Date(e);E=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 M=!1;n.ngDisabled&&y.push(e.$parent.$watch(r(n.ngDisabled),function(e){M=e})),e.noIncrementHours=function(){var e=m($,60*C);return M||e>S||e<$&&e$&&e>S},e.noIncrementMinutes=function(){var e=m($,k);return M||e>S||e<$&&e$&&e>S},e.noIncrementSeconds=function(){var e=g($,_);return M||e>S||e<$&&e$&&e>S},e.noToggleMeridian=function(){return $.getHours()<12?M||m($,720)>S:M||m($,-720)0};t.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementHours():e.decrementHours()),t.preventDefault()}),n.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementMinutes():e.decrementMinutes()),t.preventDefault()}),r.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementSeconds():e.decrementSeconds()),t.preventDefault()})},this.setupArrowkeyEvents=function(t,n,r){t.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementHours(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementHours(),e.$apply()))}),n.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementMinutes(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementMinutes(),e.$apply()))}),r.bind("keydown",function(t){M||(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*k)},e.decrementMinutes=function(){e.noDecrementMinutes()||h(60*-k)},e.incrementSeconds=function(){e.noIncrementSeconds()||h(_)},e.decrementSeconds=function(){e.noDecrementSeconds()||h(-_)},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,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),M=i(n.typeaheadNoResults).assign||angular.noop,_=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)},L=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),M(e,!1),o.when(L.source(e,i)).then(function(o){var a=n===m.$viewValue;if(a&&w)if(o&&o.length>0){U.activeIdx=A?0:-1,M(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(),M(e,!0);a&&C(e,!1)},function(){Y(),C(e,!1),M(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,Q=function(e){J=a(function(){K(e)},y)},X=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[L.itemName]=s=U.matches[r].model,o=L.modelMapper(e,l),F(e,o),m.$setValidity("editable",!0),m.$setValidity("parse",!0),E(e,{$item:s,$model:o,$label:L.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=k(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?(X(),Q(t)):K(t):(C(e,!1),X(),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),_?(i.$model=t,_(e,i)):(i[L.itemName]=t,n=L.viewMapper(e,i),i[L.itemName]=void 0,r=L.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{b=e.getSelectionElement()}catch(e){}var x=angular.element(b);if(void 0!==b){var C=b.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("
    "+b.innerHTML+"
    ")[0]],x,k)}if(C.match(n)){if(v=e.getOnlySelectedElements(),0===v.length)m=angular.element("<"+k+">
  • "+b.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"+M[0].innerHTML+"":g+=M[0].childNodes[0].innerHTML,S.unshift(M)}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(y=d.toLowerCase().replace(/[<>]/gi,""),"default"===y.trim()&&(y=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===y){v=m.children();var _=!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(),$=m[0].childNodes,y=!0;if($.length>0){for(f=[],c=0;c<$.length;c++)"p"===$[c].nodeName.toLowerCase()&&""===$[c].innerHTML.trim()||3===$[c].nodeType&&""===$[c].nodeValue.trim()||(y=y&&!n.test($[c].nodeName),f.push($[c]));for(var b=0;b)$/i.test(g.startContainer.innerHTML)&&g.selectNode(g.startContainer)}else y=!0,p=v=o.createTextNode(e);if(y)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?j:0)+(e.ctrlKey?U: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,L=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,U=1,j=2,H=4,q=8,V=[{specialKey:"UndoKey",forbiddenModifiers:H+q,mustHaveModifiers:[j+U],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H,mustHaveModifiers:[j+U,q],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H+q,mustHaveModifiers:[j+U],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:j+q+H+U,mustHaveModifiers:[],keyCode:9},{specialKey:"ShiftTabKey",forbiddenModifiers:j+H+U,mustHaveModifiers:[q],keyCode:9}];void 0===x.taDefaultWrap&&(x.taDefaultWrap="p"),""===x.taDefaultWrap?(M="",_=void 0===e.ie?"

    ":e.ie>=11?"


    ":e.ie<=8?"

     

    ":"

     

    "):(M=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+">":"<"+x.taDefaultWrap+">",_=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+"> ":"<"+x.taDefaultWrap+"> "),D.$options||(D.$options={});var B=v(_),z=function(e){if(B(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=$(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()),B(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!B(e||t)}),T.$parsers.push(Q),T.$parsers.unshift(z),T.$formatters.push(Q),T.$formatters.unshift(z),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 $=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&&$(e)}),angular.forEach(i.find("font"),$),e=i.html()}else{if(e=e.replace(/<(|\/)meta[^>]*?>/gi,""),e.match(/<[^>]*?(ta-bind)[^>]*?>/)){if(e.match(/<[^>]*?(text-angular)[^>]*?>/)){var b=angular.element("
          "+e+"
          ");b.find("textarea").remove();for(var x=y.getByAttribute(b,"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(),b.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(M),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(""!==M&&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(M);angular.element(n).replaceWith(r),d.setSelectionToElementStart(r[0])}}var a=Z();""!==M&&""===a.trim()?(ce(M),d.setSelectionToElementStart(w.children()[0])):"<"!==a.substring(0,1)&&x.taDefaultWrap;var s=E!==e.keyCode&&L.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?M:e:""===e?M: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,M=h.serial?h.serial:Math.floor(1e16*Math.random());d._name=h.name?h.name:"textAngularEditor"+M;var _=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"+M]():"redo"===e.toLowerCase()?d["$redoTaBindtaTextElement"+M]():(k(e,!1,t,d.defaultTagAttributes),n&&d["reApplyOnSelectorHandlerstaTextElement"+M](),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"),_(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),_(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),_(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"+M,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":p.attr("ng-model-options")}),d.displayElements.text.attr({id:"taTextElement"+M,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"+M],d.updateTaBindtaHtmlElement=d["updateTaBindtaHtmlElement"+M],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"+M]()},b=function(){d.focussed=!0,p.addClass(d.classes.focussed),C.focus(),p.triggerHandler("focus")},d.displayElements.html.on("focus",b),d.displayElements.text.on("focus",b),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"+M])}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"+M]()}),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"+M]()})}catch(e){u.error(e)}}),r.preventDefault(),r.stopPropagation()):t(function(){d["updateTaBindtaTextElement"+M]()},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),$=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",$),d.displayElements.text.on("keypress",$),y=function(){d._bUpdateSelectedStyles=!1,d.$apply(function(){d.updateSelectedStyles()})},d.displayElements.html.on("mouseup",y),d.displayElements.text.on("mouseup",y)}}}]),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=[];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},k=[];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 E=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!==E||o(i())||(E=t.$watch(function(){S||(S=!0,t.$$postDigest(function(){S=!1,o(i())&&(E(),E=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 M=o(function(){b.sizeSearchInput()},50);angular.element(f).bind("resize",M),t.$on("$destroy",function(){b.searchInput.off("keyup keydown tagged blur paste"),angular.element(f).off("resize",M)}),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=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)&&b(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>Ma){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();Ma=!(a.f||a.e),r.remove()}}return Ma?(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)*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(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)/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 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 Me(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),_e(t,n,e,r)}}function _e(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)}:$;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)||Fe;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 k=m.length+b.length+w.length+(y?0:i.length),E=c>k?new Array(k=c-k+1).join(r):"";return y&&(b=o(E+b,E.length?c-w.length:1/0)),i+=m,e=b+w,("<"===a?i+e+E:">"===a?E+i+e:"^"===a?E.substring(0,k>>=1)+i+e+E.substring(k):i+(y?e:E+e))+n}}}function Fe(e){return e+""}function Le(){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=Le;var r=new Le;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=Le;var r=new Le;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=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,_.c.toString(),t,r)}function l(e,t,r){return n(e,_.x.toString(),t,r)}function u(e,t,r){return n(e,_.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=Le;var t=new as;return t._=e,r(t)}finally{as=Date}}var r=t(e);return n.parse=function(e){try{as=Le;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),k=Ve(v),E=Be(v),S=Ve($),M=Be($);h.forEach(function(e,t){y.set(e.toLowerCase(),t)});var _={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:Xe,e:Xe,H:tt,I:tt,j:et,L:it,m:Qe,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 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 $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])<_a&&da(e[1]-t[1])<_a}function xt(e,t){e*=Ra;var n=Math.cos(t*=Ra);Ct(n*Math.cos(e),n*Math.sin(e),Math.sin(t))}function Ct(e,t,n){++$s,bs+=(e-bs)/$s,ws+=(t-ws)/$s,xs+=(n-xs)/$s}function kt(){function e(e,i){e*=Ra;var o=Math.cos(i*=Ra),a=o*Math.cos(e),s=o*Math.sin(e),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=n*l-r*s)*u+(u=r*a-t*l)*u+(u=t*s-n*a)*u),t*a+n*s+r*l);ys+=u,Cs+=u*(t+(t=a)),ks+=u*(n+(n=s)),Es+=u*(r+(r=l)),Ct(t,n,r)}var t,n,r;Ts.point=function(i,o){i*=Ra;var a=Math.cos(o*=Ra);t=a*Math.cos(i),n=a*Math.sin(i),r=Math.sin(o),Ts.point=e,Ct(t,n,r)}}function Et(){Ts.point=xt}function St(){function e(e,t){e*=Ra;var n=Math.cos(t*=Ra),a=n*Math.cos(e),s=n*Math.sin(e),l=Math.sin(t),u=i*l-o*s,c=o*a-r*l,f=r*s-i*a,d=Math.sqrt(u*u+c*c+f*f),p=r*a+i*s+o*l,h=d&&-ee(p)/d,m=Math.atan2(d,p);Ss+=h*u,Ms+=h*c,_s+=h*f,ys+=m,Cs+=m*(r+(r=a)),ks+=m*(i+(i=s)),Es+=m*(o+(o=l)),Ct(r,i,o)}var t,n,r,i,o;Ts.point=function(a,s){t=a,n=s,Ts.point=e,a*=Ra;var l=Math.cos(s*=Ra);r=l*Math.cos(a),i=l*Math.sin(a),o=Math.sin(s),Ct(r,i,o)},Ts.lineEnd=function(){e(t,n),Ts.lineEnd=Et,Ts.point=xt}}function Mt(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function _t(){return!0}function Tt(e,t,n,r,i){var o=[],a=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t];if(wt(n,r)){i.lineStart();for(var s=0;t>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-_a:Na-e[1])-((t=t.x)[0]<0?t[1]-Na-_a: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)<_a?(e.point(n,r=(r+a)/2>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)<_a&&(n-=i*_a),da(o-s)<_a&&(o-=s*_a),r=Ft(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}function Ft(e,t,n,r){var i,o,a=Math.sin(e-n);return da(a)>_a?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 Lt(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])>_a){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,k=C>Da,E=h*y;if(gs.add(Math.atan2(E*x*Math.sin(C),m*b+E*Math.cos(C))),o+=k?w+x*Aa:w,k^d>=n^v>=n){var S=gt(ht(f),ht(e));yt(S);var M=gt(i,S);yt(M);var _=(k^w>=0?-1:1)*te(M[2]);(r>_||r===_&&(S[0]||S[1]))&&(a+=k^w>=0?1:-1)}if(!g++)break;d=v,h=y,m=b,f=e}}return(-_a>o||_a>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]+=_a,h[1]+=_a,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],k=e[1],E=t[1];x>C&&(w=x,x=C,C=w);var S=C-x,M=da(S-Da)<_a,_=M||_a>S;if(!M&&k>E&&(w=k,k=E,E=w),_?M?k+E>0^b[1]<(da(b[0]-x)<_a?k:E):k<=b[1]&&b[1]<=E:S>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)>_a;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)<_a?i>0?0:3:da(r[0]-n)<_a?i>0?2:1:da(r[1]-t)<_a?i>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&&M.rejoin(),m.push(M.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)$=e,y=t,b=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}};_(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,M=Rt(),_=Ht(e,t,n,r),T={point:f,lineStart:d,lineEnd:p,polygonStart:function(){s=M,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 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;Ls.point=function(o,a){Ls.point=e,t=r=o,n=i=a},Ls.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){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,ks+=a*(n+r)/2,Es+=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 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),Ms+=a*(i+t),_s+=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 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(){y=NaN,k.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(){k.point=n,t.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(e,t){o(f=e,d=t),p=y,h=b,m=w,g=x,v=C,k.point=o}function c(){i(y,b,$,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 $=c-t,y=f-n,b=$*$+y*y;if(b>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)<_a||da(r-d)<_a?(r+d)/2:Math.atan2(x,w),M=e(S,E),_=M[0],T=M[1],D=_-t,A=T-n,O=y*D-$*A;(O*O/b>o||da(($*D+y*A)/b-.5)>.3||a>s*p+l*h+u*m)&&(i(t,n,r,s,l,u,_,T,S,w/=k,x/=k,C,g,v),v.point(_,T),i(_,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=Mt(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,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):jt((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]):$,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,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?Mt(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-_a)%(2*Math.PI)}function gn(e,t,n){var r=na.range(e,t-_a,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-_a,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+_a>t&&(t=-Na+_a):t>Na-_a&&(t=Na-_a);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)<_a?ln:(n.invert=function(e,t){var n=o-t;return[Math.atan2(e,n)/i,o-Q(i)*Math.sqrt(e*e+n*n)]},n)}function En(e,t){return[e,Math.log(Math.tan(Da/4+t/2))]}function Sn(e){var t,n=on(e),r=n.scale,i=n.translate,o=n.clipExtent;return n.scale=function(){var e=r.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.translate=function(){var e=i.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.clipExtent=function(e){var a=o.apply(n,arguments);if(a===n){if(t=null==e){var s=Da*r(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else t&&(a=null);return a},n.clipExtent(null)}function Mn(e,t){return[Math.log(Math.tan(Da/4+t/2)),-e]}function _n(e){return e[0]}function Tn(e){return e[1]}function Dn(e){for(var t=e.length,n=[0,1],r=2,i=2;t>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 Ln(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)<_a&&da(r-l.circle.cy)<_a;)o=l.P,s.unshift(l),Fn(l),l=o;s.unshift(l),Wn(l);for(var u=a;u.circle&&da(n-u.circle.x)<_a&&da(r-u.circle.cy)<_a;)a=u.N,s.push(u),Fn(u),u=a;s.push(u),Wn(u);var c,f=s.length;for(c=1;f>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 Un(e){for(var t,n,r,i,o=e.x,a=e.y,s=Js._;s;)if((r=jn(s,a)-o)>_a)s=s.L;else{if(!((i=o-Hn(s,a))>_a)){r>-_a?(t=s.P,n=s):i>-_a?(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};Xn(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)>_a||da(i-n)>_a)&&(s.splice(a,0,new er(Qn(o.site,c,da(r-f)<_a&&h-i>_a?{x:f,y:da(t-f)<_a?n:h}:da(i-h)<_a&&d-r>_a?{x:da(n-h)<_a?t:d,y:h}:da(r-d)<_a&&i-p>_a?{x:d,y:da(t-d)<_a?n:p}:da(i-p)<_a&&r-f>_a?{x:da(n-p)<_a?t:f,y:p}:null),o.site,null)),++l)}function Bn(e,t){return t.angle-e.angle}function zn(){nr(this),this.x=this.y=this.arc=this.site=this.cy=null}function Yn(e){var t=e.P,n=e.N;if(t&&n){var r=t.site,i=e.site,o=n.site;if(r!==o){var a=i.x,s=i.y,l=r.x-a,u=r.y-s,c=o.x-a,f=o.y-s,d=2*(l*f-u*c);if(!(d>=-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=Xs._;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,k=C<<1|x,E=k+4;E>k;++k)if(u=y[3&k])switch(3&k){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 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 Mr(e){return 1-Math.cos(e*Na)}function _r(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=Ur(t),i=Lr(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],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(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 Fi(e){var t=e[0],n=e[e.length-1];return n>t?[t,n]:[n,t]}function Li(e){return e.rangeExtent?e.rangeExtent():Fi(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=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=ji(r.map(i),n?Math:$l);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)},Bi(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(zi(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)},Bi(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,$=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)/$,k=(b*v+g*w)/$,E=(-b*g+v*w)/$,S=x-h,M=C-m,_=k-h,T=E-m;return S*S+M*M>_*_+T*T&&(x=k,C=E),[[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)?_t: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)},Bi(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]},$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=_(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=L(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},wa.insert=function(e,t){return e=L(e),t=_(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 M(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 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 Ma=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]-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=E().touches),t?ia(t).map(function(t){var n=Z(e,t);return n.identifier=t.identifier,n}):[]};var _a=1e-6,Ta=_a*_a,Da=Math.PI,Aa=2*Da,Oa=Aa-_a,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*$;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,$=(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]-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(_[0],Math.min(_[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(b.range().map(function(e){return(e-E.x)/E.k}).map(b.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(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(E.k)/Math.LN2)+1),k()}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),k(),i(Math.pow(2,.002*La())*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},M=[960,500],_=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?(La=function(){return-na.event.deltaY*(na.event.deltaMode?120:1)},"wheel"):"onmousewheel"in oa?(La=function(){return na.event.wheelDelta},"mousewheel"):(La=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=M[0],r=M[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?(_=null==t?ja:[+t[0],+t[1]],e):_},e.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],e):v},e.size=function(t){return arguments.length?(M=t&&[+t[0],+t[1]],e):M},e.duration=function(t){return arguments.length?(T=+t,e):T},e.x=function(t){return arguments.length?(w=t,b=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 La,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=Me($),na.dsv=function(e,t){function n(e,n,o){arguments.length<3&&(o=n,n=null);var a=_e(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[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,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;Le.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($)>_a&&(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)):$>_a?p=90:-_a>$&&(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=ks=Es=Ss=Ms=_s=0,na.geo.stream(e,Ts);var t=Ss,n=Ms,r=_s,i=t*t+n*n+r*r;return Ta>i&&(t=Cs,n=ks,r=Es,_a>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,ks,Es,Ss,Ms,_s,Ts={sphere:w,point:xt,lineStart:kt,lineEnd:Et,polygonStart:function(){Ts.lineStart=St},polygonEnd:function(){Ts.lineStart=kt}},Ds=Ot(_t,Pt,Lt,[-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+_a,f+.12*u+_a],[c-.214*u-_a,f+.234*u-_a]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+_a,f+.166*u+_a],[c-.115*u-_a,f+.234*u-_a]]).stream(l).point,e},e.scale(1070)};var Os,Ns,Rs,Is,Ps,Fs,Ls={point:w,lineStart:w,lineEnd:w,polygonStart:function(){Ns=0,Ls.lineStart=zt},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.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=Qt},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(Ls)),Os},e.centroid=function(e){return bs=ws=xs=Cs=ks=Es=Ss=Ms=_s=0,na.geo.stream(e,i(js)),_s?[Ss/_s,Ms/_s]:Es?[Cs/Es,ks/Es]:xs?[bs/xs,ws/xs]:[NaN,NaN]},e.bounds=function(e){return Ps=Fs=-(Rs=Is=1/0),na.geo.stream(e,i(Us)),[[Rs,Is],[Ps,Fs]]},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 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)>_a}).map(c)).concat(na.range(Math.ceil(s/m)*m,a,m).filter(function(e){return da(e%v)>_a}).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+_a],[180,90-_a]]).minorExtent([[-180,-80-_a],[180,80+_a]])},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(kn)}).raw=kn;var zs=xn(function(e){return 1/e},Math.atan);(na.geo.gnomonic=function(){return on(zs)}).raw=zs,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,Mn.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Na]},(na.geo.transverseMercator=function(){var e=Sn(Mn),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=Mn,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)/_a)*_a,y:Math.round(a(e,t)/_a)*_a,i:t}})}var r=_n,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,k=$-g;C>k?$=g+C:v=m+k;var E=fr();if(E.add=function(e){o(E,e,+y(e,++p),+b(e,p),m,g,v,$)},E.visit=function(e){dr(e,E,m,g,v,$)},E.find=function(e){return pr(E,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 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=[],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&&(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=$,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},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),$=l[1]/(m.depth||1);Xr(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=Mi(a),i=Si(i),a&&i;)l=Si(l),o=Mi(o),o.a=e,r=a.z+f-i.z-u+s(a._,i._),r>0&&(_i(Di(a,e,n),e,r),u+=r,c+=r),f+=a.m,u+=i.m,d+=l.m,c+=o.m;a&&!Mi(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:$,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 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(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,k,E,S=0,M=0,_=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=o===Cl?Math.sqrt(e*e+u*u):+o.apply(this,arguments),p||(M*=-1),u&&(M=te(g/u*Math.sin(v))),e&&(S=te(g/e*Math.sin(v)))),u){$=u*Math.cos(c+M),y=u*Math.sin(c+M),b=u*Math.cos(f-M),w=u*Math.sin(f-M);var T=Math.abs(f-c-2*M)<=Da?0:1;if(M&&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),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==b?[$,y]:Nn([$,y],[k,E],[b,w],[x,C]),R=$-N[0],I=y-N[1],P=b-N[0],F=w-N[1],L=1/Math.sin(Math.acos((R*P+I*F)/(Math.sqrt(R*R+I*I)*Math.sqrt(P*P+F*F)))/2),U=Math.sqrt(N[0]*N[0]+N[1]*N[1]);if(null!=b){var j=Math.min(h,(u-U)/(L+1)),H=po(null==k?[x,C]:[k,E],[$,y],u,j,p),q=po([b,w],[x,C],u,j,p);h===j?_.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]):_.push("M",H[0],"A",j,",",j," 0 1,",m," ",q[0])}else _.push("M",$,",",y);if(null!=k){var V=Math.min(h,(e-U)/(L-1)),B=po([$,y],[k,E],e,-V,p),z=po([x,C],null==b?[$,y]:[b,w],e,-V,p);h===V?_.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]):_.push("L",z[0],"A",V,",",V," 0 0,",m," ",B[0])}else _.push("L",x,",",C)}else _.push("M",$,",",y),null!=b&&_.push("A",u,",",u," 0 ",T,",",p," ",b,",",w),_.push("L",x,",",C),null!=k&&_.push("A",e,",",e," 0 ",A,",",1-p," ",k,",",E);return _.push("Z"),_.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 kl=na.map({linear:mo,"linear-closed":go,step:vo,"step-before":$o,"step-after":yo,basis:Eo,"basis-open":So,"basis-closed":Mo,bundle:_o,cardinal:xo,"cardinal-open":bo,"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],Ml=[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=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=$n,n=yn,r=Lo;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=Lo,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(_l.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 _l=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=_l.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 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",_a),g=na.transition(h.exit()).style("opacity",_a).remove(),v=na.transition(h.order()).style("opacity",1),y=Math.max(i,0)+a,b=Li(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=m.select("line"),_=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"+b[0]+","+O*o+"V0H"+b[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+","+b[0]+"H0V"+b[1]+"H"+O*o)),M.attr(S,O*i),D.attr(E,O*y),_.attr(k,0).attr(S,O*i),A.attr(C,0).attr(E,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 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,$);s.exit().remove(),s.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Ll[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=Li(u),d.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),c&&(l=Li(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),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;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(),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 y,b,w=this,x=na.select(na.event.target),C=l.of(w,arguments),E=na.select(w),S=x.datum(),M=!/^(n|s)$/.test(S)&&u,_=!/^(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",$),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);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());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=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 Ll={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",_t]]),Yl={range:function(e,t,n){return na.range(Math.ceil(e/n)*n,+t,n).map(Xo)},floor:$,ceil:$};Bl.year=os.year,os.scale=function(){return Qo(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",_t]]);Wl.year=os.year.utc,os.scale.utc=function(){return Qo(na.scale.linear(),Wl,Gl)},na.text=Me(function(e){return e.responseText}),na.json=function(e,t){return _e(e,"application/json",ea,t)},na.html=function(e,t){return _e(e,"text/html",ta,t)},na.xml=Me(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&&_o(n)?e(n,r,i,a):Mt(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,k=jr(y);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),y=y-E.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),_t(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=Ft(e,t),rn?wi(i+n,0):n||0,"string"==typeof e||!_o(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(L);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(L);return n.cache=new ur.Cache,n}function cr(e,t){if("function"!=typeof e)throw new Kr(L);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(Xr.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 Fr(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 Li(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 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=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=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=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),_t(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(L);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=kr,Ie.toPlainObject=Er,Ie.transform=function(e,t,n,r){var i=_o(e)||xr(e);return t=bn(t,r,4),null==n&&(i||gr(e)?(r=e.constructor,n=i?_o(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,Mr(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,M,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,_t(t,0,-1))))return!1;t=Wn(t),n=ei.call(e,t)}return n||Rn(e.length)&&Dn(t,e.length)&&(_o(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=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=Lr,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=_o(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=Xe(et({},n||t),r,Qe),n=Xe(et({},t.imports),r.imports,Qe);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,(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,$):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,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){Le.prototype[e]=function(n){var r=this.__filtered__;if(r&&!t)return new Le(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},Le.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;Le.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":"");Le.prototype[e]=function(){return this[n](1).value()[0]}}),Ve(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");Le.prototype[e]=function(){return this.__filtered__?new Le(this):this[n](1)}}),Ve(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?bt:Ur;Le.prototype[e]=function(e){return this[n](r(e))}}),Le.prototype.compact=function(){return this.filter(Ir)},Le.prototype.reject=function(e,t){return e=bn(e,t,1),this.filter(function(t){return!e(t)})},Le.prototype.slice=function(e,t){e=null==e?0:+e||0;var n=this;return n.__filtered__&&(0t)?new Le(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)},Le.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Le.prototype.toArray=function(){return this.take(Mi)},pt(Le.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 Le,c=o[0],f=u||_o(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 Le(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(Le.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}],Le.prototype.clone=function(){var e=new Le(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},Le.prototype.reverse=function(){if(this.__filtered__){var e=new Le(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},Le.prototype.value=function(){var e,t=this.__wrapped__.value(),n=this.__dir__,r=_o(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,ke=/\w*$/,Ee=/^0[xX]/,Se=/^\[object .+?Constructor\]$/,Me=/^\d+$/,_e=/[\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[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[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[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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Fe={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Le={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=Le[typeof exports]&&exports&&!exports.nodeType&&exports,qe=Le[typeof module]&&module&&!module.nodeType&&module,Ve=Le[typeof self]&&self&&self.Object&&self,Be=Le[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)?k(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 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 b(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 M(e){var t,n,r={};for(n in e)i(e,n)&&(t=S(n))&&(r[t]=e[n]);return r}function _(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),_(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=L(t,e.localeData()),er[t]=er[t]||P(t),er[t](e)):e.localeData().invalidDate()}function L(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 U(e,t,n){yr[e]=_(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 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[Mr])?kr:n[Er]<0||n[Er]>59?Er:n[Sr]<0||n[Sr]>59?Sr:n[Mr]<0||n[Mr]>999?Mr:-1,l(e)._overflowDayOfYear&&(wr>t||t>Cr)&&(t=Cr),l(e)._overflowWeeks&&-1===t&&(t=_r),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=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(!Lr.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[kr]&&0===e._a[Er]&&0===e._a[Sr]&&0===e._a[Mr]&&(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 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=L(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),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[kr]<=12&&t._a[kr]>0&&(l(t).bigHour=void 0),t._a[kr]=xe(t._locale,t._a[kr],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 ke(e){if(!e._d){var t=M(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 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:Me(e),u(e)||(e._d=null),e))}function Me(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?ke(i):"number"==typeof o?i._d=new Date(o):e.createFromInputFallback(i)}function _e(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 _e(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 Le(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=Le(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:Le(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(Le(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[kr])*n,m:g(s[Er])*n,s:g(s[Sr])*n,ms:g(s[Mr])*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&&(_(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),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 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[Mr]=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 _(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 _(i)?i(e,t,n,r):i.replace(/%d/i,e)}function $n(e,t){var n=this._relativeTime[e>0?"future":"past"];return _(n)?n(t):n.replace(/%s/i,t)}function yn(e){var t,n;for(n in e)t=e[n],_(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=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 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 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 Mn(){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 _n(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 _n(this,e,t,1)}function Dn(e,t){return _n(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 Ln(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={},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})?/,$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,kr=3,Er=4,Sr=5,Mr=6,_r=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"),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)?)?/,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)?)?/,Lr=/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"),E("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"),E("weekYear","gg"),E("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"),E("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"),E("week","w"),E("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 Qr={dow:0,doy:6};R("D",["DD",2],"Do","date"),E("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 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"),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"),E("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),E("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"],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"),U("m",sr),U("mm",sr,rr),V(["m","mm"],Er);var oi=T("Minutes",!1);R("s",["ss",2],0,"second"),E("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()}),E("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=Mt,ui.toDate=Et,ui.toISOString=pt,ui.toJSON=_t,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=jt,ui.month=J,ui.daysInMonth=Q,ui.week=ui.weeks=Bt,ui.isoWeek=ui.isoWeeks=zt,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=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.",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",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=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"),$i=Fn("s"),yi=Fn("m"),bi=Fn("h"),wi=Fn("d"),xi=Fn("w"),Ci=Fn("M"),ki=Fn("y"),Ei=Un("milliseconds"),Si=Un("seconds"),Mi=Un("minutes"),_i=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=Mn,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=ki,Ii.valueOf=Pn,Ii._bubble=On,Ii.get=Ln,Ii.milliseconds=Ei,Ii.seconds=Si,Ii.minutes=Mi,Ii.hours=_i,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=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("contact-actions/contact-actions.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/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 U(new(U(function(){},{prototype:e})),t)}function i(e){return L(arguments,function(t){t!==e&&L(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 L(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 U({},u,t)}function u(e,t,n){if(!n){n=[];for(var r in e)n.push(r)}for(var i=0;i "));if($[n]=r,I(e))g.push(n,[function(){return t.get(e)}],u);else{var i=t.annotate(e);L(i,function(e){e!==n&&l.hasOwnProperty(e)&&p(l[e],e)}),g.push(n,e,i)}v.pop(),$[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=[],$={};return L(l,p),l=v=$=null,function(r,o,a){function s(){--y||(b||i($,o.$$values),p.$$values=$,p.$$promises=p.$$promises||!0,delete p.$$inheritedValues,u.resolve($))}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={},$=U({},r),y=1+g.length/3,b=!1;if(N(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i($,d(o.$$inheritedValues,m)),U(v,o.$$promises),o.$$values?(b=i($,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,$)),f.promise.then(function(e){$[n]=e,s()},u)}catch(e){u(e)}}var f=e.defer(),d=0;L(o,function(e){v.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&(d++,v[e].then(function(t){$[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=U({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;(l=u.exec(e))&&(v=s(l,!1),!(v.segment.indexOf("?")>=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 $(e){U(this,e)}function y(){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(b[e.name],f.invoke(e.def))}}function c(e){U(this,e||{})}H=this;var f,d=!1,m=!0,g=!1,b={},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:/.*/}};y.$$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,U(o(),t))},this.isMatcher=function(e){if(!P(e))return!1;var t=!0;return L(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 b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new $(U({name:e},t)),n&&(x.push({name:e,def:n}),w||u()),this},L(C,function(e,t){b[t]=new $(U({name:t},e))}),b=r(b,{}),this.$get=["$injector",function(e){return f=e,w=!1,u(),L(C,function(e,t){b[t]||(b[t]=new $(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: '"+y+"' 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 $?t.type:new $(t.type):"config"===r?b.any:b.string)}(r,t,i);var m=function(){var t={array:"search"===i&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return U(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,y=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,y);U(this,{id:e,type:t,location:i,array:m,squash:y,replace:w,isOptional:v,value:u,dynamic:n,config:r,toString:c})},c.prototype={$$new:function(){return r(this,U(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(),L(t,function(t){L(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return L(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return L(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)}]),U(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)}]),U(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 _)R(_[o])&&(t[o]=_[o](t,_.$delegates[o]));return E[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})}]),m(n),t}function v(e){return e.indexOf("*")>-1}function $(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 y(e,t){return I(e)&&!N(t)?_[e]:R(t)&&I(e)?(_[e]&&!_.$delegates[e]&&(_.$delegates[e]=_[e]),_[e]=t,this):this}function b(e,t){return P(e)?t=e:t.name=e,g(t),this}function w(e,i,o,s,f,p,m,g,y){function b(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 L(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")),_=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,U({inherit:!0,relative:k.$current},n))},k.transitionTo=function(t,n,o){n=n||{},o=U({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 $={to:t,toParams:n,options:o},y=b($,u.self,f,o);if(y)return y;if(t=$.to,n=$.toParams,o=$.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[M])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,j(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(),_;for(var L=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 M(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 _(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=M(a.uiSref,e.current.name),u=null,c=_(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},$=i.$eval(a.uiSrefOpts)||{};t.forEach(r,function(e){e in $&&(v[e]=$[e])});var y=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&&y(e)},!0),u=t.copy(i.$eval(l.paramExpr))),y(),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 $=n[o+1];if(!1===g)null!=v&&(u+=F(v)?h(v,t).join("-"):encodeURIComponent(v)),u+=$;else if(!0===g){var y=u.match(/\/$/)?/\/?(.*)/:/(.*)/;u+=$.match(y)[1]}else I(g)&&(u+=g+$)}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},$.prototype.is=function(e,t){return!0},$.prototype.encode=function(e,t){return e},$.prototype.decode=function(e,t){return e},$.prototype.equals=function(e,t){return e==t},$.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},$.prototype.pattern=/.*/,$.prototype.toString=function(){return"{Type:"+this.name+"}"},$.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},$.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}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(L,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&&(L[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([])")))):(b(),C.nextTick(function(){b(),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){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(E(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)?E(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){E(e)?o(e,function(e){t.push(X(n,!0)+(!0===e?"":"="+X(e,!0)))}):t.push(X(n,!0)+(!0===e?"":"="+X(e,!0)))}),t.length?t.join("&"):""}function Q(e){return X(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function X(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()},M(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&&E(e)&&(e=e[e.length-1]),ae(M(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=Mr(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 M(t)?Ue(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 ke(e){var t=e.ng339,n=t&&Ur[t],r=n&&n.events,n=n&&n.data;n&&!Ce(n)||r&&!Ce(r)||(delete Ur[t],e.ng339=void 0)}function Ee(e,t,n,r){if(y(r))throw Vr("offargs");var i=(r=Me(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=Ee.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,!F&&(m.replace&&(m.templateUrl||m.template)||m.transclude&&!m.$$tlb)){for(w=L+1;F=t[w++];)if(F.transclude&&!F.$$tlb||F.replace&&(F.templateUrl||F.template)){U=!0;break}F=!0}if(!m.templateUrl&&m.controller&&(k=k||fe(),de("'"+g+"' controller",k[g],m,R),k[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=X(U,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]=X(U,Y[ee].childNodes,a));v=v.childNodes}else v=ur(we(n)).contents();R.empty(),P=X(U,v,a,void 0,void 0,{needsNewScope:m.$$isolateScope||m.$$newScope}),P.$$slots=Y}if(m.template)if(O=!0,de("template",_,m,R),_=m,w=M(m.template)?m.template(R,r):m.template,w=Ae(w),m.replace){if(l=m,v=zr.test(w)?st(he(m.templateNamespace,Mr(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(L+1,t.length-(L+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,R),_=m,m.replace&&(l=m),h=ue(t.splice(L,t.length-L),R,r,s,A&&P,u,f,{controllerDirectives:k,newScopeDirective:C!==m&&C,newIsolateScopeDirective:S,templateDirective:_,nonTlbTranscludeDirective:T}),q=t.length;else if(m.compile)try{y=m.compile(R,r,P);var oe=m.$$originalDirective||m;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(E(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=(E(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)||M(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)?k(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)||M(e)||(E(e)?o(e,function(e){t.push(X(n)+"="+X(pt(e)))}):t.push(X(n)+"="+X(pt(e))))}),t.join("&")}}}function mt(){this.$get=function(){return function(e){function t(e,r,i){E(e)?o(e,function(e,n){t(e,r+"["+(b(e)?n:"")+"]")}):b(e)&&!k(e)?a(e,function(e,n){t(e,r+(i?"":"[")+n+(i?"":"]"))}):(M(e)&&(e=e()),n.push(X(r)+"="+(null==e?"":X(pt(e)))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function gt(e,t){if(x(e)){var n=e.replace(Mi,"").trim();if(n){var r,i=t("Content-Type"),i=i&&0===i.indexOf(Ci);if((r=i)||(r=(r=n.match(Ei))&&Si[r[0]].test(n)),r)try{e=B(n)}catch(t){if(!i)return e;throw _i("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(Mr(e.substr(0,t)));e=Mr(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=Mr(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 M(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(ki),put:he(ki),patch:he(ki)},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:k),h&&(v=h.get(O),y(v)?v&&M(v.then)?v.then(c,c):E(v)?u(v[1],v[0],he(v[2]),v[3],v[4]):u(v,200,{},"OK","complete"):h.put(O,T)),$(v)&&((v=_(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]=Q(e[t].replace(/%2F/g,"/"));return e.join("/")}function Mt(e,t){var n=hn(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=d(n.port)||Ni[n.protocol]||null}function _t(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||"",Mt(e,this),this.$$parse=function(e){var n=Dt(t,e);if(!x(n))throw Ri("ipthprfx",e,t);_t(n,this,!0),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=J(this.$$search),n=this.$$hash?"#"+Q(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){Mt(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)),_t(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?"#"+Q(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?"#"+Q(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 Ft(e,t){return function(n){return $(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function Ut(){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 Lt(){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 M(e.valueOf)?e.valueOf():Ui.call(e)}function Qt(){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:M(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 E(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)"+_r(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>Qi&&(t=t.splice(0,Qi-1),a=n-1,n=1),{d:t,e:a,i:n}}function _n(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)),!k(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 Fn(){return function(e,t){return $(t)&&(t=2),V(e,t)}}function Un(){return function(e,t,n){return t=1/0===Math.abs(Number(t))?Number(t):d(t),Er(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?Ln(e,n,n+t):0===n?Ln(e,t,e.length):Ln(e,Math.max(0,n+t),n)):e)}}function Ln(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(M(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(k(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)&&!k(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&&!k(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 Qn(e){return y(e)&&!C(e)&&(e=parseFloat(e)),Er(e)?void 0:e}function Xn(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?Xn(e):0,s=i?Xn(t):0,l=o?Xn(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:Ue,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 Qr={};o("input select option textarea button form details".split(" "),function(e){Qr[e]=!0});var Xr={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};o({data:_e,removeData:Se,hasData:function(e){for(var t in Ur[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 E(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(" "):E(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=M(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){Li[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,Fi("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=F(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 Fi("syntax",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw Fi("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 Fi("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 Fi("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 Qi=22,Xi=".",eo="0";En.$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(Xr,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(k(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=Qn(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=Qn(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=Qn(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"!==Mr(n.ngTrim);$(n.name)&&t.attr("name",++kr),t.on("change",function(e){var o;t[0].checked&&(o=n.value,i&&(o=Mr(o)),r.$setViewValue(o,e&&e.type))}),r.$render=function(){var e=n.value;i&&(e=Mr(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=Qn(e),Er(r.$modelValue)||(c?(e=t.val(),f>e&&(e=f,t.val(e)),r.$setViewValue(e)):r.$validate())}function l(e){d=Qn(e),Er(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 L(e,l)}),r.$parsers.push(function(e){return e?l:u})},hidden:h,button:h,submit:h,reset:h,file:h},ko=["$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)}}}}],Eo=/^(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 Eo.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)})}}}},Mo=["$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)})}}}}],_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=$(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={},Fo={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})};Fo[e]&&r.$$phase?t.$evalAsync(i):t.$apply(i)})}}}}]});var Uo=["$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))})}}}],Lo=["$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?Mr(i):i;r.$parsers.push(function(e){if(!$(e)){var t=[];return e&&o(e.split(s),function(e){e&&t.push(a?Mr(e):e)}),t}}),r.$formatters.push(function(e){if(E(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 M(n)&&(n=e(t)),n},this.$$ngModelSet=function(e,n){M(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(!Er(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||!M(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:F,extend:c,merge:f,equals:L,element:ur,forEach:o,injector:Ge,noop:h,bind:H,toJson:V,fromJson:B,identity:m,isUndefined:$,isDefined:y,isString:x,isFunction:M,isObject:b,isNumber:C,isElement:N,isArray:E,version:Fr,isDate:k,callbacks:{$$counter:0},getTestability:ie,reloadWithDebugInfo:re,$$minErr:r,$$csp:Tr,$$encodeUriSegment:Q,$$encodeUriQuery:X,$$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:ko,textarea:ko,form:co,script:ha,select:va,option:$a,ngBind:Mo,ngBindHtml:To,ngBindTemplate:_o,ngClass:Ao,ngClassEven:No,ngClassOdd:Oo,ngCloak:Ro,ngController:Io,ngForm:fo,ngHide:sa,ngIf:Uo,ngInclude:Lo,ngInit:Ho,ngNonBindable:Qo,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:kt,$interval:Et,$http:bt,$httpParamSerializer:ht,$httpParamSerializerJQLike:mt,$httpBackend:xt,$xhrFactory:wt,$jsonpCallbacks:Ai,$location:Ut,$log:Lt,$parse:Qt,$rootScope:rn,$q:Xt,$$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 L(){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=M(q,de,he),$e=ve.maxDelay,X=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(" "),U),j.to&&(j.cleanupStyles&&_(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"),_.attr("ng-model-options","ngModelOptions")):I=null,_.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":S}),T=angular.element(_.children()[0]),T.attr("template-url",M),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(_)(e),_.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",b),s.off("click",y),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",y);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",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 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=$;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"},k=0,E=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),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&&($=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"})),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(),$=u.endSymbol(),y="
    ';return{compile:function(e,t){var n=o(y);return function(e,t,r,o){function u(){U.isOpen?g():d()}function d(){F&&!e.$eval(r[c+"Enable"])||(b(),C(),U.popupDelay?A||(A=a(v,U.popupDelay,!1)):v())}function g(){$(),U.popupCloseDelay?O||(O=a(y,U.popupCloseDelay,!1)):y()}function v(){if($(),b(),!U.content)return angular.noop;w(),U.$evalAsync(function(){U.isOpen=!0,k(!0),V()})}function $(){A&&(a.cancel(A),A=null),N&&(a.cancel(N),N=null)}function y(){U&&U.$evalAsync(function(){U&&(U.isOpen=!1,k(!1),U.animation?D||(D=a(x,150,!1)):x())})}function b(){O&&(a.cancel(O),O=null),D&&(a.cancel(D),D=null)}function w(){_||(T=U.$new(),_=n(T,function(e){I?s.find("body").append(e):t.after(e)}),E())}function x(){$(),b(),S(),_&&(_.remove(),_=null),T&&(T.$destroy(),T=null)}function C(){U.title=r[c+"Title"],U.content=H?H(e):r[i],U.popupClass=r[c+"Class"],U.placement=angular.isDefined(r[c+"Placement"])?r[c+"Placement"]:p.placement;var t=l.parsePlacement(U.placement);R=t[1]?t[0]+"-"+t[1]:t[0];var n=parseInt(r[c+"PopupDelay"],10),o=parseInt(r[c+"PopupCloseDelay"],10);U.popupDelay=isNaN(n)?p.popupDelay:n,U.popupCloseDelay=isNaN(o)?p.popupCloseDelay:o}function k(t){j&&angular.isFunction(j.assign)&&j.assign(e,t)}function E(){q.length=0,H?(q.push(e.$watch(H,function(e){U.content=e,!e&&U.isOpen&&y()})),q.push(T.$watch(function(){L||(L=!0,T.$$postDigest(function(){L=!1,U&&U.isOpen&&V()}))}))):q.push(r.$observe(i,function(e){U.content=e,!e&&U.isOpen?y():V()})),q.push(r.$observe(c+"Title",function(e){U.title=e,U.isOpen&&V()})),q.push(r.$observe(c+"Placement",function(e){U.placement=e||p.placement,U.isOpen&&V()}))}function S(){q.length&&(angular.forEach(q,function(e){e()}),q.length=0)}function M(e){U&&U.isOpen&&_&&(t[0].contains(e.target)||_[0].contains(e.target)||g())}var _,T,D,A,O,N,R,I=!!angular.isDefined(p.appendToBody)&&p.appendToBody,P=m(void 0),F=angular.isDefined(r[c+"Enable"]),U=e.$new(!0),L=!1,j=!!angular.isDefined(r[c+"IsOpen"])&&f(r[c+"IsOpen"]),H=!!p.useContentExp&&f(r[i]),q=[],V=function(){_&&_.html()&&(N||(N=a(function(){var e=l.positionElements(t,_,U.placement,I);_.css({top:e.top+"px",left:e.left+"px"}),_.hasClass(e.placement.split("-")[0])||(_.removeClass(R.split("-")[0]),_.addClass(e.placement.split("-")[0])),_.hasClass(p.placementClassPrefix+e.placement)||(_.removeClass(p.placementClassPrefix+R),_.addClass(p.placementClassPrefix+e.placement)),_.hasClass("uib-position-measure")?(l.positionArrow(_,e.placement),_.removeClass("uib-position-measure")):R!==e.placement&&l.positionArrow(_,e.placement),R=e.placement,N=null},0,!1)))};U.origScope=e,U.isOpen=!1,h.add(U,{close:y}),U.contentExp=function(){return U.content},r.$observe("disabled",function(e){e&&$(),e&&U.isOpen&&y()}),j&&e.$watch(j,function(e){U&&!e===U.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",M):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",M)):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"]);U.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(U),U=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 k=a.minuteStep;n.minuteStep&&y.push(e.$parent.$watch(r(n.minuteStep),function(e){k=+e}));var E;y.push(e.$parent.$watch(r(n.min),function(e){var t=new Date(e);E=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 M=!1;n.ngDisabled&&y.push(e.$parent.$watch(r(n.ngDisabled),function(e){M=e})),e.noIncrementHours=function(){var e=m($,60*C);return M||e>S||e<$&&e$&&e>S},e.noIncrementMinutes=function(){var e=m($,k);return M||e>S||e<$&&e$&&e>S},e.noIncrementSeconds=function(){var e=g($,_);return M||e>S||e<$&&e$&&e>S},e.noToggleMeridian=function(){return $.getHours()<12?M||m($,720)>S:M||m($,-720)0};t.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementHours():e.decrementHours()),t.preventDefault()}),n.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementMinutes():e.decrementMinutes()),t.preventDefault()}),r.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementSeconds():e.decrementSeconds()),t.preventDefault()})},this.setupArrowkeyEvents=function(t,n,r){t.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementHours(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementHours(),e.$apply()))}),n.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementMinutes(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementMinutes(),e.$apply()))}),r.bind("keydown",function(t){M||(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*k)},e.decrementMinutes=function(){e.noDecrementMinutes()||h(60*-k)},e.incrementSeconds=function(){e.noIncrementSeconds()||h(_)},e.decrementSeconds=function(){e.noDecrementSeconds()||h(-_)},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(){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],$=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,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),M=i(n.typeaheadNoResults).assign||angular.noop,_=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)},U=d.parse(n.uibTypeahead),L=e.$new(),j=e.$on("$destroy",function(){L.$destroy()});L.$on("$destroy",j);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 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(){L.matches=[],L.activeIdx=-1,t.attr("aria-expanded",!1),z()},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),M(e,!1),o.when(U.source(e,i)).then(function(o){var a=n===m.$viewValue;if(a&&w)if(o&&o.length>0){L.activeIdx=A?0:-1,M(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(),M(e,!0);a&&C(e,!1)},function(){Y(),C(e,!1),M(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)},y)},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[U.itemName]=s=L.matches[r].model,o=U.modelMapper(e,l),F(e,o),m.$setValidity("editable",!0),m.$setValidity("parse",!0),E(e,{$item:s,$model:o,$label:U.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=B.find("li")[L.activeIdx],r.parentNode.scrollTop=r.offsetTop;break;case 40:L.activeIdx=(L.activeIdx+1)%L.matches.length,L.$digest(),r=B.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!==$||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)})),!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!==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)),B.remove(),R&&q.remove()});var te=r(B)(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===$||t&&t.length>=$?y>0?(X(),Q(t)):K(t):(C(e,!1),X(),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),_?(i.$model=t,_(e,i)):(i[U.itemName]=t,n=U.viewMapper(e,i),i[U.itemName]=void 0,r=U.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{b=e.getSelectionElement()}catch(e){}var x=angular.element(b);if(void 0!==b){var C=b.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("
    "+b.innerHTML+"
    ")[0]],x,k)}if(C.match(n)){if(v=e.getOnlySelectedElements(),0===v.length)m=angular.element("<"+k+">
  • "+b.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"+M[0].innerHTML+"":g+=M[0].childNodes[0].innerHTML,S.unshift(M)}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(y=d.toLowerCase().replace(/[<>]/gi,""),"default"===y.trim()&&(y=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===y){v=m.children();var _=!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(),$=m[0].childNodes,y=!0;if($.length>0){for(f=[],c=0;c<$.length;c++)"p"===$[c].nodeName.toLowerCase()&&""===$[c].innerHTML.trim()||3===$[c].nodeType&&""===$[c].nodeValue.trim()||(y=y&&!n.test($[c].nodeName),f.push($[c]));for(var b=0;b)$/i.test(g.startContainer.innerHTML)&&g.selectNode(g.startContainer)}else y=!0,p=v=o.createTextNode(e);if(y)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?j: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,U=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,L=1,j=2,H=4,q=8,V=[{specialKey:"UndoKey",forbiddenModifiers:H+q,mustHaveModifiers:[j+L],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H,mustHaveModifiers:[j+L,q],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H+q,mustHaveModifiers:[j+L],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:j+q+H+L,mustHaveModifiers:[],keyCode:9},{specialKey:"ShiftTabKey",forbiddenModifiers:j+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?"

     

    ":"

     

    "):(M=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+">":"<"+x.taDefaultWrap+">",_=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+"> ":"<"+x.taDefaultWrap+"> "),D.$options||(D.$options={});var B=v(_),z=function(e){if(B(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=$(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()),B(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!B(e||t)}),T.$parsers.push(Q),T.$parsers.unshift(z),T.$formatters.push(Q),T.$formatters.unshift(z),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 $=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&&$(e)}),angular.forEach(i.find("font"),$),e=i.html()}else{if(e=e.replace(/<(|\/)meta[^>]*?>/gi,""),e.match(/<[^>]*?(ta-bind)[^>]*?>/)){if(e.match(/<[^>]*?(text-angular)[^>]*?>/)){var b=angular.element("
          "+e+"
          ");b.find("textarea").remove();for(var x=y.getByAttribute(b,"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(),b.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(M),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(""!==M&&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(M);angular.element(n).replaceWith(r),d.setSelectionToElementStart(r[0])}}var a=Z();""!==M&&""===a.trim()?(ce(M),d.setSelectionToElementStart(w.children()[0])):"<"!==a.substring(0,1)&&x.taDefaultWrap;var s=E!==e.keyCode&&U.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?M:e:""===e?M: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,M=h.serial?h.serial:Math.floor(1e16*Math.random());d._name=h.name?h.name:"textAngularEditor"+M;var _=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"+M]():"redo"===e.toLowerCase()?d["$redoTaBindtaTextElement"+M]():(k(e,!1,t,d.defaultTagAttributes),n&&d["reApplyOnSelectorHandlerstaTextElement"+M](),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"),_(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),_(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),_(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"+M,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":p.attr("ng-model-options")}),d.displayElements.text.attr({id:"taTextElement"+M,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"+M],d.updateTaBindtaHtmlElement=d["updateTaBindtaHtmlElement"+M],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"+M]()},b=function(){d.focussed=!0,p.addClass(d.classes.focussed),C.focus(),p.triggerHandler("focus")},d.displayElements.html.on("focus",b),d.displayElements.text.on("focus",b),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"+M])}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"+M]()}),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"+M]()})}catch(e){u.error(e)}}),r.preventDefault(),r.stopPropagation()):t(function(){d["updateTaBindtaTextElement"+M]()},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),$=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",$),d.displayElements.text.on("keypress",$),y=function(){d._bUpdateSelectedStyles=!1,d.$apply(function(){d.updateSelectedStyles()})},d.displayElements.html.on("mouseup",y),d.displayElements.text.on("mouseup",y)}}}]),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=[];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},k=[];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 E=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!==E||o(i())||(E=t.$watch(function(){S||(S=!0,t.$$postDigest(function(){S=!1,o(i())&&(E(),E=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 M=o(function(){b.sizeSearchInput()},50);angular.element(f).bind("resize",M),t.$on("$destroy",function(){b.searchInput.off("keyup keydown tagged blur paste"),angular.element(f).off("resize",M)}),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=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)&&b(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>Ma){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();Ma=!(a.f||a.e),r.remove()}}return Ma?(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)*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(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)/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 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 Me(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),_e(t,n,e,r)}}function _e(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)}:$;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)||Fe;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 k=m.length+b.length+w.length+(y?0:i.length),E=c>k?new Array(k=c-k+1).join(r):"";return y&&(b=o(E+b,E.length?c-w.length:1/0)),i+=m,e=b+w,("<"===a?i+e+E:">"===a?E+i+e:"^"===a?E.substring(0,k>>=1)+i+e+E.substring(k):i+(y?e:E+e))+n}}}function Fe(e){return e+""}function Ue(){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=Ue;var r=new Ue;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=Ue;var r=new Ue;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=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,_.c.toString(),t,r)}function l(e,t,r){return n(e,_.x.toString(),t,r)}function u(e,t,r){return n(e,_.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=Ue;var t=new as;return t._=e,r(t)}finally{as=Date}}var r=t(e);return n.parse=function(e){try{as=Ue;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),k=Ve(v),E=Be(v),S=Ve($),M=Be($);h.forEach(function(e,t){y.set(e.toLowerCase(),t)});var _={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:Xe,e:Xe,H:tt,I:tt,j:et,L:it,m:Qe,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 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 $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])<_a&&da(e[1]-t[1])<_a}function xt(e,t){e*=Ra;var n=Math.cos(t*=Ra);Ct(n*Math.cos(e),n*Math.sin(e),Math.sin(t))}function Ct(e,t,n){++$s,bs+=(e-bs)/$s,ws+=(t-ws)/$s,xs+=(n-xs)/$s}function kt(){function e(e,i){e*=Ra;var o=Math.cos(i*=Ra),a=o*Math.cos(e),s=o*Math.sin(e),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=n*l-r*s)*u+(u=r*a-t*l)*u+(u=t*s-n*a)*u),t*a+n*s+r*l);ys+=u,Cs+=u*(t+(t=a)),ks+=u*(n+(n=s)),Es+=u*(r+(r=l)),Ct(t,n,r)}var t,n,r;Ts.point=function(i,o){i*=Ra;var a=Math.cos(o*=Ra);t=a*Math.cos(i),n=a*Math.sin(i),r=Math.sin(o),Ts.point=e,Ct(t,n,r)}}function Et(){Ts.point=xt}function St(){function e(e,t){e*=Ra;var n=Math.cos(t*=Ra),a=n*Math.cos(e),s=n*Math.sin(e),l=Math.sin(t),u=i*l-o*s,c=o*a-r*l,f=r*s-i*a,d=Math.sqrt(u*u+c*c+f*f),p=r*a+i*s+o*l,h=d&&-ee(p)/d,m=Math.atan2(d,p);Ss+=h*u,Ms+=h*c,_s+=h*f,ys+=m,Cs+=m*(r+(r=a)),ks+=m*(i+(i=s)),Es+=m*(o+(o=l)),Ct(r,i,o)}var t,n,r,i,o;Ts.point=function(a,s){t=a,n=s,Ts.point=e,a*=Ra;var l=Math.cos(s*=Ra);r=l*Math.cos(a),i=l*Math.sin(a),o=Math.sin(s),Ct(r,i,o)},Ts.lineEnd=function(){e(t,n),Ts.lineEnd=Et,Ts.point=xt}}function Mt(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function _t(){return!0}function Tt(e,t,n,r,i){var o=[],a=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t];if(wt(n,r)){i.lineStart();for(var s=0;t>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=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()}},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-_a:Na-e[1])-((t=t.x)[0]<0?t[1]-Na-_a: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)<_a?(e.point(n,r=(r+a)/2>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)<_a&&(n-=i*_a),da(o-s)<_a&&(o-=s*_a),r=Ft(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}function Ft(e,t,n,r){var i,o,a=Math.sin(e-n);return da(a)>_a?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 Ut(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])>_a){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,k=C>Da,E=h*y;if(gs.add(Math.atan2(E*x*Math.sin(C),m*b+E*Math.cos(C))),o+=k?w+x*Aa:w,k^d>=n^v>=n){var S=gt(ht(f),ht(e));yt(S);var M=gt(i,S);yt(M);var _=(k^w>=0?-1:1)*te(M[2]);(r>_||r===_&&(S[0]||S[1]))&&(a+=k^w>=0?1:-1)}if(!g++)break;d=v,h=y,m=b,f=e}}return(-_a>o||_a>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]+=_a,h[1]+=_a,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],k=e[1],E=t[1];x>C&&(w=x,x=C,C=w);var S=C-x,M=da(S-Da)<_a,_=M||_a>S;if(!M&&k>E&&(w=k,k=E,E=w),_?M?k+E>0^b[1]<(da(b[0]-x)<_a?k:E):k<=b[1]&&b[1]<=E:S>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)>_a;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)<_a?i>0?0:3:da(r[0]-n)<_a?i>0?2:1:da(r[1]-t)<_a?i>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&&M.rejoin(),m.push(M.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)$=e,y=t,b=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}};_(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,M=Rt(),_=Ht(e,t,n,r),T={point:f,lineStart:d,lineEnd:p,polygonStart:function(){s=M,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 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;Us.point=function(o,a){Us.point=e,t=r=o,n=i=a},Us.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){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,ks+=a*(n+r)/2,Es+=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 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),Ms+=a*(i+t),_s+=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 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(){y=NaN,k.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(){k.point=n,t.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(e,t){o(f=e,d=t),p=y,h=b,m=w,g=x,v=C,k.point=o}function c(){i(y,b,$,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 $=c-t,y=f-n,b=$*$+y*y;if(b>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)<_a||da(r-d)<_a?(r+d)/2:Math.atan2(x,w),M=e(S,E),_=M[0],T=M[1],D=_-t,A=T-n,O=y*D-$*A;(O*O/b>o||da(($*D+y*A)/b-.5)>.3||a>s*p+l*h+u*m)&&(i(t,n,r,s,l,u,_,T,S,w/=k,x/=k,C,g,v),v.point(_,T),i(_,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=Mt(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,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):jt((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]):$,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,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?Mt(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-_a)%(2*Math.PI)}function gn(e,t,n){var r=na.range(e,t-_a,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-_a,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+_a>t&&(t=-Na+_a):t>Na-_a&&(t=Na-_a);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)<_a?ln:(n.invert=function(e,t){var n=o-t;return[Math.atan2(e,n)/i,o-Q(i)*Math.sqrt(e*e+n*n)]},n)}function En(e,t){return[e,Math.log(Math.tan(Da/4+t/2))]}function Sn(e){var t,n=on(e),r=n.scale,i=n.translate,o=n.clipExtent;return n.scale=function(){var e=r.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.translate=function(){var e=i.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.clipExtent=function(e){var a=o.apply(n,arguments);if(a===n){if(t=null==e){var s=Da*r(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else t&&(a=null);return a},n.clipExtent(null)}function Mn(e,t){return[Math.log(Math.tan(Da/4+t/2)),-e]}function _n(e){return e[0]}function Tn(e){return e[1]}function Dn(e){for(var t=e.length,n=[0,1],r=2,i=2;t>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 Un(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)<_a&&da(r-l.circle.cy)<_a;)o=l.P,s.unshift(l),Fn(l),l=o;s.unshift(l),Wn(l);for(var u=a;u.circle&&da(n-u.circle.x)<_a&&da(r-u.circle.cy)<_a;)a=u.N,s.push(u),Fn(u),u=a;s.push(u),Wn(u);var c,f=s.length;for(c=1;f>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=jn(s,a)-o)>_a)s=s.L;else{if(!((i=o-Hn(s,a))>_a)){r>-_a?(t=s.P,n=s):i>-_a?(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};Xn(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)>_a||da(i-n)>_a)&&(s.splice(a,0,new er(Qn(o.site,c,da(r-f)<_a&&h-i>_a?{x:f,y:da(t-f)<_a?n:h}:da(i-h)<_a&&d-r>_a?{x:da(n-h)<_a?t:d,y:h}:da(r-d)<_a&&i-p>_a?{x:d,y:da(t-d)<_a?n:p}:da(i-p)<_a&&r-f>_a?{x:da(n-p)<_a?t:f,y:p}:null),o.site,null)),++l)}function Bn(e,t){return t.angle-e.angle}function zn(){nr(this),this.x=this.y=this.arc=this.site=this.cy=null}function Yn(e){var t=e.P,n=e.N;if(t&&n){var r=t.site,i=e.site,o=n.site;if(r!==o){var a=i.x,s=i.y,l=r.x-a,u=r.y-s,c=o.x-a,f=o.y-s,d=2*(l*f-u*c);if(!(d>=-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=Xs._;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,k=C<<1|x,E=k+4;E>k;++k)if(u=y[3&k])switch(3&k){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 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 Mr(e){return 1-Math.cos(e*Na)}function _r(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=Ur(t,n),o=Lr(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],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(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 Fi(e){var t=e[0],n=e[e.length-1];return n>t?[t,n]:[n,t]}function Ui(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 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:Li,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=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=ji(r.map(i),n?Math:$l);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)},Bi(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(zi(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)},Bi(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,$=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)/$,k=(b*v+g*w)/$,E=(-b*g+v*w)/$,S=x-h,M=C-m,_=k-h,T=E-m;return S*S+M*M>_*_+T*T&&(x=k,C=E),[[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)?_t: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)},Bi(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]},$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=_(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=U(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},wa.insert=function(e,t){return e=U(e),t=_(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,$=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 M(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 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 Ma=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]-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=E().touches),t?ia(t).map(function(t){var n=Z(e,t);return n.identifier=t.identifier,n}):[]};var _a=1e-6,Ta=_a*_a,Da=Math.PI,Aa=2*Da,Oa=Aa-_a,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*$;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,$=(v||Math.log(l/o))/Pa;return n.duration=1e3*$,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(_[0],Math.min(_[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(b.range().map(function(e){return(e-E.x)/E.k}).map(b.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(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(E.k)/Math.LN2)+1),k()}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),k(),i(Math.pow(2,.002*Ua())*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},M=[960,500],_=ja,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?(Ua=function(){return-na.event.deltaY*(na.event.deltaMode?120:1)},"wheel"):"onmousewheel"in oa?(Ua=function(){return na.event.wheelDelta},"mousewheel"):(Ua=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=M[0],r=M[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?(_=null==t?ja:[+t[0],+t[1]],e):_},e.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],e):v},e.size=function(t){return arguments.length?(M=t&&[+t[0],+t[1]],e):M},e.duration=function(t){return arguments.length?(T=+t,e):T},e.x=function(t){return arguments.length?(w=t,b=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 Ua,La,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=Me($),na.dsv=function(e,t){function n(e,n,o){arguments.length<3&&(o=n,n=null);var a=_e(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[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,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;Ue.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){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($)>_a&&(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)):$>_a?p=90:-_a>$&&(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=ks=Es=Ss=Ms=_s=0,na.geo.stream(e,Ts);var t=Ss,n=Ms,r=_s,i=t*t+n*n+r*r;return Ta>i&&(t=Cs,n=ks,r=Es,_a>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,ks,Es,Ss,Ms,_s,Ts={sphere:w,point:xt,lineStart:kt,lineEnd:Et,polygonStart:function(){Ts.lineStart=St},polygonEnd:function(){Ts.lineStart=kt}},Ds=Ot(_t,Pt,Ut,[-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+_a,f+.12*u+_a],[c-.214*u-_a,f+.234*u-_a]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+_a,f+.166*u+_a],[c-.115*u-_a,f+.234*u-_a]]).stream(l).point,e},e.scale(1070)};var Os,Ns,Rs,Is,Ps,Fs,Us={point:w,lineStart:w,lineEnd:w,polygonStart:function(){Ns=0,Us.lineStart=zt},polygonEnd:function(){Us.lineStart=Us.lineEnd=Us.point=w,Os+=da(Ns/2)}},Ls={point:Yt,lineStart:w,lineEnd:w,polygonStart:w,polygonEnd:w},js={point:Kt,lineStart:Zt,lineEnd:Jt,polygonStart:function(){js.lineStart=Qt},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(Us)),Os},e.centroid=function(e){return bs=ws=xs=Cs=ks=Es=Ss=Ms=_s=0,na.geo.stream(e,i(js)),_s?[Ss/_s,Ms/_s]:Es?[Cs/Es,ks/Es]:xs?[bs/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):$,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)>_a}).map(c)).concat(na.range(Math.ceil(s/m)*m,a,m).filter(function(e){return da(e%v)>_a}).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+_a],[180,90-_a]]).minorExtent([[-180,-80-_a],[180,80+_a]])},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(kn)}).raw=kn;var zs=xn(function(e){return 1/e},Math.atan);(na.geo.gnomonic=function(){return on(zs)}).raw=zs,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,Mn.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Na]},(na.geo.transverseMercator=function(){var e=Sn(Mn),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=Mn,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)/_a)*_a,y:Math.round(a(e,t)/_a)*_a,i:t}})}var r=_n,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,k=$-g;C>k?$=g+C:v=m+k;var E=fr();if(E.add=function(e){o(E,e,+y(e,++p),+b(e,p),m,g,v,$)},E.visit=function(e){dr(e,E,m,g,v,$)},E.find=function(e){return pr(E,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 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=[],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&&(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=$,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},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),$=l[1]/(m.depth||1);Xr(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=Mi(a),i=Si(i),a&&i;)l=Si(l),o=Mi(o),o.a=e,r=a.z+f-i.z-u+s(a._,i._),r>0&&(_i(Di(a,e,n),e,r),u+=r,c+=r),f+=a.m,u+=i.m,d+=l.m,c+=o.m;a&&!Mi(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:$,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 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(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,k,E,S=0,M=0,_=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=o===Cl?Math.sqrt(e*e+u*u):+o.apply(this,arguments),p||(M*=-1),u&&(M=te(g/u*Math.sin(v))),e&&(S=te(g/e*Math.sin(v)))),u){$=u*Math.cos(c+M),y=u*Math.sin(c+M),b=u*Math.cos(f-M),w=u*Math.sin(f-M);var T=Math.abs(f-c-2*M)<=Da?0:1;if(M&&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),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==b?[$,y]:Nn([$,y],[k,E],[b,w],[x,C]),R=$-N[0],I=y-N[1],P=b-N[0],F=w-N[1],U=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!=b){var j=Math.min(h,(u-L)/(U+1)),H=po(null==k?[x,C]:[k,E],[$,y],u,j,p),q=po([b,w],[x,C],u,j,p);h===j?_.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]):_.push("M",H[0],"A",j,",",j," 0 1,",m," ",q[0])}else _.push("M",$,",",y);if(null!=k){var V=Math.min(h,(e-L)/(U-1)),B=po([$,y],[k,E],e,-V,p),z=po([x,C],null==b?[$,y]:[b,w],e,-V,p);h===V?_.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]):_.push("L",z[0],"A",V,",",V," 0 0,",m," ",B[0])}else _.push("L",x,",",C)}else _.push("M",$,",",y),null!=b&&_.push("A",u,",",u," 0 ",T,",",p," ",b,",",w),_.push("L",x,",",C),null!=k&&_.push("A",e,",",e," 0 ",A,",",1-p," ",k,",",E);return _.push("Z"),_.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 kl=na.map({linear:mo,"linear-closed":go,step:vo,"step-before":$o,"step-after":yo,basis:Eo,"basis-open":So,"basis-closed":Mo,bundle:_o,cardinal:xo,"cardinal-open":bo,"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],Ml=[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=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=$n,n=yn,r=Uo;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=Uo,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(_l.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 _l=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=_l.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 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",_a),g=na.transition(h.exit()).style("opacity",_a).remove(),v=na.transition(h.order()).style("opacity",1),y=Math.max(i,0)+a,b=Ui(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=m.select("line"),_=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"+b[0]+","+O*o+"V0H"+b[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+","+b[0]+"H0V"+b[1]+"H"+O*o)),M.attr(S,O*i),D.attr(E,O*y),_.attr(k,0).attr(S,O*i),A.attr(C,0).attr(E,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 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,$);s.exit().remove(),s.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Ul[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=Ui(u),d.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),c&&(l=Ui(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),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;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(),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 y,b,w=this,x=na.select(na.event.target),C=l.of(w,arguments),E=na.select(w),S=x.datum(),M=!/^(n|s)$/.test(S)&&u,_=!/^(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",$),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);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());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=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=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 Ul={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"],[]],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=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],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",_t]]),Yl={range:function(e,t,n){return na.range(Math.ceil(e/n)*n,+t,n).map(Xo)},floor:$,ceil:$};Bl.year=os.year,os.scale=function(){return Qo(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",_t]]);Wl.year=os.year.utc,os.scale.utc=function(){return Qo(na.scale.linear(),Wl,Gl)},na.text=Me(function(e){return e.responseText}),na.json=function(e,t){return _e(e,"application/json",ea,t)},na.html=function(e,t){return _e(e,"text/html",ta,t)},na.xml=Me(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&&_o(n)?e(n,r,i,a):Mt(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,k=jr(y);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),y=y-E.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),_t(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=Ft(e,t),rn?wi(i+n,0):n||0,"string"==typeof e||!_o(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(U);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(U);return n.cache=new ur.Cache,n}function cr(e,t){if("function"!=typeof e)throw new Kr(U);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?Lt(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(Xr.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 Fr(e,t,n){if(null==n){var r=gr(t),i=r?Lo(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,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 Ui(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 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=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=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=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),_t(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(U);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=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=_o(e)||xr(e);return t=bn(t,r,4),null==n&&(i||gr(e)?(r=e.constructor,n=i?_o(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,Mr(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,M,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,_t(t,0,-1))))return!1;t=Wn(t),n=ei.call(e,t)}return n||Rn(e.length)&&Dn(t,e.length)&&(_o(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=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=Ur,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=_o(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=b),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(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,(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,$):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,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){Ue.prototype[e]=function(n){var r=this.__filtered__;if(r&&!t)return new Ue(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},Ue.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;Ue.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":"");Ue.prototype[e]=function(){return this[n](1).value()[0]}}),Ve(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");Ue.prototype[e]=function(){return this.__filtered__?new Ue(this):this[n](1)}}),Ve(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?bt:Lr;Ue.prototype[e]=function(e){return this[n](r(e))}}),Ue.prototype.compact=function(){return this.filter(Ir)},Ue.prototype.reject=function(e,t){return e=bn(e,t,1),this.filter(function(t){return!e(t)})},Ue.prototype.slice=function(e,t){e=null==e?0:+e||0;var n=this;return n.__filtered__&&(0t)?new Ue(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)},Ue.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Ue.prototype.toArray=function(){return this.take(Mi)},pt(Ue.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 Ue,c=o[0],f=u||_o(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 Ue(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(Ue.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}],Ue.prototype.clone=function(){var e=new Ue(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},Ue.prototype.reverse=function(){if(this.__filtered__){var e=new Ue(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},Ue.prototype.value=function(){var e,t=this.__wrapped__.value(),n=this.__dir__,r=_o(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,ke=/\w*$/,Ee=/^0[xX]/,Se=/^\[object .+?Constructor\]$/,Me=/^\d+$/,_e=/[\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[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[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[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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Fe={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ue={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"},je={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},He=Ue[typeof exports]&&exports&&!exports.nodeType&&exports,qe=Ue[typeof module]&&module&&!module.nodeType&&module,Ve=Ue[typeof self]&&self&&self.Object&&self,Be=Ue[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)?k(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 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 b(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 M(e){var t,n,r={};for(n in e)i(e,n)&&(t=S(n))&&(r[t]=e[n]);return r}function _(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),_(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=U(t,e.localeData()),er[t]=er[t]||P(t),er[t](e)):e.localeData().invalidDate()}function U(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){yr[e]=_(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 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[Mr])?kr:n[Er]<0||n[Er]>59?Er:n[Sr]<0||n[Sr]>59?Sr:n[Mr]<0||n[Mr]>999?Mr:-1,l(e)._overflowDayOfYear&&(wr>t||t>Cr)&&(t=Cr),l(e)._overflowWeeks&&-1===t&&(t=_r),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=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(!Ur.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[kr]&&0===e._a[Er]&&0===e._a[Sr]&&0===e._a[Mr]&&(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 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=U(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),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[kr]<=12&&t._a[kr]>0&&(l(t).bigHour=void 0),t._a[kr]=xe(t._locale,t._a[kr],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 ke(e){if(!e._d){var t=M(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 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:Me(e),u(e)||(e._d=null),e))}function Me(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?ke(i):"number"==typeof o?i._d=new Date(o):e.createFromInputFallback(i)}function _e(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 _e(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 Ue(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=Ue(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:Ue(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(Ue(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[kr])*n,m:g(s[Er])*n,s:g(s[Sr])*n,ms:g(s[Mr])*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&&(_(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 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 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[Mr]=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 _(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 _(i)?i(e,t,n,r):i.replace(/%d/i,e)}function $n(e,t){var n=this._relativeTime[e>0?"future":"past"];return _(n)?n(t):n.replace(/%s/i,t)}function yn(e){var t,n;for(n in e)t=e[n],_(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=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 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 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 Mn(){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 _n(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 _n(this,e,t,1)}function Dn(e,t){return _n(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 Un(e){return e=S(e),this[e+"s"]()}function Ln(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={},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})?/,$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,kr=3,Er=4,Sr=5,Mr=6,_r=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=$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)?)?/,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)?)?/,Ur=/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}/]],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"),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()}),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",""),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),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"),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),B(["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",$r),L("ddd",$r),L("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"),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=$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=Mt,ui.toDate=Et,ui.toISOString=pt,ui.toJSON=_t,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=jt,ui.month=J,ui.daysInMonth=Q,ui.week=ui.weeks=Bt,ui.isoWeek=ui.isoWeeks=zt,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=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.",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",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=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"),$i=Fn("s"),yi=Fn("m"),bi=Fn("h"),wi=Fn("d"),xi=Fn("w"),Ci=Fn("M"),ki=Fn("y"),Ei=Ln("milliseconds"),Si=Ln("seconds"),Mi=Ln("minutes"),_i=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=Mn,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=ki,Ii.valueOf=Pn,Ii._bubble=On,Ii.get=Un,Ii.milliseconds=Ei,Ii.seconds=Si,Ii.minutes=Mi,Ii.hours=_i,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"),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=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=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("contact-actions/contact-actions.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/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 U(arguments,function(t){t!==e&&U(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 U(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($[n]=r,I(e))g.push(n,[function(){return t.get(e)}],u);else{var i=t.annotate(e);U(i,function(e){e!==n&&l.hasOwnProperty(e)&&p(l[e],e)}),g.push(n,e,i)}v.pop(),$[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=[],$={};return U(l,p),l=v=$=null,function(r,o,a){function s(){--y||(b||i($,o.$$values),p.$$values=$,p.$$promises=p.$$promises||!0,delete p.$$inheritedValues,u.resolve($))}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={},$=L({},r),y=1+g.length/3,b=!1;if(N(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i($,d(o.$$inheritedValues,m)),L(v,o.$$promises),o.$$values?(b=i($,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,$)),f.promise.then(function(e){$[n]=e,s()},u)}catch(e){u(e)}}var f=e.defer(),d=0;U(o,function(e){v.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&(d++,v[e].then(function(t){$[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;(l=u.exec(e))&&(v=s(l,!1),!(v.segment.indexOf("?")>=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 $(e){L(this,e)}function y(){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(b[e.name],f.invoke(e.def))}}function c(e){L(this,e||{})}H=this;var f,d=!1,m=!0,g=!1,b={},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:/.*/}};y.$$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 U(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 b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new $(L({name:e},t)),n&&(x.push({name:e,def:n}),w||u()),this},U(C,function(e,t){b[t]=new $(L({name:t},e))}),b=r(b,{}),this.$get=["$injector",function(e){return f=e,w=!1,u(),U(C,function(e,t){b[t]||(b[t]=new $(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: '"+y+"' 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 $?t.type:new $(t.type):"config"===r?b.any:b.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,y=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,y);L(this,{id:e,type:t,location:i,array:m,squash:y,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(),U(t,function(t){U(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return U(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return U(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 _)R(_[o])&&(t[o]=_[o](t,_.$delegates[o]));return E[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})}]),m(n),t}function v(e){return e.indexOf("*")>-1}function $(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 y(e,t){return I(e)&&!N(t)?_[e]:R(t)&&I(e)?(_[e]&&!_.$delegates[e]&&(_.$delegates[e]=_[e]),_[e]=t,this):this}function b(e,t){return P(e)?t=e:t.name=e,g(t),this}function w(e,i,o,s,f,p,m,g,y){function b(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 U(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")),_=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 $={to:t,toParams:n,options:o},y=b($,u.self,f,o);if(y)return y;if(t=$.to,n=$.toParams,o=$.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[M])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,j(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(),_;for(var U=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 M(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 _(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=M(a.uiSref,e.current.name),u=null,c=_(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},$=i.$eval(a.uiSrefOpts)||{};t.forEach(r,function(e){e in $&&(v[e]=$[e])});var y=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&&y(e)},!0),u=t.copy(i.$eval(l.paramExpr))),y(),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 $=n[o+1];if(!1===g)null!=v&&(u+=F(v)?h(v,t).join("-"):encodeURIComponent(v)),u+=$;else if(!0===g){var y=u.match(/\/$/)?/\/?(.*)/:/(.*)/;u+=$.match(y)[1]}else I(g)&&(u+=g+$)}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},$.prototype.is=function(e,t){return!0},$.prototype.encode=function(e,t){return e},$.prototype.decode=function(e,t){return e},$.prototype.equals=function(e,t){return e==t},$.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},$.prototype.pattern=/.*/,$.prototype.toString=function(){return"{Type:"+this.name+"}"},$.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},$.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)}); //# 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/src/common/vendor/angular/angular-animate.min.js b/org.civicrm.reqangular/js/src/common/vendor/angular/angular-animate.min.js index 82298ec10e5..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.6.10 + AngularJS v1.7.2 (c) 2010-2018 Google, Inc. http://angularjs.org License: MIT */ -(function(S,q){'use strict';function Ea(a,b,c){if(!a)throw Pa("areq",b||"?",c||"required");return a}function Fa(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;V(a)&&(a=a.join(" "));V(b)&&(b=b.join(" "));return a+" "+b}function Qa(a){var b={};a&&(a.to||a.from)&&(b.to=a.to,b.from=a.from);return b}function W(a,b,c){var d="";a=V(a)?a:a&&C(a)&&a.length?a.split(/\s+/):[];t(a,function(a,f){a&&0=a&&(a=g,g=0,b.push(e),e=[]);e.push(f.fn);f.children.forEach(function(a){g++;c.push(a)});a--}e.length&&b.push(e);return b}(c)}var s=[],y=X(a);return function(n,q,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 g(a){var b=[],c={};t(a,function(a,d){var k=J(a.element),g=0<=["enter","move"].indexOf(a.event),k=a.structural?E(k):[];if(k.length){var e=g?"to":"from";t(k,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]||{};c[b][e]={animationID:d,element:A(a)}})}else b.push(a)});var d={},g={};t(c,function(c,e){var f=c.from,p=c.to;if(f&&p){var H=a[f.animationID], -z=a[p.animationID],m=f.animationID.toString();if(!g[m]){var l=g[m]={structural:!0,beforeStart:function(){H.beforeStart();z.beforeStart()},close:function(){H.close();z.close()},classes:M(H.classes,z.classes),from:H,to:z,anchors:[]};l.classes.length?b.push(l):(b.push(H),b.push(z))}g[m].anchors.push({out:f.element,"in":p.element})}else f=f?f.animationID:p.animationID,p=f.toString(),d[p]||(d[p]=!0,b.push(a[f]))});return b}function M(a,b){a=a.split(" ");b=b.split(" ");for(var c=[],d=0;d=P&&b>=N&&(ba=!0,m()))}function ga(){function b(){if(!M){L(!1);t(x,function(a){k.style[a[0]]=a[1]});g(a,h); -e.addClass(a,ca);if(r.recalculateTimingStyles){ma=k.getAttribute("class")+" "+fa;ja=q(k,ma);B=E(k,ma,ja);$=B.maxDelay;w=Math.max($,0);N=B.maxDuration;if(0===N){m();return}r.hasTransitions=0s.expectedEndTime)?n.cancel(s.timer):f.push(m)}F&&(l=n(c,l,!1),f[0]={timer:l,expectedEndTime:d},f.push(m),a.data("$$animateCss",f));if(ea.length)a.on(ea.join(" "),z);h.to&&(h.cleanupStyles&&Ma(p,k,Object.keys(h.to)),Ia(a,h))}}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, function() {}, (!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 || 0)), - delay: delay || 1, - 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 * @@ -532,25 +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.promise.then(undefined, function() {}); - 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 @@ -561,72 +553,70 @@ angular.mock.$IntervalProvider = function() { * * @return {number} The amount of time moved forward. */ - $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; - }]; -}; + $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 @@ -663,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 * @@ -802,95 +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']) - .info({ angularVersion: '1.6.10' }) + angular.mock.animate = angular.module('ngAnimateMock', ['ng']) + .info({ angularVersion: '1.7.2' }) - .config(['$provide', function($provide) { - - $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 @@ -898,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 @@ -918,51 +906,49 @@ 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; + flush: function (hideErrors) { + $rootScope.$digest(); - if ($$rAF.queue.length) { - $$rAF.flush(); - doNextRun = somethingFlushed = true; - } - - 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 @@ -975,61 +961,61 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng']) * @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 @@ -1190,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 @@ -1215,7 +1198,6 @@ angular.mock.dump = function(object) { expect($rootScope.status).toBe('Failed...'); }); - it('should send msg to server', function() { var controller = createController(); $httpBackend.flush(); @@ -1232,7 +1214,6 @@ angular.mock.dump = function(object) { expect($rootScope.status).toBe(''); }); - it('should send auth header', function() { var controller = createController(); $httpBackend.flush(); @@ -1329,10 +1310,10 @@ angular.mock.dump = function(object) { }); ``` */ -angular.mock.$httpBackendDecorator = + 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 @@ -1346,9 +1327,10 @@ angular.mock.$httpBackendDecorator = * @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, @@ -1356,112 +1338,112 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { // 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; + function createResponse (status, data, headers, statusText) { + if (angular.isFunction(status)) return status; - return function() { - return angular.isNumber(status) + return function () { + return angular.isNumber(status) ? [status, data, headers, statusText, 'complete'] : [200, status, data, headers, 'complete']; - }; - } - - // 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(), + // 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(function() { - handlePrematureEnd(angular.isDefined(timeout.$$timeoutId) ? 'timeout' : 'abort'); - }); - } else { - $timeout(function() { - handlePrematureEnd('timeout'); - }, 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); + } } - } - handleResponse.description = method + ' ' + url; - 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] || ''), copy(response[4])); - } + 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 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; + 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) { - originalHttpBackend(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; + } } - } - var error = 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; + // 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; - } + throw error; + } - /** + /** * @ngdoc method * @name $httpBackend#when * @description @@ -1489,32 +1471,72 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * 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) { + $httpBackend.when = function (method, url, data, headers, keys) { + assertArgDefined(arguments, 1, 'url'); - assertArgDefined(arguments, 1, 'url'); - - var definition = new MockHttpExpectation(method, url, data, headers, keys), + 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 @@ -1522,14 +1544,15 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * * @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 @@ -1537,14 +1560,15 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * * @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 @@ -1552,14 +1576,15 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * * @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 @@ -1569,14 +1594,15 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * 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 @@ -1586,14 +1612,15 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * 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 @@ -1606,9 +1633,9 @@ 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. */ - createShortMethods('when'); + createShortMethods('when'); - /** + /** * @ngdoc method * @name $httpBackend#whenRoute * @description @@ -1618,44 +1645,45 @@ 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 @@ -1684,137 +1712,142 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * 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) { + $httpBackend.expect = function (method, url, data, headers, keys) { + assertArgDefined(arguments, 1, 'url'); - assertArgDefined(arguments, 1, 'url'); - - var expectation = new MockHttpExpectation(method, url, data, headers, keys), + 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. + * 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. + * 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. + * 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. + * 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. + * 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. + * 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. + * 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 @@ -1824,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 @@ -1849,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 @@ -1884,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 @@ -1905,17 +1936,16 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { * afterEach($httpBackend.verifyNoOutstandingRequest); * ``` */ - $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 ' + + $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 @@ -1923,227 +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.$$originalHttpBackend = originalHttpBackend; + $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) { - assertArgDefined(arguments, 0, 'url'); + function createShortMethods (prefix) { + angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function (method) { + $httpBackend[prefix + method] = function (url, headers, keys) { + assertArgDefined(arguments, 0, 'url'); - // Change url to `null` if `undefined` to stop it throwing an exception further down - if (angular.isUndefined(url)) url = null; + // 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); - }; - }); + 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'); + angular.forEach(['PUT', 'POST', 'PATCH'], function (method) { + $httpBackend[prefix + method] = function (url, data, headers, keys) { + assertArgDefined(arguments, 0, 'url'); - // Change url to `null` if `undefined` to stop it throwing an exception further down - if (angular.isUndefined(url)) url = null; + // 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, data, headers, keys); - }; - }); + return $httpBackend[prefix](method, url, data, headers, keys); + }; + }); + } } -} -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'); + 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'); + } } -} - - -function MockHttpExpectation(method, url, data, headers, keys) { - function getUrlParams(u) { - var params = u.slice(u.indexOf('?') + 1).split('&'); - return params.sort(); - } + function MockHttpExpectation (method, url, data, headers, keys) { + function getUrlParams (u) { + var params = u.slice(u.indexOf('?') + 1).split('&'); + return params.sort(); + } - function compareUrl(u) { - return (url.slice(0, url.indexOf('?')) === u.slice(0, u.indexOf('?')) && + function compareUrl (u) { + return (url.slice(0, url.indexOf('?')) === u.slice(0, u.indexOf('?')) && getUrlParams(url).join() === getUrlParams(u).join()); - } + } - this.data = data; - this.headers = headers; + this.data = data; + this.headers = headers; - 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.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.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.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.matchHeaders = function(h) { - if (angular.isUndefined(headers)) return true; - if (angular.isFunction(headers)) return headers(h); - return angular.equals(headers, h); - }; + 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.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.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.getResponseHeader = function(name) { + this.setRequestHeader = function (key, value) { + this.$$reqHeaders[key] = value; + }; + + 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; - - header = undefined; - angular.forEach(this.$$respHeaders, function(headerVal, headerName) { - if (!header && angular.lowercase(headerName) === name) header = headerVal; - }); - return header; - }; + name = angular.$$lowercase(name); + header = this.$$respHeaders[name]; + if (header) 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 = function() { - if (isFunction(this.onabort)) { - this.onabort(); - } - }; + 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 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.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 @@ -2152,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 @@ -2163,87 +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`}. * - * Depending on the value of - * {@link ng.$compileProvider#preAssignBindingsEnabled `preAssignBindingsEnabled()`}, the properties - * will be bound before or after invoking the constructor. - * - * * ## Example * * ```js @@ -2289,8 +2308,6 @@ 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 (deprecated, 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 @@ -2300,33 +2317,24 @@ angular.mock.$RootElementProvider = function() { * @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. - */ -function createControllerDecorator(compileProvider) { - angular.mock.$ControllerDecorator = ['$delegate', function($delegate) { - return function(expression, locals, later, ident) { - if (later && typeof later === 'object') { - var preAssignBindingsEnabled = compileProvider.preAssignBindingsEnabled(); - - var instantiate = $delegate(expression, locals, true, ident); - if (preAssignBindingsEnabled) { - angular.extend(instantiate.instance, later); - } - - var instance = instantiate(); - if (!preAssignBindingsEnabled || instance !== instantiate.instance) { + */ + 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; -} + return angular.mock.$ControllerDecorator; + } -/** + /** * @ngdoc service * @name $componentController * @description @@ -2352,36 +2360,35 @@ function createControllerDecorator(compileProvider) { * @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 @@ -2421,22 +2428,22 @@ 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, - $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.6.10' }); + 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 @@ -2447,11 +2454,11 @@ angular.module('ngMock', ['ng']).provider({ * 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.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator); -}]).info({ angularVersion: '1.6.10' }); + 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 @@ -2566,7 +2573,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * */ -/** + /** * @ngdoc method * @name $httpBackend#when * @module ngMockE2E @@ -2600,7 +2607,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * - Both methods return the `requestHandler` object for possible overrides. */ -/** + /** * @ngdoc method * @name $httpBackend#whenGET * @module ngMockE2E @@ -2617,7 +2624,7 @@ 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 @@ -2634,7 +2641,7 @@ 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 @@ -2651,7 +2658,7 @@ 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 @@ -2670,7 +2677,7 @@ 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 @@ -2689,7 +2696,7 @@ 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 @@ -2708,7 +2715,7 @@ 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 @@ -2723,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 @@ -2736,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 @@ -2752,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) { - - var $rootScopePrototype = Object.getPrototypeOf($delegate); + angular.mock.$RootScopeDecorator = ['$delegate', function ($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 @@ -2775,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 @@ -2807,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 @@ -2868,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 @@ -2958,99 +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'); - } + module.sharedInjector = function () { + if (!(module.$$beforeAllHook && module.$$afterAllHook)) { + throw Error('sharedInjector() cannot be used unless your test runner defines beforeAll/afterAll'); + } - var initialized = false; + 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; - } - initialized = true; - currentSpec = this; - injectorState.shared = true; - }); + 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; + }); - module.$$afterAllHook(function() { - if (initialized) { - injectorState = new InjectorState(); - module.$$cleanup(); + module.$$afterAllHook(function () { + if (initialized) { + injectorState = new InjectorState(); + module.$$cleanup(); + } else { + injectorState.sharedError = null; + } + }); + }; + + 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 { - injectorState.sharedError = null; + currentSpec = this; + originalRootElement = null; + annotatedFunctions = []; } - }); - }; - - 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 = []; - } - }; + }; - module.$$afterEach = function() { - if (injectorState.cleanupAfterEach()) { - module.$$cleanup(); - } - }; + module.$$afterEach = function () { + if (injectorState.cleanupAfterEach()) { + module.$$cleanup(); + } + }; - module.$$cleanup = function() { - var injector = currentSpec.$injector; + module.$$cleanup = function () { + var injector = currentSpec.$injector; - annotatedFunctions.forEach(function(fn) { - delete fn.$inject; - }); + 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 @@ -3136,100 +3171,96 @@ 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]); - } - try { - injector.invoke(blockFns[i] || angular.noop, this); - } catch (e) { - if (e.stack && errorForStack) { - throw new ErrorAddingDeclarationLocationStack(e, errorForStack); + 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; } - throw e; - } finally { - errorForStack = null; } } - } - }; - + }; - angular.mock.inject.strictDi = function(value) { - value = arguments.length ? !!value : true; - return wasInjectorCreated() ? workFn() : workFn; + 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; + function workFn () { + if (value !== currentSpec.$injectorStrict) { + if (currentSpec.$injector) { + throw new Error('Injector already created, can not modify strict annotations'); + } else { + currentSpec.$injectorStrict = value; + } } } - } - }; + }; - function InjectorState() { - this.shared = false; - this.sharedError = null; + function InjectorState () { + this.shared = false; + this.sharedError = null; - this.cleanupAfterEach = function() { - return !this.shared || this.sharedError; - }; - } -})(window.jasmine || window.mocha); + this.cleanupAfterEach = function () { + return !this.shared || this.sharedError; + }; + } + })(window.jasmine || window.mocha); -'use strict'; + 'use strict'; -(function() { + (function () { /** * @ngdoc function * @name browserTrigger @@ -3282,224 +3313,202 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { * 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; + 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; + 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, + 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 (!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'; - } + if (nodeName === 'option') { + element.parentNode.value = element.value; + element = element.parentNode; + eventType = 'change'; + } - keys = keys || []; - function pressed(key) { - return keys.indexOf(key) !== -1; - } + keys = keys || []; + function pressed (key) { + return keys.indexOf(key) !== -1; + } - 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); + 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 { + } else if (/animationend/.test(eventType)) { + if (window.WebKitAnimationEvent) { + evnt = new window.WebKitAnimationEvent(eventType, eventData); + evnt.initEvent(eventType, eventData.bubbles, true); + } else { + 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.AnimationEvent(eventType, eventData); + evnt = new window.CompositionEvent(eventType, { + data: eventData.data + }); } 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'), + 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); - } + } - /* we're unable to change the timeStamp value directly so this + /* 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; + evnt.$manualTimeStamp = eventData.timeStamp; - var originalPreventDefault = evnt.preventDefault, - appWindow = element.ownerDocument.defaultView, - fakeProcessDefault = true, - finalProcessDefault, - angular = appWindow.angular || {}; + if (!evnt) return; - // igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208 - angular['ff-684208-preventDefault'] = false; - evnt.preventDefault = function() { - fakeProcessDefault = false; - return originalPreventDefault.apply(evnt, arguments); + if (!eventData.bubbles || supportsEventBubblingInDetachedTree() || isAttachedToDocument(element)) { + return element.dispatchEvent(evnt); + } else { + triggerForPath(element, evnt); + } }; - if (!eventData.bubbles || supportsEventBubblingInDetachedTree() || isAttachedToDocument(element)) { - element.dispatchEvent(evnt); - } else { - triggerForPath(element, evnt); + 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; } - finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault); + function createTouchEvent (element, eventType, x, y) { + var evnt = new window.Event(eventType); + x = x || 0; + y = y || 0; - delete angular['ff-684208-preventDefault']; + var touch = window.document.createTouch(window, element, Date.now(), x, y, x, y); + var touches = window.document.createTouchList(touch); - return finalProcessDefault; - }; + evnt.touches = touches; - function supportsTouchEvents() { - if ('_cached' in supportsTouchEvents) { - return supportsTouchEvents._cached; - } - if (!window.document.createTouch || !window.document.createTouchList) { - supportsTouchEvents._cached = false; - return false; + return evnt; } - 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'), + 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); + 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; } - return supportsEventBubblingInDetachedTree._cached; - } - function triggerForPath(element, evnt) { - var stop = false; + 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); + 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)); - } + } while (!stop && (element = element.parentNode)); + } - function patchEventTargetForBubbling(event, target) { - event._target = target; - Object.defineProperty(event, 'target', {get: function() { return this._target;}}); - } + function patchEventTargetForBubbling (event, target) { + event._target = target; + Object.defineProperty(event, 'target', {get: function () { return this._target; }}); + } - function isAttachedToDocument(element) { - while ((element = element.parentNode)) { + function isAttachedToDocument (element) { + while ((element = element.parentNode)) { if (element === window) { - return true; + return true; } + } + return false; } - 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 d9ce09db874..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.6.10 + AngularJS v1.7.2 (c) 2010-2018 Google, Inc. http://angularjs.org License: MIT */ -(function(U,a){'use strict';function L(m,f){f=f||{};a.forEach(f,function(a,d){delete f[d]});for(var d in m)!m.hasOwnProperty(d)||"$"===d.charAt(0)&&"$"===d.charAt(1)||(f[d]=m[d]);return f}var B=a.$$minErr("$resource"),Q=/^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;a.module("ngResource",["ng"]).info({angularVersion:"1.6.10"}).provider("$resource",function(){var m=/^https?:\/\/\[[^\]]*][^/]*/,f=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(d,P,F,M){function C(a,d){this.template=a;this.defaults=n({},f.defaults,d);this.urlParams={}}var D=a.noop,r=a.forEach,n=a.extend,R=a.copy,N=a.isArray,w=a.isDefined,x=a.isFunction,S=a.isNumber,y=a.$$encodeUriQuery,T=a.$$encodeUriSegment;C.prototype={setUrlParams:function(a,d,f){var g=this,c=f||g.template,s,h,n="",b=g.urlParams=Object.create(null);r(c.split(/\W/),function(a){if("hasOwnProperty"=== -a)throw B("badname");!/^\d+$/.test(a)&&a&&(new RegExp("(^|[^\\\\]):"+a+"(\\W|$)")).test(c)&&(b[a]={isQueryParamValue:(new RegExp("\\?.*=:"+a+"(?:\\W|$)")).test(c)})});c=c.replace(/\\:/g,":");c=c.replace(m,function(b){n=b;return""});d=d||{};r(g.urlParams,function(b,a){s=d.hasOwnProperty(a)?d[a]:g.defaults[a];w(s)&&null!==s?(h=b.isQueryParamValue?y(s,!0):T(s),c=c.replace(new RegExp(":"+a+"(\\W|$)","g"),function(b,a){return h+a})):c=c.replace(new RegExp("(/?):"+a+"(\\W|$)","g"),function(a,b,e){return"/"=== -e.charAt(0)?e:b+e})});g.defaults.stripTrailingSlashes&&(c=c.replace(/\/+$/,"")||"/");c=c.replace(/\/\.(?=\w+($|\?))/,".");a.url=n+c.replace(/\/(\\|%5C)\./,"/.");r(d,function(b,c){g.urlParams[c]||(a.params=a.params||{},a.params[c]=b)})}};return function(m,y,z,g){function c(b,c){var d={};c=n({},y,c);r(c,function(c,f){x(c)&&(c=c(b));var e;if(c&&c.charAt&&"@"===c.charAt(0)){e=b;var k=c.substr(1);if(null==k||""===k||"hasOwnProperty"===k||!Q.test("."+k))throw B("badmember",k);for(var k=k.split("."),h=0, -n=k.length;hc)return"...";var d=b.$$hashKey,g;if(I(a)){g=0;for(var f=a.length;g
    ").append(a).html();try{return a[0].nodeType===Ma?N(b):b.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(a,b){return"<"+N(b)})}catch(d){return N(b)}}function Vc(a){try{return decodeURIComponent(a)}catch(b){}}function fc(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=Vc(e),u(e)&&(f=u(f)?Vc(f):!0,ra.call(b,e)?I(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function gc(a){var b=[];q(a,function(a,c){I(a)?q(a,function(a){b.push(ia(c,!0)+(!0===a?"":"="+ia(a,!0)))}):b.push(ia(c,!0)+(!0===a?"":"="+ia(a,!0)))});return b.length?b.join("&"):""}function fb(a){return ia(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ia(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=Ga.length;for(c=0;c protocol indicates an extension, document.location.href does not match."))}function Wc(a,b,d){G(d)||(d={});d=P({strictDi:!1},d);var c=function(){a=z(a);if(a.injector()){var c=a[0]===y.document?"document":za(a);throw oa("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=gb(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!/;y&&e.test(y.name)&&(d.debugInfoEnabled=!0,y.name=y.name.replace(e,""));if(y&&!f.test(y.name))return c();y.name=y.name.replace(f,"");ea.resumeBootstrap=function(a){q(a,function(a){b.push(a)});return c()};C(ea.resumeDeferredBootstrap)&& -ea.resumeDeferredBootstrap()}function Ae(){y.name="NG_ENABLE_DEBUG_INFO!"+y.name;y.location.reload()}function Be(a){a=ea.element(a).injector();if(!a)throw oa("test");return a.get("$$testability")}function Xc(a,b){b=b||"_";return a.replace(Ce,function(a,c){return(c?b:"")+a.toLowerCase()})}function De(){var a;if(!Yc){var b=rb();(ta=x(b)?y.jQuery:b?y[b]:void 0)&&ta.fn.on?(z=ta,P(ta.fn,{scope:Ua.scope,isolateScope:Ua.isolateScope,controller:Ua.controller,injector:Ua.injector,inheritedData:Ua.inheritedData}), -a=ta.cleanData,ta.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=ta._data(f,"events"))&&c.$destroy&&ta(f).triggerHandler("$destroy");a(b)}):z=S;ea.element=z;Yc=!0}}function hb(a,b,d){if(!a)throw oa("areq",b||"?",d||"required");return a}function sb(a,b,d){d&&I(a)&&(a=a[a.length-1]);hb(C(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Ha(a,b){if("hasOwnProperty"===a)throw oa("badname",b);}function Zc(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=db(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 S(a){if(a instanceof S)return a;var b;F(a)&&(a=Q(a),b=!0);if(!(this instanceof S)){if(b&&"<"!==a.charAt(0))throw mc("nosel");return new S(a)}if(b){b=y.document;var d;a=(d=hg.exec(a))?[b.createElement(d[1])]: -(d=hd(a,b))?d.childNodes:[];nc(this,a)}else C(a)?id(a):nc(this,a)}function oc(a){return a.cloneNode(!0)}function yb(a,b){!b&&kc(a)&&z.cleanData([a]);a.querySelectorAll&&z.cleanData(a.querySelectorAll("*"))}function jd(a,b,d,c){if(u(c))throw mc("offargs");var e=(c=zb(a))&&c.events,f=c&&c.handle;if(f)if(b){var g=function(b){var c=e[b];u(d)&&cb(c||[],d);u(d)&&c&&0l&&this.remove(n.key);return b}},get:function(a){if(l";b=Aa.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);d.value=c;a.attributes.setNamedItem(d)}function Pa(a,b){try{a.addClass(b)}catch(c){}} -function ba(a,b,c,d,e){a instanceof z||(a=z(a));var g=Sa(a,b,a,c,d,e);ba.$$addScopeClass(a);var f=null;return function(b,c,d){if(!a)throw aa("multilink");hb(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);f||(f=(d=d&&d[0])?"foreignobject"!==ya(d)&&ha.call(d).match(/SVG/)?"svg":"html":"html");d="html"!==f?z(fa(f,z("
    ").append(a).html())):c?Ua.clone.call(a): -a;if(k)for(var l in k)d.data("$"+l+"Controller",k[l].instance);ba.$$addScopeInfo(d,b);c&&c(d,b);g&&g(b,d,d,h);c||(a=g=null);return d}}function Sa(a,b,c,d,e,g){function f(a,c,d,e){var g,k,l,m,p,n,H;if(K)for(H=Array(c.length),m=0;mt.priority)break;if(y=t.scope)t.templateUrl||(G(y)?($("new/isolated scope",O||H,t,v),O=t):$("new/isolated scope",O,t,v)),H=H||t;L=t.name;if(!la&&(t.replace&&(t.templateUrl||t.template)||t.transclude&&!t.$$tlb)){for(y=Ca+1;la=a[y++];)if(la.transclude&&!la.$$tlb||la.replace&&(la.templateUrl||la.template)){u=!0;break}la=!0}!t.templateUrl&& -t.controller&&(w=w||R(),$("'"+L+"' controller",w[L],t,v),w[L]=t);if(y=t.transclude)if(T=!0,t.$$tlb||($("transclusion",s,t,v),s=t),"element"===y)qa=!0,n=t.priority,V=v,v=d.$$element=z(ba.$$createComment(L,d[L])),b=v[0],ja(g,xa.call(V,0),b),V[0].$$parentNode=V[0].parentNode,r=U(u,V,e,n,f&&f.name,{nonTlbTranscludeDirective:s});else{var F=R();if(G(y)){V=[];var Qa=R(),M=R();q(y,function(a,b){var c="?"===a.charAt(0);a=c?a.substring(1):a;Qa[a]=b;F[b]=null;M[b]=c});q(v.contents(),function(a){var b=Qa[Da(ya(a))]; -b?(M[b]=!0,F[b]=F[b]||[],F[b].push(a)):V.push(a)});q(M,function(a,b){if(!a)throw aa("reqslot",b);});for(var Sa in F)F[Sa]&&(F[Sa]=U(u,F[Sa],e))}else V=z(oc(b)).contents();v.empty();r=U(u,V,e,void 0,void 0,{needsNewScope:t.$$isolateScope||t.$$newScope});r.$$slots=F}if(t.template)if(E=!0,$("template",A,t,v),A=t,y=C(t.template)?t.template(v,d):t.template,y=Ha(y),t.replace){f=t;V=lc.test(y)?sd(fa(t.templateNamespace,Q(y))):[];b=V[0];if(1!==V.length||1!==b.nodeType)throw aa("tplrt",L,"");ja(g,v,b);Oa= -{$attr:{}};y=sc(b,[],Oa);var N=a.splice(Ca+1,a.length-(Ca+1));(O||H)&&Z(y,O,H);a=a.concat(y).concat(N);da(d,Oa);Oa=a.length}else v.html(y);if(t.templateUrl)E=!0,$("template",A,t,v),A=t,t.replace&&(f=t),p=ia(a.splice(Ca,a.length-Ca),v,d,g,T&&r,h,k,{controllerDirectives:w,newScopeDirective:H!==t&&H,newIsolateScopeDirective:O,templateDirective:A,nonTlbTranscludeDirective:s}),Oa=a.length;else if(t.compile)try{ua=t.compile(v,d,r);var tc=t.$$originalDirective||t;C(ua)?m(null,Ta(tc,ua),Pa,D):ua&&m(Ta(tc, -ua.pre),Ta(tc,ua.post),Pa,D)}catch(X){c(X,za(v))}t.terminal&&(p.terminal=!0,n=Math.max(n,t.priority))}p.scope=H&&!0===H.scope;p.transcludeOnThisElement=T;p.templateOnThisElement=E;p.transclude=r;l.hasElementTranscludeDirective=qa;return p}function W(a,b,c,d){var e;if(F(b)){var g=b.match(l);b=b.substring(g[0].length);var f=g[1]||g[3],g="?"===g[2];"^^"===f?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e=f?c.inheritedData(h):c.data(h)}if(!e&&!g)throw aa("ctreq",b,a);}else if(I(b))for(e= -[],f=0,g=b.length;fc.priority)&&-1!==c.restrict.indexOf(e)){k&&(c=$b(c,{$$start:k,$$end:l}));if(!c.$$bindings){var H=m=c,K=c.name,t={isolateScope:null,bindToController:null};G(H.scope)&&(!0===H.bindToController?(t.bindToController=d(H.scope,K,!0),t.isolateScope={}):t.isolateScope=d(H.scope,K,!1));G(H.bindToController)&&(t.bindToController=d(H.bindToController,K,!0));if(t.bindToController&&!H.controller)throw aa("noctrl", -K);m=m.$$bindings=t;G(m.isolateScope)&&(c.$$isolateBindings=m.isolateScope)}b.push(c);m=c}}return m}function ea(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 pa(a,b){if("srcdoc"===b)return qa.HTML;var c=ya(a);if("src"===b||"ngSrc"===b){if(-1===["img","video","audio","source","track"].indexOf(c))return qa.RESOURCE_URL}else if("xlinkHref"===b||"form"===c&&"action"===b||"link"===c&&"href"===b)return qa.RESOURCE_URL} -function va(a,c,d,e,g){var f=pa(a,e),k=h[e]||g,l=b(d,!g,f,k);if(l){if("multiple"===e&&"select"===ya(a))throw aa("selmulti",za(a));if(m.test(e))throw aa("nodomevents");c.push({priority:100,compile:function(){return{pre:function(a,c,g){c=g.$$observers||(g.$$observers=R());var h=g[e];h!==d&&(l=h&&b(h,!0,f,k),d=h);l&&(g[e]=l(a),(c[e]||(c[e]=[])).$$inter=!0,(g.$$observers&&g.$$observers[e].$$scope||a).$watch(l,function(a,b){"class"===e&&a!==b?g.$updateClass(a,b):g.$set(e,a)}))}}}})}}function ja(a,b,c){var d= -b[0],e=b.length,g=d.parentNode,f,h;if(a)for(f=0,h=a.length;f=b)return a;for(;b--;){var d=a[b];(8===d.nodeType||d.nodeType===Ma&&""===d.nodeValue.trim())&&wg.call(a,b,1)}return a}function ug(a,b){if(b&&F(b))return b;if(F(a)){var d=vd.exec(a);if(d)return d[3]}} -function Af(){var a={},b=!1;this.has=function(b){return a.hasOwnProperty(b)};this.register=function(b,c){Ha(b,"controller");G(b)?P(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||!G(a.$scope))throw M("$controller")("noscp",d,b);a.$scope[b]=c}return function(f,g,k,h){var l,m,p;k=!0===k;h&&F(h)&&(p=h);if(F(f)){h=f.match(vd);if(!h)throw wd("ctrlfmt",f);m=h[1];p=p||h[3];f=a.hasOwnProperty(m)?a[m]:Zc(g.$scope,m,!0)||(b?Zc(c,m,!0): -void 0);if(!f)throw wd("ctrlreg",m);sb(f,m,!0)}if(k)return k=(I(f)?f[f.length-1]:f).prototype,l=Object.create(k||null),p&&e(g,p,l,m||f.name),P(function(){var a=d.invoke(f,l,g,m);a!==l&&(G(a)||C(a))&&(l=a,p&&e(g,p,l,m||f.name));return l},{instance:l,identifier:p});l=d.instantiate(f,g,m);p&&e(g,p,l,m||f.name);return l}}]}function Bf(){this.$get=["$window",function(a){return z(a.document)}]}function Cf(){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 Df(){this.$get=["$log",function(a){return function(b,d){a.error.apply(a,arguments)}}]}function vc(a){return G(a)?da(a)?a.toISOString():eb(a):a}function If(){this.$get=function(){return function(a){if(!a)return"";var b=[];Qc(a,function(a,c){null===a||x(a)||C(a)||(I(a)?q(a,function(a){b.push(ia(c)+"="+ia(vc(a)))}):b.push(ia(c)+"="+ia(vc(a))))});return b.join("&")}}}function Jf(){this.$get= -function(){return function(a){function b(a,e,f){null===a||x(a)||(I(a)?q(a,function(a,c){b(a,e+"["+(G(a)?c:"")+"]")}):G(a)&&!da(a)?Qc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}):d.push(ia(e)+"="+ia(vc(a))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function wc(a,b){if(F(a)){var d=a.replace(xg,"").trim();if(d){var c=b("Content-Type"),c=c&&0===c.indexOf(xd),e;(e=c)||(e=(e=d.match(yg))&&zg[e[0]].test(d));if(e)try{a=Tc(d)}catch(f){if(!c)return a;throw Kb("baddata",a,f);}}}return a}function yd(a){var b= -R(),d;F(a)?q(a.split("\n"),function(a){d=a.indexOf(":");var e=N(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=N(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[N(d)],void 0===d&&(d=null),d):b}}function Ad(a,b,d,c){if(C(c))return c(a,b,d);q(c,function(c){a=c(a,b,d)});return a}function Hf(){var a=this.defaults={transformResponse:[wc],transformRequest:[function(a){return G(a)&&"[object File]"!== -ha.call(a)&&"[object Blob]"!==ha.call(a)&&"[object FormData]"!==ha.call(a)?eb(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:pa(xc),put:pa(xc),patch:pa(xc)},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 M("$http")("badreq",b);if(!F(p.valueOf(b.url)))throw M("$http")("badreq",b.url);var f= -P({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer,jsonpCallbackParam:a.jsonpCallbackParam},b);f.headers=function(b){var c=a.headers,e=P({},b.headers),g,f,h,c=P({},c.common,c[N(b.method)]);a:for(g in c){f=N(g);for(h in e)if(N(h)===f)continue a;e[g]=c[g]}return d(e,pa(b))}(b);f.method=ub(f.method);f.paramSerializer=F(f.paramSerializer)?m.get(f.paramSerializer):f.paramSerializer;e.$$incOutstandingRequestCount();var h=[],k=[];b= -l.resolve(f);q(s,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);x(d)&&q(c,function(a,b){"content-type"===N(b)&&delete c[b]});x(b.withCredentials)&&!x(a.withCredentials)&&(b.withCredentials=a.withCredentials);return B(b,d).then(g,g)});b=c(b,k);return b=b.finally(function(){e.$$completeOutstandingRequest(D)})}function B(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,g){function f(){m(c,a,d,e,g)}L&&(200<=a&&300>a?L.put(z,[a,c,yd(d),e,g]):L.remove(z));b?h.$applyAsync(f):(f(),h.$$phase||h.$apply())}function m(a,b,d,e,g){b=-1<=b?b:0;(200<=b&&300>b?s.resolve:s.reject)({data:a,status:b,headers:zd(d),config:c,statusText:e,xhrStatus:g})}function t(a){m(a.data,a.status,pa(a.headers()),a.statusText,a.xhrStatus)} -function B(){var a=n.pendingRequests.indexOf(c);-1!==a&&n.pendingRequests.splice(a,1)}var s=l.defer(),qa=s.promise,L,r,la=c.headers,y="jsonp"===N(c.method),z=c.url;y?z=p.getTrustedResourceUrl(z):F(z)||(z=p.valueOf(z));z=v(z,c.paramSerializer(c.params));y&&(z=E(z,c.jsonpCallbackParam));n.pendingRequests.push(c);qa.then(B,B);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(L=G(c.cache)?c.cache:G(a.cache)?a.cache:A);L&&(r=L.get(z),u(r)?r&&C(r.then)?r.then(t,t):I(r)?m(r[1],r[0], -pa(r[2]),r[3],r[4]):m(r,200,{},"OK","complete"):L.put(z,qa));x(r)&&((r=J(c.url)?g()[c.xsrfCookieName||a.xsrfCookieName]:void 0)&&(la[c.xsrfHeaderName||a.xsrfHeaderName]=r),f(c.method,z,d,k,la,c.timeout,c.withCredentials,c.responseType,e(c.eventHandlers),e(c.uploadEventHandlers)));return qa}function v(a,b){0=l&&(J.resolve(A),E(q.$$intervalId),delete g[q.$$intervalId]);s||a.$apply()},h);g[q.$$intervalId]=J;return q}var g={};f.cancel=function(a){return a&&a.$$intervalId in g?(g[a.$$intervalId].promise.$$state.pur=!0,g[a.$$intervalId].reject("canceled"),b.clearInterval(a.$$intervalId),delete g[a.$$intervalId],!0):!1};return f}]}function yc(a){a=a.split("/");for(var b=a.length;b--;)a[b]= -fb(a[b].replace(/%2F/g,"/"));return a.join("/")}function Bd(a,b){var d=ma(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=Z(d.port)||Cg[d.protocol]||null}function Cd(a,b,d){if(Dg.test(a))throw kb("badpath",a);var c="/"!==a.charAt(0);c&&(a="/"+a);a=ma(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=fc(a.search);b.$$hash=decodeURIComponent(a.hash); -b.$$path&&"/"!==b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function zc(a,b){return a.slice(0,b.length)===b}function va(a,b){if(zc(b,a))return b.substr(a.length)}function Ka(a){var b=a.indexOf("#");return-1===b?a:a.substr(0,b)}function lb(a){return a.replace(/(#.+)|#$/,"$1")}function Ac(a,b,d){this.$$html5=!0;d=d||"";Bd(a,this);this.$$parse=function(a){var d=va(b,a);if(!F(d))throw kb("ipthprfx",a,b);Cd(d,this,!0);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=gc(this.$$search), -d=this.$$hash?"#"+fb(this.$$hash):"";this.$$url=yc(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=va(a,c))?(g=f,g=d&&u(f=va(d,f))?b+(va("/",f)||f):a+g):u(f=va(b,c))?g=b+f:b===c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function Bc(a,b,d){Bd(a,this);this.$$parse=function(c){var e=va(a,c)||va(b,c),f;x(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",x(e)&&(a=c, -this.replace())):(f=va(d,e),x(f)&&(f=e));Cd(f,this,!1);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;zc(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=gc(this.$$search),e=this.$$hash?"#"+fb(this.$$hash):"";this.$$url=yc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+(this.$$url?d+this.$$url:"");this.$$urlUpdatedByLocation=!0};this.$$parseLinkUrl=function(b,d){return Ka(a)===Ka(b)?(this.$$parse(b),!0):!1}}function Dd(a,b,d){this.$$html5= -!0;Bc.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a===Ka(c)?f=c:(g=va(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$compose=function(){var b=gc(this.$$search),e=this.$$hash?"#"+fb(this.$$hash):"";this.$$url=yc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+d+this.$$url;this.$$urlUpdatedByLocation=!0}}function Lb(a){return function(){return this[a]}}function Ed(a,b){return function(d){if(x(d))return this[a];this[a]= -b(d);this.$$compose();return this}}function Nf(){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(La(a))return b.enabled=a,this;if(G(a)){La(a.enabled)&&(b.enabled=a.enabled);La(a.requireBase)&&(b.requireBase=a.requireBase);if(La(a.rewriteLinks)||F(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(),g=l.$$state;try{c.url(a,b,d),l.$$state=c.state()}catch(f){throw l.url(e),l.$$state=g,f;}}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?Ac:Dd}else n=Ka(p),m=Bc;var B=n.substr(0,Ka(n).lastIndexOf("/")+1);l=new m(n,B,"#"+a);l.$$parseLinkUrl(p,p);l.$$state=c.state();var v=/^\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 h=z(a.target);"a"!==ya(h[0]);)if(h[0]===f[0]||!(h=h.parent())[0])return;if(!F(e)||!x(h.attr(e))){var e=h.prop("href"),k=h.attr("href")||h.attr("xlink:href");G(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=ma(e.animVal).href);v.test(e)||!e||h.attr("target")||a.isDefaultPrevented()||!l.$$parseLinkUrl(e,k)||(a.preventDefault(),l.absUrl()!==c.url()&&(d.$apply(),g.angular["ff-684208-preventDefault"]= -!0))}}});lb(l.absUrl())!==lb(p)&&c.url(l.absUrl(),!0);var q=!0;c.onUrlChange(function(a,b){zc(a,B)?(d.$evalAsync(function(){var c=l.absUrl(),e=l.$$state,g;a=lb(a);l.$$parse(a);l.$$state=b;g=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;l.absUrl()===a&&(g?(l.$$parse(c),l.$$state=e,k(c,!1,e)):(q=!1,h(c,e)))}),d.$$phase||d.$digest()):g.location.href=a});d.$watch(function(){if(q||l.$$urlUpdatedByLocation){l.$$urlUpdatedByLocation=!1;var a=lb(c.url()),b=lb(l.absUrl()),g=c.state(),f=l.$$replace, -m=a!==b||l.$$html5&&e.history&&g!==l.$$state;if(q||m)q=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,l.$$state,g).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=g):(m&&k(b,f,g===l.$$state?null:l.$$state),h(a,g)))})}l.$$replace=!1});return l}]}function Of(){var a=!0,b=this;this.debugEnabled=function(b){return u(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){bc(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||D;return function(){var a=[];q(arguments,function(b){a.push(c(b))});return Function.prototype.apply.call(e,b,a)}}var f=Ba||/\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 Eg(a){return a+""}function Fg(a, -b){return"undefined"!==typeof a?a:b}function Fd(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function Gg(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 U(a,b,d){var c,e,f=a.isPure=Gg(a,d);switch(a.type){case r.Program:c=!0;q(a.body,function(a){U(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:U(a.argument,b,f);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;break;case r.BinaryExpression:U(a.left,b,f);U(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:U(a.left,b,f);U(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case r.ConditionalExpression:U(a.test,b,f);U(a.alternate,b,f); -U(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:U(a.object,b,f);a.computed&&U(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){U(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:U(a.left,b,f);U(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){U(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){U(a.value,b,f);c=c&&a.value.constant;e.push.apply(e,a.value.toWatch);a.computed&&(U(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 Mb(a,b,d){this.ast=new r(a,d);this.astCompiler=d.csp?new Ld(b):new Kd(b)}function Cc(a){return C(a.valueOf)?a.valueOf():Hg.call(a)}function Pf(){var a=R(),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,g;switch(typeof b){case "string":return g=b=b.trim(),d=a[g],d||(d=new Nb(n),d=(new Mb(d,e,n)).parse(b), -d.constant?d.$$watchDelegate=m:d.oneTime?d.$$watchDelegate=d.literal?l:h:d.inputs&&(d.$$watchDelegate=k),a[g]=d),p(d,c);case "function":return p(b,c);default:return p(D,c)}}function g(a,b,c){return null==a||null==b?a===b:"object"!==typeof a||(a=Cc(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&&Cc(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)ra.call(e,b)||(q--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$stateful=!0;var d=this,e,f,h,k=1B&&(z=4-B,A[z]||(A[z]=[]),A[z].push({msg:C(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:g,oldVal:h}));else if(a===c){q=!1;break a}}catch(F){f(F)}if(!(n=!w.$$suspended&&w.$$watchersCount&&w.$$childHead||w!==this&&w.$$nextSibling))for(;w!==this&&!(n=w.$$nextSibling);)w=w.$parent}while(w=n);if((q||J.length)&&!B--)throw s.$$phase=null,d("infdig", -b,A);}while(q||J.length);for(s.$$phase=null;HBa)throw wa("iequirks");var c=pa(fa);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=ab);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(fa,function(a,b){var d=N(b);c[("parse_as_"+d).replace(Dc,wb)]=function(b){return e(a,b)};c[("get_trusted_"+d).replace(Dc,wb)]=function(b){return f(a,b)};c[("trust_as_"+d).replace(Dc,wb)]=function(b){return g(a,b)}});return c}]}function Vf(){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=Z((/android (\d+)/.exec(N((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&&Ba)return!1;if(x(d[a])){var b=g.createElement("div"); -d[a]="on"+a in b}return d[a]},csp:Ia(),transitions:h,animations:l,android:e}}]}function Xf(){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(!F(k)||x(d.get(k)))k=f.getTrustedResourceUrl(k);var l=c.defaults&&c.defaults.transformResponse;I(l)?l=l.filter(function(a){return a!==wc}):l===wc&&(l=null);return c.get(k,P({cache:d,transformResponse:l},a)).finally(function(){g.totalPendingRequests--}).then(function(a){d.put(k, -a.data);return a.data},function(a){h||(a=Jg("tpload",k,a.status,a.statusText),b(a));return e.reject(a)})}g.totalPendingRequests=0;return g}]}function Yf(){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=ea.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>Yd&&(d=d.splice(0,Yd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function Rg(a,b,d,c){var e=a.d,f=e.length-a.i;b=x(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 Ob(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 Ob(f,b,c,e)}}function mb(a,b,d){return function(c,e){var f=c["get"+a](),g=ub((d?"STANDALONE":"")+(b?"SHORT":"")+a);return e[g][f]}}function Zd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function $d(a){return function(b){var d=Zd(b.getFullYear());b=+new Date(b.getFullYear(), -b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Ob(b,a)}}function Gc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Td(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=Z(b[9]+b[10]),g=Z(b[9]+b[11]));k.call(a,Z(b[1]),Z(b[2])-1,Z(b[3]));f=Z(b[4]||0)-f;g=Z(b[5]||0)-g;k=Z(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;F(c)&&(c=Sg.test(c)?Z(c):b(c));Y(c)&&(c=new Date(c));if(!da(c)||!isFinite(c.getTime()))return c;for(;d;)(l=Tg.exec(d))?(k=db(k,l,1),d=k.pop()):(k.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=dc(f,m),c=ec(c,f,!0));q(k,function(b){h=Ug[b];g+=h?h(c,a.DATETIME_FORMATS,m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Lg(){return function(a,b){x(b)&&(b=2);return eb(a,b)}}function Mg(){return function(a, -b,d){b=Infinity===Math.abs(Number(b))?Number(b):Z(b);if(X(b))return a;Y(a)&&(a=a.toString());if(!ja(a))return a;d=!d||isNaN(d)?0:Z(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 F(a)?a.slice(b,d):xa.call(a,b,d)}function Vd(a){function b(b){return b.map(function(b){var c=1,d=ab;if(C(b))d=b;else if(F(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(ee[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(da(d))return d;if(F(d)){'"'===d.charAt(0)&&'"'===d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));if(Vg.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=A};g.$observe("min",function(a){A=n(a);k.$validate()})}if(u(g.max)||g.ngMax){var s;k.$validators.max= -function(a){return!p(a)||x(s)||d(a)<=s};g.$observe("max",function(a){s=n(a);k.$validate()})}}}function Jc(a,b,d,c){(c.$$hasNativeValidators=G(b[0].validity))&&c.$parsers.push(function(a){var c=b.prop("validity")||{};return c.badInput||c.typeMismatch?void 0:a})}function fe(a){a.$$parserName="number";a.$parsers.push(function(b){if(a.$isEmpty(b))return null;if(Wg.test(b))return parseFloat(b)});a.$formatters.push(function(b){if(!a.$isEmpty(b)){if(!Y(b))throw pb("numfmt",b);b=b.toString()}return b})}function Wa(a){u(a)&& -!Y(a)&&(a=parseFloat(a));return X(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 ge(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 he(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 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+;/,fg=/<([\w:-]+)/,gg=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,$={option:[1,'"],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};$.optgroup=$.option;$.tbody=$.tfoot=$.colgroup=$.caption=$.thead;$.th=$.td;var ng=y.Node.prototype.contains|| -function(a){return!!(this.compareDocumentPosition(a)&16)},Ua=S.prototype={ready:id,toString:function(){var a=[];q(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?z(this[a]):z(this[this.length+a])},length:0,push:Zg,sort:[].sort,splice:[].splice},Gb={};q("multiple selected checked disabled readOnly required open".split(" "),function(a){Gb[N(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 ib[a.ng339])return!0;return!1},cleanData:function(a){for(var b=0,d=a.length;b/,qg=/^[^(]*\(\s*([^)]*)\)/m,bh=/,/,ch=/^\s*(_?)(\S+?)\1\s*$/,og=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Aa=M("$injector");gb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw F(d)&&d||(d=a.name||rg(a)),Aa("strictdi",d);b=pd(a);q(b[1].split(bh),function(a){a.replace(ch,function(a,b,d){c.push(d)})})}a.$inject= -c}}else I(a)?(b=a.length-1,sb(a[b],"fn"),c=a.slice(0,b)):sb(a,"fn",!0);return c};var je=M("$animate"),uf=function(){this.$get=D},vf=function(){var a=new Hb,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=F(b)?b.split(" "):I(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=sg(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&& -Db(a,e);f&&Cb(a,f)});a.delete(b)}});b.length=0}return{enabled:D,on:D,off:D,pin:D,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}}}]},sf=["$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 je("notcsel", -c);var g=c+"-animation";b.$$registeredAnimations[c.substr(1)]=g;a.factory(g,d)};this.customFilter=function(a){1===arguments.length&&(c=C(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,je("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 fh={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Nb=function(a){this.options=a};Nb.prototype={constructor:Nb,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 Xa("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=na(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 Xa("syntax",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw Xa("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 Xa("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:[]};U(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,Eg,Fg,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||D;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(F(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(Y(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 Xa("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;U(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?D: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)}}};Mb.prototype={constructor:Mb,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 wa=M("$sce"),fa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"}, -Dc=/_([a-z])/g,Jg=M("$compile"),W=y.document.createElement("a"),Qd=ma(y.location.href);Rd.$inject=["$document"];gd.$inject=["$provide"];var Yd=22,Xd=".",Fc="0";Sd.$inject=["$locale"];Ud.$inject=["$locale"];var Ug={yyyy:ca("FullYear",4,0,!1,!0),yy:ca("FullYear",2,0,!0,!0),y:ca("FullYear",1,0,!1,!0),MMMM:mb("Month"),MMM:mb("Month",!0),MM:ca("Month",2,1),M:ca("Month",1,1),LLLL:mb("Month",!1,!0),dd:ca("Date",2),d:ca("Date",1),HH:ca("Hours",2),H:ca("Hours",1),hh:ca("Hours",2,-12),h:ca("Hours",1,-12),mm:ca("Minutes", -2),m:ca("Minutes",1),ss:ca("Seconds",2),s:ca("Seconds",1),sss:ca("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?"+":"")+(Ob(Math[0=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},Tg=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,Sg=/^-?\d+$/; -Td.$inject=["$locale"];var Ng=ka(N),Og=ka(ub);Vd.$inject=["$parse"];var Je=ka({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]"===ha.call(b.prop("href"))?"xlink:href":"href";b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),vb={};q(Gb,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!==a){var c=Da("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!== -e[c]&&d(a,b,e)});vb[c]=function(){return{restrict:"A",priority:100,link:e}}}});q(ud,function(a,b){vb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"===e.ngPattern.charAt(0)&&(c=e.ngPattern.match(Yg))){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=Da("ng-"+a);vb[b]=function(){return{priority:99,link:function(d,c,e){var f=a,g=a;"href"===a&&"[object SVGAnimatedString]"===ha.call(c.prop("href"))&& -(g="xlinkHref",e.$attr[g]="xlink:href",f=null);e.$observe(b,function(b){b?(e.$set(g,b),Ba&&f&&c.prop(f,e[g])):"href"===a&&e.$set(g,null)})}}}});var Qb={$addControl:D,$$renameControl:function(a,b){a.$name=b},$removeControl:D,$setValidity:D,$setDirty:D,$setPristine:D,$setSubmitted:D};Pb.$inject=["$element","$attrs","$scope","$animate","$interpolate"];Pb.prototype={$rollbackViewValue:function(){q(this.$$controls,function(a){a.$rollbackViewValue()})},$commitViewValue:function(){q(this.$$controls,function(a){a.$commitViewValue()})}, -$addControl:function(a){Ha(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);cb(this.$$controls,a); -a.$$parentForm=Qb},$setDirty:function(){this.$$animate.removeClass(this.$$element,Ya);this.$$animate.addClass(this.$$element,Vb);this.$dirty=!0;this.$pristine=!1;this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,Ya,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(){this.$$animate.addClass(this.$$element, -"ng-submitted");this.$submitted=!0;this.$$parentForm.$setSubmitted()}};ce({clazz:Pb,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&&(cb(c,d),0===c.length&&delete a[b])}});var ke=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||D}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Pb,compile:function(d,f){d.addClass(Ya).addClass(nb);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 q=g?c(p.$name):D;g&&(q(a,p),e.$observe(g,function(b){p.$name!==b&&(q(a,void 0),p.$$parentForm.$$renameControl(p,b),q=c(p.$name),q(a,p))}));d.on("$destroy",function(){p.$$parentForm.$removeControl(p); -q(a,void 0);P(p,Qb)})}}}}}]},Ke=ke(),We=ke(!0),Vg=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,gh=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,hh=/^(?=.{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])?)*$/,Wg=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,le=/^(\d{4,})-(\d{2})-(\d{2})$/, -me=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Nc=/^(\d{4,})-W(\d\d)$/,ne=/^(\d{4,})-(\d\d)$/,oe=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ee=R();q(["date","datetime-local","month","time","week"],function(a){ee[a]=!0});var pe={text:function(a,b,d,c,e,f){Va(a,b,d,c,e,f);Ic(c)},date:ob("date",le,Rb(le,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":ob("datetimelocal",me,Rb(me,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:ob("time",oe,Rb(oe,["HH","mm", -"ss","sss"]),"HH:mm:ss.sss"),week:ob("week",Nc,function(a,b){if(da(a))return a;if(F(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=Zd(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:ob("month",ne,Rb(ne,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f){Jc(a,b,d,c);fe(c);Va(a,b,d,c,e,f);var g,k;if(u(d.min)||d.ngMin)c.$validators.min=function(a){return c.$isEmpty(a)|| -x(g)||a>=g},d.$observe("min",function(a){g=Wa(a);c.$validate()});if(u(d.max)||d.ngMax)c.$validators.max=function(a){return c.$isEmpty(a)||x(k)||a<=k},d.$observe("max",function(a){k=Wa(a);c.$validate()});if(u(d.step)||d.ngStep){var h;c.$validators.step=function(a,b){return c.$isEmpty(b)||x(h)||ge(b,g||0,h)};d.$observe("step",function(a){h=Wa(a);c.$validate()})}},url:function(a,b,d,c,e,f){Va(a,b,d,c,e,f);Ic(c);c.$$parserName="url";c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||gh.test(d)}}, -email:function(a,b,d,c,e,f){Va(a,b,d,c,e,f);Ic(c);c.$$parserName="email";c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||hh.test(d)}},radio:function(a,b,d,c){var e=!d.ngTrim||"false"!==Q(d.ngTrim);x(d.name)&&b.attr("name",++qb);b.on("click",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=Wa(a);X(c.$modelValue)||(m?(a=b.val(),p>a&&(a=p,b.val(a)),c.$setViewValue(a)):c.$validate())}function h(a){n=Wa(a);X(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)||x(n)||b<=n},g("max",h));f&&(c.$validators.step=m?function(){return!r.stepMismatch}:function(a,b){return c.$isEmpty(b)||x(q)||ge(b,p||0,q)},g("step",l))},checkbox:function(a,b,d,c,e, -f,g,k){var h=he(k,a,"ngTrueValue",d.ngTrueValue,!0),l=he(k,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 sa(a,h)});c.$parsers.push(function(a){return a?h:l})},hidden:D,button:D,submit:D,reset:D,file:D},ad=["$browser","$sniffer","$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e, -f,g,k){k[0]&&(pe[N(g.type)]||pe.text)(e,f,g,k[0],b,a,d,c)}}}}],ih=/^(true|false|\d+)$/,of=function(){function a(a,d,c){var e=u(c)?c:9===Ba?"":null;a.prop("value",e);d.$set("value",c)}return{restrict:"A",priority:100,compile:function(b,d){return ih.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)})}}}},Oe=["$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=hc(a)})}}}}],Qe=["$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=x(a)?"":a})}}}}],Pe=["$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)||"")})}}}}],nf=ka({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Re=Lc("",!0),Te=Lc("Odd",0),Se=Lc("Even",1),Ue=Ra({compile:function(a,b){b.$set("ngCloak",void 0);a.removeClass("ng-cloak")}}),Ve=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],fd={},jh={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=Da("ng-"+a);fd[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})};jh[a]&&c.$$phase?b.$evalAsync(e):b.$apply(e)})}}}}]});var Ye=["$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=tb(k.clone),a.leave(l).done(function(a){!1!==a&&(l=null)}),k=null))})}}}],Ze=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:ea.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 q=0,r,E,A,s=function(){E&&(E.remove(),E=null);r&&(r.$destroy(),r=null);A&&(d.leave(A).done(function(a){!1!==a&&(E=null)}),E=A,A=null)};c.$watch(f,function(f){var m=function(a){!1===a||!u(k)||k&&!c.$eval(k)||b()},w=++q;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&w===q){var b=c.$new();p.template=a;a=n(b,function(a){s();d.enter(a,null,e).done(m)});r=b;A=a;r.$emit("$includeContentLoaded",f);c.$eval(g)}},function(){c.$$destroyed|| -w!==q||(s(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(s(),p.template=null)})}}}}],qf=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(b,d,c,e){ha.call(d[0]).match(/SVG/)?(d.empty(),a(hd(e.template,y.document).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],$e=Ra({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),mf=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(!x(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(I(a))return a.join(e)});c.$isEmpty=function(a){return!a||!a.length}}}},nb="ng-valid",be="ng-invalid",Ya="ng-pristine",Vb="ng-dirty",pb=M("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);C(c)&&(c=a(b));return c};this.$$ngModelSet=function(a,c){C(this.$$parsedNgModel(a))?b(a,{$$$p:c}):this.$$parsedNgModelAssign(a,c)}}else if(!this.$$parsedNgModel.assign)throw pb("nonassign",this.$$attr.ngModel,za(this.$$element));},$render:D,$isEmpty:function(a){return x(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,Ya)},$setDirty:function(){this.$dirty=!0;this.$pristine=!1;this.$$animate.removeClass(this.$$element, -Ya);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(!X(this.$modelValue)){var a= +(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||!C(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?h.$$q.all(c).then(function(){g(d)},D):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||"parse";if(x(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;if(this.$$parserValid= -x(a)?void 0:!0)for(var d=0;de||c.$isEmpty(b)|| -b.length<=e}}}}},dd=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=0;d.$observe("minlength",function(a){e=Z(a)||0;c.$validate()});c.$validators.minlength=function(a,b){return c.$isEmpty(b)||b.length>=e}}}}};y.angular.bootstrap?y.console&&console.log("WARNING: Tried to load AngularJS more than once."):(De(),Ge(ea),ea.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"}})}]),z(function(){ye(y.document,Wc)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(''); +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 From f36247e05ed9a9c40f93bc6ea9a0f74322ea2d98 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Wed, 25 Jul 2018 14:13:24 +0100 Subject: [PATCH 058/151] PCHR-4002: Allow contact perform Admin status actions on own request when he is own leave approver or an Admin. Add tests. Remove un-used test. --- .../Service/LeaveRequest.php | 6 --- .../Service/LeaveRequestStatusMatrix.php | 6 +-- .../Service/LeaveRequestStatusMatrixTest.php | 49 ++++++++++++------- .../Service/LeaveRequestTest.php | 17 ------- 4 files changed, 34 insertions(+), 44 deletions(-) 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..20805846edf 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequest.php @@ -137,13 +137,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/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/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrixTest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestStatusMatrixTest.php index ceb343797f5..625cd254330 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,50 @@ 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'])); + } + } - $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo($fromStatus, $toStatus, $adminID)); + public function testCanTransitionToReturnsTrueWhenUserIsTheLeaveContactAndOwnApproverForAllPossibleManagerTransitionStatuses() { + $manager = ContactFabricator::fabricate(); + $this->registerCurrentLoggedInContactInSession($manager['id']); + $this->setContactAsLeaveApproverOf($manager, $manager); + + $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..8a9c5d60d20 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 @@ -328,23 +328,6 @@ public function testCreateThrowsAnExceptionWhenTransitionStatusIsNotValidWhenUpd $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); - } - /** * @expectedException RuntimeException * @expectedExceptionMessage You are not allowed to change the request dates From 2cf519c10330d777104706e551fab1cec11b79d1 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Wed, 25 Jul 2018 15:47:53 +0100 Subject: [PATCH 059/151] PCHR-4002: Fix broken tests. Some tests were ran with admin permissions set in earlier tests, Fixed by setting permission to empty. --- .../tests/phpunit/api/v3/LeaveRequestTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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..d75026e6ee9 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 @@ -2962,6 +2962,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 +3222,7 @@ public function testLeaveRequestIsValidShouldNotReturnErrorWhenValidationsPass() public function testCreateAlsoCreatesTheBalanceChangesForTheLeaveRequest() { $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $startDate = new DateTime(); $endDate = new DateTime('+5 days'); @@ -4847,6 +4849,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 +4898,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 +4943,7 @@ public function testCreateReturnsFalseForFromEmailParameterWhenFromEmailIsNotCon $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $startDate = new DateTime(); $endDate = new DateTime('+5 days'); @@ -4980,6 +4985,7 @@ public function testCreateReturnsFalseForFromEmailParameterWhenFromEmailIsNotCon public function testCreateReturnsTrueForFromEmailParameterWhenFromEmailIsConfigured() { $contactID = 1; $this->registerCurrentLoggedInContactInSession($contactID); + $this->setPermissions(); $startDate = new DateTime(); $endDate = new DateTime('+5 days'); @@ -5027,6 +5033,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 +5077,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'), From d947641fa2b8107d285727255a5b9b7259515d91 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Wed, 25 Jul 2018 16:35:47 +0100 Subject: [PATCH 060/151] PCHR-4002: Split argument in separate lines --- .../Service/LeaveRequestStatusMatrixTest.php | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) 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 625cd254330..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 @@ -143,7 +143,11 @@ public function testCanTransitionToReturnsFalseWhenAdminIsTheLeaveContactForAllN $nonPossibleTransitions = $this->allNonPossibleStatusTransitionForLeaveApprover(); foreach($nonPossibleTransitions as $transition) { - $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo($transition[0], $transition[1], $adminID)); + $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo( + $transition[0], + $transition[1], + $adminID + )); } } @@ -154,7 +158,11 @@ public function testCanTransitionToReturnsTrueWhenAdminIsTheLeaveContactForAllPo $possibleTransitions = $this->allPossibleStatusTransitionForLeaveApprover(); foreach($possibleTransitions as $transition) { - $this->assertTrue($this->leaveRequestStatusMatrix->canTransitionTo($transition[0], $transition[1], $adminID)); + $this->assertTrue($this->leaveRequestStatusMatrix->canTransitionTo( + $transition[0], + $transition[1], + $adminID + )); } } @@ -166,7 +174,11 @@ public function testCanTransitionToReturnsFalseWhenUserIsTheLeaveContactAndOwnAp $nonPossibleTransitions = $this->allNonPossibleStatusTransitionForLeaveApprover(); foreach($nonPossibleTransitions as $transition) { - $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo($transition[0], $transition[1], $manager['id'])); + $this->assertFalse($this->leaveRequestStatusMatrix->canTransitionTo( + $transition[0], + $transition[1], + $manager['id'] + )); } } @@ -178,7 +190,11 @@ public function testCanTransitionToReturnsTrueWhenUserIsTheLeaveContactAndOwnApp $possibleTransitions = $this->allPossibleStatusTransitionForLeaveApprover(); foreach($possibleTransitions as $transition) { - $this->assertTrue($this->leaveRequestStatusMatrix->canTransitionTo($transition[0], $transition[1], $manager['id'])); + $this->assertTrue($this->leaveRequestStatusMatrix->canTransitionTo( + $transition[0], + $transition[1], + $manager['id'] + )); } } From 7d7f2ee55412b6edbfa20cdb9b21cdae4da02348 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Thu, 26 Jul 2018 14:13:23 +0530 Subject: [PATCH 061/151] PCHR-3941: Detach require.min.js from reqangular --- hrui/js/dist/hrui.min.js | 2 +- org.civicrm.reqangular/js/build.js | 1 - .../js/dist/reqangular.min.js | 65 +++++++++---------- .../js/src/common/bundles/vendors.js | 1 - org.civicrm.reqangular/reqangular.php | 9 +-- 5 files changed, 33 insertions(+), 45 deletions(-) diff --git a/hrui/js/dist/hrui.min.js b/hrui/js/dist/hrui.min.js index 2d830f3e190..77d760c6d8c 100644 --- a/hrui/js/dist/hrui.min.js +++ b/hrui/js/dist/hrui.min.js @@ -1,2 +1,2 @@ !function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,m(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function i(n){1===t(n).length&&t(n).on("change",u)}function o(){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&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a").text("Personal Details"),f())}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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(){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 m(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var i=t(n),o=t("
    ");o.attr("id",e),o.append(t("#civicrm-menu")),o.append(i),o.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(){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(),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()}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(),i=t("");i.append(n.find("label")),i.append(t("
    ")),i.append(e.html()),t("#nick_name").parent().after(i)})}function C(){t(".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()}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(){p()}).ready(function(){i("input[type='file']"),e(),o(),n(),a(),c(),r(),l(),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,i){void 0!==i.contract&&n(i.contract),void 0!==i.roles&&e(i.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},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){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 i(){r=m.clone(!0).appendTo(n).addClass("civihr-popup")}function o(){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(),i(),c(),a(),o()}()})})}(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 +//# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/hrui/js/dist/hrui.min.js.map diff --git a/org.civicrm.reqangular/js/build.js b/org.civicrm.reqangular/js/build.js index 40f90f11575..d00d036a5f7 100755 --- a/org.civicrm.reqangular/js/build.js +++ b/org.civicrm.reqangular/js/build.js @@ -26,7 +26,6 @@ '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..5fa46f79e7c 100644 --- a/org.civicrm.reqangular/js/dist/reqangular.min.js +++ b/org.civicrm.reqangular/js/dist/reqangular.min.js @@ -1,9 +1,3 @@ -/* - 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 @@ -95,34 +89,33 @@ See README.md or https://github.com/fraywing/textAngular/wiki for requirements a */ -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(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===$r?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 X(e){if(!(e=or.element(e).injector()))throw ir("test");return e.get("$$testability")}function Q(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(b(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={},$=u(v,function(e,t){var n=m.get(e+"Provider",t);return w.invoke(n.$get,n,void 0,e)}),w=$;p.$injectorProvider={$get:h($)};var x=l(e),w=$.get("$injector");return w.strictDi=t,r(x,function(e){e&&w.invoke(e)}),w}function Le(){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=b(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 je(e,t){return e||t?e?t?(lr(e)&&(e=e.join(" ")),lr(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function Ue(e){b(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,Qn.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(){$=k(),$=g($)?null:$,R($,_)&&($=_),_=$}function l(){w===u.url()&&b===$||(w=u.url(),b=$,r(E,function(e){e(u.url(),$)}))}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=b===r;if(w===t&&(!i.history||o))return u;var a=w&&yt(w)===yt(t);return w=t,b=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 $};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((b=h.scope)&&(h.templateUrl||(y(b)?(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(b=L+1;I=e[b++];)if(I.transclude&&!I.$$tlb||I.replace&&(I.templateUrl||I.template)){F=!0;break}I=!0}if(!h.templateUrl&&h.controller&&(b=h.controller,k=k||oe(),ue("'"+m+"' controller",k[m],h,N),k[m]=h),b=h.transclude)if(T=!0,h.$$tlb||(ue("transclusion",M,h,N),M=h),"element"===b)O=!0,w=h.priority,v=N,N=n.$$element=Yn(V.$$createComment(m,n[m])),t=N[0],ge(a,Qn.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(b)){v=[];var W=oe(),J=oe();r(b,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 Q in B)B[Q]&&(B[Q]=Z(F,B[Q],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,b=C(h.template)?h.template(N,n):h.template,b=Te(b),h.replace){if(s=h,v=Mr.test(b)?Ze(de(h.templateNamespace,cr(b))):[],t=v[0],1!==v.length||1!==t.nodeType)throw Jr("tplrt",m,"");ge(a,N,t),U={$attr:{}},b=Y(t,[],U);var ee=e.splice(L+1,e.length-(L+1));(E||x)&&ne(b,E,x),e=e.concat(b).concat(ee),ae(n,U),U=e.length}else N.html(b);if(h.templateUrl)D=!0,ue("template",_,h,N),_=h,h.replace&&(s=h),p=se(e.splice(L,e.length-L),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{$=h.compile(N,n,R);var re=h.$$originalDirective||h +;C($)?d(null,P(re,$),H,z):$&&d(P(re,$.pre),P(re,$.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 X(e,t,n,i){var o;if(b(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,$=d.name,b={isolateScope:null,bindToController:null};if(y(v.scope)&&(!0===v.bindToController?(b.bindToController=i(v.scope,$,!0),b.isolateScope={}):b.isolateScope=i(v.scope,$,!1)),y(v.bindToController)&&(b.bindToController=i(v.bindToController,$,!0)),y(b.bindToController)){var w=v.controller,x=v.controllerAs;if(!w)throw Jr("noctrl",$);if(!Je(w,x))throw Jr("noident",$)}var C=m.$$bindings=b;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=$[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&&b(t))return t;if(b(e)){var n=ti.exec(e);if(n)return n[3]}}function Xe(){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&&b(u)&&(d=u),b(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 Qe(){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():L(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(b(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=j(n))}}return e}function ot(e){var t,n=oe();return b(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)?L(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(!b(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=Xn(u.method),u.paramSerializer=b(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)}b&&(200<=e&&300>e?b.put(S,[e,t,ot(r),i]):b.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 b,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||(b=y(t.cache)?t.cache:y(e.cache)?e.cache:$),b&&(w=b.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"):b.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($.$$intervalId),delete a[$.$$intervalId]),g||e.$apply()},s),a[$.$$intervalId]=y,$}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 $t(e){return e.replace(/(#.+)|#$/,"$1")}function bt(e,t,n){this.$$html5=!0,n=n||"",mt(e,this),this.$$parse=function(e){var n=vt(t,e);if(!b(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?bt: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))}}),$t(u.absUrl())!==$t(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=$t(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=$t(r.url()),t=$t(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===$i||e===bi||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 Lt(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 jt(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||b,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?$:y;var v=new Pi(o);o=new Li(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=b;b=!0;try{return e(t,n,r,i)}finally{b=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 ji("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=b(u.webkitTransition),d=b(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++,b(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 bn(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),bn(o,t,r,i)}}function xn(e,t,n){return function(r,i){var o=r["get"+e]();return i[Xn((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),bn(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,b(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),L(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 b(e)?e.slice(t,n):Qn.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(b(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(b(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 Ln(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 jn(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/,jr=/^[^\(]*\(\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 b(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=b(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&&be(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}}},jt.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=Lt(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(b(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=Lt(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 Li=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 jt(this.ast,t)};Li.prototype={constructor:Li,parse:function(e){return this.astCompiler.compile(e,this.options.expensiveChecks)}};var ji=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?"+":"")+(bn(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(Xn);Dn.$inject=["$parse"];var Xi=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()})}}}}),Qi={};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)}),Qi[r]=function(){return{restrict:"A",priority:100,link:i}}}}),r(Pr,function(e,t){Qi[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);Qi[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(b(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),Ln(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=jn(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=jn(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=jn(e),sr(r.$modelValue)||(c?(e=t.val(),f>e&&(e=f,t.val(e)),r.$setViewValue(e)):r.$validate())}function l(e){d=jn(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)})}}}},$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=g(e)?"":e})}}}}],bo=["$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",Lo="ng-dirty",jo="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,$=null,b=this;this.$$setOptions=function(e){if((b.$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){b.$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(){b.$dirty=!1,b.$pristine=!0,a.removeClass(i,Lo),a.addClass(i,Fo)},this.$setDirty=function(){b.$dirty=!0,b.$pristine=!1,a.removeClass(i,Fo),a.addClass(i,Lo),b.$$parentForm.$setDirty()},this.$setUntouched=function(){b.$touched=!1,b.$untouched=!0,a.setClass(i,"ng-untouched","ng-touched")},this.$setTouched=function(){b.$touched=!0,b.$untouched=!1,a.setClass(i,"ng-touched","ng-untouched")},this.$rollbackViewValue=function(){s.cancel($),b.$viewValue=b.$$lastCommittedViewValue,b.$render()},this.$validate=function(){if(!sr(b.$modelValue)){var e=b.$$rawModelValue,t=b.$valid,n=b.$modelValue,r=b.$options&&b.$options.allowInvalid;b.$$runValidators(e,b.$$lastCommittedViewValue,function(i){r||t===i||(b.$modelValue=i?e:void 0,b.$modelValue!==n&&b.$$writeModelToScope())})}},this.$$runValidators=function(e,t,n){function i(e,t){a===x&&b.$setValidity(e,t)}function o(e){a===x&&n(e)}x++;var a=x;!function(){var e=b.$$parserName||"parse";return g(f)?(i(e,null),!0):(f||(r(b.$validators,function(e,t){i(t,null)}),r(b.$asyncValidators,function(e,t){i(t,null)})),i(e,f),f)}()?o(!1):function(){var n=!0;return r(b.$validators,function(r,o){var a=r(e,t);n=n&&a,i(o,a)}),!!n||(r(b.$asyncValidators,function(e,t){i(t,null)}),!1)}()?function(){var n=[],a=!0;r(b.$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=b.$viewValue;s.cancel($),(b.$$lastCommittedViewValue!==e||""===e&&b.$$hasNativeValidators)&&(b.$$updateEmptyClasses(e),b.$$lastCommittedViewValue=e,b.$pristine&&this.$setDirty(),this.$$parseAndValidate())},this.$$parseAndValidate=function(){var t=b.$$lastCommittedViewValue;if(f=!g(t)||void 0)for(var n=0;ni||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:L,fromJson:j,identity:p,isUndefined:g,isDefined:v,isString:b,isFunction:C,isObject:y,isNumber:w,isElement:T,isArray:lr,version:br,isDate:x,lowercase:Jn,uppercase:Xn,callbacks:{$$counter:0},getTestability:X,$$minErr:t,$$csp:dr,reloadWithDebugInfo:J}),(Gn=ae(e))("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:Kt}),e.provider("$compile",Ye).directive({a:Xi,input:go,textarea:go,form:no,script:oa,select:la,option:ua,ngBind:$o,ngBindHtml:wo,ngBindTemplate:bo,ngClass:Co,ngClassEven:Eo,ngClassOdd:ko,ngCloak:So,ngController:_o,ngForm:ro,ngHide:Xo,ngIf:Do,ngInclude:Ao,ngInit:No,ngNonBindable:Bo,ngPluralize:Ko,ngRepeat:Zo,ngShow:Jo,ngStyle:Qo,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(Qi).directive(Mo),e.provider({$anchorScroll:Le,$animate:Wr,$animateCss:Zr,$$animateJs:Br,$$animateQueue:Yr,$$AnimateRunner:Kr,$$animateAsyncRun:Gr,$browser:Ve,$cacheFactory:ze,$controller:Xe,$document:Qe, +$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:Qt,$sceDelegate:Xt,$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 j(){function t(){if(!V){if(C(!1),I(ie,function(e){q.style[e[0]]=e[1]}),R(e,U),r.addClass(e,pe),$e.recalculateTimingStyles){if(de=q.className+" "+fe,he=y(q,de),ve=_(q,de,he),ye=ve.maxDelay,Q=Math.max(ye,0),0===(te=ve.maxDuration))return void m();$e.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(" "),L),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),$.length)){var r=$.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&&$.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)&&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",b),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",b),s.off("click",$),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",$);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",$),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,$=!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))}$=angular.isDefined(n.dropdownAppendToBody),w=angular.isDefined(n.keyboardNav),$&&!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"),!$){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&&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||b;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),$=l.scrollbarPadding(u),$.heightOverflow&&$.scrollbarWidth&&u.css({paddingRight:$.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(),$="
    ';return{compile:function(e,t){var n=o($);return function(e,t,r,o){function u(){L.isOpen?g():d()}function d(){F&&!e.$eval(r[c+"Enable"])||(b(),C(),L.popupDelay?A||(A=a(v,L.popupDelay,!1)):v())}function g(){y(),L.popupCloseDelay?O||(O=a($,L.popupCloseDelay,!1)):$()}function v(){if(y(),b(),!L.content)return angular.noop;w(),L.$evalAsync(function(){L.isOpen=!0,k(!0),V()})}function y(){A&&(a.cancel(A),A=null),N&&(a.cancel(N),N=null)}function $(){L&&L.$evalAsync(function(){L&&(L.isOpen=!1,k(!1),L.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=L.$new(),M=n(T,function(e){I?s.find("body").append(e):t.after(e)}),E())}function x(){y(),b(),S(),M&&(M.remove(),M=null),T&&(T.$destroy(),T=null)}function C(){L.title=r[c+"Title"],L.content=H?H(e):r[i],L.popupClass=r[c+"Class"],L.placement=angular.isDefined(r[c+"Placement"])?r[c+"Placement"]:p.placement;var t=l.parsePlacement(L.placement);R=t[1]?t[0]+"-"+t[1]:t[0];var n=parseInt(r[c+"PopupDelay"],10),o=parseInt(r[c+"PopupCloseDelay"],10);L.popupDelay=isNaN(n)?p.popupDelay:n,L.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){L.content=e,!e&&L.isOpen&&$()})),q.push(T.$watch(function(){j||(j=!0,T.$$postDigest(function(){j=!1,L&&L.isOpen&&V()}))}))):q.push(r.$observe(i,function(e){L.content=e,!e&&L.isOpen?$():V()})),q.push(r.$observe(c+"Title",function(e){L.title=e,L.isOpen&&V()})),q.push(r.$observe(c+"Placement",function(e){L.placement=e||p.placement,L.isOpen&&V()}))}function S(){q.length&&(angular.forEach(q,function(e){e()}),q.length=0)}function _(e){L&&L.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"]),L=e.$new(!0),j=!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,L.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)))};L.origScope=e,L.isOpen=!1,h.add(L,{close:$}),L.contentExp=function(){return L.content},r.$observe("disabled",function(e){e&&y(),e&&L.isOpen&&$()}),U&&e.$watch(U,function(e){L&&!e===L.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"]);L.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(L),L=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(y)),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=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){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&&$.push(e.$parent.$watch(r(n.hourStep),function(e){C=+e}));var k=a.minuteStep;n.minuteStep&&$.push(e.$parent.$watch(r(n.minuteStep),function(e){k=+e}));var E;$.push(e.$parent.$watch(r(n.min),function(e){var t=new Date(e);E=isNaN(t)?void 0:t}));var S;$.push(e.$parent.$watch(r(n.max),function(e){var t=new Date(e);S=isNaN(t)?void 0:t}));var _=!1;n.ngDisabled&&$.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){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)?(y.setHours(e),y.setMinutes(t),yS?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)?(y.setHours(t),y.setMinutes(e),yS?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)?(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=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&&(y=t),yS?(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*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(){b.$setTouched()},e.$on("$destroy",function(){for(;$.length;)$.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(){j.moveInProgress||(j.moveInProgress=!0,j.$digest()),Z()}function h(){j.position=T?f.offset(t):f.position(t),j.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 $=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,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)},L=d.parse(n.uibTypeahead),j=e.$new(),U=e.$on("$destroy",function(){j.$destroy()});j.$on("$destroy",U);var H="typeahead-"+j.$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(){j.matches=[],j.activeIdx=-1,t.attr("aria-expanded",!1),B()},W=function(e){return H+"-option-"+e};j.$watch("activeIdx",function(e){e<0?t.removeAttr("aria-activedescendant"):t.attr("aria-activedescendant",W(e))});var G=function(e,t){return!!(j.matches.length>t&&e)&&e.toUpperCase()===j.matches[t].label.toUpperCase()},K=function(n,r){var i={$viewValue:n};C(e,!0),_(e,!1),o.when(L.source(e,i)).then(function(o){var a=n===m.$viewValue;if(a&&w)if(o&&o.length>0){j.activeIdx=A?0:-1,_(e,!1),j.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(){j.matches.length&&h(),j.moveInProgress=!1},200);j.moveInProgress=!1,j.query=void 0;var J,X=function(e){J=a(function(){K(e)},$)},Q=function(){J&&a.cancel(J)};Y(),j.assignIsOpen=function(t){N(e,t)},j.select=function(r,i){var o,s,l={};x=!0,l[L.itemName]=s=j.matches[r].model,o=L.modelMapper(e,l),F(e,o),m.$setValidity("editable",!0),m.$setValidity("parse",!0),E(e,{$item:s,$model:o,$label:L.viewMapper(e,l),$event:i}),Y(),!1!==j.$eval(n.typeaheadFocusOnSelect)&&a(function(){t[0].focus()},0,!1)},t.on("keydown",function(t){if(0!==j.matches.length&&-1!==v.indexOf(t.which)){var n=k(e,{$event:t});if(-1===j.activeIdx&&n||9===t.which&&t.shiftKey)return Y(),void j.$digest();t.preventDefault();var r;switch(t.which){case 27:t.stopPropagation(),Y(),e.$digest();break;case 38:j.activeIdx=(j.activeIdx>0?j.activeIdx:j.matches.length)-1,j.$digest(),r=z.find("li")[j.activeIdx],r.parentNode.scrollTop=r.offsetTop;break;case 40:j.activeIdx=(j.activeIdx+1)%j.matches.length,j.$digest(),r=z.find("li")[j.activeIdx],r.parentNode.scrollTop=r.offsetTop;break;default:n&&j.$apply(function(){angular.isNumber(j.debounceUpdate)||angular.isObject(j.debounceUpdate)?c(function(){j.select(j.activeIdx,t)},angular.isNumber(j.debounceUpdate)?j.debounceUpdate:j.debounceUpdate.default):j.select(j.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&&j.matches.length&&-1!==j.activeIdx&&!x&&(x=!0,j.$apply(function(){angular.isObject(j.debounceUpdate)&&angular.isNumber(j.debounceUpdate.blur)?c(function(){j.select(j.activeIdx,e)},j.debounceUpdate.blur):j.select(j.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!==j.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)(j);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,j.debounceUpdate=m.$options&&i(m.$options.debounce)(e),m.$parsers.unshift(function(t){return w=!0,0===y||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[L.itemName]=t,n=L.viewMapper(e,i),i[L.itemName]=void 0,r=L.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{b=e.getSelectionElement()}catch(e){}var x=angular.element(b);if(void 0!==b){var C=b.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("
    "+b.innerHTML+"
    ")[0]],x,k)}if(C.match(n)){if(v=e.getOnlySelectedElements(),0===v.length)m=angular.element("<"+k+">
  • "+b.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($=d.toLowerCase().replace(/[<>]/gi,""),"default"===$.trim()&&($=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===$){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,$=!0;if(y.length>0){for(f=[],c=0;c)$/i.test(g.startContainer.innerHTML)&&g.selectNode(g.startContainer)}else $=!0,p=v=o.createTextNode(e);if($)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?j: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,L=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,j=1,U=2,H=4,q=8,V=[{specialKey:"UndoKey",forbiddenModifiers:H+q,mustHaveModifiers:[U+j],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H,mustHaveModifiers:[U+j,q],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H+q,mustHaveModifiers:[U+j],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:U+q+H+j,mustHaveModifiers:[],keyCode:9},{specialKey:"ShiftTabKey",forbiddenModifiers:U+H+j,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 X=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(X),T.$parsers.unshift(B),T.$formatters.push(X),T.$formatters.unshift(B),T.$formatters.unshift(function(e){return T.$undoManager.push(e||"")}),O)if(f.events={},A){var Q=!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 b=angular.element("
          "+e+"
          ");b.find("textarea").remove();for(var x=$.getByAttribute(b,"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()),Q=!1,w.removeClass("processing-paste")},0)}else Q=!1,w.removeClass("processing-paste")};w.on("paste",f.events.paste=function(e,t){if(t&&angular.extend(e,t),N||Q)return e.stopPropagation(),e.preventDefault(),!1;Q=!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(),b.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&&L.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"+_]()},b=function(){d.focussed=!0,p.addClass(d.classes.focussed),C.focus(),p.triggerHandler("focus")},d.displayElements.html.on("focus",b),d.displayElements.text.on("focus",b),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),$=function(){d._bUpdateSelectedStyles=!1,d.$apply(function(){d.updateSelectedStyles()})},d.displayElements.html.on("mouseup",$),d.displayElements.text.on("mouseup",$)}}}]),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=[];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 y(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 $(){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&&$()})}},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},k=[];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 E=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!==E||o(i())||(E=t.$watch(function(){S||(S=!0,t.$$postDigest(function(){S=!1,o(i())&&(E(),E=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)&&(y(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&&$(),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),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="",$=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($),$[0].style.position="absolute",$[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($),$[0].style.position="",$[0].style.top=""},x=function(){a(function(){if("up"===h.dropdownPosition)b();else{s.removeClass("direction-up");var t=r(s),n=r($),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)}$[0].style.opacity=1})},C=!1;i.calculateDropdownPos=function(){if(h.open){if($=angular.element(s).querySelectorAll(".ui-select-dropdown"),0===$.length)return;if(""!==h.search||C||($[0].style.opacity=0,C=!0),!r($).height&&h.$animate&&h.$animate.on&&h.$animate.enabled($)){var e=!0;h.$animate.on("enter",$,function(t,n){"close"===n&&e&&(x(),e=!1)})}else x()}else{if(null===$||0===$.length)return;$[0].style.opacity=0,$[0].style.position="",$[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 $(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 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)&&b(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 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)*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 $e(e){return ye(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(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(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)}: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 $=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=y?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 k=m.length+b.length+w.length+($?0:i.length),E=c>k?new Array(k=c-k+1).join(r):"";return $&&(b=o(E+b,E.length?c-w.length:1/0)),i+=m,e=b+w,("<"===a?i+e+E:">"===a?E+i+e:"^"===a?E.substring(0,k>>=1)+i+e+E.substring(k):i+($?e:E+e))+n}}}function Fe(e){return e+""}function Le(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function je(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=Le;var r=new Le;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=Le;var r=new Le;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){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=$.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=Le;var t=new as;return t._=e,r(t)}finally{as=Date}}var r=t(e);return n.parse=function(e){try{as=Le;var t=r.parse(e);return t&&t._}finally{as=Date}},n.toString=r.toString,n},t.multi=t.utc.multi=st;var $=na.map(),b=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){$.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:Qe,e:Qe,H:tt,I:tt,j:et,L:it,m:Xe,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 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 yt(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function $t(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]),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=jt(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()}},$=Rt(),b=t($),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 Lt(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,$=Math.sin(y),b=Math.cos(y),w=v-d,x=w>=0?1:-1,C=x*w,k=C>Da,E=h*$;if(gs.add(Math.atan2(E*x*Math.sin(C),m*b+E*Math.cos(C))),o+=k?w+x*Aa:w,k^d>=n^v>=n){var S=gt(ht(f),ht(e));$t(S);var _=gt(i,S);$t(_);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=$,m=b,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 $=Math.sqrt(y),b=yt(m,(-g-$)/v);if(vt(b,h),b=bt(b),!n)return b;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^b[1]<(da(b[0]-x)Da^(x<=b[0]&&b[0]<=C)){var T=yt(m,(-g+$)/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=[]),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,$=t,b=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;Ls.point=function(o,a){Ls.point=e,t=r=o,n=i=a},Ls.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){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,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 Xt(){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 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(){$=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,$=a[0],b=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=$,h=b,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,$=f-n,b=y*y+$*$;if(b>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+$*A)/b-.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,$=0,b=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,$=e[1]%360*Ra,b=e.length>2?e[2]%360*Ra:0,r()):[v*Ia,$*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,$t(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 $n(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):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&&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 Fn(e){Wn(e),Js.remove(e),el.push(e),nr(e)}function Ln(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],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 jn(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,$=m*m+g*g,b={x:(g*y-p*$)/v+c,y:(d*$-m*y)/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 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(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 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,$=Qs._;$;)if(v.y<$.y||v.y===$.y&&v.x<=$.x){if(!$.L){y=$.P;break}$=$.L}else{if(!$.R){y=$;break}$=$.R}Qs.insert(y,v),y||(Xs=v)}}}}function Wn(e){var t=e.circle;t&&(t.P||(Xs=t.N),Qs.remove(t),tl.push(t),nr(t),e.circle=null)}function Gn(e){for(var t,n=Ks,r=Ht(e[0][0],e[0][1],e[1][0],e[1][1]),i=n.length;i--;)t=n[i],(!Kn(t,e)||!r(t)||da(t.a.x-t.b.x)g||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 $=u.nodes,b=.5*(c+d),w=.5*(f+p),x=t>=b,C=n>=w,k=C<<1|x,E=k+4;E>k;++k)if(u=$[3&k])switch(3&k){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]=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 $r(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 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 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=jr(t),i=Lr(t,n),o=jr(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 $i(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],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($i(s,o)){h=1;break}if(1==h)for(l=r._pack_prev;l!==s._pack_prev&&!$i(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($,o.r+Math.sqrt(o.x*o.x+o.y*o.y));e.r=$,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 Li(e){return e.rangeExtent?e.rangeExtent():Fi(e.range())}function ji(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:ji,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 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(Bi(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)},zi(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,y=g*g+v*v,$=n-r,b=c*p-d*f,w=(0>v?-1:1)*Math.sqrt($*$*y-b*b),x=(b*v-g*w)/y,C=(-b*g-v*w)/y,k=(b*v+g*w)/y,E=(-b*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/$,C*n/$]]}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 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=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],Qo(+n[1]+1),1>t?1:t)},r.tickFormat=function(){return n},r.copy=function(){return Xo(e.copy(),t,n)},zi(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]},ya=function(e,t){return t.querySelector(e)},$a=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&&(ya=function(e,t){return Sizzle(e,t)[0]||null},$a=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(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=L(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},wa.insert=function(e,t){return e=L(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(j)},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]-$[0],n=r[1]-$[1],h|=e|n,$=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),$=t(d,m);i?(u=i.apply(c,arguments),u=[u.x-$[0],u.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,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(ja+".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(b.range().map(function(e){return(e-E.x)/E.k}).map(b.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(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-$){var c=l[0];a(h,c,g[c.identifier],Math.floor(Math.log(E.k)/Math.LN2)+1),k()}$=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)}$=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,b="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*La())*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 ja||(ja="onwheel"in oa?(La=function(){return-na.event.deltaY*(na.event.deltaMode?120:1)},"wheel"):"onmousewheel"in oa?(La=function(){return na.event.wheelDelta},"mousewheel"):(La=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,b=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 La,ja,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"#"+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,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,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;Le.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=je(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=je(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]=je(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){$.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);$t(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 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(){b[0]=c,b[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)),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)):y>Ma?p=90:-Ma>y&&(f=-90),b[0]=c,b[1]=d}};return function(e){p=d=-(c=f=1/0),$=[],na.geo.stream(e,w);var t=$.length;if(t){$.sort(l);for(var n,r=1,i=$[0],o=[i];t>r;++r)n=$[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=$s=bs=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>$s&&(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 ys,$s,bs,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,Lt,[-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,Ls={point:w,lineStart:w,lineEnd:w,polygonStart:function(){Ns=0,Ls.lineStart=Bt},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.point=w,Os+=da(Ns/2)}},js={point:Yt,lineStart:w,lineEnd:w,polygonStart:w,polygonEnd:w},Us={point:Kt,lineStart:Zt,lineEnd:Jt,polygonStart:function(){Us.lineStart=Xt},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(Ls)),Os},e.centroid=function(e){return bs=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?[bs/xs,ws/xs]:[NaN,NaN]},e.bounds=function(e){return Ps=Fs=-(Rs=Is=1/0),na.geo.stream(e,i(js)),[[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 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,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=$n;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 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,$=Se(s),b=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=+$(c=e[p],p),x=+b(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,+$(e,++p),+b(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,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 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=[],$=[];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,b,w=v.length,x=$.length;for(n=0;x>n;++n)s=$[n],f=s.source,d=s.target,y=d.x-f.x,b=d.y-f.y,(h=y*y+b*b)&&(h=r*o[n]*((h=Math.sqrt(h))-i[n])/h,y*=h,b*=h,d.x-=y*(g=f.weight/(d.weight+f.weight)),d.y-=b*g,f.x+=y*(g=1-g),f.y+=b*g);if((g=r*m)&&(y=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=$[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=$[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,$[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,$[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&&(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=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,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),y=l[1]/(m.depth||1);Qr(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},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=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},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: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 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($l)},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 $l=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map($e),bl=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map($e),wl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map($e),xl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map($e);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+_),$=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;y=u*Math.cos(D),$=u*Math.sin(D),b=w=null}}else y=$=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==b?[y,$]:Nn([y,$],[k,E],[b,w],[x,C]),R=y-N[0],I=$-N[1],P=b-N[0],F=w-N[1],L=1/Math.sin(Math.acos((R*P+I*F)/(Math.sqrt(R*R+I*I)*Math.sqrt(P*P+F*F)))/2),j=Math.sqrt(N[0]*N[0]+N[1]*N[1]);if(null!=b){var U=Math.min(h,(u-j)/(L+1)),H=po(null==k?[x,C]:[k,E],[y,$],u,U,p),q=po([b,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,",",$);if(null!=k){var V=Math.min(h,(e-j)/(L-1)),z=po([y,$],[k,E],e,-V,p),B=po([x,C],null==b?[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,",",$),null!=b&&M.push("A",u,",",u," 0 ",T,",",p," ",b,",",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":$o,basis:Eo,"basis-open":So,"basis-closed":_o,bundle:Mo,cardinal:xo,"cardinal-open":bo,"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=$o,$o.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=$n,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=$n,r=Lo;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=Lo,n=e.projection;return e.projection=function(e){return arguments.length?n(jo(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),$=Math.max(i,0)+a,b=Li(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"+b[0]+","+O*o+"V0H"+b[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+","+b[0]+"H0V"+b[1]+"H"+O*o)),_.attr(S,O*i),D.attr(E,O*$),M.attr(k,0).attr(S,O*i),A.attr(C,0).attr(E,O*$),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 Ll[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=Li(u),d.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),c&&(l=Li(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||($=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;b&&(e[0]+=b[0],e[1]+=b[1]),T||(na.event.altKey?($||($=[(f[0]+f[1])/2,(d[0]+d[1])/2]),A[0]=f[+(e[0]<$[0])],A[1]=d[+(e[1]<$[1])]):$=null),_&&v(e,u,0)&&(r(E),t=!0),M&&v(e,c,1)&&(i(E),t=!0),t&&(n(E),C({type:"brush",mode:T?"move":"resize"}))}function v(e,t,n){var r,i,o=Li(t),l=o[0],u=o[1],c=A[n],m=n?d:f,g=m[1]-m[0];return T&&(l-=c,u-=g+c),r=(n?h:p)?Math.max(l,Math.min(u,e[n])):e[n],T?i=(r+=c)+g:($&&(c=Math.max(l,Math.min(u,2*$[n]-r))),r>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);b=[f[1-N]-A[0],d[1-R]-A[1]],A[0]=f[N],A[1]=d[R]}else na.event.altKey&&($=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=jl[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=$r(f,t.x),r=$r(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=jl[!u<<1|!c],e):u},e.y=function(t){return arguments.length?(c=t,m=jl[!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 Ll={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},jl=[["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=je(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=je(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=je(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=je(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(Qo)},floor:y,ceil:y};zl.year=os.year,os.scale=function(){return Xo(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 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 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===b||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?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 $=arguments.length,w=$,k=Ur($);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),$=$-E.length;if($t?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]: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=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=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(L);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(L);return n.cache=new ur.Cache,n}function cr(e,t){if("function"!=typeof e)throw new Kr(L);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=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?jt(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)==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(Qr.call(e)):p(e)&&Se.test(e))}function yr(e){return"number"==typeof e||p(e)&&ni.call(e)==Y}function $r(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||!$i(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 Fr(e,t,n){if(null==n){var r=gr(t),i=r?jo(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,jo(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 Li(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),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=Ur(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(L);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))||!$i(e))return[];var r=-1,i=Ur(xi(e,4294967295));for(t=jt(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=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($e,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,bt(t))},Ie.first=Bn,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=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=Lr,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:jn(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=jo(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,(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){Le.prototype[e]=function(n){var r=this.__filtered__;if(r&&!t)return new Le(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},Le.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;Le.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":"");Le.prototype[e]=function(){return this[n](1).value()[0]}}),Ve(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");Le.prototype[e]=function(){return this.__filtered__?new Le(this):this[n](1)}}),Ve(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?bt:jr;Le.prototype[e]=function(e){return this[n](r(e))}}),Le.prototype.compact=function(){return this.filter(Ir)},Le.prototype.reject=function(e,t){return e=bn(e,t,1),this.filter(function(t){return!e(t)})},Le.prototype.slice=function(e,t){e=null==e?0:+e||0;var n=this;return n.__filtered__&&(0t)?new Le(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)},Le.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Le.prototype.toArray=function(){return this.take(_i)},pt(Le.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 Le,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 Le(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)?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(Le.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}],Le.prototype.clone=function(){var e=new Le(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},Le.prototype.reverse=function(){if(this.__filtered__){var e=new Le(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},Le.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,$e=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,be=RegExp($e.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[X]=Ne[Q]=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[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[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={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Le={function:!0,object:!0},je={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=Le[typeof exports]&&exports&&!exports.nodeType&&exports,qe=Le[typeof module]&&module&&!module.nodeType&&module,Ve=Le[typeof self]&&self&&self.Object&&self,ze=Le[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=$();"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 $(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)?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 b(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(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 F(e,t){return e.isValid()?(t=L(t,e.localeData()),er[t]=er[t]||P(t),er[t](e)):e.localeData().invalidDate()}function L(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 j(e,t,n){$r[e]=M(t)?t:function(e,r){return e&&n?n:t}}function U(e,t){return i($r,e)?$r[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[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=jr.length;n>t;t++)if(jr[t][1].exec(u[1])){i=jr[t][0],r=!1!==jr[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(!Lr.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 $e(e){var t,n,r,i,o=[];if(!e._d){for(r=ye(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[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 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=L(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),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),$e(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)}),$e(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)}),$e(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 Le(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function je(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=Le(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:Le(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(Le(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=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=Fe(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=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),jt.call(this,e,t,n,r,i))}function jt(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 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 yn(e,t){var n=this._relativeTime[e>0?"future":"past"];return M(n)?n(t):n.replace(/%s/i,t)}function $n(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=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 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 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 Ln(e){return e=S(e),this[e+"s"]()}function jn(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={},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})?/,yr=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,$r={},br={},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"),j("M",sr),j("MM",sr,rr),j("MMM",function(e,t){return t.monthsShortRegex(e)}),j("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)?)?/,Lr=/Z|[+-]\d\d(?::?\d\d)?/,jr=[["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"),j("Y",hr),j("YY",sr,rr),j("YYYY",fr,or),j("YYYYY",dr,ar),j("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",""),j("Z",gr),j("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"),j("G",hr),j("g",hr),j("GG",sr,rr),j("gg",sr,rr),j("GGGG",fr,or),j("gggg",fr,or),j("GGGGG",dr,ar),j("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"),j("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"),j("w",sr),j("ww",sr,rr),j("W",sr),j("WW",sr,rr),z(["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"),E("date","D"),j("D",sr),j("DD",sr,rr),j("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"),E("day","d"),E("weekday","e"),E("isoWeekday","E"),j("d",sr),j("e",sr),j("E",sr),j("dd",yr),j("ddd",yr),j("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"),j("DDD",cr),j("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"),j("a",rn),j("A",rn),j("H",sr),j("h",sr),j("HH",sr,rr),j("hh",sr,rr),j("hmm",lr),j("hmmss",ur),j("Hmm",lr),j("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"),j("m",sr),j("mm",sr,rr),V(["m","mm"],Er);var oi=T("Minutes",!1);R("s",["ss",2],0,"second"),E("second","s"),j("s",sr),j("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"),j("S",cr,nr),j("SS",cr,rr),j("SSS",cr,ir);var si;for(si="SSSS";si.length<=9;si+="S")j(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=$t,ui.localeData=bt,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=X,ui.week=ui.weeks=zt,ui.isoWeek=ui.isoWeeks=Bt,ui.weeksInYear=Ft,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=je,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.",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",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=$n,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.",k);var gi=Math.abs,vi=Fn("ms"),yi=Fn("s"),$i=Fn("m"),bi=Fn("h"),wi=Fn("d"),xi=Fn("w"),Ci=Fn("M"),ki=Fn("y"),Ei=jn("milliseconds"),Si=jn("seconds"),_i=jn("minutes"),Mi=jn("hours"),Ti=jn("days"),Di=jn("months"),Ai=jn("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=$i,Ii.asHours=bi,Ii.asDays=wi,Ii.asWeeks=xi,Ii.asMonths=Ci,Ii.asYears=ki,Ii.valueOf=Pn,Ii._bubble=On,Ii.get=Ln,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=$t,Ii.localeData=bt,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"),j("x",hr),j("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/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 j(new(j(function(){},{prototype:e})),t)}function i(e){return L(arguments,function(t){t!==e&&L(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 L(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 j({},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);L(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 L(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=j({},r),$=1+g.length/3,b=!1;if(N(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i(y,d(o.$$inheritedValues,m)),j(v,o.$$promises),o.$$values?(b=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;L(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=j({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,$;(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;$=e.substring(d);var b=$.indexOf("?");if(b>=0){var w=this.sourceSearch=$.substring(b);if($=$.substring(0,b),this.sourcePath=e.substring(0,d+b),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($)+(!1===t.strict?"/?":"")+"$",p.push($),this.regexp=new RegExp(f,t.caseInsensitive?"i":n),this.prefix=p[0],this.$$paramNames=g}function y(e){j(this,e)}function $(){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(b[e.name],f.invoke(e.def))}}function c(e){j(this,e||{})}H=this;var f,d=!1,m=!0,g=!1,b={},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:/.*/}};$.$$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,j(o(),t))},this.isMatcher=function(e){if(!P(e))return!1;var t=!0;return L(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 b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new y(j({name:e},t)),n&&(x.push({name:e,def:n}),w||u()),this},L(C,function(e,t){b[t]=new y(j({name:t},e))}),b=r(b,{}),this.$get=["$injector",function(e){return f=e,w=!1,u(),L(C,function(e,t){b[t]||(b[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: '"+$+"' 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?b.any:b.string)}(r,t,i);var m=function(){var t={array:"search"===i&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return j(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,$=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,$);j(this,{id:e,type:t,location:i,array:m,squash:$,replace:w,isOptional:v,value:u,dynamic:n,config:r,toString:c})},c.prototype={$$new:function(){return r(this,j(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(),L(t,function(t){L(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return L(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return L(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)}]),j(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)}]),j(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 $(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 b(e,t){return P(e)?t=e:t.name=e,g(t),this}function w(e,i,o,s,f,p,m,g,$){function b(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 L(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,j({inherit:!0,relative:k.$current},n))},k.transitionTo=function(t,n,o){n=n||{},o=j({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($)return $;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 L=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 $=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&&$(e)},!0),u=t.copy(i.$eval(l.paramExpr))),$(),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 $=u.match(/\/$/)?/\/?(.*)/:/(.*)/;u+=y.match($)[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)}); //# 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/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/reqangular.php b/org.civicrm.reqangular/reqangular.php index 4b9aebeef68..bf4563640ac 100755 --- a/org.civicrm.reqangular/reqangular.php +++ b/org.civicrm.reqangular/reqangular.php @@ -108,13 +108,10 @@ function reqangular_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { } /** - * Implements hook_civicrm_buildForm(). - * - * @param string $formName - * @param CRM_Core_Form $form + * Implements hook_civicrm_coreResourceList(). */ -function reqangular_civicrm_buildForm($formName, &$form) { - _reqangular_inject_reqangular(); +function reqangular_civicrm_coreResourceList(&$items, $region) { + CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.reqangular', 'js/src/common/vendor/require.min.js', 990); } /** From cc3e27246a4f24edf523ab6e4ece61760002085b Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Thu, 26 Jul 2018 11:45:42 +0100 Subject: [PATCH 062/151] PCHR-4019: Allow self approver to choose request status --- .../shared/controllers/request.controller.js | 46 ++++--- .../controllers/request.controller.spec.js | 118 ++++++++++++++---- .../leave-request-popup-body.html | 2 +- .../leave-request-popup-footer.html | 2 +- 4 files changed, 129 insertions(+), 39 deletions(-) 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..d05084278da 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 @@ -38,7 +38,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 = []; @@ -95,7 +95,7 @@ define([ initAvailableStatusesMatrix(); initListeners(); - return loadLoggedInContactId() + return loadLoggedInContact() .then(initIsSelfRecord) .then(function () { return $q.all([ @@ -248,7 +248,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; @@ -287,6 +287,15 @@ define([ return getLeaveType() !== 'toil' && !vm.request.change_balance; } + /** + * Checks if the currently logged in user is a leave approver + * + * @return {Promise} + */ + function checkIfContactIsSelfLeaveApprover () { + return loggedInContact.checkIfSelfLeaveApprover(); + } + /** * Closes the error alerts if any */ @@ -530,7 +539,7 @@ 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); @@ -594,7 +603,7 @@ define([ if (vm.request) { attributes = vm.request.attributes(); } else if (!vm.canManage) { - attributes = { contact_id: loggedInContactId }; + attributes = { contact_id: loggedInContact.id }; } return attributes; @@ -613,7 +622,16 @@ define([ // 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 checkIfContactIsSelfLeaveApprover() + .then(function (isSelfLeaveApprover) { + if (!isSelfLeaveApprover) { + return; + } + + role = 'admin'; + vm.isSelfLeaveApprover = true; + vm.canManage = true; + }); } return checkPermissions(sharedSettings.permissions.admin.administer) @@ -767,10 +785,11 @@ define([ * * @return {Promise} */ - function loadLoggedInContactId () { - return Session.get().then(function (value) { - loggedInContactId = value.contactId; - }); + function loadLoggedInContact () { + return Contact.getLoggedIn() + .then(function (_loggedInContact_) { + loggedInContact = _loggedInContact_; + }); } /** @@ -791,15 +810,12 @@ define([ .then(function (contacts) { vm.managedContacts = _.remove(contacts.list, function (contact) { // Removes the admin from the list of contacts - return contact.id !== loggedInContactId; + return contact.id !== loggedInContact.id; }); }); } 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/test/shared/controllers/request.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js index f9b154c35e6..6c42698d660 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js @@ -22,7 +22,7 @@ describe('LeaveRequestCtrl', function () { var $log, $rootScope, controller, modalInstanceSpy, $scope, $q, dialog, $controller, $provide, sharedSettings, AbsenceTypeAPI, AbsencePeriodAPI, LeaveRequestInstance, - Contact, ContactAPIMock, EntitlementAPI, LeaveRequestAPI, pubSub, + Contact, ContactInstance, ContactAPIMock, EntitlementAPI, LeaveRequestAPI, pubSub, requiredTab, WorkPatternAPI, LeaveRequestService; var role = 'staff'; // change this value to set other roles @@ -65,7 +65,7 @@ }])); beforeEach(inject(function (_$log_, _$controller_, _$rootScope_, _$q_, _dialog_, - _AbsenceTypeAPI_, _AbsencePeriodAPI_, _Contact_, _EntitlementAPI_, _Entitlement_, + _AbsenceTypeAPI_, _AbsencePeriodAPI_, _Contact_, _ContactInstance_, _EntitlementAPI_, _Entitlement_, _LeaveRequestInstance_, _LeaveRequest_, _LeaveRequestAPI_, _pubSub_, _WorkPatternAPI_, _LeaveRequestService_) { $log = _$log_; @@ -75,6 +75,7 @@ dialog = _dialog_; Contact = _Contact_; + ContactInstance = _ContactInstance_; EntitlementAPI = _EntitlementAPI_; LeaveRequestAPI = _LeaveRequestAPI_; WorkPatternAPI = _WorkPatternAPI_; @@ -117,6 +118,8 @@ beforeEach(inject(function () { leaveRequest = LeaveRequestInstance.init(); leaveRequest.contact_id = CRM.vars.leaveAndAbsences.contactId.toString(); + + spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.returnValue($q.resolve(false)); initTestController({ leaveRequest: leaveRequest }); })); @@ -576,6 +579,7 @@ leaveRequest.contact_id = CRM.vars.leaveAndAbsences.contactId.toString(); $rootScope.section = 'my-leave'; + initTestController({ leaveRequest: leaveRequest }); expectedStatusValue = optionGroupMock.specificValue('hrleaveandabsences_leave_request_status', 'value', '3'); @@ -1342,33 +1346,57 @@ }); }); - describe('user edits their own leave request popup', function () { + describe('when user edits their own leave request', function () { var leaveRequest; - ['staff', 'manager', 'admin'].forEach(function (permissionsRole) { - testRoleForSelfRecord(permissionsRole); + beforeEach(function () { + $rootScope.section = 'my-leave'; + leaveRequest = LeaveRequestInstance.init(); }); - /** - * Tests the role for the self record and expects it to be "staff" - * - * @param {String} permissionsRole (staff|manager|admin) - */ - function testRoleForSelfRecord (permissionsRole) { - describe('when user is ' + permissionsRole, function () { + describe('basic tests', function () { + beforeEach(function () { + spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.returnValue($q.resolve(false)); + }); + + ['staff', 'manager', 'admin'].forEach(function (permissionsRole) { beforeEach(function () { - $rootScope.section = 'my-leave'; role = permissionsRole; - leaveRequest = LeaveRequestInstance.init(); initTestController({ leaveRequest: leaveRequest }); }); it('sets the staff role', function () { - expect(controller.isRole('staff')).toBeTruthy(); + expect(controller.isRole('staff')).toBe(true); }); }); - } + }); + + describe('when user is a self leave approver', function () { + beforeEach(function () { + spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.returnValue($q.resolve(true)); + }); + + ['staff', 'manager', 'admin'].forEach(function (permissionsRole) { + beforeEach(function () { + role = permissionsRole; + + initTestController({ leaveRequest: leaveRequest }); + }); + + it('sets the "admin" role', function () { + expect(controller.isRole('admin')).toBe(true); + }); + + it('sets the `isSelfLeaveApprover` public property to `true`', function () { + expect(controller.isSelfLeaveApprover).toBe(true); + }); + + it('sets the `canManage` public property to `true`', function () { + expect(controller.canManage).toBe(true); + }); + }); + }); }); describe('checking if it is a self record', function () { @@ -1399,7 +1427,7 @@ }); }); - describe('and the user is checking my own request', function () { + describe('and the user is checking their own leave request', function () { beforeEach(function () { leaveRequest.id = _.uniqueId(); leaveRequest.contact_id = loggedInContactId; @@ -1412,13 +1440,59 @@ }); }); - describe('and the user creates a new request for themselves', function () { - beforeEach(function () { - initTestController({ mode: 'create', leaveRequest: leaveRequest }); + describe('and the user creates a new leave request for themselves', function () { + describe('basic tests', function () { + beforeEach(function () { + initTestController({ mode: 'create', leaveRequest: leaveRequest }); + }); + + it('sets is self record as true', function () { + expect(controller.isSelfRecord).toBe(true); + }); }); - it('sets is self record as true', function () { - expect(controller.isSelfRecord).toBe(true); + describe('when user is a self leave approver', function () { + beforeEach(function () { + spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.returnValue($q.resolve(true)); + }); + + ['staff', 'manager', 'admin'].forEach(function (permissionsRole) { + beforeEach(function () { + role = permissionsRole; + + initTestController({ mode: 'create', leaveRequest: leaveRequest }); + }); + + it('sets the `isSelfLeaveApprover` public property to `true`', function () { + expect(controller.isSelfLeaveApprover).toBe(true); + }); + + it('sets the `canManage` public property to `true`', function () { + expect(controller.canManage).toBe(true); + }); + + describe('when the user submits a leave request with the "Approved" status', function () { + var approvalStatus; + beforeEach(function () { + approvalStatus = optionGroupMock.specificValue('hrleaveandabsences_leave_request_status', 'value', '1'); + + LeaveRequestAPI.isValid.and.returnValue($q.resolve()); + LeaveRequestAPI.create.and.returnValue($q.resolve({ id: '1' })); + controller.request.status_id = approvalStatus; + + controller.submit(); + $scope.$digest(); + }); + + it('keeps the status unamended', function () { + expect(controller.request.status_id).toEqual(approvalStatus); + }); + + it('calls corresponding API end points', function () { + expect(LeaveRequestAPI.create).toHaveBeenCalled(); + }); + }); + }); }); }); }); diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-body.html b/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-body.html index 2bb9fd4ea23..4f569de51a2 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-body.html +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-body.html @@ -75,7 +75,7 @@
    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 From de592699dd62a5ef6c1f7bd6fc0452642e4c2e92 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Thu, 26 Jul 2018 13:42:50 +0100 Subject: [PATCH 063/151] PCHR-4019: Improve the code --- .../js/dist/absence-tab.min.js | 4 +- .../js/dist/admin-dashboard.min.js | 10 +-- .../js/dist/manager-leave.min.js | 10 +-- .../js/dist/my-leave.min.js | 2 +- .../shared/controllers/request.controller.js | 69 ++++++++++--------- .../controllers/request.controller.spec.js | 2 +- 6 files changed, 51 insertions(+), 46 deletions(-) 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 29fdd38293b..71d2fdd63f9 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,O(!0)})}function b(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(B(),E(),O())})}function g(e){W.injectMonth=!0,U("injected").then(function(){O(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 S(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&f(),M(),E(),L("month")}function k(e){var t="previous"===e?"subtract":"add";B(n(W.selectedMonth.moment)[t](1,"month")),E(),L("month")}function L(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 O(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=S,W.paginateMonth=k,W.refresh=L,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:k()},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)&&L()}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!==k().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/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(n){w=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===S.leaveRequest.request_type?i.open(y(n)):v(n)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(t){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(S.leaveRequest.from_date):"2"===a)}function v(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){T(n)}}):y(n)})}})}function b(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return I===S.leaveRequest.contact_id}function _(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function y(e){var n=L[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return m.get().then(function(e){I=e.contactId})}function C(e,n){e.stopPropagation(),r.openModal(n)}function T(e){r.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function A(n){var t=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;w===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:S.leaveRequest})}function D(){var n=S.leaveRequestStatuses[S.leaveRequest.status_id].name,t=e.compact(e.map(L,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!h(n)&&e.pull(t,"cancel"),"admin"!==S.role&&e.pull(t,"delete"),"staff"===S.role&&e.pull(t,"approve","reject"),"staff"!==S.role&&R(t),p()&&t.push("delete"),S.allowedActions=e.map(t,function(e){return{key:e,label:L[e].label,isDirectAction:L[e].isDirectAction}})}function P(){return b().then(function(e){e&&(S.role="admin")})}function R(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,w,S=this,k=l.statusNames,L={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"}}},O={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=f,S.openLeavePopup=C,function(){a.resolve().then(_).then(q).then(function(){return g()&&P()}).then(D).finally(function(){S.loading.component=!1})}()}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(){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(),k("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,k("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 S(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function k(e){return ne.selectedAbsenceType.calculation_unit_name===e}function L(e){return ne.request.request_type===e}function O(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")&&(L("sickness")||k("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),(k("hours")||L("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=k,ne.isLeaveType=L,ne.isNotWorkingDay=O,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(S).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 S.fileUploader&&S.fileUploader.queue.length>0}function m(){return S.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return S.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||S.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=D,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=m,S.formatDateTime=f,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",S),g(),a.all([T(),q()]).then(_).finally(function(){S.filesLoaded=!0})}(),S}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 S(){return t.all(Object.values(G.sections).filter(function(e){return e.open}).map(M))}function k(){return w("other",{status_id:{in:[H(m.statusNames.rejected),H(m.statusNames.cancelled)]}})}function L(){return w("pending",{status_id:{in:[H(m.statusNames.awaitingApproval),H(m.statusNames.moreInformationRequired)]}})}function O(){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([S(),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:O},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k}},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),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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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;ke.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 S(){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 k(){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 L(){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 O(){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(ke,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=+Oe==+t.get(Ee,"leaveRequest.contact_id"),a=!t.get(Ee,"leaveRequest.id");Ee.isSelfRecord=e&&(n||a)}function J(){Le.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(){Se++})),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:Oe}),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){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=t.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 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"]=ke[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(){ke=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,k(),D(),Ee.request.isValid().then(te()&&L).then($).then(O()&&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===Se&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Se>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function De(){Le.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={},Se=0,ke={},Le=[],Oe="",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=S,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(){}); +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([S(),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:O},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k}},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),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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function D(){["from","to"].forEach(A)}function P(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;Me.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function R(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function w(){return!Fe.loading.entitlements&&(!!ue("admin")||!re("view")&&!(ue("manager")&&!re("create")))}function S(){var e=R();return Fe.isMode("edit")&&(e=e&&(G()||I())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function k(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function L(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==j())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return T.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function O(){return"toil"!==j()&&!Fe.request.change_balance}function M(){Fe.errors=[]}function x(){return Fe.request.create().then(Pe).then(function(){be("LeaveRequest::new")})}function $(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return t.map(Le[e],function(e){return Fe.requestStatuses[e]})}function j(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function W(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?U():N("none")}function H(e){return t.find(Fe.requestStatuses,function(n){return n.value===e})}function Y(e){Fe.errors=t.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function G(){return!e.equals(Me,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function V(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?o.resolve().then(de).then(me).then(_e).then(qe).then(ae).then(X).then(Fe.isMode("edit")?Ce:t.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==$e)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];Le.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],Le.awaiting_approval=e,Le.more_information_required=e,Le.rejected=e,Le.approved=e,Le.cancelled=[y.statusNames.awaitingApproval].concat(e)}function X(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):o.resolve()}function Q(){var e="my-leave"===s.section,n=+ke.id==+t.get(Fe,"leaveRequest.contact_id"),a=!t.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(n||a)}function J(){xe.push(s.$on("LeaveRequestPopup::requestObjectUpdated",Ce),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(_e).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,n){Y(n)}),s.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),i.$on("$destroy",Re),i.$on("LeaveRequestPopup::addTab",function(e,n){Be.push(n)})}function K(){var e,n;Fe.request=Fe.leaveRequest||null,e=j(),n=Fe.initRequestAttributes(),"leave"===e?Fe.request=_.init(n):"sickness"===e?Fe.request=q.init(n):"toil"===e&&(Fe.request=C.init(n))}function Z(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:ke.id}),e}function ee(){return Ee="staff",(Fe.isSelfRecord?ne():te()).finally(function(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")})}function ne(){return ke.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Fe.isSelfLeaveApprover=!0)})}function te(){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 ae(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!t.includes(["cancelled","rejected"],H(Fe.request.status_id).name)}function se(e){var n=Fe.getStatusFromValue(Fe.request.status_id);return!!n&&n.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function re(e){return Fe.mode===e}function ce(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 ue(e){return Ee===e}function le(){return h.all().then(function(e){Fe.absencePeriods=e})}function de(){return v.all(F()).then(v.loadCalculationUnits).then(function(e){Se={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Fe.loading.entitlements=!0,b.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Se.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function fe(){return f.getLoggedIn().then(function(e){ke=e})}function pe(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=t.remove(e.list,function(e){return e.id!==ke.id})}):ke.leaveManagees().then(function(e){Fe.managedContacts=e})}function he(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.requestStatuses=t.indexBy(e,"name")})}function ve(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 be(e){P(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ge(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Me[e+"_date"]})}function _e(e){if(Fe.absenceTypes=ve(Se.types,e),!Fe.absenceTypes.length)return o.reject($e)}function ye(){Fe.period=t.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=t.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Me=e.copy(Fe.request.attributes())}function Te(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,k(),D(),Fe.request.isValid().then(oe()&&L).then($).then(O()&&ge).then(De).then(function(){return Fe.isMode("edit")?we():x()}).catch(function(n){Fe.request.status_id=e,n&&Y(n)}).finally(function(){Fe.submitting=!1})}function De(){return o.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&t.push(e),++a===Oe&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Oe>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function Re(){xe.forEach(function(e){e()})}function Ie(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function we(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?be("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&be("LeaveRequest::edit")})}n.debug("RequestCtrl");var Se,ke,Le={},Oe=0,Me={},xe=[],$e="No entitlement",Ee="",Be=[],Fe=t.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=w,Fe.canSubmit=S,Fe.closeAlert=M,Fe.deleteLeaveRequest=E,Fe.dismissModal=B,Fe.getStatuses=W,Fe.getStatusFromValue=H,Fe.initAfterContactSelection=V,Fe.initRequestAttributes=Z,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=re,Fe.isRole=ue,Fe.submit=Ae,Fe.updateAbsenceType=Ie,function(){Fe.loading.absenceTypes=!0,z(),J(),fe().then(Q).then(function(){return o.all([ee(),le(),he()])}).then(K).then(Te).then(ye).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&pe()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(Y).finally(function(){Fe.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(){}); //# 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 225c924d119..d2da8882dcd 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 @@ -6,9 +6,9 @@ */ -!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/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,r,o,s,i,u,c,l,d,f){function m(t){R=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===S.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(n){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(S.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===S.leaveRequest.contact_id}function y(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function _(e){var t=O[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[k[e]]})}function A(t){var n=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;R===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:S.leaveRequest})}function w(){var t=S.leaveRequestStatuses[S.leaveRequest.status_id].name,n=e.compact(e.map(O,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==S.role&&e.pull(n,"delete"),"staff"===S.role&&e.pull(n,"approve","reject"),"staff"!==S.role&&P(n),p()&&n.push("delete"),S.allowedActions=e.map(n,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function T(){return b().then(function(e){e&&(S.role="admin")})}function P(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 D,R,S=this,I=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},k={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=m,S.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return g()&&T()}).then(w).finally(function(){S.loading.component=!1})}()}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,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(){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 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){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=L[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),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!==B?(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 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 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 O(e,t){return{relative:S(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=R(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 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=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 x(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;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(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,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(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(),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&&x).then("contacts"===t&&A).then("month"===t&&E).then(function(){g("contacts"===t)})}function k(e){o.$emit("LeaveCalendar::showMonth",!!e)}function L(){j(t())}function x(){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=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 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 x(){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=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(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=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/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,r,o,s,i,u,c,l,d,f){function m(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=O[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[k[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(O,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},k={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return g()&&T()}).then(w).finally(function(){R.loading.component=!1})}()}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,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 x()}).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 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 O(e){return te.request.request_type===e}function k(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 x(){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(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: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=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([x(),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),g(),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 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(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:M(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 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 x(e){var t=[_(i.statusNames.moreInformationRequired),_(i.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function M(e){var t=U.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&&(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(),S(),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),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 $(){["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){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 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=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(){R("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=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 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 S(){return l(),k(),B()}function R(){return x(),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 L(){N=e.cloneDeep(u.request.attributes())}function x(){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(),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=M,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=I,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){L(),x(),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"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function w(){["from","to"].forEach(A)}function T(){var e=Be.requestStatuses[_.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Be.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function R(){var e=P();return Be.isMode("edit")&&(e=e&&(Y()||D())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function I(){Be.isSelfRecord&&!Be.isSelfLeaveApprover?Be.request.status_id=Be.requestStatuses[_.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function O(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==U())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function k(){return"toil"!==U()&&!Be.request.change_balance}function L(){Be.errors=[]}function x(){return Be.request.create().then(Te).then(function(){be("LeaveRequest::new")})}function M(){re()&&!Be.isRole("staff")&&(Be.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 Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.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(Be.getStatusFromValue(Be.request.status_id).name)}function N(e){return n.map(Oe[e],function(e){return Be.requestStatuses[e]})}function U(){return Be.request?Be.request.request_type:Be.leaveType||null}function H(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?F():N("none")}function W(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function V(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function Y(){return!e.equals(Le,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function G(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?r.resolve().then(de).then(fe).then(ye).then(qe).then(ae).then(X).then(Be.isMode("edit")?$e:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return r.reject(e)}):r.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(){return Be.canManage?m.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function K(){xe.push(o.$on("LeaveRequestPopup::requestObjectUpdated",$e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function Q(){var e,t;Be.request=Be.leaveRequest||null,e=U(),t=Be.initRequestAttributes(),"leave"===e?Be.request=y.init(t):"sickness"===e?Be.request=q.init(t):"toil"===e&&(Be.request=$.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:Ie.id}),e}function ee(){return Ee="staff",(Be.isSelfRecord?te():ne()).finally(function(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")})}function te(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Be.isSelfLeaveApprover=!0)})}function ne(){return u(_.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(_.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[_.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[_.statusNames.approved].value)}function re(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],W(Be.request.status_id).name)}function oe(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function se(e){return Be.request&&Be.request.request_type===e}function ie(e){return Be.mode===e}function ue(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 ce(e){return Ee===e}function le(){return h.all().then(function(e){Be.absencePeriods=e})}function de(){return v.all(B()).then(v.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Be.loading.entitlements=!0,b.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Re.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function me(){return m.getLoggedIn().then(function(e){Ie=e})}function pe(){return Be.selectedContactId?m.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?m.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Be.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.requestStatuses=n.indexBy(e,"name")})}function ve(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 be(e){T(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function ge(){ +["from","to"].forEach(function(e){Be.request[e+"_date"]=Le[e+"_date"]})}function ye(e){if(Be.absenceTypes=ve(Re.types,e),!Be.absenceTypes.length)return r.reject(Me)}function _e(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ue(Be.request,e)})}function qe(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function $e(){Le=e.copy(Be.request.attributes())}function Ce(){var e;Be.request.id?(e=[Be.requestStatuses[_.statusNames.approved].value,Be.requestStatuses[_.statusNames.adminApproved].value,Be.requestStatuses[_.statusNames.rejected].value,Be.requestStatuses[_.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function Ae(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,I(),w(),Be.request.isValid().then(re()&&O).then(M).then(k()&&ge).then(we).then(function(){return Be.isMode("edit")?Se():x()}).catch(function(t){Be.request.status_id=e,t&&V(t)}).finally(function(){Be.submitting=!1})}function we(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){xe.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Be.request.update().then(Te).then(function(){Be.isRole("manager")?be("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Ie,Oe={},ke=0,Le={},xe=[],Me="No entitlement",Ee="",je=[],Be=n.assign(this,f);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.loading={absenceTypes:!0,entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=S,Be.canSubmit=R,Be.closeAlert=L,Be.deleteLeaveRequest=E,Be.dismissModal=j,Be.getStatuses=H,Be.getStatusFromValue=W,Be.initAfterContactSelection=G,Be.initRequestAttributes=Z,Be.isLeaveStatus=oe,Be.isLeaveType=se,Be.isMode=ie,Be.isRole=ce,Be.submit=Ae,Be.updateAbsenceType=De,function(){Be.loading.absenceTypes=!0,z(),K(),me().then(J).then(function(){return r.all([ee(),le(),he()])}).then(Q).then(Ce).then(_e).then(function(){return Be.canManage&&!Be.isMode("edit")&&pe()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(V).finally(function(){Be.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(){}); //# 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 0a518ef69e7..3f455ecc634 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 @@ -6,9 +6,9 @@ */ -!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 k(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 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(),E(),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(),E(),I("month")}function O(e){var n="previous"===e?"subtract":"add";B(t(H.selectedMonth.moment)[n](1,"month")),E(),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&&E).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 k(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(){k("previous"),k("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(),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: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 k(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 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=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/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,r,o,s,i,u,c,l,d,f){function m(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([O.awaitingApproval,O.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function g(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function b(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=I[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[x[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(I,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:I[e].label,isDirectAction:I[e].isDirectAction}})}function T(){return g().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,O=l.statusNames,I={edit:{label:"Edit",allowedStatuses:[O.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[O.moreInformationRequired]},view:{label:"View",allowedStatuses:[O.approved,O.rejected,O.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.approved,O.rejected,O.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.moreInformationRequired,O.approved,O.rejected,O.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},x={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return b()&&T()}).then(w).finally(function(){R.loading.component=!1})}()}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,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 E();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(w).finally(_)}function g(){return G(),E()}function b(){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,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?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 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 k(){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 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(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:k},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=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(),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:k(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 k(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 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=E,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 k(){u.setRequestDateTimesAndDateTypes(),l(),x(),u.isCalculationUnit("hours")?I():u.request.toil_to_accrue=null}function E(){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=k,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,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"===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;Oe.status_id===e&&e!==Ee.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return ke.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return ke.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 O(){Ee.isSelfRecord?Ee.request.status_id=Ee.requestStatuses[_.statusNames.awaitingApproval].value:Ee.canManage&&(Ee.request.status_id=Ee.newStatusOnSave||Ee.request.status_id)}function I(){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 x(){return"toil"!==U()&&!Ee.request.change_balance}function L(){Ee.errors=[]}function M(){return Ee.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function k(){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 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(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(Oe,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(ge).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!==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 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=+xe==+n.get(Ee,"leaveRequest.contact_id"),a=!n.get(Ee,"leaveRequest.id");Ee.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",Ee.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){ke.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:xe}),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(j()).then(v.loadCalculationUnits).then(function(e){De={types:e,ids:e.map(function(e){return e.id})}})}function le(){return Ee.loading.entitlements=!0,g.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){xe=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!==xe})}):m.find(xe).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"]=Oe[e+"_date"]})}function ge(e){if(Ee.absenceTypes=pe(De.types,e),!Ee.absenceTypes.length)return r.reject(Le)}function be(){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(){Oe=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,O(),w(),Ee.request.isValid().then(ne()&&I).then(k).then(x()&&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(ke.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 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,Se={},Re=0,Oe={},Ie=[],xe="",Le="No entitlement",Me="",ke=[],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=S,Ee.canSubmit=R,Ee.closeAlert=L,Ee.deleteLeaveRequest=E,Ee.dismissModal=B,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(be).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"]}),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(){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=x[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 L(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 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=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 k(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 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,L(!0)})}function g(){o.$new().$watch(function(){return H.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(B(),E(),L())})}function b(e){H.injectMonth=!0,F("injected").then(function(){L(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 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(),x(),E(),I("month")}function O(e){var n="previous"===e?"subtract":"add";B(t(H.selectedMonth.moment)[n](1,"month")),E(),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&&E).then(function(){b("contacts"===t)})}function L(e){o.$emit("LeaveCalendar::showMonth",!!e)}function x(){B(t())}function M(){B(H.months[0].moment)}function k(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(){k("previous"),k("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(),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: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 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 k(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 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=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/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,r,o,s,i,u,c,l,d,f){function m(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([O.awaitingApproval,O.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function g(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function b(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=I[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[L[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(I,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:I[e].label,isDirectAction:I[e].isDirectAction}})}function T(){return g().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,O=l.statusNames,I={edit:{label:"Edit",allowedStatuses:[O.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[O.moreInformationRequired]},view:{label:"View",allowedStatuses:[O.approved,O.rejected,O.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.approved,O.rejected,O.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.moreInformationRequired,O.approved,O.rejected,O.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},L={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return b()&&T()}).then(w).finally(function(){R.loading.component=!1})}()}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,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 E();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(w).finally(_)}function g(){return G(),E()}function b(){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,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?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 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 L(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 k(){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 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(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:k},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=L,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(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:x(),managed_by:U.isAdmin&&"me"!==n.assignedTo.type?void 0:U.contactId,status_id:k(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 L(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 k(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 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=L,U.refresh=E,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){ +L[e]=t,f(e,t),n&&"from"===e&&f("to",t)}).catch(function(t){return L[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=L[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 L={};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(),L())})})}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(),L(),j()}function R(){return M(),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time),l(),U?U=!1:L(),j()}function O(e){u.uiOptions.times[e].time=""}function I(){u.request.toil_to_accrue=u.uiOptions.toil_duration_in_hours}function L(){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 k(){u.setRequestDateTimesAndDateTypes(),l(),L(),u.isCalculationUnit("hours")?I():u.request.toil_to_accrue=null}function E(){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=k,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=O,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){x(),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"===je.selectedAbsenceType.calculation_unit_name?delete je.request[e+"_date_amount"]:delete je.request[e+"_date_type"]}function w(){["from","to"].forEach(A)}function T(){var e=je.requestStatuses[_.statusNames.awaitingApproval].value;xe.status_id===e&&e!==je.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!je.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function R(){var e=P();return je.isMode("edit")&&(e=e&&(Y()||D())),je.canManage&&je.requestStatuses&&(e=e&&!!je.getStatusFromValue(je.newStatusOnSave)),(e=e&&!!je.period.id)&&!je.isMode("view")}function O(){je.isSelfRecord&&!je.isSelfLeaveApprover?je.request.status_id=je.requestStatuses[_.statusNames.awaitingApproval].value:je.canManage&&(je.request.status_id=je.newStatusOnSave||je.request.status_id)}function I(){if(je.isMode("edit")&&!je.isRole("staff")&&"toil"!==U())return je.request.calculateBalanceChange(je.selectedAbsenceType.calculation_unit_name).then(function(e){if(+je.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function L(){return"toil"!==U()&&!je.request.change_balance}function x(){je.errors=[]}function M(){return je.request.create().then(Te).then(function(){ge("LeaveRequest::new")})}function k(){re()&&!je.isRole("staff")&&(je.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 je.request.delete().then(function(){je.dismissModal(),d.publish("LeaveRequest::delete",je.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(je.getStatusFromValue(je.request.status_id).name)}function N(e){return n.map(Ie[e],function(e){return je.requestStatuses[e]})}function U(){return je.request?je.request.request_type:je.leaveType||null}function H(){return!je.request||e.equals({},je.requestStatuses)?[]:je.request.status_id?F():N("none")}function W(e){return n.find(je.requestStatuses,function(t){return t.value===e})}function V(e){je.errors=n.isArray(e)?e:[e],je.loading.absenceTypes=!1,je.submitting=!1}function Y(){return!e.equals(xe,je.request.attributes())||je.canManage&&je.newStatusOnSave}function G(){return je.postContactSelection=!0,je.staffMemberSelectionComplete=!1,je.request.contact_id?r.resolve().then(de).then(fe).then(ye).then(qe).then(ae).then(X).then(je.isMode("edit")?$e:n.noop).then(function(){je.postContactSelection=!1,je.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];Ie.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Ie.awaiting_approval=e,Ie.more_information_required=e,Ie.rejected=e,Ie.approved=e,Ie.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){return je.canManage?m.find(je.request.contact_id).then(function(e){je.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Oe.id==+n.get(je,"leaveRequest.contact_id"),a=!n.get(je,"leaveRequest.id");je.isSelfRecord=e&&(t||a)}function K(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",$e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",je.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Le++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function Q(){var e,t;je.request=je.leaveRequest||null,e=U(),t=je.initRequestAttributes(),"leave"===e?je.request=y.init(t):"sickness"===e?je.request=q.init(t):"toil"===e&&(je.request=$.init(t))}function Z(){var e={};return je.request?e=je.request.attributes():je.canManage||(e={contact_id:Oe.id}),e}function ee(){return Ee="staff",(je.isSelfRecord?te():ne()).finally(function(){je.canManage=je.isRole("manager")||je.isRole("admin")})}function te(){return Oe.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",je.isSelfLeaveApprover=!0)})}function ne(){return u(_.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(_.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){je.defaultStatus?je.newStatusOnSave=je.requestStatuses[_.statusNames[je.defaultStatus]].value:(je.isRole("admin")||je.isMode("create")&&je.isRole("manager"))&&(je.newStatusOnSave=je.requestStatuses[_.statusNames.approved].value)}function re(){return!je.request.status_id||!n.includes(["cancelled","rejected"],W(je.request.status_id).name)}function oe(e){var t=je.getStatusFromValue(je.request.status_id);return!!t&&t.name===e}function se(e){return je.request&&je.request.request_type===e}function ie(e){return je.mode===e}function ue(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 ce(e){return Ee===e}function le(){return h.all().then(function(e){je.absencePeriods=e})}function de(){return v.all(j()).then(v.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return je.loading.entitlements=!0,g.all({contact_id:je.request.contact_id,period_id:je.period.id,type_id:{IN:Re.ids}},!0).finally(function(){je.loading.entitlements=!1})}function me(){return m.getLoggedIn().then(function(e){Oe=e})}function pe(){return je.selectedContactId?m.find(je.selectedContactId).then(function(e){je.managedContacts=[e]}):je.isRole("admin")?m.all().then(function(e){je.managedContacts=n.remove(e.list,function(e){return e.id!==Oe.id})}):Oe.leaveManagees().then(function(e){je.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){je.requestStatuses=n.indexBy(e,"name")})}function ve(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){T(),d.publish(e,je.request),je.errors=[],je.dismissModal()}function be(){["from","to"].forEach(function(e){je.request[e+"_date"]=xe[e+"_date"]})}function ye(e){if(je.absenceTypes=ve(Re.types,e), +!je.absenceTypes.length)return r.reject(ke)}function _e(){je.period=n.find(je.absencePeriods,function(e){return je.isMode("create")?e.current:ue(je.request,e)})}function qe(){je.isMode("create")?(je.selectedAbsenceType=je.absenceTypes[0],je.request.type_id=je.selectedAbsenceType.id):je.selectedAbsenceType=n.find(je.absenceTypes,function(e){return e.id===je.request.type_id})}function $e(){xe=e.copy(je.request.attributes())}function Ce(){var e;je.request.id?(e=[je.requestStatuses[_.statusNames.approved].value,je.requestStatuses[_.statusNames.adminApproved].value,je.requestStatuses[_.statusNames.rejected].value,je.requestStatuses[_.statusNames.cancelled].value],je.mode="edit",je.isRole("staff")&&e.indexOf(je.request.status_id)>-1&&(je.mode="view")):je.mode="create"}function Ae(){var e=je.request.status_id;if(!je.isMode("view")&&!je.submitting)return je.submitting=!0,O(),w(),je.request.isValid().then(re()&&I).then(k).then(L()&&be).then(we).then(function(){return je.isMode("edit")?Se():M()}).catch(function(t){je.request.status_id=e,t&&V(t)}).finally(function(){je.submitting=!1})}function we(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===Le&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Le>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){Me.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return je.request.update().then(Te).then(function(){je.isRole("manager")?ge("LeaveRequest::updatedByManager"):(je.isRole("staff")||je.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Oe,Ie={},Le=0,xe={},Me=[],ke="No entitlement",Ee="",Be=[],je=n.assign(this,f);je.absencePeriods=[],je.absenceTypes=[],je.canManage=!1,je.contactName=null,je.errors=[],je.loading={absenceTypes:!0,entitlements:!0},je.managedContacts=[],je.mode="",je.newStatusOnSave=null,je.period={},je.postContactSelection=!1,je.requestStatuses={},je.selectedAbsenceType={},je.staffMemberSelectionComplete=!1,je.submitting=!1,je.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},je.canChangeAbsenceType=S,je.canSubmit=R,je.closeAlert=x,je.deleteLeaveRequest=E,je.dismissModal=B,je.getStatuses=H,je.getStatusFromValue=W,je.initAfterContactSelection=G,je.initRequestAttributes=Z,je.isLeaveStatus=oe,je.isLeaveType=se,je.isMode=ie,je.isRole=ce,je.submit=Ae,je.updateAbsenceType=De,function(){je.loading.absenceTypes=!0,z(),K(),me().then(J).then(function(){return r.all([ee(),le(),he()])}).then(Q).then(Ce).then(_e).then(function(){return je.canManage&&!je.isMode("edit")&&pe()}).then(function(){if(je.selectedContactId&&(je.request.contact_id=je.selectedContactId),je.request.contact_id)return je.initAfterContactSelection()}).catch(V).finally(function(){je.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(){}); //# 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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index 8111c517a4d..db8240b7e9a 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 @@ -9,6 +9,6 @@ !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/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,r,o,s,i,u,c,l,d,m){function f(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=x[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){w(e)}).catch(function(e){d.error("Error:",e)})}}}function $(){return m.get().then(function(e){D=e.contactId})}function q(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function w(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function A(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(x,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:x[e].label,isDirectAction:x[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,x={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},O={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=f,R.openLeavePopup=q,function(){a.resolve().then(y).then($).then(function(){return g()&&T()}).then(A).finally(function(){R.loading.component=!1})}()}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,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"]}), +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"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function A(){["from","to"].forEach(w)}function T(){var e=Be.requestStatuses[_.statusNames.awaitingApproval].value;ke.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Be.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function R(){var e=P();return Be.isMode("edit")&&(e=e&&(Y()||D())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function I(){Be.isSelfRecord&&!Be.isSelfLeaveApprover?Be.request.status_id=Be.requestStatuses[_.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function x(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==U())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==U()&&!Be.request.change_balance}function k(){Be.errors=[]}function L(){return Be.request.create().then(Te).then(function(){be("LeaveRequest::new")})}function M(){re()&&!Be.isRole("staff")&&(Be.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 Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.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(Be.getStatusFromValue(Be.request.status_id).name)}function N(e){return n.map(xe[e],function(e){return Be.requestStatuses[e]})}function U(){return Be.request?Be.request.request_type:Be.leaveType||null}function H(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?F():N("none")}function W(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function V(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function Y(){return!e.equals(ke,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function G(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?r.resolve().then(de).then(me).then(ye).then($e).then(ae).then(X).then(Be.isMode("edit")?qe:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return r.reject(e)}):r.reject("The contact id was not set")}function z(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];xe.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],xe.awaiting_approval=e,xe.more_information_required=e,xe.rejected=e,xe.approved=e,xe.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){return Be.canManage?f.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function K(){Le.push(o.$on("LeaveRequestPopup::requestObjectUpdated",qe),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function Q(){var e,t;Be.request=Be.leaveRequest||null,e=U(),t=Be.initRequestAttributes(),"leave"===e?Be.request=y.init(t):"sickness"===e?Be.request=$.init(t):"toil"===e&&(Be.request=q.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:Ie.id}),e}function ee(){return Ee="staff",(Be.isSelfRecord?te():ne()).finally(function(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")})}function te(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Be.isSelfLeaveApprover=!0)})}function ne(){return u(_.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(_.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[_.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[_.statusNames.approved].value)}function re(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],W(Be.request.status_id).name)}function oe(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function se(e){return Be.request&&Be.request.request_type===e}function ie(e){return Be.mode===e}function ue(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 ce(e){return Ee===e}function le(){return h.all().then(function(e){Be.absencePeriods=e})}function de(){return v.all(B()).then(v.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Be.loading.entitlements=!0,b.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Re.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function fe(){return f.getLoggedIn().then(function(e){Ie=e})}function pe(){return Be.selectedContactId?f.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?f.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Be.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.requestStatuses=n.indexBy(e,"name")})}function ve(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 be(e){T(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function ge(){["from","to"].forEach(function(e){Be.request[e+"_date"]=ke[e+"_date"]})}function ye(e){if(Be.absenceTypes=ve(Re.types,e),!Be.absenceTypes.length)return r.reject(Me)}function _e(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ue(Be.request,e)})}function $e(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function qe(){ke=e.copy(Be.request.attributes())}function Ce(){var e;Be.request.id?(e=[Be.requestStatuses[_.statusNames.approved].value,Be.requestStatuses[_.statusNames.adminApproved].value,Be.requestStatuses[_.statusNames.rejected].value,Be.requestStatuses[_.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function we(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,I(),A(),Be.request.isValid().then(re()&&x).then(M).then(O()&&ge).then(Ae).then(function(){return Be.isMode("edit")?Se():L()}).catch(function(t){Be.request.status_id=e,t&&V(t)}).finally(function(){Be.submitting=!1})}function Ae(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===Oe&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Oe>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){Le.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Be.request.update().then(Te).then(function(){Be.isRole("manager")?be("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Ie,xe={},Oe=0,ke={},Le=[],Me="No entitlement",Ee="",je=[],Be=n.assign(this,m);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.loading={absenceTypes:!0,entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=S,Be.canSubmit=R,Be.closeAlert=k,Be.deleteLeaveRequest=E,Be.dismissModal=j,Be.getStatuses=H,Be.getStatusFromValue=W,Be.initAfterContactSelection=G,Be.initRequestAttributes=Z,Be.isLeaveStatus=oe,Be.isLeaveType=se,Be.isMode=ie,Be.isRole=ce,Be.submit=we,Be.updateAbsenceType=De,function(){Be.loading.absenceTypes=!0,z(),K(),fe().then(J).then(function(){return r.all([ee(),le(),he()])}).then(Q).then(Ce).then(_e).then(function(){return Be.canManage&&!Be.isMode("edit")&&pe()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(V).finally(function(){Be.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(){}); //# 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/shared/controllers/request.controller.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js index d05084278da..b2286df2a83 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 @@ -99,7 +99,7 @@ define([ .then(initIsSelfRecord) .then(function () { return $q.all([ - initRoles(), + initRole(), loadAbsencePeriods(), loadStatuses() ]); @@ -287,15 +287,6 @@ define([ return getLeaveType() !== 'toil' && !vm.request.change_balance; } - /** - * Checks if the currently logged in user is a leave approver - * - * @return {Promise} - */ - function checkIfContactIsSelfLeaveApprover () { - return loggedInContact.checkIfSelfLeaveApprover(); - } - /** * Closes the error alerts if any */ @@ -616,37 +607,51 @@ 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 checkIfContactIsSelfLeaveApprover() - .then(function (isSelfLeaveApprover) { - if (!isSelfLeaveApprover) { - return; - } - - role = 'admin'; - vm.isSelfLeaveApprover = true; - vm.canManage = true; - }); - } + return (vm.isSelfRecord + ? initRoleBasedOnSelfLeaveApproverState() + : initRoleBasedOnPermissions()) + .finally(function () { + vm.canManage = vm.isRole('manager') || vm.isRole('admin'); + }); + } + + /** + * Initiates the user role based on their self leave approver state. + * If the user is creating or editing their own leave request, they will be + * treated as an "admin". + * + * @return {Promise} + */ + function initRoleBasedOnSelfLeaveApproverState () { + return loggedInContact.checkIfSelfLeaveApprover() + .then(function (isSelfLeaveApprover) { + if (!isSelfLeaveApprover) { + return; + } + + role = 'admin'; + vm.isSelfLeaveApprover = true; + }); + } + /** + * 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'); }); } diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js index 6c42698d660..094ccfc40a4 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js @@ -1488,7 +1488,7 @@ expect(controller.request.status_id).toEqual(approvalStatus); }); - it('calls corresponding API end points', function () { + it('calls the corresponding API endpoint', function () { expect(LeaveRequestAPI.create).toHaveBeenCalled(); }); }); From 799e70981b6cc4183bcee65899f6299a4fc2276f Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Fri, 27 Jul 2018 10:49:30 +0530 Subject: [PATCH 064/151] PCHR-3941: hide fields on document.ready --- hrui/js/dist/hrui.min.js | 4 ++-- hrui/js/src/hrui/main.js | 39 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/hrui/js/dist/hrui.min.js b/hrui/js/dist/hrui.min.js index 77d760c6d8c..5b6d5955e2a 100644 --- a/hrui/js/dist/hrui.min.js +++ b/hrui/js/dist/hrui.min.js @@ -1,2 +1,2 @@ -!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,m(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function i(n){1===t(n).length&&t(n).on("change",u)}function o(){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&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a").text("Personal Details"),f())}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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(){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 m(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var i=t(n),o=t("
    ");o.attr("id",e),o.append(t("#civicrm-menu")),o.append(i),o.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(){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(),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()}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(),i=t("");i.append(n.find("label")),i.append(t("
    ")),i.append(e.html()),t("#nick_name").parent().after(i)})}function C(){t(".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()}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(){p()}).ready(function(){i("input[type='file']"),e(),o(),n(),a(),c(),r(),l(),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,i){void 0!==i.contract&&n(i.contract),void 0!==i.roles&&e(i.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},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){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 i(){r=m.clone(!0).appendTo(n).addClass("civihr-popup")}function o(){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(),i(),c(),a(),o()}()})})}(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 +!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,l(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function o(n){1===t(n).length&&t(n).on("change",u)}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&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a").text("Personal Details"),f())}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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 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 l(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var o=t(n),i=t("
    ");i.attr("id",e),i.append(t("#civicrm-menu")),i.append(o),i.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(){"contactForm"!==CRM.formName&&"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(),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())}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(){t(".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()}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(){p()}).ready(function(){o("input[type='file']"),e(),i(),n(),a(),c(),r(),m(),p(),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=l.clone(!0).appendTo(n).addClass("civihr-popup")}function i(){m.data("attrchange-is-on")||(m.data("attrchange-is-on",!0),m.attrchange(function(){m.hasClass("btn-slide-active")||e()}))}function a(){r.find("a").click(function(){var n=t(this).parent().index();l.find("li:nth("+n+") a").click()})}function c(){var t=m.offset();r.css({left:+t.left-(r.width()-m.outerWidth()),top:+t.top+m.outerHeight()}),r.show(),n.addClass("civihr-popup-open")}var r,m=t(this),l=m.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/hrui/main.js b/hrui/js/src/hrui/main.js index 85f4755c186..c3d157d52aa 100755 --- a/hrui/js/src/hrui/main.js +++ b/hrui/js/src/hrui/main.js @@ -16,6 +16,7 @@ amendVacancyForm(); applyMiscChanges(); changeContactSourceFieldHelpText(); + miscContactPageChanges(); toggleActiveClassOnHoverOnAnyMainMenuItem(); useFontAwesomeArrowsInSubMenuItems(); }); @@ -201,24 +202,26 @@ * Misc changes to the page (hiding elements, inserting new ones, etc) */ function miscContactPageChanges () { - // 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(); - // 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 (CRM.formName === 'contactForm' || 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(); + // 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(); + } } } From 9aaceeb26f2afb389f363ae48fa2f708e0fd8e06 Mon Sep 17 00:00:00 2001 From: Debarshi Bhaumik Date: Fri, 27 Jul 2018 15:40:01 +0530 Subject: [PATCH 065/151] PCHR-3941: Refactor hrui --- hrui/js/dist/hrui.min.js | 2 +- hrui/js/src/hrui/main.js | 107 ++++++++++++++++++++------------------- 2 files changed, 56 insertions(+), 53 deletions(-) diff --git a/hrui/js/dist/hrui.min.js b/hrui/js/dist/hrui.min.js index 5b6d5955e2a..8983781b726 100644 --- a/hrui/js/dist/hrui.min.js +++ b/hrui/js/dist/hrui.min.js @@ -1,2 +1,2 @@ -!function(t,n){define("hrui/main",[],function(){function n(){var n=t(".crm-link-home");v(n,l(n,_(n)))}function e(){t.ajax("/civicrm/hrcore/usermenu?snippet=4",{dataType:"html",success:function(t){s(t,"civihr-menu")}})}function o(n){1===t(n).length&&t(n).on("change",u)}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&&"viewSummary"!==CRM.pageName||(t(".crm-contact-job_title",".crm-summary-contactinfo-block").length&&t(".crm-contact-tabs-list #tab_summary a").text("Personal Details"),f())}function c(){1===t(".CRM_HRRecruitment_Form_HRVacancy").length&&(d(t('label[for="start_date"]').parents("tr")),d(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 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 l(n,e){return t("li > a",n).first().text("Home").wrapInner('').prepend(e)}function s(n,e){var o=t(n),i=t("
    ");i.attr("id",e),i.append(t("#civicrm-menu")),i.append(o),i.insertAfter("#page")}function u(){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 d(t){t.find("label").attr("for",t.find(".crm-form-date").attr("id"))}function f(){t(".Inline_Custom_Data").length&&C(),t("#customFields").length<1&&b()}function p(){"contactForm"!==CRM.formName&&"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(),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())}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(){t(".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()}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(){p()}).ready(function(){o("input[type='file']"),e(),i(),n(),a(),c(),r(),m(),p(),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=l.clone(!0).appendTo(n).addClass("civihr-popup")}function i(){m.data("attrchange-is-on")||(m.data("attrchange-is-on",!0),m.attrchange(function(){m.hasClass("btn-slide-active")||e()}))}function a(){r.find("a").click(function(){var n=t(this).parent().index();l.find("li:nth("+n+") a").click()})}function c(){var t=m.offset();r.css({left:+t.left-(r.width()-m.outerWidth()),top:+t.top+m.outerHeight()}),r.show(),n.addClass("civihr-popup-open")}var r,m=t(this),l=m.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); +!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 i(n){1===t(n).length&&t(n).on("change",f)}function o(){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())}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 i=t(n),o=t("
    ");o.attr("id",e),o.append(t("#civicrm-menu")),o.append(i),o.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(),i=t("");i.append(n.find("label")),i.append(t("
    ")),i.append(e.html()),t("#nick_name").parent().after(i)})}function C(){t(".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()}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(){i("input[type='file']"),e(),o(),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,i){void 0!==i.contract&&n(i.contract),void 0!==i.roles&&e(i.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},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){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 i(){r=m.clone(!0).appendTo(n).addClass("civihr-popup")}function o(){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(),i(),c(),a(),o()}()})})}(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/hrui/main.js b/hrui/js/src/hrui/main.js index c3d157d52aa..6265975a4c0 100755 --- a/hrui/js/src/hrui/main.js +++ b/hrui/js/src/hrui/main.js @@ -5,18 +5,18 @@ define(function () { $(document) .on('crmLoad', function () { - miscContactPageChanges(); + hideFieldsInPersonalDetailsTab(); }) .ready(function () { addUploadFileListener("input[type='file']"); addUserMenuToMainMenu(); amendApplicationForm(); amendAppLogoMenuItem(); - amendContactPageAndForm(); + amendPersonalDetailsTab(); + amendContactsPage(); amendVacancyForm(); applyMiscChanges(); changeContactSourceFieldHelpText(); - miscContactPageChanges(); toggleActiveClassOnHoverOnAnyMainMenuItem(); useFontAwesomeArrowsInSubMenuItems(); }); @@ -65,17 +65,29 @@ } /** - * Amends the contact page and the contact form + * Amends Contacts Page + * URL: civicrm/contact/add?reset=1&ct=Individual */ - function amendContactPageAndForm () { - 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').text('Personal Details'); + 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(); } - manipulateDOMOfInlineCustomData(); + if ($('#customFields').length < 1) { + repositionInlineCustomDataFieldsInEditContactForm(); + } } } @@ -111,6 +123,24 @@ }); } + /** + * 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) { + repositionInlineCustomDataBlockInPersonalDetailsTab(); + } + } + } + /** * Changes of sorce help text */ @@ -143,6 +173,20 @@ .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 @@ -184,47 +228,6 @@ $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 () { - if (CRM.formName === 'contactForm' || 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(); - // 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(); - } - } - } - /** * Remove the #js-uploaded-file DIV and * clean input[type="file"] value From 5e543d2712cef69b952f9319214d032c2b0f1bef Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Thu, 26 Apr 2018 10:28:45 +0100 Subject: [PATCH 066/151] PCHR-3624: Move extended demographics custom group XML --- .../xml/extended_demographics_install.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hrdemog/xml/auto_install.xml => uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml (100%) diff --git a/hrdemog/xml/auto_install.xml b/uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml similarity index 100% rename from hrdemog/xml/auto_install.xml rename to uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml From e7753fd8e545bc8584fa8569817c25a71498d2b7 Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Thu, 26 Apr 2018 10:33:36 +0100 Subject: [PATCH 067/151] PCHR-3624: Apply changes from upgrader to XML. Delete upgraders It is possible that someone with a CiviHR system created before these upgraders were run would end up without the changes from the upgraders, but all our clients are on the latest version and private usage does not seem to be common --- hrdemog/CRM/HRDemog/Upgrader.php | 185 ----------- hrdemog/CRM/HRDemog/Upgrader/Base.php | 298 ------------------ .../xml/extended_demographics_install.xml | 4 +- 3 files changed, 2 insertions(+), 485 deletions(-) delete mode 100644 hrdemog/CRM/HRDemog/Upgrader.php delete mode 100644 hrdemog/CRM/HRDemog/Upgrader/Base.php 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/uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml b/uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml index 7dde14fbb55..6e8f0fa1bc6 100755 --- a/uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml +++ b/uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml @@ -15,7 +15,7 @@ civicrm_value_extended_demographics_8 0 0 - 0 + 1 @@ -41,7 +41,7 @@ String Multi-Select - :;:;:;Not Applicable:;:;:; + Not Applicable 0 1 0 From 08d63d0397055c41e9afd18a623a0c54179ce4e0 Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Thu, 26 Apr 2018 12:10:49 +0100 Subject: [PATCH 068/151] PCHR-3624: Migrate upgrader stuff from HRDemog --- .../Hook/Disable/CustomGroupDisabler.php | 17 ++++ .../HRCore/Hook/Enable/CustomGroupEnabler.php | 21 ++++ .../Hook/Uninstall/CustomGroupRemover.php | 25 +++++ .../Service/CustomGroupStatusSwitcher.php | 99 +++++++++++++++++++ .../config/container/container.xml | 1 + uk.co.compucorp.civicrm.hrcore/hrcore.php | 27 +++++ 6 files changed, 190 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Disable/CustomGroupDisabler.php create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Enable/CustomGroupEnabler.php create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Uninstall/CustomGroupRemover.php create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Disable/CustomGroupDisabler.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Disable/CustomGroupDisabler.php new file mode 100644 index 00000000000..f8c61048cec --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Disable/CustomGroupDisabler.php @@ -0,0 +1,17 @@ +get('custom_group.status_switcher'); + + foreach ($customGroups as $groupName) { + $switcher->disable($groupName); + } + } + +} diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Enable/CustomGroupEnabler.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Enable/CustomGroupEnabler.php new file mode 100644 index 00000000000..b6043723f4a --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Enable/CustomGroupEnabler.php @@ -0,0 +1,21 @@ +enable($groupName); + } + } + +} diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Uninstall/CustomGroupRemover.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Uninstall/CustomGroupRemover.php new file mode 100644 index 00000000000..302e5ee0664 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Uninstall/CustomGroupRemover.php @@ -0,0 +1,25 @@ + 'id', 'name' => $customGroupName]; + $result = civicrm_api3('CustomGroup', 'get', $params); + + if ($result['count'] != 1) { + continue; + } + $customGroup = array_shift($result['values']); + + civicrm_api3('CustomGroup', 'delete', ['id' => $customGroup['id']]); + } + } +} diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php new file mode 100644 index 00000000000..4bdad17e493 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php @@ -0,0 +1,99 @@ +changeStatus($customGroupName, TRUE); + } + + /** + * Disable a custom group and all its fields + * + * @param string $customGroupName + */ + public function disable($customGroupName) { + $this->changeStatus($customGroupName, FALSE); + } + + /** + * Switches the status for custom group and all its fields + * + * @param string $customGroupName + * @param bool $status + */ + private function changeStatus($customGroupName, $status) { + $customGroup = $this->getCustomGroup($customGroupName); + + if (!$customGroup) { + return; + } + + $customGroupId = (int) $customGroup['id']; + $this->changeGroupStatus($customGroupId, $status); + $this->changeAllGroupFieldsStatus($customGroupId, $status); + } + + /** + * Update the 'is_active' status for a custom group + * + * @param int $customGroupId + * @param bool $status + */ + private function changeGroupStatus($customGroupId, $status) { + $params = ['id' => $customGroupId, 'is_active' => $status]; + civicrm_api3('CustomGroup', 'create', $params); + } + + /** + * Update the 'is_active' status for all custom fields for a group + * + * @param int $customGroupId + * @param bool $status + */ + private function changeAllGroupFieldsStatus($customGroupId, $status) { + $fields = $this->getAllCustomFields($customGroupId); + + foreach ($fields as $field) { + $params = ['id' => $field['id'], 'is_active' => $status]; + civicrm_api3('CustomField', 'create', $params); + } + } + + /** + * Fetches all custom fields for a custom group + * + * @param int $customGroupId + * + * @return array + */ + private function getAllCustomFields($customGroupId) { + $params = ['custom_group_id' => $customGroupId]; + $result = civicrm_api3('CustomField', 'get', $params); + + return $result['values']; + } + + /** + * Gets a custom group based on name, returns null if group doesn't exist + * + * @param string $customGroupName + * + * @return mixed|null + */ + private function getCustomGroup($customGroupName) { + $params = ['name' => $customGroupName]; + $result = civicrm_api3('CustomGroup', 'get', $params); + + if ($result['count'] != 1) { + return NULL; + } + + return array_shift($result['values']); + } + +} diff --git a/uk.co.compucorp.civicrm.hrcore/config/container/container.xml b/uk.co.compucorp.civicrm.hrcore/config/container/container.xml index ffa8e04b42c..24c717b282a 100644 --- a/uk.co.compucorp.civicrm.hrcore/config/container/container.xml +++ b/uk.co.compucorp.civicrm.hrcore/config/container/container.xml @@ -45,6 +45,7 @@ + diff --git a/uk.co.compucorp.civicrm.hrcore/hrcore.php b/uk.co.compucorp.civicrm.hrcore/hrcore.php index 5f9183ccb4b..a437c0632f8 100644 --- a/uk.co.compucorp.civicrm.hrcore/hrcore.php +++ b/uk.co.compucorp.civicrm.hrcore/hrcore.php @@ -180,6 +180,14 @@ function hrcore_civicrm_postInstall() { * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall */ function hrcore_civicrm_uninstall() { + $listeners = [ + new CRM_HRCore_Hook_Uninstall_CustomGroupRemover() + ]; + + foreach ($listeners as $listener) { + $listener->handle(); + } + _hrcore_civix_civicrm_uninstall(); } @@ -189,6 +197,17 @@ function hrcore_civicrm_uninstall() { * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable */ function hrcore_civicrm_enable() { + // required for PEAR style autoloading in this extension + _hrcore_civix_civicrm_config(); + + $listeners = [ + new CRM_HRCore_Hook_Enable_CustomGroupEnabler() + ]; + + foreach ($listeners as $listener) { + $listener->handle(); + } + _hrcore_civix_civicrm_enable(); } @@ -198,6 +217,14 @@ function hrcore_civicrm_enable() { * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable */ function hrcore_civicrm_disable() { + $listeners = [ + new CRM_HRCore_Hook_Disable_CustomGroupDisabler() + ]; + + foreach ($listeners as $listener) { + $listener->handle(); + } + _hrcore_civix_civicrm_disable(); } From 7371deaed334cd44012d718e36d99a71c810842e Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Thu, 26 Apr 2018 16:02:43 +0100 Subject: [PATCH 069/151] PCHR-3624: Delete the hrdemog extension The extension has been deleted from the code which means you'll get a warning about missing files until the upgrader has been run. The upgrader cannot be run from the UI because it complains about missing extension files, but running from the CLI is fine --- hrdemog/hrdemog.civix.php | 215 -------------------------------------- hrdemog/hrdemog.php | 116 -------------------- hrdemog/info.xml | 20 ---- 3 files changed, 351 deletions(-) delete mode 100644 hrdemog/hrdemog.civix.php delete mode 100644 hrdemog/hrdemog.php delete mode 100644 hrdemog/info.xml 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 - - From 4d1ae997e7ce51872c8129d0ae262d0c878db25b Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Mon, 30 Apr 2018 09:19:54 +0100 Subject: [PATCH 070/151] PCHR-3624: Remove references to hrdemog extension --- bin/drush-install.sh | 1 - bin/git-release.sh | 1 - hrvisa/tests/phpunit/CRM/HRVisa/ActivityTest.php | 2 -- .../tests/phpunit/CRM/HRSampleData/BaseCSVProcessorTest.php | 1 - 4 files changed, 5 deletions(-) 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/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/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') From 6b8b8d3acb0a49b188ccaf7603857ce846519a65 Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Mon, 30 Apr 2018 11:59:48 +0100 Subject: [PATCH 071/151] PCHR-3624: Add fabricators for custom group and field --- .../HRCore/Test/Fabricator/CustomField.php | 23 +++++++++++++++++++ .../HRCore/Test/Fabricator/CustomGroup.php | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomField.php create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomGroup.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomField.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomField.php new file mode 100644 index 00000000000..e2030ae18c1 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomField.php @@ -0,0 +1,23 @@ + 'test_custom_field', + 'html_type' => 'Text', + 'data_type' => 'String', + ]; + + public static function fabricate($params = []) { + $params = array_merge(self::$defaultParams, $params); + + if (!isset($params['label'])) { + $params['label'] = $params['name']; + } + + $result = civicrm_api3('CustomField', 'create', $params); + + return array_shift($result['values']); + } + +} diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomGroup.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomGroup.php new file mode 100644 index 00000000000..fcb13b0f80f --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomGroup.php @@ -0,0 +1,23 @@ + 'test_custom_group', + 'title' => 'Test Custom Group', + 'extends' => 'Individual' + ]; + + public static function fabricate($params = []) { + $params = array_merge(self::$defaultParams, $params); + + $result = civicrm_api3( + 'CustomGroup', + 'create', + $params + ); + + return array_shift($result['values']); + } + +} From e19d68667e65adbc8631dbf2a63f9bae063fa77d Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Mon, 30 Apr 2018 12:05:24 +0100 Subject: [PATCH 072/151] PCHR-3624: Throw exception if group not found. Add tests --- .../Service/CustomGroupStatusSwitcher.php | 3 +- .../Service/CustomGroupStatusSwitcherTest.php | 140 ++++++++++++++++++ 2 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php index 4bdad17e493..1d3545ff0ca 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php @@ -30,7 +30,8 @@ private function changeStatus($customGroupName, $status) { $customGroup = $this->getCustomGroup($customGroupName); if (!$customGroup) { - return; + $err = sprintf('Could not find group with name "%s"', $customGroupName); + throw new \Exception($err); } $customGroupId = (int) $customGroup['id']; diff --git a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php new file mode 100644 index 00000000000..57c78e5b677 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php @@ -0,0 +1,140 @@ +disable(self::$customGroup['name']); + + // check that all custom fields were enabled + foreach (self::$customFields as $customField) { + $id = $customField['id']; + $updatedField = civicrm_api3('CustomField', 'getsingle', ['id' => $id]); + $this->assertEquals(0, $updatedField['is_active']); + } + + // check custom group was enabled + $updatedGroup = civicrm_api3('CustomGroup', 'getsingle', ['id' => $groupId]); + $this->assertEquals(0, $updatedGroup['is_active']); + + } + + public function testEnablingWillEnableAllFields() { + $groupId = self::$customGroup['id']; + // disable the group + civicrm_api3('CustomGroup', 'create', ['id' => $groupId, 'is_active' => 0]); + + // disable the fields + foreach (self::$customFields as $customField) { + civicrm_api3('CustomField', 'create', [ + 'id' => $customField['id'], + 'is_active' => 0, + ]); + } + + $switcher = new CustomGroupStatusSwitcher(); + $switcher->enable(self::$customGroup['name']); + + // check that all custom fields were enabled + foreach (self::$customFields as $customField) { + $id = $customField['id']; + $updatedField = civicrm_api3('CustomField', 'getsingle', ['id' => $id]); + $this->assertEquals(1, $updatedField['is_active']); + } + + // check custom group was enabled + $updatedGroup = civicrm_api3('CustomGroup', 'getsingle', ['id' => $groupId]); + $this->assertEquals(1, $updatedGroup['is_active']); + } + + public function testNonExistingGroupNameWillThrowException() { + $groupName = 'Lala'; + $expectedMessage = 'Could not find group with name "Lala"'; + $this->setExpectedException(\Exception::class, $expectedMessage); + $switcher = new CustomGroupStatusSwitcher(); + $switcher->enable($groupName); + } + + /** + * CiviCRM test transactions are broken by custom group creation. If you + * create and subsequently delete a custom group in a test it will drop the + * table but leave the civicrm_custom_group entry. This means the next + * time the test is run it will fail when it tries to drop a table that + * doesn't exist. + * + * Similarly with custom fields, if you drop one inside a test the column + * will be dropped outside of the transaction, but the field will only be + * dropped inside the transaction, meaning the next time you try to delete + * a custom group it will fail because it tries to drop columns that don't + * exist. + * + * To avoid these problems all custom group / field creation and deletion is + * done outside the test. The CiviTestListener manages transactions in + * SetUp and TearDown, so we use the "BeforeClass" and "AfterClass" methods + */ + public static function setUpBeforeClass() { + // If the last test critically errored the group might still exist + self::deleteCustomGroupIfExists('Foo'); + + self::$customGroup = CustomGroupFabricator::fabricate(['name' => 'Foo']); + self::createCustomFields(2); + } + + /** + * Clean up everything created in this test class + */ + public static function tearDownAfterClass() { + static::deleteCustomGroupIfExists(self::$customGroup['name']); + } + + /** + * Checks if a custom group exists (by name) and deletes it if it does + * + * @param string $groupName + */ + private static function deleteCustomGroupIfExists($groupName) { + $existing = civicrm_api3('CustomGroup', 'get', ['name' => $groupName]); + if ($existing['count'] > 0) { + $existing = array_shift($existing['values']); + civicrm_api3('CustomGroup', 'delete', ['id' => $existing['id']]); + } + } + + /** + * Create some custom fields for the test custom group + * + * @param int $count + */ + private static function createCustomFields($count) { + $customFields = []; + + for ($i = 0; $i < $count; $i++) { + $params['custom_group_id'] = self::$customGroup['id']; + $params['name'] = 'bar_' . $i; + $customFields[] = CustomFieldFabricator::fabricate($params); + } + + self::$customFields = $customFields; + } + +} From 539ece29c06987d43dba8c98de10fcc328b2d2fb Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Mon, 30 Apr 2018 15:08:00 +0100 Subject: [PATCH 073/151] PCHR-3624: Add required param in update Without custom_group_id (even in an update) the endpoint will throw an exception about required params --- .../CRM/HRCore/Service/CustomGroupStatusSwitcher.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php index 1d3545ff0ca..f381b3be7d5 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Service/CustomGroupStatusSwitcher.php @@ -61,6 +61,8 @@ private function changeAllGroupFieldsStatus($customGroupId, $status) { foreach ($fields as $field) { $params = ['id' => $field['id'], 'is_active' => $status]; + // Custom field endpoint freaks out if custom_group_id is missing + $params['custom_group_id'] = $field['custom_group_id']; civicrm_api3('CustomField', 'create', $params); } } From eacf7642afa2d50011ec10b000faaec74a9caaac Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Mon, 30 Apr 2018 15:09:03 +0100 Subject: [PATCH 074/151] PCHR-3624: Don't use HRCore in extension helper test Some test probably should test HRCore installation and uninstallation, but since it installs / removes some CustomGroups now it will break the test db because of CiviCRM issues with CustomGroup alterations in transactions --- .../phpunit/CRM/HRCore/Helper/ExtensionHelperTest.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Helper/ExtensionHelperTest.php b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Helper/ExtensionHelperTest.php index f7bde0da97f..e67d3ea052d 100644 --- a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Helper/ExtensionHelperTest.php +++ b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Helper/ExtensionHelperTest.php @@ -10,16 +10,15 @@ class CRM_HRCore_Helper_ExtensionHelperTest extends CRM_HRCore_Test_BaseHeadless /** * @var string */ - private $hrCoreKey = 'uk.co.compucorp.civicrm.hrcore'; + private $extensionKey = 'uk.co.compucorp.civicrm.hremails'; public function testCheckIsFalseAfterExtensionIsDisabled() { - // hrcore is enabled by default in CRM_HRCore_Test_BaseHeadlessTest - civicrm_api3('Extension', 'disable', ['keys' => $this->hrCoreKey]); - $this->assertFalse(ExtensionHelper::isExtensionEnabled($this->hrCoreKey)); + civicrm_api3('Extension', 'disable', ['keys' => $this->extensionKey]); + $this->assertFalse(ExtensionHelper::isExtensionEnabled($this->extensionKey)); } public function testCheckIsTrueAfterExtensionIsEnabled() { - civicrm_api3('Extension', 'enable', ['keys' => $this->hrCoreKey]); - $this->assertTrue(ExtensionHelper::isExtensionEnabled($this->hrCoreKey)); + civicrm_api3('Extension', 'enable', ['keys' => $this->extensionKey]); + $this->assertTrue(ExtensionHelper::isExtensionEnabled($this->extensionKey)); } } From eaccc6ef7f36c4625b1352a01c35831ada21625d Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Fri, 27 Jul 2018 11:58:31 +0100 Subject: [PATCH 075/151] PCHR-4040: Allow user who is own leave approver to delete own request. Modify canDeleleteFor Method. Add tests. --- .../Service/LeaveRequestRights.php | 14 ++++++++++++-- .../Service/LeaveRequestRightsTest.php | 9 +++++++++ .../Service/LeaveRequestTest.php | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) 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..648d8dabab0 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php @@ -85,7 +85,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 +95,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); } /** 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..8d959f2a5ff 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 @@ -37,13 +37,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 */ 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 8a9c5d60d20..8a6c538aff3 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 @@ -467,6 +467,21 @@ public function testDeleteThrowsAnExceptionWhenLeaveContactTriesToDeleteALeaveRe $this->getLeaveRequestService()->delete($leaveRequest->id); } + 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); From b909dcd6f16f6a16e7283fd3f1ac07fa4d85c73b Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Mon, 30 Apr 2018 15:32:44 +0100 Subject: [PATCH 076/151] PCHR-3624: Resolve upgrader conflict Upgrader 1017 conflicted with an upgrader with the same number on staging. This was fixed by renaming the upgrader on this branch to 1022. The upgrader from staging was left untouched. --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1022.php | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1022.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 404ecaf87a7..51012af733a 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -29,6 +29,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1019; use CRM_HRCore_Upgrader_Steps_1020; use CRM_HRCore_Upgrader_Steps_1021; + use CRM_HRCore_Upgrader_Steps_1022; /** * @var array diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1022.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1022.php new file mode 100644 index 00000000000..4e9fbef14b8 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1022.php @@ -0,0 +1,27 @@ + $key]); + civicrm_api3('Extension', 'uninstall', ['keys' => $key]); + + return TRUE; + } + +} From dbf2f65cd37c122a0386dc64d4b27b27d66dfd42 Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Wed, 2 May 2018 12:30:39 +0100 Subject: [PATCH 077/151] PCHR-3624: Fix comments --- .../CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php index 57c78e5b677..a1d65aacdd3 100644 --- a/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php +++ b/uk.co.compucorp.civicrm.hrcore/tests/phpunit/CRM/HRCore/Service/CustomGroupStatusSwitcherTest.php @@ -26,14 +26,14 @@ public function testDisablingWillDisableAllFields() { $switcher = new CustomGroupStatusSwitcher(); $switcher->disable(self::$customGroup['name']); - // check that all custom fields were enabled + // check that all custom fields were disabled foreach (self::$customFields as $customField) { $id = $customField['id']; $updatedField = civicrm_api3('CustomField', 'getsingle', ['id' => $id]); $this->assertEquals(0, $updatedField['is_active']); } - // check custom group was enabled + // check custom group was disabled $updatedGroup = civicrm_api3('CustomGroup', 'getsingle', ['id' => $groupId]); $this->assertEquals(0, $updatedGroup['is_active']); From 9c55a5187017610722f037345d474af6fd17bc60 Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Tue, 15 May 2018 14:40:00 +0100 Subject: [PATCH 078/151] PCHR-3624: Ensure name is different on each successive fabricator call --- .../HRCore/Test/Fabricator/CustomGroup.php | 19 ++++++++++++------- uk.co.compucorp.civicrm.hrcore/hrcore.php | 4 +++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomGroup.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomGroup.php index fcb13b0f80f..5ac6eecbbdd 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomGroup.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Test/Fabricator/CustomGroup.php @@ -2,14 +2,8 @@ class CRM_HRCore_Test_Fabricator_CustomGroup { - private static $defaultParams = [ - 'name' => 'test_custom_group', - 'title' => 'Test Custom Group', - 'extends' => 'Individual' - ]; - public static function fabricate($params = []) { - $params = array_merge(self::$defaultParams, $params); + $params = array_merge(self::getDefaultParams(), $params); $result = civicrm_api3( 'CustomGroup', @@ -20,4 +14,15 @@ public static function fabricate($params = []) { return array_shift($result['values']); } + private static function getDefaultParams() { + static $count = 0; + $count++; + + return [ + 'name' => 'test_custom_group_' . $count, + 'title' => 'Test Custom Group ' . $count, + 'extends' => 'Individual' + ]; + } + } diff --git a/uk.co.compucorp.civicrm.hrcore/hrcore.php b/uk.co.compucorp.civicrm.hrcore/hrcore.php index a437c0632f8..d7da2293f86 100644 --- a/uk.co.compucorp.civicrm.hrcore/hrcore.php +++ b/uk.co.compucorp.civicrm.hrcore/hrcore.php @@ -197,7 +197,9 @@ function hrcore_civicrm_uninstall() { * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable */ function hrcore_civicrm_enable() { - // required for PEAR style autoloading in this extension + // _hrcore_civix_civicrm_config() will add this extension to the include path. + // We need to do this here because before extension is enabled the config + // hook is not called for it _hrcore_civix_civicrm_config(); $listeners = [ From c3a645d616522413b7567fdecf21447973cb39f5 Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Tue, 15 May 2018 15:08:17 +0100 Subject: [PATCH 079/151] PCHR-3624: Move XML files to subdirectory --- .../CRM/HRCore/Upgrader.php | 27 +++++++++++++++++++ .../extended_demographics_install.xml | 0 2 files changed, 27 insertions(+) rename uk.co.compucorp.civicrm.hrcore/xml/{ => CustomGroups}/extended_demographics_install.xml (100%) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index 51012af733a..f07642370ee 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -60,10 +60,18 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { 'Validate Email Address from Mailings.' ]; + /** + * A list of directories to be scanned for XML installation files + * + * @var array + */ + private $xmlDirectories = ['CustomGroups']; + /** * Callback called when the extension is installed */ public function install() { + $this->processXMLInstallationFiles(); $this->setScheduledJobsDefaultStatus(); $this->deleteLocationTypes(); $this->createRequiredLocationTypes(); @@ -72,6 +80,25 @@ public function install() { $this->runAllUpgraders(); } + /** + * Scans all the directories in $xmlDirectories for installation files + * (xml files ending with _install.xml) and processes them. + */ + private function processXMLInstallationFiles() { + foreach($this->xmlDirectories as $directory) { + $files = glob($this->extensionDir . "/xml/{$directory}/*_install.xml"); + if (is_array($files)) { + foreach ($files as $file) { + $this->executeCustomDataFileByAbsPath($file); + } + } + } + // Flush the cache so that all pseudoconstants can be re-read from db + // This is to avoid issues when running upgraders during installation + // whereby some pseudoconstants were not available. + CRM_Core_PseudoConstant::flush(); + } + /** * Callback method called when the extension is uninstalled. * diff --git a/uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml b/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml similarity index 100% rename from uk.co.compucorp.civicrm.hrcore/xml/extended_demographics_install.xml rename to uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml From 989f3a9bb87682c00920628306bb15ed3d122bbf Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Thu, 17 May 2018 10:05:42 +0100 Subject: [PATCH 080/151] PCHR-3624: Change service IDs to match convention --- .../Page/UserMailNotifier.php | 4 +-- .../AbstractDrupalInteractionTaskForm.php | 2 +- .../Hook/Disable/CustomGroupDisabler.php | 2 +- .../api/v3/Job/CheckCivihrVersion.php | 4 +-- .../config/container/container.xml | 31 ++++++++++--------- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/CRM/HRContactActionsMenu/Page/UserMailNotifier.php b/uk.co.compucorp.civicrm.hrcontactactionsmenu/CRM/HRContactActionsMenu/Page/UserMailNotifier.php index aadc269032f..f3907946bd1 100644 --- a/uk.co.compucorp.civicrm.hrcontactactionsmenu/CRM/HRContactActionsMenu/Page/UserMailNotifier.php +++ b/uk.co.compucorp.civicrm.hrcontactactionsmenu/CRM/HRContactActionsMenu/Page/UserMailNotifier.php @@ -14,7 +14,7 @@ class CRM_HRContactActionsMenu_Page_UserMailNotifier { public static function sendPasswordResetEmail() { $contactID = CRM_Utils_Array::value('cid', $_GET); $contactInfo = ContactHelper::getUserInformation($contactID); - $cmsUserMailNotifier = Civi::container()->get('hrcore.cms_notifier'); + $cmsUserMailNotifier = Civi::container()->get('civihr.cms.notifier'); $cmsUserMailNotifier->sendPasswordResetEmail($contactInfo); CRM_Core_Session::setStatus(ts('Password Reset Email sent'), 'Success', 'success'); @@ -30,7 +30,7 @@ public static function sendPasswordResetEmail() { public static function sendWelcomeEmail() { $contactID = CRM_Utils_Array::value('cid', $_GET); $contactInfo = ContactHelper::getUserInformation($contactID); - $cmsUserMailNotifier = Civi::container()->get('hrcore.cms_notifier'); + $cmsUserMailNotifier = Civi::container()->get('civihr.cms.notifier'); $cmsUserMailNotifier->sendWelcomeEmail($contactInfo); CRM_Core_Session::setStatus(ts('Welcome Email sent'), 'Success', 'success'); diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Form/AbstractDrupalInteractionTaskForm.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Form/AbstractDrupalInteractionTaskForm.php index 0997556e4af..d328fcbf322 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Form/AbstractDrupalInteractionTaskForm.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Form/AbstractDrupalInteractionTaskForm.php @@ -26,7 +26,7 @@ public function __construct( $method = 'post', $name = NULL ) { - $this->drupalUserService = Civi::container()->get('drupal_user_service'); + $this->drupalUserService = Civi::container()->get('civihr.cms.drupal_user_service'); parent::__construct($state, $action, $method, $name); } diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Disable/CustomGroupDisabler.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Disable/CustomGroupDisabler.php index f8c61048cec..bc2369c0dc8 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Disable/CustomGroupDisabler.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Hook/Disable/CustomGroupDisabler.php @@ -7,7 +7,7 @@ class CRM_HRCore_Hook_Disable_CustomGroupDisabler { */ public function handle() { $customGroups = ['Extended_Demographics']; - $switcher = Civi::container()->get('custom_group.status_switcher'); + $switcher = Civi::container()->get('civihr.custom_group_status_switcher'); foreach ($customGroups as $groupName) { $switcher->disable($groupName); diff --git a/uk.co.compucorp.civicrm.hrcore/api/v3/Job/CheckCivihrVersion.php b/uk.co.compucorp.civicrm.hrcore/api/v3/Job/CheckCivihrVersion.php index d1956223a66..22f3b99120a 100644 --- a/uk.co.compucorp.civicrm.hrcore/api/v3/Job/CheckCivihrVersion.php +++ b/uk.co.compucorp.civicrm.hrcore/api/v3/Job/CheckCivihrVersion.php @@ -7,8 +7,8 @@ */ function civicrm_api3_job_check_civihr_version() { $container = Civi::container(); - $currentStats = $container->get('civihr_stats_cache')->fetchCurrent(); - $container->get('civihr_stats_sender')->send($currentStats); + $currentStats = $container->get('civihr.stats_cache')->fetchCurrent(); + $container->get('civihr.stats_sender')->send($currentStats); return civicrm_api3_create_success(); } diff --git a/uk.co.compucorp.civicrm.hrcore/config/container/container.xml b/uk.co.compucorp.civicrm.hrcore/config/container/container.xml index 24c717b282a..3055b64c30b 100644 --- a/uk.co.compucorp.civicrm.hrcore/config/container/container.xml +++ b/uk.co.compucorp.civicrm.hrcore/config/container/container.xml @@ -3,49 +3,50 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - 10 + 10 - - - - + + + - - - + + + - %connection_timeout% + %civihr.connection_timeout% - + - - + + - + From aa453f0371795683ec147329bae61a7b23c5711a Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Thu, 17 May 2018 16:16:07 +0100 Subject: [PATCH 081/151] PCHR-3624: Revert changes to ethnicity default value --- .../xml/CustomGroups/extended_demographics_install.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml b/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml index 6e8f0fa1bc6..70839e1a49c 100755 --- a/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml +++ b/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml @@ -41,7 +41,7 @@ String Multi-Select - Not Applicable + :;:;:;Not Applicable:;:;:; 0 1 0 From 1438816149a97607c9d9e0e3b710035b0bfef944 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Fri, 27 Jul 2018 12:20:12 +0100 Subject: [PATCH 082/151] PCHR-4019: PR Feedback --- .../js/dist/absence-tab.min.js | 4 ++-- .../js/dist/admin-dashboard.min.js | 4 ++-- .../js/dist/manager-leave.min.js | 4 ++-- .../js/dist/my-leave.min.js | 2 +- .../shared/controllers/request.controller.js | 19 ++++++++++++------- .../controllers/request.controller.spec.js | 16 ++++++++++++++++ 6 files changed, 35 insertions(+), 14 deletions(-) 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 71d2fdd63f9..01014a33327 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,O(!0)})}function b(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(B(),E(),O())})}function g(e){W.injectMonth=!0,U("injected").then(function(){O(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 S(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&f(),M(),E(),L("month")}function k(e){var t="previous"===e?"subtract":"add";B(n(W.selectedMonth.moment)[t](1,"month")),E(),L("month")}function L(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 O(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=S,W.paginateMonth=k,W.refresh=L,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:k()},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)&&L()}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!==k().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/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(n){w=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===S.leaveRequest.request_type?i.open(y(n)):v(n)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(t){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(S.leaveRequest.from_date):"2"===a)}function v(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){T(n)}}):y(n)})}})}function b(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return I===S.leaveRequest.contact_id}function _(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function y(e){var n=L[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return m.get().then(function(e){I=e.contactId})}function C(e,n){e.stopPropagation(),r.openModal(n)}function T(e){r.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function A(n){var t=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;w===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:S.leaveRequest})}function D(){var n=S.leaveRequestStatuses[S.leaveRequest.status_id].name,t=e.compact(e.map(L,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!h(n)&&e.pull(t,"cancel"),"admin"!==S.role&&e.pull(t,"delete"),"staff"===S.role&&e.pull(t,"approve","reject"),"staff"!==S.role&&R(t),p()&&t.push("delete"),S.allowedActions=e.map(t,function(e){return{key:e,label:L[e].label,isDirectAction:L[e].isDirectAction}})}function P(){return b().then(function(e){e&&(S.role="admin")})}function R(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,w,S=this,k=l.statusNames,L={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"}}},O={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=f,S.openLeavePopup=C,function(){a.resolve().then(_).then(q).then(function(){return g()&&P()}).then(D).finally(function(){S.loading.component=!1})}()}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(){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(),k("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,k("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 S(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function k(e){return ne.selectedAbsenceType.calculation_unit_name===e}function L(e){return ne.request.request_type===e}function O(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")&&(L("sickness")||k("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),(k("hours")||L("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=k,ne.isLeaveType=L,ne.isNotWorkingDay=O,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(S).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 S.fileUploader&&S.fileUploader.queue.length>0}function m(){return S.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return S.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||S.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=D,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=m,S.formatDateTime=f,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",S),g(),a.all([T(),q()]).then(_).finally(function(){S.filesLoaded=!0})}(),S}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 S(){return t.all(Object.values(G.sections).filter(function(e){return e.open}).map(M))}function k(){return w("other",{status_id:{in:[H(m.statusNames.rejected),H(m.statusNames.cancelled)]}})}function L(){return w("pending",{status_id:{in:[H(m.statusNames.awaitingApproval),H(m.statusNames.moreInformationRequired)]}})}function O(){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([S(),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:O},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k}},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),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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function D(){["from","to"].forEach(A)}function P(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;Me.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function R(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function w(){return!Fe.loading.entitlements&&(!!ue("admin")||!re("view")&&!(ue("manager")&&!re("create")))}function S(){var e=R();return Fe.isMode("edit")&&(e=e&&(G()||I())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function k(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function L(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==j())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return T.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function O(){return"toil"!==j()&&!Fe.request.change_balance}function M(){Fe.errors=[]}function x(){return Fe.request.create().then(Pe).then(function(){be("LeaveRequest::new")})}function $(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return t.map(Le[e],function(e){return Fe.requestStatuses[e]})}function j(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function W(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?U():N("none")}function H(e){return t.find(Fe.requestStatuses,function(n){return n.value===e})}function Y(e){Fe.errors=t.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function G(){return!e.equals(Me,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function V(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?o.resolve().then(de).then(me).then(_e).then(qe).then(ae).then(X).then(Fe.isMode("edit")?Ce:t.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==$e)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];Le.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],Le.awaiting_approval=e,Le.more_information_required=e,Le.rejected=e,Le.approved=e,Le.cancelled=[y.statusNames.awaitingApproval].concat(e)}function X(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):o.resolve()}function Q(){var e="my-leave"===s.section,n=+ke.id==+t.get(Fe,"leaveRequest.contact_id"),a=!t.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(n||a)}function J(){xe.push(s.$on("LeaveRequestPopup::requestObjectUpdated",Ce),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(_e).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,n){Y(n)}),s.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),i.$on("$destroy",Re),i.$on("LeaveRequestPopup::addTab",function(e,n){Be.push(n)})}function K(){var e,n;Fe.request=Fe.leaveRequest||null,e=j(),n=Fe.initRequestAttributes(),"leave"===e?Fe.request=_.init(n):"sickness"===e?Fe.request=q.init(n):"toil"===e&&(Fe.request=C.init(n))}function Z(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:ke.id}),e}function ee(){return Ee="staff",(Fe.isSelfRecord?ne():te()).finally(function(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")})}function ne(){return ke.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Fe.isSelfLeaveApprover=!0)})}function te(){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 ae(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!t.includes(["cancelled","rejected"],H(Fe.request.status_id).name)}function se(e){var n=Fe.getStatusFromValue(Fe.request.status_id);return!!n&&n.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function re(e){return Fe.mode===e}function ce(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 ue(e){return Ee===e}function le(){return h.all().then(function(e){Fe.absencePeriods=e})}function de(){return v.all(F()).then(v.loadCalculationUnits).then(function(e){Se={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Fe.loading.entitlements=!0,b.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Se.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function fe(){return f.getLoggedIn().then(function(e){ke=e})}function pe(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=t.remove(e.list,function(e){return e.id!==ke.id})}):ke.leaveManagees().then(function(e){Fe.managedContacts=e})}function he(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.requestStatuses=t.indexBy(e,"name")})}function ve(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 be(e){P(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ge(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Me[e+"_date"]})}function _e(e){if(Fe.absenceTypes=ve(Se.types,e),!Fe.absenceTypes.length)return o.reject($e)}function ye(){Fe.period=t.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=t.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Me=e.copy(Fe.request.attributes())}function Te(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,k(),D(),Fe.request.isValid().then(oe()&&L).then($).then(O()&&ge).then(De).then(function(){return Fe.isMode("edit")?we():x()}).catch(function(n){Fe.request.status_id=e,n&&Y(n)}).finally(function(){Fe.submitting=!1})}function De(){return o.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&t.push(e),++a===Oe&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Oe>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function Re(){xe.forEach(function(e){e()})}function Ie(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function we(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?be("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&be("LeaveRequest::edit")})}n.debug("RequestCtrl");var Se,ke,Le={},Oe=0,Me={},xe=[],$e="No entitlement",Ee="",Be=[],Fe=t.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=w,Fe.canSubmit=S,Fe.closeAlert=M,Fe.deleteLeaveRequest=E,Fe.dismissModal=B,Fe.getStatuses=W,Fe.getStatusFromValue=H,Fe.initAfterContactSelection=V,Fe.initRequestAttributes=Z,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=re,Fe.isRole=ue,Fe.submit=Ae,Fe.updateAbsenceType=Ie,function(){Fe.loading.absenceTypes=!0,z(),J(),fe().then(Q).then(function(){return o.all([ee(),le(),he()])}).then(K).then(Te).then(ye).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&pe()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(Y).finally(function(){Fe.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(){}); +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([S(),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:O},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k}},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),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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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/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"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function A(){["from","to"].forEach(T)}function D(){var e=Fe.requestStatuses[_.statusNames.awaitingApproval].value;Me.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function R(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return!Fe.loading.entitlements&&(!!ue("admin")||!re("view")&&!(ue("manager")&&!re("create")))}function w(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||R())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function S(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[_.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function k(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==N())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function L(){return"toil"!==N()&&!Fe.request.change_balance}function O(){Fe.errors=[]}function M(){return Fe.request.create().then(Pe).then(function(){be("LeaveRequest::new")})}function x(){oe()&&!Fe.isRole("staff")&&(Fe.request.change_balance=!0)}function $(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.request)})}})}function E(){r.dismiss({$value:"cancel"})}function B(){var e=N();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function F(){return U(Fe.getStatusFromValue(Fe.request.status_id).name)}function U(e){return t.map(Le[e],function(e){return Fe.requestStatuses[e]})}function N(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function j(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():U("none")}function W(e){return t.find(Fe.requestStatuses,function(n){return n.value===e})}function H(e){Fe.errors=t.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(Me,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?o.resolve().then(de).then(me).then(_e).then(qe).then(ae).then(X).then(Fe.isMode("edit")?Ce:t.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==$e)return o.reject(e)}):o.reject("The contact id was not set")}function V(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];Le.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Le.awaiting_approval=e,Le.more_information_required=e,Le.rejected=e,Le.approved=e,Le.cancelled=[_.statusNames.awaitingApproval].concat(e)}function z(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function X(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):o.resolve()}function Q(){var e="my-leave"===s.section,n=+ke.id==+t.get(Fe,"leaveRequest.contact_id"),a=!t.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(n||a)}function J(){xe.push(s.$on("LeaveRequestPopup::requestObjectUpdated",Ce),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(_e).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,n){H(n)}),s.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),i.$on("$destroy",Re),i.$on("LeaveRequestPopup::addTab",function(e,n){Be.push(n)})}function K(){var e,n;Fe.request=Fe.leaveRequest||null,e=N(),n=Fe.initRequestAttributes(),"leave"===e?Fe.request=g.init(n):"sickness"===e?Fe.request=y.init(n):"toil"===e&&(Fe.request=q.init(n))}function Z(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:ke.id}),e}function ee(){return Ee="staff",Fe.isSelfRecord?ne():te()}function ne(){return ke.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Fe.isSelfLeaveApprover=!0)})}function te(){return c(_.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&c(_.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[_.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[_.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!t.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var n=Fe.getStatusFromValue(Fe.request.status_id);return!!n&&n.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function re(e){return Fe.mode===e}function ce(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 ue(e){return Ee===e}function le(){return p.all().then(function(e){Fe.absencePeriods=e})}function de(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Se={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Se.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function fe(){return f.getLoggedIn().then(function(e){ke=e})}function pe(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=t.remove(e.list,function(e){return e.id!==ke.id})}):ke.leaveManagees().then(function(e){Fe.managedContacts=e})}function he(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.requestStatuses=t.indexBy(e,"name")})}function ve(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 be(e){D(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ge(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Me[e+"_date"]})}function _e(e){if(Fe.absenceTypes=ve(Se.types,e),!Fe.absenceTypes.length)return o.reject($e)}function ye(){Fe.period=t.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=t.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Me=e.copy(Fe.request.attributes())}function Te(){var e;Fe.request.id?(e=[Fe.requestStatuses[_.statusNames.approved].value,Fe.requestStatuses[_.statusNames.adminApproved].value,Fe.requestStatuses[_.statusNames.rejected].value,Fe.requestStatuses[_.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,S(),A(),Fe.request.isValid().then(oe()&&k).then(x).then(L()&&ge).then(De).then(function(){return Fe.isMode("edit")?we():M()}).catch(function(n){Fe.request.status_id=e,n&&H(n)}).finally(function(){Fe.submitting=!1})}function De(){return o.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&t.push(e),++a===Oe&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Oe>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function Re(){xe.forEach(function(e){e()})}function Ie(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function we(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?be("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&be("LeaveRequest::edit")})}n.debug("RequestCtrl");var Se,ke,Le={},Oe=0,Me={},xe=[],$e="No entitlement",Ee="",Be=[],Fe=t.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=I,Fe.canSubmit=w,Fe.closeAlert=O,Fe.deleteLeaveRequest=$,Fe.dismissModal=E,Fe.getStatuses=j,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=Z,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=re,Fe.isRole=ue,Fe.submit=Ae,Fe.updateAbsenceType=Ie,function(){Fe.loading.absenceTypes=!0,V(),J(),fe().then(Q).then(function(){return o.all([ee(),le(),he()])}).then(z).then(K).then(Te).then(ye).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&pe()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(H).finally(function(){Fe.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){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(){}); //# 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 d2da8882dcd..6099737a491 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 @@ -9,6 +9,6 @@ !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 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){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=L[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),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!==B?(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 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 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 O(e,t){return{relative:S(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=R(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 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=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 x(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;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(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,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(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(),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&&x).then("contacts"===t&&A).then("month"===t&&E).then(function(){g("contacts"===t)})}function k(e){o.$emit("LeaveCalendar::showMonth",!!e)}function L(){j(t())}function x(){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=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 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 x(){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=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(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=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/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,r,o,s,i,u,c,l,d,f){function m(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=O[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[k[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(O,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},k={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return g()&&T()}).then(w).finally(function(){R.loading.component=!1})}()}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,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 x()}).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 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 O(e){return te.request.request_type===e}function k(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 x(){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(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: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=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([x(),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),g(),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 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(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:M(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 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 x(e){var t=[_(i.statusNames.moreInformationRequired),_(i.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function M(e){var t=U.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&&(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(),S(),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),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 $(){["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){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 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=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(){R("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=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 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 S(){return l(),k(),B()}function R(){return x(),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 L(){N=e.cloneDeep(u.request.attributes())}function x(){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(),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=M,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=I,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){L(),x(),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"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function w(){["from","to"].forEach(A)}function T(){var e=Be.requestStatuses[_.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Be.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function R(){var e=P();return Be.isMode("edit")&&(e=e&&(Y()||D())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function I(){Be.isSelfRecord&&!Be.isSelfLeaveApprover?Be.request.status_id=Be.requestStatuses[_.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function O(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==U())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function k(){return"toil"!==U()&&!Be.request.change_balance}function L(){Be.errors=[]}function x(){return Be.request.create().then(Te).then(function(){be("LeaveRequest::new")})}function M(){re()&&!Be.isRole("staff")&&(Be.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 Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.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(Be.getStatusFromValue(Be.request.status_id).name)}function N(e){return n.map(Oe[e],function(e){return Be.requestStatuses[e]})}function U(){return Be.request?Be.request.request_type:Be.leaveType||null}function H(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?F():N("none")}function W(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function V(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function Y(){return!e.equals(Le,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function G(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?r.resolve().then(de).then(fe).then(ye).then(qe).then(ae).then(X).then(Be.isMode("edit")?$e:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return r.reject(e)}):r.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(){return Be.canManage?m.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function K(){xe.push(o.$on("LeaveRequestPopup::requestObjectUpdated",$e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function Q(){var e,t;Be.request=Be.leaveRequest||null,e=U(),t=Be.initRequestAttributes(),"leave"===e?Be.request=y.init(t):"sickness"===e?Be.request=q.init(t):"toil"===e&&(Be.request=$.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:Ie.id}),e}function ee(){return Ee="staff",(Be.isSelfRecord?te():ne()).finally(function(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")})}function te(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Be.isSelfLeaveApprover=!0)})}function ne(){return u(_.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(_.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[_.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[_.statusNames.approved].value)}function re(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],W(Be.request.status_id).name)}function oe(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function se(e){return Be.request&&Be.request.request_type===e}function ie(e){return Be.mode===e}function ue(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 ce(e){return Ee===e}function le(){return h.all().then(function(e){Be.absencePeriods=e})}function de(){return v.all(B()).then(v.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Be.loading.entitlements=!0,b.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Re.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function me(){return m.getLoggedIn().then(function(e){Ie=e})}function pe(){return Be.selectedContactId?m.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?m.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Be.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.requestStatuses=n.indexBy(e,"name")})}function ve(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 be(e){T(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function ge(){ -["from","to"].forEach(function(e){Be.request[e+"_date"]=Le[e+"_date"]})}function ye(e){if(Be.absenceTypes=ve(Re.types,e),!Be.absenceTypes.length)return r.reject(Me)}function _e(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ue(Be.request,e)})}function qe(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function $e(){Le=e.copy(Be.request.attributes())}function Ce(){var e;Be.request.id?(e=[Be.requestStatuses[_.statusNames.approved].value,Be.requestStatuses[_.statusNames.adminApproved].value,Be.requestStatuses[_.statusNames.rejected].value,Be.requestStatuses[_.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function Ae(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,I(),w(),Be.request.isValid().then(re()&&O).then(M).then(k()&&ge).then(we).then(function(){return Be.isMode("edit")?Se():x()}).catch(function(t){Be.request.status_id=e,t&&V(t)}).finally(function(){Be.submitting=!1})}function we(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){xe.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Be.request.update().then(Te).then(function(){Be.isRole("manager")?be("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Ie,Oe={},ke=0,Le={},xe=[],Me="No entitlement",Ee="",je=[],Be=n.assign(this,f);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.loading={absenceTypes:!0,entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=S,Be.canSubmit=R,Be.closeAlert=L,Be.deleteLeaveRequest=E,Be.dismissModal=j,Be.getStatuses=H,Be.getStatusFromValue=W,Be.initAfterContactSelection=G,Be.initRequestAttributes=Z,Be.isLeaveStatus=oe,Be.isLeaveType=se,Be.isMode=ie,Be.isRole=ce,Be.submit=Ae,Be.updateAbsenceType=De,function(){Be.loading.absenceTypes=!0,z(),K(),me().then(J).then(function(){return r.all([ee(),le(),he()])}).then(Q).then(Ce).then(_e).then(function(){return Be.canManage&&!Be.isMode("edit")&&pe()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(V).finally(function(){Be.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(){}); +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 S(){return l(),k(),B()}function R(){return x(),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 L(){N=e.cloneDeep(u.request.attributes())}function x(){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(),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=M,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=I,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){L(),x(),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/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,$){function C(e){"days"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function A(){["from","to"].forEach(C)}function w(){var e=Be.requestStatuses[y.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function T(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function P(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return!Be.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function S(){var e=T();return Be.isMode("edit")&&(e=e&&(V()||P())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function R(){Be.isSelfRecord&&!Be.isSelfLeaveApprover?Be.request.status_id=Be.requestStatuses[y.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function I(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==N())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return $.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==N()&&!Be.request.change_balance}function k(){Be.errors=[]}function L(){return Be.request.create().then(Te).then(function(){be("LeaveRequest::new")})}function x(){re()&&!Be.isRole("staff")&&(Be.request.change_balance=!0)}function M(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.request)})}})}function E(){i.dismiss({$value:"cancel"})}function j(){var e=N();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function B(){return F(Be.getStatusFromValue(Be.request.status_id).name)}function F(e){return n.map(Oe[e],function(e){return Be.requestStatuses[e]})}function N(){return Be.request?Be.request.request_type:Be.leaveType||null}function U(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?B():F("none")}function H(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function W(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function V(){return!e.equals(Le,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function Y(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?r.resolve().then(de).then(fe).then(ye).then(qe).then(ae).then(X).then(Be.isMode("edit")?$e:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return r.reject(e)}):r.reject("The contact id was not set")}function G(){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 z(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")}function X(){return Be.canManage?m.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function K(){xe.push(o.$on("LeaveRequestPopup::requestObjectUpdated",$e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){W(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function Q(){var e,t;Be.request=Be.leaveRequest||null,e=N(),t=Be.initRequestAttributes(),"leave"===e?Be.request=g.init(t):"sickness"===e?Be.request=_.init(t):"toil"===e&&(Be.request=q.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:Ie.id}),e}function ee(){return Ee="staff",Be.isSelfRecord?te():ne()}function te(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Be.isSelfLeaveApprover=!0)})}function ne(){return u(y.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(y.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[y.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[y.statusNames.approved].value)}function re(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],H(Be.request.status_id).name)}function oe(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function se(e){return Be.request&&Be.request.request_type===e}function ie(e){return Be.mode===e}function ue(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 ce(e){return Ee===e}function le(){return p.all().then(function(e){Be.absencePeriods=e})}function de(){return h.all(j()).then(h.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Be.loading.entitlements=!0,v.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Re.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function me(){return m.getLoggedIn().then(function(e){Ie=e})}function pe(){return Be.selectedContactId?m.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?m.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Be.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.requestStatuses=n.indexBy(e,"name")})}function ve(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 be(e){w(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function ge(){["from","to"].forEach(function(e){Be.request[e+"_date"]=Le[e+"_date"]}) +}function ye(e){if(Be.absenceTypes=ve(Re.types,e),!Be.absenceTypes.length)return r.reject(Me)}function _e(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ue(Be.request,e)})}function qe(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function $e(){Le=e.copy(Be.request.attributes())}function Ce(){var e;Be.request.id?(e=[Be.requestStatuses[y.statusNames.approved].value,Be.requestStatuses[y.statusNames.adminApproved].value,Be.requestStatuses[y.statusNames.rejected].value,Be.requestStatuses[y.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function Ae(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,R(),A(),Be.request.isValid().then(re()&&I).then(x).then(O()&&ge).then(we).then(function(){return Be.isMode("edit")?Se():L()}).catch(function(t){Be.request.status_id=e,t&&W(t)}).finally(function(){Be.submitting=!1})}function we(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){xe.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Be.request.update().then(Te).then(function(){Be.isRole("manager")?be("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Ie,Oe={},ke=0,Le={},xe=[],Me="No entitlement",Ee="",je=[],Be=n.assign(this,f);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.isSelfLeaveApprover=!1,Be.loading={absenceTypes:!0,entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=D,Be.canSubmit=S,Be.closeAlert=k,Be.deleteLeaveRequest=M,Be.dismissModal=E,Be.getStatuses=U,Be.getStatusFromValue=H,Be.initAfterContactSelection=Y,Be.initRequestAttributes=Z,Be.isLeaveStatus=oe,Be.isLeaveType=se,Be.isMode=ie,Be.isRole=ce,Be.submit=Ae,Be.updateAbsenceType=De,function(){Be.loading.absenceTypes=!0,G(),K(),me().then(J).then(function(){return r.all([ee(),le(),he()])}).then(z).then(Q).then(Ce).then(_e).then(function(){return Be.canManage&&!Be.isMode("edit")&&pe()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(W).finally(function(){Be.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$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,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(){}); //# 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 3f455ecc634..44317aff2c9 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 @@ -9,6 +9,6 @@ !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=x[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 L(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 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=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 k(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 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,L(!0)})}function g(){o.$new().$watch(function(){return H.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(B(),E(),L())})}function b(e){H.injectMonth=!0,F("injected").then(function(){L(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 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(),x(),E(),I("month")}function O(e){var n="previous"===e?"subtract":"add";B(t(H.selectedMonth.moment)[n](1,"month")),E(),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&&E).then(function(){b("contacts"===t)})}function L(e){o.$emit("LeaveCalendar::showMonth",!!e)}function x(){B(t())}function M(){B(H.months[0].moment)}function k(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(){k("previous"),k("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(),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: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 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 k(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 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=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/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,r,o,s,i,u,c,l,d,f){function m(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([O.awaitingApproval,O.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function g(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function b(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=I[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[L[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(I,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:I[e].label,isDirectAction:I[e].isDirectAction}})}function T(){return g().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,O=l.statusNames,I={edit:{label:"Edit",allowedStatuses:[O.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[O.moreInformationRequired]},view:{label:"View",allowedStatuses:[O.approved,O.rejected,O.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.approved,O.rejected,O.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.moreInformationRequired,O.approved,O.rejected,O.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},L={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return b()&&T()}).then(w).finally(function(){R.loading.component=!1})}()}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,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 E();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(w).finally(_)}function g(){return G(),E()}function b(){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,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?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 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 L(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 k(){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 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(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:k},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=L,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(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:x(),managed_by:U.isAdmin&&"me"!==n.assignedTo.type?void 0:U.contactId,status_id:k(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 L(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 k(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 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=L,U.refresh=E,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){ -L[e]=t,f(e,t),n&&"from"===e&&f("to",t)}).catch(function(t){return L[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=L[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 L={};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(),L())})})}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(),L(),j()}function R(){return M(),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time),l(),U?U=!1:L(),j()}function O(e){u.uiOptions.times[e].time=""}function I(){u.request.toil_to_accrue=u.uiOptions.toil_duration_in_hours}function L(){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 k(){u.setRequestDateTimesAndDateTypes(),l(),L(),u.isCalculationUnit("hours")?I():u.request.toil_to_accrue=null}function E(){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=k,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=O,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){x(),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"===je.selectedAbsenceType.calculation_unit_name?delete je.request[e+"_date_amount"]:delete je.request[e+"_date_type"]}function w(){["from","to"].forEach(A)}function T(){var e=je.requestStatuses[_.statusNames.awaitingApproval].value;xe.status_id===e&&e!==je.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!je.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function R(){var e=P();return je.isMode("edit")&&(e=e&&(Y()||D())),je.canManage&&je.requestStatuses&&(e=e&&!!je.getStatusFromValue(je.newStatusOnSave)),(e=e&&!!je.period.id)&&!je.isMode("view")}function O(){je.isSelfRecord&&!je.isSelfLeaveApprover?je.request.status_id=je.requestStatuses[_.statusNames.awaitingApproval].value:je.canManage&&(je.request.status_id=je.newStatusOnSave||je.request.status_id)}function I(){if(je.isMode("edit")&&!je.isRole("staff")&&"toil"!==U())return je.request.calculateBalanceChange(je.selectedAbsenceType.calculation_unit_name).then(function(e){if(+je.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function L(){return"toil"!==U()&&!je.request.change_balance}function x(){je.errors=[]}function M(){return je.request.create().then(Te).then(function(){ge("LeaveRequest::new")})}function k(){re()&&!je.isRole("staff")&&(je.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 je.request.delete().then(function(){je.dismissModal(),d.publish("LeaveRequest::delete",je.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(je.getStatusFromValue(je.request.status_id).name)}function N(e){return n.map(Ie[e],function(e){return je.requestStatuses[e]})}function U(){return je.request?je.request.request_type:je.leaveType||null}function H(){return!je.request||e.equals({},je.requestStatuses)?[]:je.request.status_id?F():N("none")}function W(e){return n.find(je.requestStatuses,function(t){return t.value===e})}function V(e){je.errors=n.isArray(e)?e:[e],je.loading.absenceTypes=!1,je.submitting=!1}function Y(){return!e.equals(xe,je.request.attributes())||je.canManage&&je.newStatusOnSave}function G(){return je.postContactSelection=!0,je.staffMemberSelectionComplete=!1,je.request.contact_id?r.resolve().then(de).then(fe).then(ye).then(qe).then(ae).then(X).then(je.isMode("edit")?$e:n.noop).then(function(){je.postContactSelection=!1,je.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];Ie.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Ie.awaiting_approval=e,Ie.more_information_required=e,Ie.rejected=e,Ie.approved=e,Ie.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){return je.canManage?m.find(je.request.contact_id).then(function(e){je.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Oe.id==+n.get(je,"leaveRequest.contact_id"),a=!n.get(je,"leaveRequest.id");je.isSelfRecord=e&&(t||a)}function K(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",$e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",je.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Le++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function Q(){var e,t;je.request=je.leaveRequest||null,e=U(),t=je.initRequestAttributes(),"leave"===e?je.request=y.init(t):"sickness"===e?je.request=q.init(t):"toil"===e&&(je.request=$.init(t))}function Z(){var e={};return je.request?e=je.request.attributes():je.canManage||(e={contact_id:Oe.id}),e}function ee(){return Ee="staff",(je.isSelfRecord?te():ne()).finally(function(){je.canManage=je.isRole("manager")||je.isRole("admin")})}function te(){return Oe.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",je.isSelfLeaveApprover=!0)})}function ne(){return u(_.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(_.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){je.defaultStatus?je.newStatusOnSave=je.requestStatuses[_.statusNames[je.defaultStatus]].value:(je.isRole("admin")||je.isMode("create")&&je.isRole("manager"))&&(je.newStatusOnSave=je.requestStatuses[_.statusNames.approved].value)}function re(){return!je.request.status_id||!n.includes(["cancelled","rejected"],W(je.request.status_id).name)}function oe(e){var t=je.getStatusFromValue(je.request.status_id);return!!t&&t.name===e}function se(e){return je.request&&je.request.request_type===e}function ie(e){return je.mode===e}function ue(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 ce(e){return Ee===e}function le(){return h.all().then(function(e){je.absencePeriods=e})}function de(){return v.all(j()).then(v.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return je.loading.entitlements=!0,g.all({contact_id:je.request.contact_id,period_id:je.period.id,type_id:{IN:Re.ids}},!0).finally(function(){je.loading.entitlements=!1})}function me(){return m.getLoggedIn().then(function(e){Oe=e})}function pe(){return je.selectedContactId?m.find(je.selectedContactId).then(function(e){je.managedContacts=[e]}):je.isRole("admin")?m.all().then(function(e){je.managedContacts=n.remove(e.list,function(e){return e.id!==Oe.id})}):Oe.leaveManagees().then(function(e){je.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){je.requestStatuses=n.indexBy(e,"name")})}function ve(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){T(),d.publish(e,je.request),je.errors=[],je.dismissModal()}function be(){["from","to"].forEach(function(e){je.request[e+"_date"]=xe[e+"_date"]})}function ye(e){if(je.absenceTypes=ve(Re.types,e), -!je.absenceTypes.length)return r.reject(ke)}function _e(){je.period=n.find(je.absencePeriods,function(e){return je.isMode("create")?e.current:ue(je.request,e)})}function qe(){je.isMode("create")?(je.selectedAbsenceType=je.absenceTypes[0],je.request.type_id=je.selectedAbsenceType.id):je.selectedAbsenceType=n.find(je.absenceTypes,function(e){return e.id===je.request.type_id})}function $e(){xe=e.copy(je.request.attributes())}function Ce(){var e;je.request.id?(e=[je.requestStatuses[_.statusNames.approved].value,je.requestStatuses[_.statusNames.adminApproved].value,je.requestStatuses[_.statusNames.rejected].value,je.requestStatuses[_.statusNames.cancelled].value],je.mode="edit",je.isRole("staff")&&e.indexOf(je.request.status_id)>-1&&(je.mode="view")):je.mode="create"}function Ae(){var e=je.request.status_id;if(!je.isMode("view")&&!je.submitting)return je.submitting=!0,O(),w(),je.request.isValid().then(re()&&I).then(k).then(L()&&be).then(we).then(function(){return je.isMode("edit")?Se():M()}).catch(function(t){je.request.status_id=e,t&&V(t)}).finally(function(){je.submitting=!1})}function we(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===Le&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Le>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){Me.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return je.request.update().then(Te).then(function(){je.isRole("manager")?ge("LeaveRequest::updatedByManager"):(je.isRole("staff")||je.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Oe,Ie={},Le=0,xe={},Me=[],ke="No entitlement",Ee="",Be=[],je=n.assign(this,f);je.absencePeriods=[],je.absenceTypes=[],je.canManage=!1,je.contactName=null,je.errors=[],je.loading={absenceTypes:!0,entitlements:!0},je.managedContacts=[],je.mode="",je.newStatusOnSave=null,je.period={},je.postContactSelection=!1,je.requestStatuses={},je.selectedAbsenceType={},je.staffMemberSelectionComplete=!1,je.submitting=!1,je.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},je.canChangeAbsenceType=S,je.canSubmit=R,je.closeAlert=x,je.deleteLeaveRequest=E,je.dismissModal=B,je.getStatuses=H,je.getStatusFromValue=W,je.initAfterContactSelection=G,je.initRequestAttributes=Z,je.isLeaveStatus=oe,je.isLeaveType=se,je.isMode=ie,je.isRole=ce,je.submit=Ae,je.updateAbsenceType=De,function(){je.loading.absenceTypes=!0,z(),K(),me().then(J).then(function(){return r.all([ee(),le(),he()])}).then(Q).then(Ce).then(_e).then(function(){return je.canManage&&!je.isMode("edit")&&pe()}).then(function(){if(je.selectedContactId&&(je.request.contact_id=je.selectedContactId),je.request.contact_id)return je.initAfterContactSelection()}).catch(V).finally(function(){je.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(){}); +L[e]=t,f(e,t),n&&"from"===e&&f("to",t)}).catch(function(t){return L[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=L[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 L={};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(),L())})})}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(),L(),j()}function R(){return M(),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time),l(),U?U=!1:L(),j()}function O(e){u.uiOptions.times[e].time=""}function I(){u.request.toil_to_accrue=u.uiOptions.toil_duration_in_hours}function L(){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 k(){u.setRequestDateTimesAndDateTypes(),l(),L(),u.isCalculationUnit("hours")?I():u.request.toil_to_accrue=null}function E(){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=k,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=O,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){x(),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/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,$){function C(e){"days"===je.selectedAbsenceType.calculation_unit_name?delete je.request[e+"_date_amount"]:delete je.request[e+"_date_type"]}function A(){["from","to"].forEach(C)}function w(){var e=je.requestStatuses[y.statusNames.awaitingApproval].value;xe.status_id===e&&e!==je.request.status_id&&d.publish("ManagerBadge:: Update Count")}function T(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function P(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return!je.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function S(){var e=T();return je.isMode("edit")&&(e=e&&(V()||P())),je.canManage&&je.requestStatuses&&(e=e&&!!je.getStatusFromValue(je.newStatusOnSave)),(e=e&&!!je.period.id)&&!je.isMode("view")}function R(){je.isSelfRecord&&!je.isSelfLeaveApprover?je.request.status_id=je.requestStatuses[y.statusNames.awaitingApproval].value:je.canManage&&(je.request.status_id=je.newStatusOnSave||je.request.status_id)}function O(){if(je.isMode("edit")&&!je.isRole("staff")&&"toil"!==N())return je.request.calculateBalanceChange(je.selectedAbsenceType.calculation_unit_name).then(function(e){if(+je.balance.change.amount!=+e.amount)return $.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function I(){return"toil"!==N()&&!je.request.change_balance}function L(){je.errors=[]}function x(){return je.request.create().then(Te).then(function(){ge("LeaveRequest::new")})}function M(){re()&&!je.isRole("staff")&&(je.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 je.request.delete().then(function(){je.dismissModal(),d.publish("LeaveRequest::delete",je.request)})}})}function E(){i.dismiss({$value:"cancel"})}function B(){var e=N();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function j(){return F(je.getStatusFromValue(je.request.status_id).name)}function F(e){return n.map(Ie[e],function(e){return je.requestStatuses[e]})}function N(){return je.request?je.request.request_type:je.leaveType||null}function U(){return!je.request||e.equals({},je.requestStatuses)?[]:je.request.status_id?j():F("none")}function H(e){return n.find(je.requestStatuses,function(t){return t.value===e})}function W(e){je.errors=n.isArray(e)?e:[e],je.loading.absenceTypes=!1,je.submitting=!1}function V(){return!e.equals(xe,je.request.attributes())||je.canManage&&je.newStatusOnSave}function Y(){return je.postContactSelection=!0,je.staffMemberSelectionComplete=!1,je.request.contact_id?r.resolve().then(de).then(fe).then(ye).then(qe).then(ae).then(X).then(je.isMode("edit")?$e:n.noop).then(function(){je.postContactSelection=!1,je.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==ke)return r.reject(e)}):r.reject("The contact id was not set")}function G(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];Ie.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],Ie.awaiting_approval=e,Ie.more_information_required=e,Ie.rejected=e,Ie.approved=e,Ie.cancelled=[y.statusNames.awaitingApproval].concat(e)}function z(){je.canManage=je.isRole("manager")||je.isRole("admin")}function X(){return je.canManage?m.find(je.request.contact_id).then(function(e){je.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Oe.id==+n.get(je,"leaveRequest.contact_id"),a=!n.get(je,"leaveRequest.id");je.isSelfRecord=e&&(t||a)}function K(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",$e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",je.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){W(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Le++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function Q(){var e,t;je.request=je.leaveRequest||null,e=N(),t=je.initRequestAttributes(),"leave"===e?je.request=b.init(t):"sickness"===e?je.request=_.init(t):"toil"===e&&(je.request=q.init(t))}function Z(){var e={};return je.request?e=je.request.attributes():je.canManage||(e={contact_id:Oe.id}),e}function ee(){return Ee="staff",je.isSelfRecord?te():ne()}function te(){return Oe.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",je.isSelfLeaveApprover=!0)})}function ne(){return u(y.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(y.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){je.defaultStatus?je.newStatusOnSave=je.requestStatuses[y.statusNames[je.defaultStatus]].value:(je.isRole("admin")||je.isMode("create")&&je.isRole("manager"))&&(je.newStatusOnSave=je.requestStatuses[y.statusNames.approved].value)}function re(){return!je.request.status_id||!n.includes(["cancelled","rejected"],H(je.request.status_id).name)}function oe(e){var t=je.getStatusFromValue(je.request.status_id);return!!t&&t.name===e}function se(e){return je.request&&je.request.request_type===e}function ie(e){return je.mode===e}function ue(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 ce(e){return Ee===e}function le(){return p.all().then(function(e){je.absencePeriods=e})}function de(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return je.loading.entitlements=!0,v.all({contact_id:je.request.contact_id,period_id:je.period.id,type_id:{IN:Re.ids}},!0).finally(function(){je.loading.entitlements=!1})}function me(){return m.getLoggedIn().then(function(e){Oe=e})}function pe(){return je.selectedContactId?m.find(je.selectedContactId).then(function(e){je.managedContacts=[e]}):je.isRole("admin")?m.all().then(function(e){je.managedContacts=n.remove(e.list,function(e){return e.id!==Oe.id})}):Oe.leaveManagees().then(function(e){je.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){je.requestStatuses=n.indexBy(e,"name")})}function ve(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){w(),d.publish(e,je.request),je.errors=[],je.dismissModal()}function be(){["from","to"].forEach(function(e){je.request[e+"_date"]=xe[e+"_date"]})}function ye(e){if(je.absenceTypes=ve(Re.types,e),!je.absenceTypes.length)return r.reject(ke)}function _e(){ +je.period=n.find(je.absencePeriods,function(e){return je.isMode("create")?e.current:ue(je.request,e)})}function qe(){je.isMode("create")?(je.selectedAbsenceType=je.absenceTypes[0],je.request.type_id=je.selectedAbsenceType.id):je.selectedAbsenceType=n.find(je.absenceTypes,function(e){return e.id===je.request.type_id})}function $e(){xe=e.copy(je.request.attributes())}function Ce(){var e;je.request.id?(e=[je.requestStatuses[y.statusNames.approved].value,je.requestStatuses[y.statusNames.adminApproved].value,je.requestStatuses[y.statusNames.rejected].value,je.requestStatuses[y.statusNames.cancelled].value],je.mode="edit",je.isRole("staff")&&e.indexOf(je.request.status_id)>-1&&(je.mode="view")):je.mode="create"}function Ae(){var e=je.request.status_id;if(!je.isMode("view")&&!je.submitting)return je.submitting=!0,R(),A(),je.request.isValid().then(re()&&O).then(M).then(I()&&be).then(we).then(function(){return je.isMode("edit")?Se():x()}).catch(function(t){je.request.status_id=e,t&&W(t)}).finally(function(){je.submitting=!1})}function we(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===Le&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Le>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){Me.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return je.request.update().then(Te).then(function(){je.isRole("manager")?ge("LeaveRequest::updatedByManager"):(je.isRole("staff")||je.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Oe,Ie={},Le=0,xe={},Me=[],ke="No entitlement",Ee="",Be=[],je=n.assign(this,f);je.absencePeriods=[],je.absenceTypes=[],je.canManage=!1,je.contactName=null,je.errors=[],je.isSelfLeaveApprover=!1,je.loading={absenceTypes:!0,entitlements:!0},je.managedContacts=[],je.mode="",je.newStatusOnSave=null,je.period={},je.postContactSelection=!1,je.requestStatuses={},je.selectedAbsenceType={},je.staffMemberSelectionComplete=!1,je.submitting=!1,je.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},je.canChangeAbsenceType=D,je.canSubmit=S,je.closeAlert=L,je.deleteLeaveRequest=k,je.dismissModal=E,je.getStatuses=U,je.getStatusFromValue=H,je.initAfterContactSelection=Y,je.initRequestAttributes=Z,je.isLeaveStatus=oe,je.isLeaveType=se,je.isMode=ie,je.isRole=ce,je.submit=Ae,je.updateAbsenceType=De,function(){je.loading.absenceTypes=!0,G(),K(),me().then(J).then(function(){return r.all([ee(),le(),he()])}).then(z).then(Q).then(Ce).then(_e).then(function(){return je.canManage&&!je.isMode("edit")&&pe()}).then(function(){if(je.selectedContactId&&(je.request.contact_id=je.selectedContactId),je.request.contact_id)return je.initAfterContactSelection()}).catch(W).finally(function(){je.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$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,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(){}); //# 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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index db8240b7e9a..db616d98965 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 @@ -9,6 +9,6 @@ !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/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,r,o,s,i,u,c,l,d,m){function f(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=x[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){w(e)}).catch(function(e){d.error("Error:",e)})}}}function $(){return m.get().then(function(e){D=e.contactId})}function q(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function w(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function A(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(x,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:x[e].label,isDirectAction:x[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,x={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},O={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=f,R.openLeavePopup=q,function(){a.resolve().then(y).then($).then(function(){return g()&&T()}).then(A).finally(function(){R.loading.component=!1})}()}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,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"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function A(){["from","to"].forEach(w)}function T(){var e=Be.requestStatuses[_.statusNames.awaitingApproval].value;ke.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Be.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function R(){var e=P();return Be.isMode("edit")&&(e=e&&(Y()||D())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function I(){Be.isSelfRecord&&!Be.isSelfLeaveApprover?Be.request.status_id=Be.requestStatuses[_.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function x(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==U())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==U()&&!Be.request.change_balance}function k(){Be.errors=[]}function L(){return Be.request.create().then(Te).then(function(){be("LeaveRequest::new")})}function M(){re()&&!Be.isRole("staff")&&(Be.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 Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.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(Be.getStatusFromValue(Be.request.status_id).name)}function N(e){return n.map(xe[e],function(e){return Be.requestStatuses[e]})}function U(){return Be.request?Be.request.request_type:Be.leaveType||null}function H(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?F():N("none")}function W(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function V(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function Y(){return!e.equals(ke,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function G(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?r.resolve().then(de).then(me).then(ye).then($e).then(ae).then(X).then(Be.isMode("edit")?qe:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return r.reject(e)}):r.reject("The contact id was not set")}function z(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];xe.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],xe.awaiting_approval=e,xe.more_information_required=e,xe.rejected=e,xe.approved=e,xe.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){return Be.canManage?f.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function K(){Le.push(o.$on("LeaveRequestPopup::requestObjectUpdated",qe),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function Q(){var e,t;Be.request=Be.leaveRequest||null,e=U(),t=Be.initRequestAttributes(),"leave"===e?Be.request=y.init(t):"sickness"===e?Be.request=$.init(t):"toil"===e&&(Be.request=q.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:Ie.id}),e}function ee(){return Ee="staff",(Be.isSelfRecord?te():ne()).finally(function(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")})}function te(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Be.isSelfLeaveApprover=!0)})}function ne(){return u(_.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(_.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[_.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[_.statusNames.approved].value)}function re(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],W(Be.request.status_id).name)}function oe(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function se(e){return Be.request&&Be.request.request_type===e}function ie(e){return Be.mode===e}function ue(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 ce(e){return Ee===e}function le(){return h.all().then(function(e){Be.absencePeriods=e})}function de(){return v.all(B()).then(v.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Be.loading.entitlements=!0,b.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Re.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function fe(){return f.getLoggedIn().then(function(e){Ie=e})}function pe(){return Be.selectedContactId?f.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?f.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Be.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.requestStatuses=n.indexBy(e,"name")})}function ve(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 be(e){T(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function ge(){["from","to"].forEach(function(e){Be.request[e+"_date"]=ke[e+"_date"]})}function ye(e){if(Be.absenceTypes=ve(Re.types,e),!Be.absenceTypes.length)return r.reject(Me)}function _e(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ue(Be.request,e)})}function $e(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function qe(){ke=e.copy(Be.request.attributes())}function Ce(){var e;Be.request.id?(e=[Be.requestStatuses[_.statusNames.approved].value,Be.requestStatuses[_.statusNames.adminApproved].value,Be.requestStatuses[_.statusNames.rejected].value,Be.requestStatuses[_.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function we(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,I(),A(),Be.request.isValid().then(re()&&x).then(M).then(O()&&ge).then(Ae).then(function(){return Be.isMode("edit")?Se():L()}).catch(function(t){Be.request.status_id=e,t&&V(t)}).finally(function(){Be.submitting=!1})}function Ae(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===Oe&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Oe>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){Le.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Be.request.update().then(Te).then(function(){Be.isRole("manager")?be("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Ie,xe={},Oe=0,ke={},Le=[],Me="No entitlement",Ee="",je=[],Be=n.assign(this,m);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.loading={absenceTypes:!0,entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=S,Be.canSubmit=R,Be.closeAlert=k,Be.deleteLeaveRequest=E,Be.dismissModal=j,Be.getStatuses=H,Be.getStatusFromValue=W,Be.initAfterContactSelection=G,Be.initRequestAttributes=Z,Be.isLeaveStatus=oe,Be.isLeaveType=se,Be.isMode=ie,Be.isRole=ce,Be.submit=we,Be.updateAbsenceType=De,function(){Be.loading.absenceTypes=!0,z(),K(),fe().then(J).then(function(){return r.all([ee(),le(),he()])}).then(Q).then(Ce).then(_e).then(function(){return Be.canManage&&!Be.isMode("edit")&&pe()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(V).finally(function(){Be.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"]}), +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/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){function C(e){"days"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function w(){["from","to"].forEach(C)}function A(){var e=Be.requestStatuses[y.statusNames.awaitingApproval].value;ke.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function T(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function P(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return!Be.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function S(){var e=T();return Be.isMode("edit")&&(e=e&&(V()||P())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function R(){Be.isSelfRecord&&!Be.isSelfLeaveApprover?Be.request.status_id=Be.requestStatuses[y.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function I(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==N())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return q.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function x(){return"toil"!==N()&&!Be.request.change_balance}function O(){Be.errors=[]}function k(){return Be.request.create().then(Te).then(function(){be("LeaveRequest::new")})}function L(){re()&&!Be.isRole("staff")&&(Be.request.change_balance=!0)}function M(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.request)})}})}function E(){i.dismiss({$value:"cancel"})}function j(){var e=N();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function B(){return F(Be.getStatusFromValue(Be.request.status_id).name)}function F(e){return n.map(xe[e],function(e){return Be.requestStatuses[e]})}function N(){return Be.request?Be.request.request_type:Be.leaveType||null}function U(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?B():F("none")}function H(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function W(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function V(){return!e.equals(ke,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function Y(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?r.resolve().then(de).then(me).then(ye).then($e).then(ae).then(X).then(Be.isMode("edit")?qe:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return r.reject(e)}):r.reject("The contact id was not set")}function G(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];xe.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],xe.awaiting_approval=e,xe.more_information_required=e,xe.rejected=e,xe.approved=e,xe.cancelled=[y.statusNames.awaitingApproval].concat(e)}function z(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")}function X(){return Be.canManage?f.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function K(){Le.push(o.$on("LeaveRequestPopup::requestObjectUpdated",qe),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){W(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function Q(){var e,t;Be.request=Be.leaveRequest||null,e=N(),t=Be.initRequestAttributes(),"leave"===e?Be.request=g.init(t):"sickness"===e?Be.request=_.init(t):"toil"===e&&(Be.request=$.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:Ie.id}),e}function ee(){return Ee="staff",Be.isSelfRecord?te():ne()}function te(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Be.isSelfLeaveApprover=!0)})}function ne(){return u(y.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(y.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[y.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[y.statusNames.approved].value)}function re(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],H(Be.request.status_id).name)}function oe(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function se(e){return Be.request&&Be.request.request_type===e}function ie(e){return Be.mode===e}function ue(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 ce(e){return Ee===e}function le(){return p.all().then(function(e){Be.absencePeriods=e})}function de(){return h.all(j()).then(h.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Be.loading.entitlements=!0,v.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Re.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function fe(){return f.getLoggedIn().then(function(e){Ie=e})}function pe(){return Be.selectedContactId?f.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?f.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Be.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.requestStatuses=n.indexBy(e,"name")})}function ve(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 be(e){A(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function ge(){["from","to"].forEach(function(e){Be.request[e+"_date"]=ke[e+"_date"]})}function ye(e){if(Be.absenceTypes=ve(Re.types,e),!Be.absenceTypes.length)return r.reject(Me)}function _e(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ue(Be.request,e)})}function $e(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function qe(){ke=e.copy(Be.request.attributes())}function Ce(){var e;Be.request.id?(e=[Be.requestStatuses[y.statusNames.approved].value,Be.requestStatuses[y.statusNames.adminApproved].value,Be.requestStatuses[y.statusNames.rejected].value,Be.requestStatuses[y.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function we(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,R(),w(),Be.request.isValid().then(re()&&I).then(L).then(x()&&ge).then(Ae).then(function(){return Be.isMode("edit")?Se():k()}).catch(function(t){Be.request.status_id=e,t&&W(t)}).finally(function(){Be.submitting=!1})}function Ae(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===Oe&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Oe>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){Le.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Be.request.update().then(Te).then(function(){Be.isRole("manager")?be("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Ie,xe={},Oe=0,ke={},Le=[],Me="No entitlement",Ee="",je=[],Be=n.assign(this,m);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.isSelfLeaveApprover=!1,Be.loading={absenceTypes:!0,entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=D,Be.canSubmit=S,Be.closeAlert=O,Be.deleteLeaveRequest=M,Be.dismissModal=E,Be.getStatuses=U,Be.getStatusFromValue=H,Be.initAfterContactSelection=Y,Be.initRequestAttributes=Z,Be.isLeaveStatus=oe,Be.isLeaveType=se,Be.isMode=ie,Be.isRole=ce,Be.submit=we,Be.updateAbsenceType=De,function(){Be.loading.absenceTypes=!0,G(),K(),fe().then(J).then(function(){return r.all([ee(),le(),he()])}).then(z).then(Q).then(Ce).then(_e).then(function(){return Be.canManage&&!Be.isMode("edit")&&pe()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(W).finally(function(){Be.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$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,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(){}); //# 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/shared/controllers/request.controller.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js index b2286df2a83..228c95f4924 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'); @@ -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 @@ -104,6 +104,7 @@ define([ loadStatuses() ]); }) + .then(initCanManage) .then(initRequest) .then(setModalMode) .then(setInitialAbsencePeriod) @@ -507,6 +508,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 * @@ -612,10 +620,7 @@ define([ return (vm.isSelfRecord ? initRoleBasedOnSelfLeaveApproverState() - : initRoleBasedOnPermissions()) - .finally(function () { - vm.canManage = vm.isRole('manager') || vm.isRole('admin'); - }); + : initRoleBasedOnPermissions()); } /** diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js index 094ccfc40a4..542521f9073 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js @@ -131,6 +131,10 @@ expect(controller.getStatuses()).toEqual(jasmine.any(Array)); }); + it('sets the `canManage` public property to `false`', function () { + expect(controller.canManage).toBe(false); + }); + describe('when initialized', function () { describe('before date is selected', function () { beforeEach(function () { @@ -662,6 +666,10 @@ expect(controller.isRole('manager')).toBeTruthy(); }); + it('sets the `canManage` public property to `true`', function () { + expect(controller.canManage).toBe(true); + }); + it('sets all leaverequest values', function () { expect(controller.request.contact_id).toEqual('' + CRM.vars.leaveAndAbsences.contactId); expect(controller.request.type_id).toEqual(jasmine.any(String)); @@ -1369,6 +1377,14 @@ it('sets the staff role', function () { expect(controller.isRole('staff')).toBe(true); }); + + it('sets the `isSelfLeaveApprover` public property to `false`', function () { + expect(controller.isSelfLeaveApprover).toBe(false); + }); + + it('sets the `canManage` public property to `false`', function () { + expect(controller.canManage).toBe(false); + }); }); }); From df3618ad6627999d592907cb07110cb1a2a9dac0 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Fri, 27 Jul 2018 12:22:59 +0200 Subject: [PATCH 083/151] PCHR-3944: Update rangy version --- .../src/common/vendor/angular/rangy-core.js | 6649 ++++++++--------- .../angular/rangy-selectionsaverestore.js | 449 +- 2 files changed, 3525 insertions(+), 3573 deletions(-) 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);
    
    From 149dfc1c7c3b04b0c733e59d52cd26b36123dbf4 Mon Sep 17 00:00:00 2001
    From: Alessandro Verdura 
    Date: Fri, 27 Jul 2018 12:24:58 +0200
    Subject: [PATCH 084/151] PCHR-3944: Update textAngular version (use fork)
    
    textAngular does not work with Angular 1.7, see https://github.com/textAngular/textAngular/issues/1608 and seems the project had been abandoned (at the time of this writing, the last changes are from 2 years ago). The only way to get it to work is to use a fork, https://github.com/antosarho/textAngularJs/, which contains the necessary fixes
    ---
     org.civicrm.reqangular/js/build.js            |    2 +-
     .../vendor/angular/textAngular-sanitize.js    |  805 ++
     .../angular/textAngular-sanitize.min.js       |    6 -
     .../src/common/vendor/angular/textAngular.js  | 7234 ++++++++++-------
     .../common/vendor/angular/textAngular.min.js  |   10 -
     .../common/vendor/angular/textAngularSetup.js | 1766 ++--
     6 files changed, 5976 insertions(+), 3847 deletions(-)
     create mode 100755 org.civicrm.reqangular/js/src/common/vendor/angular/textAngular-sanitize.js
     delete mode 100755 org.civicrm.reqangular/js/src/common/vendor/angular/textAngular-sanitize.min.js
     delete mode 100755 org.civicrm.reqangular/js/src/common/vendor/angular/textAngular.min.js
    
    diff --git a/org.civicrm.reqangular/js/build.js b/org.civicrm.reqangular/js/build.js
    index 40f90f11575..b7a20fa1fc0 100755
    --- a/org.civicrm.reqangular/js/build.js
    +++ b/org.civicrm.reqangular/js/build.js
    @@ -22,7 +22,7 @@
         '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',
    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 '),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 L(){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=M(q,de,he),$e=ve.maxDelay,X=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(" "),U),j.to&&(j.cleanupStyles&&_(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"),_.attr("ng-model-options","ngModelOptions")):I=null,_.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":S}),T=angular.element(_.children()[0]),T.attr("template-url",M),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(_)(e),_.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",b),s.off("click",y),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",y);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",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 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=$;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"},k=0,E=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),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&&($=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"})),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(),$=u.endSymbol(),y="
    ';return{compile:function(e,t){var n=o(y);return function(e,t,r,o){function u(){U.isOpen?g():d()}function d(){F&&!e.$eval(r[c+"Enable"])||(b(),C(),U.popupDelay?A||(A=a(v,U.popupDelay,!1)):v())}function g(){$(),U.popupCloseDelay?O||(O=a(y,U.popupCloseDelay,!1)):y()}function v(){if($(),b(),!U.content)return angular.noop;w(),U.$evalAsync(function(){U.isOpen=!0,k(!0),V()})}function $(){A&&(a.cancel(A),A=null),N&&(a.cancel(N),N=null)}function y(){U&&U.$evalAsync(function(){U&&(U.isOpen=!1,k(!1),U.animation?D||(D=a(x,150,!1)):x())})}function b(){O&&(a.cancel(O),O=null),D&&(a.cancel(D),D=null)}function w(){_||(T=U.$new(),_=n(T,function(e){I?s.find("body").append(e):t.after(e)}),E())}function x(){$(),b(),S(),_&&(_.remove(),_=null),T&&(T.$destroy(),T=null)}function C(){U.title=r[c+"Title"],U.content=H?H(e):r[i],U.popupClass=r[c+"Class"],U.placement=angular.isDefined(r[c+"Placement"])?r[c+"Placement"]:p.placement;var t=l.parsePlacement(U.placement);R=t[1]?t[0]+"-"+t[1]:t[0];var n=parseInt(r[c+"PopupDelay"],10),o=parseInt(r[c+"PopupCloseDelay"],10);U.popupDelay=isNaN(n)?p.popupDelay:n,U.popupCloseDelay=isNaN(o)?p.popupCloseDelay:o}function k(t){j&&angular.isFunction(j.assign)&&j.assign(e,t)}function E(){q.length=0,H?(q.push(e.$watch(H,function(e){U.content=e,!e&&U.isOpen&&y()})),q.push(T.$watch(function(){L||(L=!0,T.$$postDigest(function(){L=!1,U&&U.isOpen&&V()}))}))):q.push(r.$observe(i,function(e){U.content=e,!e&&U.isOpen?y():V()})),q.push(r.$observe(c+"Title",function(e){U.title=e,U.isOpen&&V()})),q.push(r.$observe(c+"Placement",function(e){U.placement=e||p.placement,U.isOpen&&V()}))}function S(){q.length&&(angular.forEach(q,function(e){e()}),q.length=0)}function M(e){U&&U.isOpen&&_&&(t[0].contains(e.target)||_[0].contains(e.target)||g())}var _,T,D,A,O,N,R,I=!!angular.isDefined(p.appendToBody)&&p.appendToBody,P=m(void 0),F=angular.isDefined(r[c+"Enable"]),U=e.$new(!0),L=!1,j=!!angular.isDefined(r[c+"IsOpen"])&&f(r[c+"IsOpen"]),H=!!p.useContentExp&&f(r[i]),q=[],V=function(){_&&_.html()&&(N||(N=a(function(){var e=l.positionElements(t,_,U.placement,I);_.css({top:e.top+"px",left:e.left+"px"}),_.hasClass(e.placement.split("-")[0])||(_.removeClass(R.split("-")[0]),_.addClass(e.placement.split("-")[0])),_.hasClass(p.placementClassPrefix+e.placement)||(_.removeClass(p.placementClassPrefix+R),_.addClass(p.placementClassPrefix+e.placement)),_.hasClass("uib-position-measure")?(l.positionArrow(_,e.placement),_.removeClass("uib-position-measure")):R!==e.placement&&l.positionArrow(_,e.placement),R=e.placement,N=null},0,!1)))};U.origScope=e,U.isOpen=!1,h.add(U,{close:y}),U.contentExp=function(){return U.content},r.$observe("disabled",function(e){e&&$(),e&&U.isOpen&&y()}),j&&e.$watch(j,function(e){U&&!e===U.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",M):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",M)):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"]);U.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(U),U=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 k=a.minuteStep;n.minuteStep&&y.push(e.$parent.$watch(r(n.minuteStep),function(e){k=+e}));var E;y.push(e.$parent.$watch(r(n.min),function(e){var t=new Date(e);E=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 M=!1;n.ngDisabled&&y.push(e.$parent.$watch(r(n.ngDisabled),function(e){M=e})),e.noIncrementHours=function(){var e=m($,60*C);return M||e>S||e<$&&e$&&e>S},e.noIncrementMinutes=function(){var e=m($,k);return M||e>S||e<$&&e$&&e>S},e.noIncrementSeconds=function(){var e=g($,_);return M||e>S||e<$&&e$&&e>S},e.noToggleMeridian=function(){return $.getHours()<12?M||m($,720)>S:M||m($,-720)0};t.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementHours():e.decrementHours()),t.preventDefault()}),n.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementMinutes():e.decrementMinutes()),t.preventDefault()}),r.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementSeconds():e.decrementSeconds()),t.preventDefault()})},this.setupArrowkeyEvents=function(t,n,r){t.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementHours(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementHours(),e.$apply()))}),n.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementMinutes(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementMinutes(),e.$apply()))}),r.bind("keydown",function(t){M||(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*k)},e.decrementMinutes=function(){e.noDecrementMinutes()||h(60*-k)},e.incrementSeconds=function(){e.noIncrementSeconds()||h(_)},e.decrementSeconds=function(){e.noDecrementSeconds()||h(-_)},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(){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],$=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,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),M=i(n.typeaheadNoResults).assign||angular.noop,_=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)},U=d.parse(n.uibTypeahead),L=e.$new(),j=e.$on("$destroy",function(){L.$destroy()});L.$on("$destroy",j);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 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(){L.matches=[],L.activeIdx=-1,t.attr("aria-expanded",!1),z()},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),M(e,!1),o.when(U.source(e,i)).then(function(o){var a=n===m.$viewValue;if(a&&w)if(o&&o.length>0){L.activeIdx=A?0:-1,M(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(),M(e,!0);a&&C(e,!1)},function(){Y(),C(e,!1),M(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)},y)},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[U.itemName]=s=L.matches[r].model,o=U.modelMapper(e,l),F(e,o),m.$setValidity("editable",!0),m.$setValidity("parse",!0),E(e,{$item:s,$model:o,$label:U.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=B.find("li")[L.activeIdx],r.parentNode.scrollTop=r.offsetTop;break;case 40:L.activeIdx=(L.activeIdx+1)%L.matches.length,L.$digest(),r=B.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!==$||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)})),!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!==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)),B.remove(),R&&q.remove()});var te=r(B)(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===$||t&&t.length>=$?y>0?(X(),Q(t)):K(t):(C(e,!1),X(),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),_?(i.$model=t,_(e,i)):(i[U.itemName]=t,n=U.viewMapper(e,i),i[U.itemName]=void 0,r=U.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){ +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}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(F,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(E,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(E,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:L,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&&(F[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(E,n)?E[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([])")))):(b(),C.nextTick(function(){b(),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){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(X(n,!0)+(!0===e?"":"="+X(e,!0)))}):t.push(X(n,!0)+(!0===e?"":"="+X(e,!0)))}),t.length?t.join("&"):""}function Q(e){return X(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function X(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()},M(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(M(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=Mr(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 M(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=Me(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=X(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]=X(F,Y[ee].childNodes,a));v=v.childNodes}else v=ur(we(n)).contents();R.empty(),P=X(F,v,a,void 0,void 0,{needsNewScope:m.$$isolateScope||m.$$newScope}),P.$$slots=Y}if(m.template)if(O=!0,de("template",_,m,R),_=m,w=M(m.template)?m.template(R,r):m.template,w=Ae(w),m.replace){if(l=m,v=zr.test(w)?st(he(m.templateNamespace,Mr(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,R),_=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:_,nonTlbTranscludeDirective:T}),q=t.length;else if(m.compile)try{y=m.compile(R,r,P);var oe=m.$$originalDirective||m;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)||M(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)||M(e)||(k(e)?o(e,function(e){t.push(X(n)+"="+X(pt(e)))}):t.push(X(n)+"="+X(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?"":"]"))}):(M(e)&&(e=e()),n.push(X(r)+"="+(null==e?"":X(pt(e)))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function gt(e,t){if(x(e)){var n=e.replace(Mi,"").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 _i("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(Mr(e.substr(0,t)));e=Mr(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=Mr(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 M(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&&M(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=_(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]=Q(e[t].replace(/%2F/g,"/"));return e.join("/")}function Mt(e,t){var n=hn(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=d(n.port)||Ni[n.protocol]||null}function _t(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||"",Mt(e,this),this.$$parse=function(e){var n=Dt(t,e);if(!x(n))throw Ri("ipthprfx",e,t);_t(n,this,!0),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=J(this.$$search),n=this.$$hash?"#"+Q(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){Mt(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)),_t(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?"#"+Q(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?"#"+Q(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 M(e.valueOf)?e.valueOf():Fi.call(e)}function Qt(){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:M(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)"+_r(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>Qi&&(t=t.splice(0,Qi-1),a=n-1,n=1),{d:t,e:a,i:n}}function _n(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(M(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 Qn(e){return y(e)&&!C(e)&&(e=parseFloat(e)),kr(e)?void 0:e}function Xn(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?Xn(e):0,s=i?Xn(t):0,l=o?Xn(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 Qr={};o("input select option textarea button form details".split(" "),function(e){Qr[e]=!0});var Xr={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};o({data:_e,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=M(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 Qi=22,Xi=".",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(Xr,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=Qn(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=Qn(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=Qn(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"!==Mr(n.ngTrim);$(n.name)&&t.attr("name",++Er),t.on("change",function(e){var o;t[0].checked&&(o=n.value,i&&(o=Mr(o)),r.$setViewValue(o,e&&e.type))}),r.$render=function(){var e=n.value;i&&(e=Mr(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=Qn(e),kr(r.$modelValue)||(c?(e=t.val(),f>e&&(e=f,t.val(e)),r.$setViewValue(e)):r.$validate())}function l(e){d=Qn(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)})}}}},Mo=["$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)})}}}}],_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=$(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?Mr(i):i;r.$parsers.push(function(e){if(!$(e)){var t=[];return e&&o(e.split(s),function(e){e&&t.push(a?Mr(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 M(n)&&(n=e(t)),n},this.$$ngModelSet=function(e,n){M(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||!M(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:M,isObject:b,isNumber:C,isElement:N,isArray:k,version:Lr,isDate:E,callbacks:{$$counter:0},getTestability:ie,reloadWithDebugInfo:re,$$minErr:r,$$csp:Tr,$$encodeUriSegment:Q,$$encodeUriQuery:X,$$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:Mo,ngBindHtml:To,ngBindTemplate:_o,ngClass:Ao,ngClassEven:No,ngClassOdd:Oo,ngCloak:Ro,ngController:Io,ngForm:fo,ngHide:sa,ngIf:Fo,ngInclude:Uo,ngInit:Ho,ngNonBindable:Qo,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:Qt,$rootScope:rn,$q:Xt,$$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=M(q,de,he),$e=ve.maxDelay,X=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&&_(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"),_.attr("ng-model-options","ngModelOptions")):I=null,_.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":S}),T=angular.element(_.children()[0]),T.attr("template-url",M),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(_)(e),_.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(){_||(T=F.$new(),_=n(T,function(e){I?s.find("body").append(e):t.after(e)}),k())}function x(){$(),b(),S(),_&&(_.remove(),_=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 M(e){F&&F.isOpen&&_&&(t[0].contains(e.target)||_[0].contains(e.target)||g())}var _,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(){_&&_.html()&&(N||(N=a(function(){var e=l.positionElements(t,_,F.placement,I);_.css({top:e.top+"px",left:e.left+"px"}),_.hasClass(e.placement.split("-")[0])||(_.removeClass(R.split("-")[0]),_.addClass(e.placement.split("-")[0])),_.hasClass(p.placementClassPrefix+e.placement)||(_.removeClass(p.placementClassPrefix+R),_.addClass(p.placementClassPrefix+e.placement)),_.hasClass("uib-position-measure")?(l.positionArrow(_,e.placement),_.removeClass("uib-position-measure")):R!==e.placement&&l.positionArrow(_,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",M):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",M)):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 M=!1;n.ngDisabled&&y.push(e.$parent.$watch(r(n.ngDisabled),function(e){M=e})),e.noIncrementHours=function(){var e=m($,60*C);return M||e>S||e<$&&e$&&e>S},e.noIncrementMinutes=function(){var e=m($,E);return M||e>S||e<$&&e$&&e>S},e.noIncrementSeconds=function(){var e=g($,_);return M||e>S||e<$&&e$&&e>S},e.noToggleMeridian=function(){return $.getHours()<12?M||m($,720)>S:M||m($,-720)0};t.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementHours():e.decrementHours()),t.preventDefault()}),n.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementMinutes():e.decrementMinutes()),t.preventDefault()}),r.bind("mousewheel wheel",function(t){M||e.$apply(i(t)?e.incrementSeconds():e.decrementSeconds()),t.preventDefault()})},this.setupArrowkeyEvents=function(t,n,r){t.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementHours(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementHours(),e.$apply()))}),n.bind("keydown",function(t){M||(38===t.which?(t.preventDefault(),e.incrementMinutes(),e.$apply()):40===t.which&&(t.preventDefault(),e.decrementMinutes(),e.$apply()))}),r.bind("keydown",function(t){M||(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(_)},e.decrementSeconds=function(){e.noDecrementSeconds()||h(-_)},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),M=i(n.typeaheadNoResults).assign||angular.noop,_=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),M(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,M(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(),M(e,!0);a&&C(e,!1)},function(){Y(),C(e,!1),M(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,Q=function(e){J=a(function(){K(e)},y)},X=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?(X(),Q(t)):K(t):(C(e,!1),X(),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),_?(i.$model=t,_(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",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{b=e.getSelectionElement()}catch(e){}var x=angular.element(b);if(void 0!==b){var C=b.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("
    "+b.innerHTML+"
    ")[0]],x,k)}if(C.match(n)){if(v=e.getOnlySelectedElements(),0===v.length)m=angular.element("<"+k+">
  • "+b.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"+M[0].innerHTML+"":g+=M[0].childNodes[0].innerHTML,S.unshift(M)}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(y=d.toLowerCase().replace(/[<>]/gi,""),"default"===y.trim()&&(y=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===y){v=m.children();var _=!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(),$=m[0].childNodes,y=!0;if($.length>0){for(f=[],c=0;c<$.length;c++)"p"===$[c].nodeName.toLowerCase()&&""===$[c].innerHTML.trim()||3===$[c].nodeType&&""===$[c].nodeValue.trim()||(y=y&&!n.test($[c].nodeName),f.push($[c]));for(var b=0;b)$/i.test(g.startContainer.innerHTML)&&g.selectNode(g.startContainer)}else y=!0,p=v=o.createTextNode(e);if(y)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?j: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,U=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,L=1,j=2,H=4,q=8,V=[{specialKey:"UndoKey",forbiddenModifiers:H+q,mustHaveModifiers:[j+L],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H,mustHaveModifiers:[j+L,q],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:H+q,mustHaveModifiers:[j+L],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:j+q+H+L,mustHaveModifiers:[],keyCode:9},{specialKey:"ShiftTabKey",forbiddenModifiers:j+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?"

     

    ":"

     

    "):(M=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+">":"<"+x.taDefaultWrap+">",_=void 0===e.ie||e.ie>=11?"<"+x.taDefaultWrap+">
    ":e.ie<=8?"<"+x.taDefaultWrap.toUpperCase()+"> ":"<"+x.taDefaultWrap+"> "),D.$options||(D.$options={});var B=v(_),z=function(e){if(B(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=$(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()),B(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!B(e||t)}),T.$parsers.push(Q),T.$parsers.unshift(z),T.$formatters.push(Q),T.$formatters.unshift(z),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 $=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&&$(e)}),angular.forEach(i.find("font"),$),e=i.html()}else{if(e=e.replace(/<(|\/)meta[^>]*?>/gi,""),e.match(/<[^>]*?(ta-bind)[^>]*?>/)){if(e.match(/<[^>]*?(text-angular)[^>]*?>/)){var b=angular.element("
          "+e+"
          ");b.find("textarea").remove();for(var x=y.getByAttribute(b,"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(),b.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(M),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(""!==M&&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(M);angular.element(n).replaceWith(r),d.setSelectionToElementStart(r[0])}}var a=Z();""!==M&&""===a.trim()?(ce(M),d.setSelectionToElementStart(w.children()[0])):"<"!==a.substring(0,1)&&x.taDefaultWrap;var s=E!==e.keyCode&&U.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?M:e:""===e?M: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,M=h.serial?h.serial:Math.floor(1e16*Math.random());d._name=h.name?h.name:"textAngularEditor"+M;var _=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"+M]():"redo"===e.toLowerCase()?d["$redoTaBindtaTextElement"+M]():(k(e,!1,t,d.defaultTagAttributes),n&&d["reApplyOnSelectorHandlerstaTextElement"+M](),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"),_(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),_(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),_(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"+M,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":p.attr("ng-model-options")}),d.displayElements.text.attr({id:"taTextElement"+M,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"+M],d.updateTaBindtaHtmlElement=d["updateTaBindtaHtmlElement"+M],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"+M]()},b=function(){d.focussed=!0,p.addClass(d.classes.focussed),C.focus(),p.triggerHandler("focus")},d.displayElements.html.on("focus",b),d.displayElements.text.on("focus",b),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"+M])}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"+M]()}),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"+M]()})}catch(e){u.error(e)}}),r.preventDefault(),r.stopPropagation()):t(function(){d["updateTaBindtaTextElement"+M]()},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),$=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",$),d.displayElements.text.on("keypress",$),y=function(){d._bUpdateSelectedStyles=!1,d.$apply(function(){d.updateSelectedStyles()})},d.displayElements.html.on("mouseup",y),d.displayElements.text.on("mouseup",y)}}}]),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=[];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},k=[];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 E=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!==E||o(i())||(E=t.$watch(function(){S||(S=!0,t.$$postDigest(function(){S=!1,o(i())&&(E(),E=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 M=o(function(){b.sizeSearchInput()},50);angular.element(f).bind("resize",M),t.$on("$destroy",function(){b.searchInput.off("keyup keydown tagged blur paste"),angular.element(f).off("resize",M)}),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=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)&&b(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>Ma){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();Ma=!(a.f||a.e),r.remove()}}return Ma?(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)*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(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)/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 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 Me(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),_e(t,n,e,r)}}function _e(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)}:$;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)||Fe;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 k=m.length+b.length+w.length+(y?0:i.length),E=c>k?new Array(k=c-k+1).join(r):"";return y&&(b=o(E+b,E.length?c-w.length:1/0)),i+=m,e=b+w,("<"===a?i+e+E:">"===a?E+i+e:"^"===a?E.substring(0,k>>=1)+i+e+E.substring(k):i+(y?e:E+e))+n}}}function Fe(e){return e+""}function Ue(){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=Ue;var r=new Ue;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=Ue;var r=new Ue;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=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,_.c.toString(),t,r)}function l(e,t,r){return n(e,_.x.toString(),t,r)}function u(e,t,r){return n(e,_.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=Ue;var t=new as;return t._=e,r(t)}finally{as=Date}}var r=t(e);return n.parse=function(e){try{as=Ue;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),k=Ve(v),E=Be(v),S=Ve($),M=Be($);h.forEach(function(e,t){y.set(e.toLowerCase(),t)});var _={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:Xe,e:Xe,H:tt,I:tt,j:et,L:it,m:Qe,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 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 $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])<_a&&da(e[1]-t[1])<_a}function xt(e,t){e*=Ra;var n=Math.cos(t*=Ra);Ct(n*Math.cos(e),n*Math.sin(e),Math.sin(t))}function Ct(e,t,n){++$s,bs+=(e-bs)/$s,ws+=(t-ws)/$s,xs+=(n-xs)/$s}function kt(){function e(e,i){e*=Ra;var o=Math.cos(i*=Ra),a=o*Math.cos(e),s=o*Math.sin(e),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=n*l-r*s)*u+(u=r*a-t*l)*u+(u=t*s-n*a)*u),t*a+n*s+r*l);ys+=u,Cs+=u*(t+(t=a)),ks+=u*(n+(n=s)),Es+=u*(r+(r=l)),Ct(t,n,r)}var t,n,r;Ts.point=function(i,o){i*=Ra;var a=Math.cos(o*=Ra);t=a*Math.cos(i),n=a*Math.sin(i),r=Math.sin(o),Ts.point=e,Ct(t,n,r)}}function Et(){Ts.point=xt}function St(){function e(e,t){e*=Ra;var n=Math.cos(t*=Ra),a=n*Math.cos(e),s=n*Math.sin(e),l=Math.sin(t),u=i*l-o*s,c=o*a-r*l,f=r*s-i*a,d=Math.sqrt(u*u+c*c+f*f),p=r*a+i*s+o*l,h=d&&-ee(p)/d,m=Math.atan2(d,p);Ss+=h*u,Ms+=h*c,_s+=h*f,ys+=m,Cs+=m*(r+(r=a)),ks+=m*(i+(i=s)),Es+=m*(o+(o=l)),Ct(r,i,o)}var t,n,r,i,o;Ts.point=function(a,s){t=a,n=s,Ts.point=e,a*=Ra;var l=Math.cos(s*=Ra);r=l*Math.cos(a),i=l*Math.sin(a),o=Math.sin(s),Ct(r,i,o)},Ts.lineEnd=function(){e(t,n),Ts.lineEnd=Et,Ts.point=xt}}function Mt(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function _t(){return!0}function Tt(e,t,n,r,i){var o=[],a=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t];if(wt(n,r)){i.lineStart();for(var s=0;t>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=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()}},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-_a:Na-e[1])-((t=t.x)[0]<0?t[1]-Na-_a: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)<_a?(e.point(n,r=(r+a)/2>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)<_a&&(n-=i*_a),da(o-s)<_a&&(o-=s*_a),r=Ft(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}function Ft(e,t,n,r){var i,o,a=Math.sin(e-n);return da(a)>_a?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 Ut(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])>_a){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,k=C>Da,E=h*y;if(gs.add(Math.atan2(E*x*Math.sin(C),m*b+E*Math.cos(C))),o+=k?w+x*Aa:w,k^d>=n^v>=n){var S=gt(ht(f),ht(e));yt(S);var M=gt(i,S);yt(M);var _=(k^w>=0?-1:1)*te(M[2]);(r>_||r===_&&(S[0]||S[1]))&&(a+=k^w>=0?1:-1)}if(!g++)break;d=v,h=y,m=b,f=e}}return(-_a>o||_a>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]+=_a,h[1]+=_a,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],k=e[1],E=t[1];x>C&&(w=x,x=C,C=w);var S=C-x,M=da(S-Da)<_a,_=M||_a>S;if(!M&&k>E&&(w=k,k=E,E=w),_?M?k+E>0^b[1]<(da(b[0]-x)<_a?k:E):k<=b[1]&&b[1]<=E:S>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)>_a;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)<_a?i>0?0:3:da(r[0]-n)<_a?i>0?2:1:da(r[1]-t)<_a?i>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&&M.rejoin(),m.push(M.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)$=e,y=t,b=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}};_(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,M=Rt(),_=Ht(e,t,n,r),T={point:f,lineStart:d,lineEnd:p,polygonStart:function(){s=M,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 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;Us.point=function(o,a){Us.point=e,t=r=o,n=i=a},Us.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){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,ks+=a*(n+r)/2,Es+=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 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),Ms+=a*(i+t),_s+=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 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(){y=NaN,k.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(){k.point=n,t.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(e,t){o(f=e,d=t),p=y,h=b,m=w,g=x,v=C,k.point=o}function c(){i(y,b,$,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 $=c-t,y=f-n,b=$*$+y*y;if(b>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)<_a||da(r-d)<_a?(r+d)/2:Math.atan2(x,w),M=e(S,E),_=M[0],T=M[1],D=_-t,A=T-n,O=y*D-$*A;(O*O/b>o||da(($*D+y*A)/b-.5)>.3||a>s*p+l*h+u*m)&&(i(t,n,r,s,l,u,_,T,S,w/=k,x/=k,C,g,v),v.point(_,T),i(_,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=Mt(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,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):jt((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]):$,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,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?Mt(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-_a)%(2*Math.PI)}function gn(e,t,n){var r=na.range(e,t-_a,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-_a,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+_a>t&&(t=-Na+_a):t>Na-_a&&(t=Na-_a);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)<_a?ln:(n.invert=function(e,t){var n=o-t;return[Math.atan2(e,n)/i,o-Q(i)*Math.sqrt(e*e+n*n)]},n)}function En(e,t){return[e,Math.log(Math.tan(Da/4+t/2))]}function Sn(e){var t,n=on(e),r=n.scale,i=n.translate,o=n.clipExtent;return n.scale=function(){var e=r.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.translate=function(){var e=i.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.clipExtent=function(e){var a=o.apply(n,arguments);if(a===n){if(t=null==e){var s=Da*r(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else t&&(a=null);return a},n.clipExtent(null)}function Mn(e,t){return[Math.log(Math.tan(Da/4+t/2)),-e]}function _n(e){return e[0]}function Tn(e){return e[1]}function Dn(e){for(var t=e.length,n=[0,1],r=2,i=2;t>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 Un(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)<_a&&da(r-l.circle.cy)<_a;)o=l.P,s.unshift(l),Fn(l),l=o;s.unshift(l),Wn(l);for(var u=a;u.circle&&da(n-u.circle.x)<_a&&da(r-u.circle.cy)<_a;)a=u.N,s.push(u),Fn(u),u=a;s.push(u),Wn(u);var c,f=s.length;for(c=1;f>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=jn(s,a)-o)>_a)s=s.L;else{if(!((i=o-Hn(s,a))>_a)){r>-_a?(t=s.P,n=s):i>-_a?(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};Xn(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)>_a||da(i-n)>_a)&&(s.splice(a,0,new er(Qn(o.site,c,da(r-f)<_a&&h-i>_a?{x:f,y:da(t-f)<_a?n:h}:da(i-h)<_a&&d-r>_a?{x:da(n-h)<_a?t:d,y:h}:da(r-d)<_a&&i-p>_a?{x:d,y:da(t-d)<_a?n:p}:da(i-p)<_a&&r-f>_a?{x:da(n-p)<_a?t:f,y:p}:null),o.site,null)),++l)}function Bn(e,t){return t.angle-e.angle}function zn(){nr(this),this.x=this.y=this.arc=this.site=this.cy=null}function Yn(e){var t=e.P,n=e.N;if(t&&n){var r=t.site,i=e.site,o=n.site;if(r!==o){var a=i.x,s=i.y,l=r.x-a,u=r.y-s,c=o.x-a,f=o.y-s,d=2*(l*f-u*c);if(!(d>=-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=Xs._;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,k=C<<1|x,E=k+4;E>k;++k)if(u=y[3&k])switch(3&k){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 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 Mr(e){return 1-Math.cos(e*Na)}function _r(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=Ur(t,n),o=Lr(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],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(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 Fi(e){var t=e[0],n=e[e.length-1];return n>t?[t,n]:[n,t]}function Ui(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 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:Li,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=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=ji(r.map(i),n?Math:$l);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)},Bi(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(zi(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)},Bi(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,$=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)/$,k=(b*v+g*w)/$,E=(-b*g+v*w)/$,S=x-h,M=C-m,_=k-h,T=E-m;return S*S+M*M>_*_+T*T&&(x=k,C=E),[[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)?_t: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)},Bi(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]},$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=_(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=U(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},wa.insert=function(e,t){return e=U(e),t=_(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,$=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 M(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 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 Ma=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]-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=E().touches),t?ia(t).map(function(t){var n=Z(e,t);return n.identifier=t.identifier,n}):[]};var _a=1e-6,Ta=_a*_a,Da=Math.PI,Aa=2*Da,Oa=Aa-_a,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*$;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,$=(v||Math.log(l/o))/Pa;return n.duration=1e3*$,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(_[0],Math.min(_[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(b.range().map(function(e){return(e-E.x)/E.k}).map(b.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(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(E.k)/Math.LN2)+1),k()}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),k(),i(Math.pow(2,.002*Ua())*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},M=[960,500],_=ja,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?(Ua=function(){return-na.event.deltaY*(na.event.deltaMode?120:1)},"wheel"):"onmousewheel"in oa?(Ua=function(){return na.event.wheelDelta},"mousewheel"):(Ua=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=M[0],r=M[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?(_=null==t?ja:[+t[0],+t[1]],e):_},e.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],e):v},e.size=function(t){return arguments.length?(M=t&&[+t[0],+t[1]],e):M},e.duration=function(t){return arguments.length?(T=+t,e):T},e.x=function(t){return arguments.length?(w=t,b=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 Ua,La,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=Me($),na.dsv=function(e,t){function n(e,n,o){arguments.length<3&&(o=n,n=null);var a=_e(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[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,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;Ue.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){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($)>_a&&(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)):$>_a?p=90:-_a>$&&(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=ks=Es=Ss=Ms=_s=0,na.geo.stream(e,Ts);var t=Ss,n=Ms,r=_s,i=t*t+n*n+r*r;return Ta>i&&(t=Cs,n=ks,r=Es,_a>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,ks,Es,Ss,Ms,_s,Ts={sphere:w,point:xt,lineStart:kt,lineEnd:Et,polygonStart:function(){Ts.lineStart=St},polygonEnd:function(){Ts.lineStart=kt}},Ds=Ot(_t,Pt,Ut,[-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+_a,f+.12*u+_a],[c-.214*u-_a,f+.234*u-_a]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+_a,f+.166*u+_a],[c-.115*u-_a,f+.234*u-_a]]).stream(l).point,e},e.scale(1070)};var Os,Ns,Rs,Is,Ps,Fs,Us={point:w,lineStart:w,lineEnd:w,polygonStart:function(){Ns=0,Us.lineStart=zt},polygonEnd:function(){Us.lineStart=Us.lineEnd=Us.point=w,Os+=da(Ns/2)}},Ls={point:Yt,lineStart:w,lineEnd:w,polygonStart:w,polygonEnd:w},js={point:Kt,lineStart:Zt,lineEnd:Jt,polygonStart:function(){js.lineStart=Qt},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(Us)),Os},e.centroid=function(e){return bs=ws=xs=Cs=ks=Es=Ss=Ms=_s=0,na.geo.stream(e,i(js)),_s?[Ss/_s,Ms/_s]:Es?[Cs/Es,ks/Es]:xs?[bs/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):$,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)>_a}).map(c)).concat(na.range(Math.ceil(s/m)*m,a,m).filter(function(e){return da(e%v)>_a}).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+_a],[180,90-_a]]).minorExtent([[-180,-80-_a],[180,80+_a]])},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(kn)}).raw=kn;var zs=xn(function(e){return 1/e},Math.atan);(na.geo.gnomonic=function(){return on(zs)}).raw=zs,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,Mn.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Na]},(na.geo.transverseMercator=function(){var e=Sn(Mn),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=Mn,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)/_a)*_a,y:Math.round(a(e,t)/_a)*_a,i:t}})}var r=_n,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,k=$-g;C>k?$=g+C:v=m+k;var E=fr();if(E.add=function(e){o(E,e,+y(e,++p),+b(e,p),m,g,v,$)},E.visit=function(e){dr(e,E,m,g,v,$)},E.find=function(e){return pr(E,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 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=[],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&&(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=$,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},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),$=l[1]/(m.depth||1);Xr(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=Mi(a),i=Si(i),a&&i;)l=Si(l),o=Mi(o),o.a=e,r=a.z+f-i.z-u+s(a._,i._),r>0&&(_i(Di(a,e,n),e,r),u+=r,c+=r),f+=a.m,u+=i.m,d+=l.m,c+=o.m;a&&!Mi(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:$,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 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(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,k,E,S=0,M=0,_=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=o===Cl?Math.sqrt(e*e+u*u):+o.apply(this,arguments),p||(M*=-1),u&&(M=te(g/u*Math.sin(v))),e&&(S=te(g/e*Math.sin(v)))),u){$=u*Math.cos(c+M),y=u*Math.sin(c+M),b=u*Math.cos(f-M),w=u*Math.sin(f-M);var T=Math.abs(f-c-2*M)<=Da?0:1;if(M&&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),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==b?[$,y]:Nn([$,y],[k,E],[b,w],[x,C]),R=$-N[0],I=y-N[1],P=b-N[0],F=w-N[1],U=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!=b){var j=Math.min(h,(u-L)/(U+1)),H=po(null==k?[x,C]:[k,E],[$,y],u,j,p),q=po([b,w],[x,C],u,j,p);h===j?_.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]):_.push("M",H[0],"A",j,",",j," 0 1,",m," ",q[0])}else _.push("M",$,",",y);if(null!=k){var V=Math.min(h,(e-L)/(U-1)),B=po([$,y],[k,E],e,-V,p),z=po([x,C],null==b?[$,y]:[b,w],e,-V,p);h===V?_.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]):_.push("L",z[0],"A",V,",",V," 0 0,",m," ",B[0])}else _.push("L",x,",",C)}else _.push("M",$,",",y),null!=b&&_.push("A",u,",",u," 0 ",T,",",p," ",b,",",w),_.push("L",x,",",C),null!=k&&_.push("A",e,",",e," 0 ",A,",",1-p," ",k,",",E);return _.push("Z"),_.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 kl=na.map({linear:mo,"linear-closed":go,step:vo,"step-before":$o,"step-after":yo,basis:Eo,"basis-open":So,"basis-closed":Mo,bundle:_o,cardinal:xo,"cardinal-open":bo,"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],Ml=[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=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=$n,n=yn,r=Uo;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=Uo,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(_l.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 _l=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=_l.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 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",_a),g=na.transition(h.exit()).style("opacity",_a).remove(),v=na.transition(h.order()).style("opacity",1),y=Math.max(i,0)+a,b=Ui(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=m.select("line"),_=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"+b[0]+","+O*o+"V0H"+b[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+","+b[0]+"H0V"+b[1]+"H"+O*o)),M.attr(S,O*i),D.attr(E,O*y),_.attr(k,0).attr(S,O*i),A.attr(C,0).attr(E,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 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,$);s.exit().remove(),s.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Ul[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=Ui(u),d.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),c&&(l=Ui(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),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;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(),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 y,b,w=this,x=na.select(na.event.target),C=l.of(w,arguments),E=na.select(w),S=x.datum(),M=!/^(n|s)$/.test(S)&&u,_=!/^(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",$),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);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());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=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=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 Ul={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"],[]],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=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],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",_t]]),Yl={range:function(e,t,n){return na.range(Math.ceil(e/n)*n,+t,n).map(Xo)},floor:$,ceil:$};Bl.year=os.year,os.scale=function(){return Qo(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",_t]]);Wl.year=os.year.utc,os.scale.utc=function(){return Qo(na.scale.linear(),Wl,Gl)},na.text=Me(function(e){return e.responseText}),na.json=function(e,t){return _e(e,"application/json",ea,t)},na.html=function(e,t){return _e(e,"text/html",ta,t)},na.xml=Me(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&&_o(n)?e(n,r,i,a):Mt(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,k=jr(y);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),y=y-E.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),_t(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=Ft(e,t),rn?wi(i+n,0):n||0,"string"==typeof e||!_o(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(U);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(U);return n.cache=new ur.Cache,n}function cr(e,t){if("function"!=typeof e)throw new Kr(U);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?Lt(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(Xr.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 Fr(e,t,n){if(null==n){var r=gr(t),i=r?Lo(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,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 Ui(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 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=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=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=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),_t(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(U);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=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=_o(e)||xr(e);return t=bn(t,r,4),null==n&&(i||gr(e)?(r=e.constructor,n=i?_o(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,Mr(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,M,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,_t(t,0,-1))))return!1;t=Wn(t),n=ei.call(e,t)}return n||Rn(e.length)&&Dn(t,e.length)&&(_o(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=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=Ur,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=_o(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=b),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(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,(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,$):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,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){Ue.prototype[e]=function(n){var r=this.__filtered__;if(r&&!t)return new Ue(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},Ue.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;Ue.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":"");Ue.prototype[e]=function(){return this[n](1).value()[0]}}),Ve(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");Ue.prototype[e]=function(){return this.__filtered__?new Ue(this):this[n](1)}}),Ve(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?bt:Lr;Ue.prototype[e]=function(e){return this[n](r(e))}}),Ue.prototype.compact=function(){return this.filter(Ir)},Ue.prototype.reject=function(e,t){return e=bn(e,t,1),this.filter(function(t){return!e(t)})},Ue.prototype.slice=function(e,t){e=null==e?0:+e||0;var n=this;return n.__filtered__&&(0t)?new Ue(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)},Ue.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Ue.prototype.toArray=function(){return this.take(Mi)},pt(Ue.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 Ue,c=o[0],f=u||_o(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 Ue(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(Ue.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}],Ue.prototype.clone=function(){var e=new Ue(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},Ue.prototype.reverse=function(){if(this.__filtered__){var e=new Ue(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},Ue.prototype.value=function(){var e,t=this.__wrapped__.value(),n=this.__dir__,r=_o(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,ke=/\w*$/,Ee=/^0[xX]/,Se=/^\[object .+?Constructor\]$/,Me=/^\d+$/,_e=/[\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[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[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[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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Fe={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ue={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"},je={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},He=Ue[typeof exports]&&exports&&!exports.nodeType&&exports,qe=Ue[typeof module]&&module&&!module.nodeType&&module,Ve=Ue[typeof self]&&self&&self.Object&&self,Be=Ue[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)?k(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 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 b(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 M(e){var t,n,r={};for(n in e)i(e,n)&&(t=S(n))&&(r[t]=e[n]);return r}function _(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),_(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=U(t,e.localeData()),er[t]=er[t]||P(t),er[t](e)):e.localeData().invalidDate()}function U(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){yr[e]=_(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 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[Mr])?kr:n[Er]<0||n[Er]>59?Er:n[Sr]<0||n[Sr]>59?Sr:n[Mr]<0||n[Mr]>999?Mr:-1,l(e)._overflowDayOfYear&&(wr>t||t>Cr)&&(t=Cr),l(e)._overflowWeeks&&-1===t&&(t=_r),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=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(!Ur.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[kr]&&0===e._a[Er]&&0===e._a[Sr]&&0===e._a[Mr]&&(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 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=U(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),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[kr]<=12&&t._a[kr]>0&&(l(t).bigHour=void 0),t._a[kr]=xe(t._locale,t._a[kr],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 ke(e){if(!e._d){var t=M(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 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:Me(e),u(e)||(e._d=null),e))}function Me(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?ke(i):"number"==typeof o?i._d=new Date(o):e.createFromInputFallback(i)}function _e(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 _e(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 Ue(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=Ue(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:Ue(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(Ue(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[kr])*n,m:g(s[Er])*n,s:g(s[Sr])*n,ms:g(s[Mr])*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&&(_(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 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 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[Mr]=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 _(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 _(i)?i(e,t,n,r):i.replace(/%d/i,e)}function $n(e,t){var n=this._relativeTime[e>0?"future":"past"];return _(n)?n(t):n.replace(/%s/i,t)}function yn(e){var t,n;for(n in e)t=e[n],_(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=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 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 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 Mn(){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 _n(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 _n(this,e,t,1)}function Dn(e,t){return _n(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 Un(e){return e=S(e),this[e+"s"]()}function Ln(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={},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})?/,$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,kr=3,Er=4,Sr=5,Mr=6,_r=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=$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)?)?/,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)?)?/,Ur=/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}/]],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"),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()}),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",""),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),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"),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),B(["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",$r),L("ddd",$r),L("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"),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=$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=Mt,ui.toDate=Et,ui.toISOString=pt,ui.toJSON=_t,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=jt,ui.month=J,ui.daysInMonth=Q,ui.week=ui.weeks=Bt,ui.isoWeek=ui.isoWeeks=zt,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=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.",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",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=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"),$i=Fn("s"),yi=Fn("m"),bi=Fn("h"),wi=Fn("d"),xi=Fn("w"),Ci=Fn("M"),ki=Fn("y"),Ei=Ln("milliseconds"),Si=Ln("seconds"),Mi=Ln("minutes"),_i=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=Mn,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=ki,Ii.valueOf=Pn,Ii._bubble=On,Ii.get=Un,Ii.milliseconds=Ei,Ii.seconds=Si,Ii.minutes=Mi,Ii.hours=_i,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"),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=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=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("contact-actions/contact-actions.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/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 U(arguments,function(t){t!==e&&U(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 U(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($[n]=r,I(e))g.push(n,[function(){return t.get(e)}],u);else{var i=t.annotate(e);U(i,function(e){e!==n&&l.hasOwnProperty(e)&&p(l[e],e)}),g.push(n,e,i)}v.pop(),$[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=[],$={};return U(l,p),l=v=$=null,function(r,o,a){function s(){--y||(b||i($,o.$$values),p.$$values=$,p.$$promises=p.$$promises||!0,delete p.$$inheritedValues,u.resolve($))}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={},$=L({},r),y=1+g.length/3,b=!1;if(N(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i($,d(o.$$inheritedValues,m)),L(v,o.$$promises),o.$$values?(b=i($,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,$)),f.promise.then(function(e){$[n]=e,s()},u)}catch(e){u(e)}}var f=e.defer(),d=0;U(o,function(e){v.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&(d++,v[e].then(function(t){$[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;(l=u.exec(e))&&(v=s(l,!1),!(v.segment.indexOf("?")>=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 $(e){L(this,e)}function y(){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(b[e.name],f.invoke(e.def))}}function c(e){L(this,e||{})}H=this;var f,d=!1,m=!0,g=!1,b={},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:/.*/}};y.$$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 U(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 b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new $(L({name:e},t)),n&&(x.push({name:e,def:n}),w||u()),this},U(C,function(e,t){b[t]=new $(L({name:t},e))}),b=r(b,{}),this.$get=["$injector",function(e){return f=e,w=!1,u(),U(C,function(e,t){b[t]||(b[t]=new $(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: '"+y+"' 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 $?t.type:new $(t.type):"config"===r?b.any:b.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,y=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,y);L(this,{id:e,type:t,location:i,array:m,squash:y,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(),U(t,function(t){U(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return U(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return U(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 _)R(_[o])&&(t[o]=_[o](t,_.$delegates[o]));return E[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})}]),m(n),t}function v(e){return e.indexOf("*")>-1}function $(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 y(e,t){return I(e)&&!N(t)?_[e]:R(t)&&I(e)?(_[e]&&!_.$delegates[e]&&(_.$delegates[e]=_[e]),_[e]=t,this):this}function b(e,t){return P(e)?t=e:t.name=e,g(t),this}function w(e,i,o,s,f,p,m,g,y){function b(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 U(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")),_=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 $={to:t,toParams:n,options:o},y=b($,u.self,f,o);if(y)return y;if(t=$.to,n=$.toParams,o=$.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[M])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,j(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(),_;for(var U=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 M(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 _(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=M(a.uiSref,e.current.name),u=null,c=_(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},$=i.$eval(a.uiSrefOpts)||{};t.forEach(r,function(e){e in $&&(v[e]=$[e])});var y=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&&y(e)},!0),u=t.copy(i.$eval(l.paramExpr))),y(),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 $=n[o+1];if(!1===g)null!=v&&(u+=F(v)?h(v,t).join("-"):encodeURIComponent(v)),u+=$;else if(!0===g){var y=u.match(/\/$/)?/\/?(.*)/:/(.*)/;u+=$.match(y)[1]}else I(g)&&(u+=g+$)}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},$.prototype.is=function(e,t){return!0},$.prototype.encode=function(e,t){return e},$.prototype.decode=function(e,t){return e},$.prototype.equals=function(e,t){return e==t},$.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},$.prototype.pattern=/.*/,$.prototype.toString=function(){return"{Type:"+this.name+"}"},$.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},$.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)}); +for(var n=e.split("?"),i=n[0],o=i.split("/"),a=0;a-1)&&(o[l]="FILTERED");return o.join("/")}return e}function f(e,t){o(e)||(e=l(e),e=u(e),e=c(e),r.pageTrack(e,t))}var d,p,h;if(r.settings.pageTracking.autoTrackFirstPage){if(d=!0,i.has("$route"))if(p=i.get("$route"))for(h in p.routes){d=!1;break}else null===p&&(d=!1);else if(i.has("$state")){var m=i.get("$state");m.get().length>1&&(d=!1)}d&&(r.settings.pageTracking.autoBasePath&&(r.settings.pageTracking.basePath=n.location.pathname),i.invoke(["$location",function(e){if(r.settings.pageTracking.trackRelativePath){f(r.settings.pageTracking.basePath+e.url(),e)}else f(e.absUrl(),e)}]))}if(r.settings.pageTracking.autoTrackVirtualPages){if(r.settings.pageTracking.autoBasePath&&(r.settings.pageTracking.basePath=n.location.pathname+"#"),d=!0,r.settings.pageTracking.trackRoutes&&i.has("$route")){if(p=i.get("$route"))for(h in p.routes){d=!1;break}else null===p&&(d=!1);t.$on("$routeChangeSuccess",function(e,t){t&&(t.$$route||t).redirectTo||i.invoke(["$location",function(e){f(r.settings.pageTracking.basePath+e.url(),e)}])})}r.settings.pageTracking.trackStates&&(i.has("$state")&&!i.has("$transitions")&&(d=!1,t.$on("$stateChangeSuccess",function(e,t){i.invoke(["$location",function(e){f(r.settings.pageTracking.basePath+e.url(),e)}])})),i.has("$state")&&i.has("$transitions")&&(d=!1,i.invoke(["$transitions",function(e){e.onSuccess({},function(e){e.options().notify&&i.invoke(["$location",function(e){f(r.settings.pageTracking.basePath+e.url(),e)}])})}]))),d&&t.$on("$locationChangeSuccess",function(e,t){t&&(t.$$route||t).redirectTo||i.invoke(["$location",function(e){if(r.settings.pageTracking.trackRelativePath){f(r.settings.pageTracking.basePath+e.url(),e)}else f(e.absUrl(),e)}])})}r.settings.developerMode&&e.forEach(r,function(e,t){"function"==typeof e&&(r[t]=function(){})})}function i(t){return{restrict:"A",link:function(n,r,i){var o=i.analyticsOn||"click",a={};e.forEach(i.$attr,function(e,t){l(t)&&(a[u(t)]=i[t],i.$observe(t,function(e){a[u(t)]=e}))}),e.element(r[0]).on(o,function(o){var l=i.analyticsEvent||s(r[0]);a.eventType=o.type,i.analyticsIf&&!n.$eval(i.analyticsIf)||(i.analyticsProperties&&e.extend(a,n.$eval(i.analyticsProperties)),t.eventTrack(l,a))})}}}function o(e){e.decorator("$exceptionHandler",["$delegate","$injector",function(e,t){return function(n,r){var i=e(n,r),o=t.get("$analytics");return o.settings.trackExceptions&&o.exceptionTrack(n,r),i}}])}function a(e){return["a:","button:","button:button","button:submit","input:button","input:submit"].indexOf(e.tagName.toLowerCase()+":"+(e.type||""))>=0}function s(e){return a(e)?e.innerText||e.value:e.id||e.name||e.tagName}function l(e){return"analytics"===e.substr(0,9)&&-1===["On","Event","If","Properties","EventType"].indexOf(e.substr(9))}function u(e){var t=e.slice(9);return void 0!==t&&null!==t&&t.length>0?t.substring(0,1).toLowerCase()+t.substring(1):t}var c=window.angulartics||(window.angulartics={});c.waitForVendorCount=0,c.waitForVendorApi=function(e,t,n,r,i){i||c.waitForVendorCount++,r||(r=n,n=void 0),!Object.prototype.hasOwnProperty.call(window,e)||void 0!==n&&void 0===window[e][n]?setTimeout(function(){c.waitForVendorApi(e,t,n,r,!0)},t):(c.waitForVendorCount--,r(window[e]))},e.module("angulartics",[]).provider("$analytics",n).run(["$rootScope","$window","$analytics","$injector",r]).directive("analyticsOn",["$analytics",i]).config(["$provide",o])}(angular),define("common/angulartics",function(){}),function(e){"use strict";e.module("angulartics.google.tagmanager",["angulartics"]).config(["$analyticsProvider",function(e){function t(t,n){var r=window.dataLayer=window.dataLayer||[];n=n||{},r.push({event:n.event||"interaction",target:n.category,action:t,"target-properties":n.label,value:n.value,"interaction-type":n.noninteraction,userId:e.settings.ga.userId})}e.settings.ga={userId:null},e.registerPageTrack(function(t){(window.dataLayer=window.dataLayer||[]).push({event:"content-view","content-name":t,userId:e.settings.ga.userId})}),e.registerEventTrack(t),e.registerExceptionTrack(function(e){return e.description?void t(e.description,{category:"Exceptions",label:e.stack}):void console.log("Property description is required to be set")}),e.registerSetUsername(function(t){e.settings.ga.userId=t})}])}(angular),define("common/angulartics-google-tag-manager",function(){}),function(e,t){"use strict";function n(e){var t,n=/^(-?\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/;if(t=e.match(n)){var i=new Date(0),o=0,a=0;return t[9]&&(o=r(t[9]+t[10]),a=r(t[9]+t[11])),i.setUTCFullYear(r(t[1]),r(t[2])-1,r(t[3])),i.setUTCHours(r(t[4]||0)-o,r(t[5]||0)-a,r(t[6]||0),r(t[7]||0)),i}return e}function r(e){return parseInt(e,10)}function i(e,t,n){var r="";for(e<0&&(r="-",e=-e),e=""+e;e.length=m.length)throw new Error("No pending request to flush !");if(t.isDefined(n)&&null!==n)for(;n--;){var o=m.splice(r,1);if(!o.length)throw new Error("No more pending request to flush !");o[0]()}else for(;m.length>r;)m.splice(r,1)[0]();u.verifyNoOutstandingExpectation(i)},u.verifyNoOutstandingExpectation=function(t){if(!1!==t&&e.$digest(),p.length)throw new Error("Unsatisfied requests: "+p.join(", "))},u.verifyNoOutstandingRequest=function(t){if(!1!==t&&e.$digest(),m.length){var n=m.map(function(e){return e.description});throw new Error("Unflushed requests: "+m.length+"\n "+n.join("\n "))}},u.resetExpectations=function(){p.length=0,m.length=0},u.$$originalHttpBackend=$,u}function a(e,n,r){if(e.length>n&&t.isUndefined(e[n]))throw new Error("Undefined argument `"+r+"`; the argument is provided but not defined")}function s(e,n,r,i,o){function a(e){return e.slice(e.indexOf("?")+1).split("&").sort()}function s(e){return n.slice(0,n.indexOf("?"))===e.slice(0,e.indexOf("?"))&&a(n).join()===a(e).join()}this.data=r,this.headers=i,this.match=function(n,r,i,o){return e===n&&(!!this.matchUrl(r)&&(!(t.isDefined(i)&&!this.matchData(i))&&!(t.isDefined(o)&&!this.matchHeaders(o))))},this.matchUrl=function(e){return!n||(t.isFunction(n.test)?n.test(e):t.isFunction(n)?n(e):n===e||s(e))},this.matchHeaders=function(e){return!!t.isUndefined(i)||(t.isFunction(i)?i(e):t.equals(i,e))},this.matchData=function(e){return!!t.isUndefined(r)||(r&&t.isFunction(r.test)?r.test(e):r&&t.isFunction(r)?r(e):r&&!t.isString(r)?t.equals(t.fromJson(t.toJson(r)),t.fromJson(e)):r==e)},this.toString=function(){return e+" "+n},this.params=function(e){function r(e){try{return decodeURIComponent(e)}catch(e){}}return t.extend(function(){var n,i,o={},a=e.indexOf("?")>-1?e.substring(e.indexOf("?")+1):"";return t.forEach(a.split("&"),function(e){if(e&&(n=e.replace(/\+/g,"%20").split("="),i=r(n[0]),t.isDefined(i))){var a=!t.isDefined(n[1])||r(n[1]);hasOwnProperty.call(o,i)?t.isArray(o[i])?o[i].push(a):o[i]=[o[i],a]:o[i]=a}}),o}(),function(){var r={};if(!n||!t.isFunction(n.test)||!o||0===o.length)return r;var i=n.exec(e);if(!i)return r;for(var a=1,s=i.length;a0&&m>=c){var r;v.resolve(m),t.forEach(o,function(e,t){e.id===$.$$intervalId&&(r=t)}),t.isDefined(r)&&o.splice(r,1)}g?e.defer.flush():n.$apply()}var p=arguments.length>4,h=p?Array.prototype.slice.call(arguments,4):[],m=0,g=t.isDefined(f)&&!f,v=(g?i:r).defer(),$=v.promise;return c=t.isDefined(c)?c:0,$.then(null,function(){},p?function(){l.apply(null,h)}:l),$.$$intervalId=a,o.push({nextTime:s+(u||0),delay:u||1,fn:d,id:a,deferred:v}),o.sort(function(e,t){return e.nextTime-t.nextTime}),a++,$};return l.cancel=function(e){if(!e)return!1;var n;return t.forEach(o,function(t,r){t.id===e.$$intervalId&&(n=r)}),!!t.isDefined(n)&&(o[n].deferred.promise.then(void 0,function(){}),o[n].deferred.reject("canceled"),o.splice(n,1),!0)},l.flush=function(e){var t=s;for(s+=e;o.length&&o[0].nextTime<=s;){var n=o[0];n.fn(),n.nextTime===t&&n.nextTime++,n.nextTime+=n.delay,o.sort(function(e,t){return e.nextTime-t.nextTime})}return e},l}]},t.mock.TzDate=function(e,r){var o=new Date(0);if(t.isString(r)){var a=r;if(o.origDate=n(r),r=o.origDate.getTime(),isNaN(r))throw{name:"Illegal Argument",message:"Arg '"+a+"' passed into TzDate constructor is not a valid date string"}}else o.origDate=new Date(r);var s=new Date(r).getTimezoneOffset();o.offsetDiff=60*s*1e3-1e3*e*60*60,o.date=new Date(r+o.offsetDiff),o.getTime=function(){return o.date.getTime()-o.offsetDiff},o.toLocaleDateString=function(){return o.date.toLocaleDateString()},o.getFullYear=function(){return o.date.getFullYear()},o.getMonth=function(){return o.date.getMonth()},o.getDate=function(){return o.date.getDate()},o.getHours=function(){return o.date.getHours()},o.getMinutes=function(){return o.date.getMinutes()},o.getSeconds=function(){return o.date.getSeconds()},o.getMilliseconds=function(){return o.date.getMilliseconds()},o.getTimezoneOffset=function(){return 60*e},o.getUTCFullYear=function(){return o.origDate.getUTCFullYear()},o.getUTCMonth=function(){return o.origDate.getUTCMonth()},o.getUTCDate=function(){return o.origDate.getUTCDate()},o.getUTCHours=function(){return o.origDate.getUTCHours()},o.getUTCMinutes=function(){return o.origDate.getUTCMinutes()},o.getUTCSeconds=function(){return o.origDate.getUTCSeconds()},o.getUTCMilliseconds=function(){return o.origDate.getUTCMilliseconds()},o.getDay=function(){return o.date.getDay()},o.toISOString&&(o.toISOString=function(){return i(o.origDate.getUTCFullYear(),4)+"-"+i(o.origDate.getUTCMonth()+1,2)+"-"+i(o.origDate.getUTCDate(),2)+"T"+i(o.origDate.getUTCHours(),2)+":"+i(o.origDate.getUTCMinutes(),2)+":"+i(o.origDate.getUTCSeconds(),2)+"."+i(o.origDate.getUTCMilliseconds(),3)+"Z"});var l=["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"];return t.forEach(l,function(e){o[e]=function(){throw new Error("Method '"+e+"' is not implemented in the TzDate mock")}}),o},t.mock.TzDate.prototype=Date.prototype,t.mock.animate=t.module("ngAnimateMock",["ng"]).info({angularVersion:"1.7.2"}).config(["$provide",function(e){e.factory("$$forceReflow",function(){function e(){e.totalReflows++}return e.totalReflows=0,e}),e.factory("$$animateAsyncRun",function(){var e=[],t=function(){return function(t){e.push(t)}};return t.flush=function(){if(0===e.length)return!1;for(var t=0;t
    "),t.forEach(e,function(e){i.append(t.element(e).clone())}),i=i.html()):t.isArray(e)?(i=[],t.forEach(e,function(e){i.push(n(e))}),i="[ "+i.join(", ")+" ]"):i=t.isObject(e)?t.isFunction(e.$eval)&&t.isFunction(e.$apply)?r(e):e instanceof Error?e.stack||e.name+": "+e.message:t.toJson(e,!0):String(e),i}function r(e,n){n=n||" ";var i=[n+"Scope("+e.$id+"): {"];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&!o.match(/^(\$|this)/)&&i.push(" "+o+": "+t.toJson(e[o]));for(var a=e.$$childHead;a;)i.push(r(a,n+" ")),a=a.$$nextSibling;return i.push("}"),i.join("\n"+n)}return n(e)},t.mock.$httpBackendDecorator=["$rootScope","$timeout","$delegate",o],t.mock.$TimeoutDecorator=["$delegate","$browser",function(e,n){function r(e){var n=[];return t.forEach(e,function(e){n.push("{id: "+e.id+", time: "+e.time+"}")}),n.join(", ")}return e.flush=function(e){n.defer.flush(e)},e.verifyNoPendingTasks=function(){if(n.deferredFns.length)throw new Error("Deferred tasks to flush ("+n.deferredFns.length+"): "+r(n.deferredFns))},e}],t.mock.$RAFDecorator=["$delegate",function(e){var t=function(e){var n=t.queue.length;return t.queue.push(e),function(){t.queue.splice(n,1)}};return t.queue=[],t.supported=e.supported,t.flush=function(){if(0===t.queue.length)throw new Error("No rAF callbacks present");for(var e=t.queue.length,n=0;n
    ").data("$injector",e)}]},t.mock.$ComponentControllerProvider=["$compileProvider",function(e){this.$get=["$controller","$injector","$rootScope",function(e,t,n){return function(r,i,o,a){var s=t.get(r+"Directive"),l=s.filter(function(e){return e.controller&&e.controllerAs&&"E"===e.restrict});if(0===l.length)throw new Error("No component found");if(l.length>1)throw new Error("Too many components found");var u=l[0];return i=i||{},i.$scope=i.$scope||n.$new(!0),e(u.controller,i,o,a||u.controllerAs)}}]}],t.module("ngMock",["ng"]).provider({$browser:t.mock.$BrowserProvider,$exceptionHandler:t.mock.$ExceptionHandlerProvider,$log:t.mock.$LogProvider,$interval:t.mock.$IntervalProvider,$rootElement:t.mock.$RootElementProvider,$componentController:t.mock.$ComponentControllerProvider}).config(["$provide","$compileProvider",function(e,n){e.decorator("$timeout",t.mock.$TimeoutDecorator),e.decorator("$$rAF",t.mock.$RAFDecorator),e.decorator("$rootScope",t.mock.$RootScopeDecorator),e.decorator("$controller",u()),e.decorator("$httpBackend",t.mock.$httpBackendDecorator)}]).info({angularVersion:"1.7.2"}),t.module("ngMockE2E",["ng"]).config(["$provide",function(e){e.decorator("$httpBackend",t.mock.e2e.$httpBackendDecorator)}]).info({angularVersion:"1.7.2"}),t.mock.e2e={},t.mock.e2e.$httpBackendDecorator=["$rootScope","$timeout","$delegate","$browser",o],t.mock.$RootScopeDecorator=["$delegate",function(e){function t(){for(var e,t=0,n=[this.$$childHead];n.length;)for(e=n.shift();e;)t+=1,n.push(e.$$childHead),e=e.$$nextSibling;return t}function n(){for(var e,t=this.$$watchers?this.$$watchers.length:0,n=[this.$$childHead];n.length;)for(e=n.shift();e;)t+=e.$$watchers?e.$$watchers.length:0,n.push(e.$$childHead),e=e.$$nextSibling;return t}var r=Object.getPrototypeOf(e);return r.$countChildScopes=t,r.$countWatchers=n,e}],function(n){function r(){this.shared=!1,this.sharedError=null,this.cleanupAfterEach=function(){return!this.shared||this.sharedError}}if(n){var i=null,o=new r,a=[],s=function(){return!!i};t.mock.$$annotate=t.injector.$$annotate,t.injector.$$annotate=function(e){return"function"!=typeof e||e.$inject||a.push(e),t.mock.$$annotate.apply(this,arguments)};var u=e.module=t.mock.module=function(){function e(){if(i.$injector)throw new Error("Injector already created, can not register a module!");var e,r=i.$modules||(i.$modules=[]);t.forEach(n,function(n){e=t.isObject(n)&&!t.isArray(n)?["$provide",function(e){t.forEach(n,function(t,n){e.value(n,t)})}]:n,i.$providerInjector?i.$providerInjector.invoke(e):r.push(e)})}var n=Array.prototype.slice.call(arguments,0);return s()?e():e};u.$$beforeAllHook=e.before||e.beforeAll,u.$$afterAllHook=e.after||e.afterAll,u.$$currentSpec=function(e){if(0===arguments.length)return e;i=e},u.sharedInjector=function(){if(!u.$$beforeAllHook||!u.$$afterAllHook)throw Error("sharedInjector() cannot be used unless your test runner defines beforeAll/afterAll");var e=!1;u.$$beforeAllHook(function(){if(o.shared)throw o.sharedError=Error("sharedInjector() cannot be called inside a context that has already called sharedInjector()"),o.sharedError;e=!0,i=this,o.shared=!0}),u.$$afterAllHook(function(){e?(o=new r,u.$$cleanup()):o.sharedError=null})},u.$$beforeEach=function(){if(o.shared&&i&&i!==this){var e=i;i=this,t.forEach(["$injector","$modules","$providerInjector","$injectorStrict"],function(t){i[t]=e[t],e[t]=null})}else i=this,c=null,a=[]},u.$$afterEach=function(){o.cleanupAfterEach()&&u.$$cleanup()},u.$$cleanup=function(){var e=i.$injector;if(a.forEach(function(e){delete e.$inject}),i.$injector=null,i.$modules=null,i.$providerInjector=null,i=null,e){var n=e.get("$rootElement"),r=n&&n[0],o=c?[c[0]]:[];!r||c&&r===c[0]||o.push(r),t.element.cleanData(o);var s=e.get("$rootScope");s&&s.$destroy&&s.$destroy()}t.forEach(t.element.fragments,function(e,n){delete t.element.fragments[n]}),l.$$lastInstance=null,t.forEach(t.callbacks,function(e,n){delete t.callbacks[n]}),t.callbacks.$$counter=0},(e.beforeEach||e.setup)(u.$$beforeEach),(e.afterEach||e.teardown)(u.$$afterEach);var f=function(e,t){this.message=e.message,this.name=e.name,e.line&&(this.line=e.line),e.sourceId&&(this.sourceId=e.sourceId),e.stack&&t&&(this.stack=e.stack+"\n"+t.stack),e.stackArray&&(this.stackArray=e.stackArray)};f.prototype=Error.prototype,e.inject=t.mock.inject=function(){function e(){var e=i.$modules||[],o=!!i.$injectorStrict;e.unshift(["$injector",function(e){i.$providerInjector=e}]),e.unshift("ngMock"),e.unshift("ng");var a=i.$injector;a||(o&&t.forEach(e,function(e){"function"==typeof e&&t.injector.$$annotate(e)}),a=i.$injector=t.injector(e,o),i.$injectorStrict=o);for(var s=0,l=n.length;s
    ",render:function(){this.parent.render.call(this);var e=this.attrs,t=this.scope,o=angular.element('');o.attr("uib-datepicker-popup",e.eDatepickerPopupXEditable||uibDatepickerPopupConfig.datepickerPopup),o.attr("year-range",e.eYearRange||20),o.attr("ng-readonly",e.eReadonly||!1);for(var a=r.length-1;a>=0;a--){var s=e[r[a][0]];void 0!==s&&o.attr(r[a][1],s)}e.eNgChange&&(o.attr("ng-change",e.eNgChange),this.inputEl.removeAttr("ng-change")),e.eStyle&&(o.attr("style",e.eStyle),this.inputEl.removeAttr("style"));var l={maxDate:t.$eval(e.eMaxDate)||uibDatepickerConfig.maxDate,minDate:t.$eval(e.eMinDate)||uibDatepickerConfig.minDate,showWeeks:e.eShowWeeks?"true"===e.eShowWeeks.toLowerCase():uibDatepickerConfig.showWeeks,startingDay:e.eStartingDay||0,initDate:t.$eval(e.eInitDate)||new Date};if(e.eDatepickerOptions){var u=n(e.eDatepickerOptions)(t);angular.extend(l,u)}for(var c=i.length-1;c>=0;c--){var f=e[i[c][0]];void 0!==f&&(l[i[c][1]]=f)}if(t.dateOptions=l,"true"===(angular.isDefined(e.eShowCalendarButton)?e.eShowCalendarButton:"true")){var d=angular.element(''),p=angular.element('');d.attr("ng-click",e.eNgClick),p.append(d),this.inputEl.append(p)}else o.attr("ng-click",e.eNgClick);o.attr("datepicker-options","dateOptions"),this.inputEl.prepend(o),this.inputEl.removeAttr("class"),this.inputEl.removeAttr("ng-click"),this.inputEl.removeAttr("is-open"),this.inputEl.removeAttr("init-date"),this.inputEl.removeAttr("datepicker-popup"),this.inputEl.removeAttr("required"),this.inputEl.removeAttr("ng-model"),this.inputEl.removeAttr("date-picker-append-to-body"),this.inputEl.removeAttr("name"),this.inputEl.attr("class","input-group")}})}]),angular.module("xeditable").directive("editableBstime",["editableDirectiveFactory",function(e){return e({directiveName:"editableBstime",inputTpl:"",render:function(){this.parent.render.call(this);var e=angular.element('
    ');e.attr("ng-model",this.inputEl.attr("ng-model")),this.inputEl.removeAttr("ng-model"),this.attrs.eNgChange&&(e.attr("ng-change",this.inputEl.attr("ng-change")),this.inputEl.removeAttr("ng-change")),this.inputEl.wrap(e)}})}]),angular.module("xeditable").directive("editableCheckbox",["editableDirectiveFactory",function(e){return e({directiveName:"editableCheckbox",inputTpl:'',render:function(){this.parent.render.call(this),this.attrs.eTitle&&(this.inputEl.wrap(""),this.inputEl.parent().append(""+this.attrs.eTitle+""))},autosubmit:function(){var e=this;e.inputEl.bind("change",function(){setTimeout(function(){e.scope.$apply(function(){e.scope.$form.$submit()})},500)})}})}]),angular.module("xeditable").directive("editableChecklist",["editableDirectiveFactory","editableNgOptionsParser",function(e,t){return e({directiveName:"editableChecklist",inputTpl:"",useCopy:!0,render:function(){this.parent.render.call(this);var e=t(this.attrs.eNgOptions),n="",r="";this.attrs.eNgChange&&(n=' ng-change="'+this.attrs.eNgChange+'"'),this.attrs.eChecklistComparator&&(r=' checklist-comparator="'+this.attrs.eChecklistComparator+'"');var i='';this.inputEl.removeAttr("ng-model"),this.inputEl.removeAttr("ng-options"),this.inputEl.removeAttr("ng-change"),this.inputEl.removeAttr("checklist-comparator"),this.inputEl.html(i)}})}]),angular.module("xeditable").directive("editableCombodate",["editableDirectiveFactory","editableCombodate",function(e,t){return e({directiveName:"editableCombodate",inputTpl:'',render:function(){this.parent.render.call(this);var e={value:new Date(this.scope.$data)},n=this;angular.forEach(["format","template","minYear","maxYear","yearDescending","minuteStep","secondStep","firstItem","errorClass","customClass","roundTime","smartDays"],function(t){var r="e"+t.charAt(0).toUpperCase()+t.slice(1);r in n.attrs&&(e[t]="minYear"==t||"maxYear"==t||"minuteStep"==t||"secondStep"==t?parseInt(n.attrs[r],10):n.attrs[r])});var r=t.getInstance(this.inputEl,e);r.$widget.find("select").bind("change",function(e){n.scope.$data=new Date(r.getValue()).toISOString()})}})}]),function(){var e=function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})},t="text|password|email|tel|number|url|search|color|date|datetime|datetime-local|time|month|week|file".split("|");angular.forEach(t,function(t){var n=e("editable-"+t);angular.module("xeditable").directive(n,["editableDirectiveFactory",function(e){return e({directiveName:n,inputTpl:'',render:function(){if(this.parent.render.call(this),this.attrs.eInputgroupleft||this.attrs.eInputgroupright){if(this.inputEl.wrap('
    '),this.attrs.eInputgroupleft){var e=angular.element(''+this.attrs.eInputgroupleft+"");this.inputEl.parent().prepend(e)}if(this.attrs.eInputgroupright){var t=angular.element(''+this.attrs.eInputgroupright+"");this.inputEl.parent().append(t)}}if(this.attrs.eLabel){var n=angular.element("");this.attrs.eInputgroupleft||this.attrs.eInputgroupright?this.inputEl.parent().parent().prepend(n):this.inputEl.parent().prepend(n)}this.attrs.eFormclass&&this.editorEl.addClass(this.attrs.eFormclass)},autosubmit:function(){var e=this;e.inputEl.bind("keydown",function(t){9===t.keyCode&&e.scope.$apply(function(){e.scope.$form.$submit()})})}})}])}),angular.module("xeditable").directive("editableRange",["editableDirectiveFactory","$interpolate",function(e,t){return e({directiveName:"editableRange",inputTpl:'',render:function(){this.parent.render.call(this),this.inputEl.after(""+t.startSymbol()+"$data"+t.endSymbol()+"")}})}])}(),angular.module("xeditable").directive("editableTagsInput",["editableDirectiveFactory","editableUtils",function(e,t){var n=e({directiveName:"editableTagsInput",inputTpl:"",render:function(){this.parent.render.call(this),this.inputEl.append(t.rename("auto-complete",this.attrs.$autoCompleteElement)),this.inputEl.removeAttr("ng-model"),this.inputEl.attr("ng-model","$parent.$data")}}),r=n.link;return n.link=function(e,t,n,i){var o=t.find("editable-tags-input-auto-complete");return n.$autoCompleteElement=o.clone(),o.remove(),r(e,t,n,i)},n}]),angular.module("xeditable").directive("editableRadiolist",["editableDirectiveFactory","editableNgOptionsParser","$interpolate",function(e,t,n){return e({directiveName:"editableRadiolist",inputTpl:"",render:function(){this.parent.render.call(this);var e=t(this.attrs.eNgOptions),r="";this.attrs.eNgChange&&(r='ng-change="'+this.attrs.eNgChange+'"');var i='';this.inputEl.removeAttr("ng-model"),this.inputEl.removeAttr("ng-options"),this.inputEl.removeAttr("ng-change"),this.inputEl.html(i)},autosubmit:function(){var e=this;e.inputEl.bind("change",function(){setTimeout(function(){e.scope.$apply(function(){e.scope.$form.$submit()})},500)})}})}]),angular.module("xeditable").directive("editableSelect",["editableDirectiveFactory",function(e){return e({directiveName:"editableSelect",inputTpl:"",render:function(){if(this.parent.render.call(this),this.attrs.ePlaceholder){var e=angular.element('");this.inputEl.append(e)}},autosubmit:function(){var e=this;e.inputEl.bind("change",function(){e.scope.$apply(function(){e.scope.$form.$submit()})})}})}]),angular.module("xeditable").directive("editableTextarea",["editableDirectiveFactory",function(e){return e({directiveName:"editableTextarea",inputTpl:"",addListeners:function(){var e=this;e.parent.addListeners.call(e),e.single&&"no"!==e.buttons&&e.autosubmit()},autosubmit:function(){var e=this;e.inputEl.bind("keydown",function(t){e.attrs.submitOnEnter?13!==t.keyCode||t.shiftKey||e.scope.$apply(function(){e.scope.$form.$submit()}):(t.ctrlKey||t.metaKey)&&13===t.keyCode&&e.scope.$apply(function(){e.scope.$form.$submit()})})}})}]),angular.module("xeditable").directive("editableUidate",["editableDirectiveFactory",function(e){return e({directiveName:"editableUidate",inputTpl:'',render:function(){this.parent.render.call(this),this.inputEl.attr("ui-date",this.attrs.eUiDate),this.inputEl.attr("placeholder",this.attrs.ePlaceholder)}})}]),angular.module("xeditable").directive("editableUiSelect",["editableDirectiveFactory","editableUtils",function(e,t){var n=e({directiveName:"editableUiSelect",inputTpl:"",render:function(){this.parent.render.call(this),this.inputEl.append(t.rename("ui-select-match",this.attrs.$matchElement)),this.inputEl.append(t.rename("ui-select-choices",this.attrs.$choicesElement)),this.inputEl.removeAttr("ng-model"),this.inputEl.attr("ng-model","$parent.$parent.$data"),this.inputEl.attr("theme",this.attrs.theme)}}),r=n.link;return n.link=function(e,t,n,i){var o=t.find("editable-ui-select-match"),a=t.find("editable-ui-select-choices");return n.$matchElement=o.clone(),n.$choicesElement=a.clone(),o.remove(),a.remove(),r(e,t,n,i)},n}]),angular.module("xeditable").factory("editableController",["$q","editableUtils",function(e,t){function n(e,n,r,i,o,a,s,l,u,c){var f,d,p=this;p.scope=e,p.elem=r,p.attrs=n,p.inputEl=null,p.editorEl=null,p.single=!0,p.error="",p.theme=o[n.editableTheme]||o[s.theme]||o.default,p.parent={};var h=n.editableTheme||s.theme||"default",m=n.editableIconSet||s.icon_set;p.icon_set="default"===m?a.default[h]:a.external[m],p.inputTpl="",p.directiveName="",p.useCopy=!1,p.single=null,p.buttons="right",p.init=function(t){if(p.single=t,p.name=n.eName||n[p.directiveName],!n[p.directiveName])throw"You should provide value for `"+p.directiveName+"` in editable element!";f=i(n[p.directiveName]),p.single?p.buttons=p.attrs.buttons||s.buttons:p.buttons="no",n.eName&&p.scope.$watch("$data",function(e){p.scope.$form.$data[n.eName]=e}),n.onshow&&(p.onshow=function(){return p.catchError(i(n.onshow)(e))}),n.onhide&&(p.onhide=function(){return i(n.onhide)(e)}),n.oncancel&&(p.oncancel=function(){return i(n.oncancel)(e)}),n.onbeforesave&&(p.onbeforesave=function(){return p.catchError(i(n.onbeforesave)(e))}),n.onaftersave&&(p.onaftersave=function(){return p.catchError(i(n.onaftersave)(e))}),e.$parent.$watch(n[p.directiveName],function(e,t){p.setLocalValue(),p.handleEmpty()})},p.render=function(){var e=p.theme;p.inputEl=angular.element(p.inputTpl),p.controlsEl=angular.element(e.controlsTpl),p.controlsEl.append(p.inputEl),"no"!==p.buttons&&(p.buttonsEl=angular.element(e.buttonsTpl),p.submitEl=angular.element(e.submitTpl),p.resetEl=angular.element(e.resetTpl),p.cancelEl=angular.element(e.cancelTpl),p.submitEl.attr("title",s.submitButtonTitle),p.submitEl.attr("aria-label",s.submitButtonAriaLabel),p.cancelEl.attr("title",s.cancelButtonTitle),p.cancelEl.attr("aria-label",s.cancelButtonAriaLabel),p.resetEl.attr("title",s.clearButtonTitle),p.resetEl.attr("aria-label",s.clearButtonAriaLabel),p.icon_set&&(p.submitEl.find("span").addClass(p.icon_set.ok),p.cancelEl.find("span").addClass(p.icon_set.cancel),p.resetEl.find("span").addClass(p.icon_set.clear)),p.buttonsEl.append(p.submitEl).append(p.cancelEl),s.displayClearButton&&p.buttonsEl.append(p.resetEl),p.controlsEl.append(p.buttonsEl),p.inputEl.addClass("editable-has-buttons")),p.errorEl=angular.element(e.errorTpl),p.controlsEl.append(p.errorEl),p.editorEl=angular.element(p.single?e.formTpl:e.noformTpl),p.editorEl.append(p.controlsEl);for(var r in n.$attr)if(!(r.length<=1)){var i=!1,o=r.substring(1,2);if("e"===r.substring(0,1)&&o===o.toUpperCase()&&"Form"!==(i=r.substring(1))&&"NgSubmit"!==i){var a=i.substring(0,1),l=i.substring(1,2);i=l===l.toUpperCase()&&a===a.toUpperCase()?a.toLowerCase()+"-"+t.camelToDash(i.substring(1)):a.toLowerCase()+t.camelToDash(i.substring(1));var u="value"!==i&&""===n[r]?i:n[r];p.inputEl.attr(i,u)}}p.inputEl.addClass("editable-input"),p.inputEl.attr("ng-model","$parent.$data"),p.editorEl.addClass(t.camelToDash(p.directiveName)),p.single&&(p.editorEl.attr("editable-form","$form"),p.editorEl.attr("blur",p.attrs.blur||("no"===p.buttons?"cancel":s.blurElem))),angular.isFunction(e.postrender)&&e.postrender.call(p)},p.setLocalValue=function(){p.scope.$data=p.useCopy?angular.copy(f(e.$parent)):f(e.$parent)};var g=null;p.show=function(){return p.setLocalValue(),p.render(),r.after(p.editorEl),g=e.$new(),u(p.editorEl)(g),p.addListeners(),r.addClass("editable-hide"),p.onshow()},p.hide=function(){return g.$destroy(),p.controlsEl.remove(),p.editorEl.remove(),r.removeClass("editable-hide"),p.onhide()},p.cancel=function(){p.oncancel()},p.addListeners=function(){p.inputEl.bind("keyup",function(e){if(p.single)switch(e.keyCode){case 27:p.scope.$apply(function(){p.scope.$form.$cancel()})}}),p.single&&"no"===p.buttons&&p.autosubmit(),p.editorEl.bind("click",function(e){e.which&&1!==e.which||p.scope.$form.$visible&&(p.scope.$form._clicked=!0)})},p.setWaiting=function(e){e?(d=!p.inputEl.attr("disabled")&&!p.inputEl.attr("ng-disabled")&&!p.inputEl.attr("ng-enabled"))&&(p.inputEl.attr("disabled","disabled"),p.buttonsEl&&p.buttonsEl.find("button").attr("disabled","disabled")):d&&(p.inputEl.removeAttr("disabled"),p.buttonsEl&&p.buttonsEl.find("button").removeAttr("disabled"))},p.activate=function(e,t){setTimeout(function(){var n=p.inputEl[0];"focus"===s.activate&&n.focus?(void 0!==e&&""!==e&&n.setSelectionRange&&(t=t||e,n.onfocus=function(){setTimeout(function(){try{this.setSelectionRange(e,t)}catch(e){}}.bind(this))}),"editableRadiolist"==p.directiveName||"editableChecklist"==p.directiveName||"editableBsdate"==p.directiveName||"editableTagsInput"==p.directiveName?n.querySelector(".ng-pristine").focus():n.focus()):"select"===s.activate&&(n.select?n.select():n.focus&&n.focus())},0)},p.setError=function(t){angular.isObject(t)||(e.$error=t,p.error=t)},p.catchError=function(e,t){return angular.isObject(e)&&!0!==t?c.when(e).then(angular.bind(this,function(e){this.catchError(e,!0)}),angular.bind(this,function(e){this.catchError(e,!0)})):t&&angular.isObject(e)&&e.status&&200!==e.status&&e.data&&angular.isString(e.data)?(this.setError(e.data),e=e.data):angular.isString(e)&&this.setError(e),e},p.save=function(){f.assign(e.$parent,p.useCopy?angular.copy(p.scope.$data):p.scope.$data)},p.handleEmpty=function(){var t=f(e.$parent),n=null===t||void 0===t||""===t||angular.isArray(t)&&0===t.length;r.toggleClass("editable-empty",n)},p.autosubmit=angular.noop,p.onshow=angular.noop,p.onhide=angular.noop,p.oncancel=angular.noop,p.onbeforesave=angular.noop,p.onaftersave=angular.noop}return n.$inject=["$scope","$attrs","$element","$parse","editableThemes","editableIcons","editableOptions","$rootScope","$compile","$q"],n}]),angular.module("xeditable").factory("editableDirectiveFactory",["$parse","$compile","editableThemes","$rootScope","$document","editableController","editableFormController","editableOptions",function(e,t,n,r,i,o,a,s){return function(t){return{restrict:"A",scope:!0,require:[t.directiveName,"?^form"],controller:o,link:function(n,o,l,u){var c,f=u[0],d=!1;if(u[1])c=u[1],d=void 0===l.eSingle;else if(l.eForm){var p=e(l.eForm)(n);if(p)c=p,d=!0;else if(o&&"function"==typeof o.parents&&o.parents().last().find("form[name="+l.eForm+"]").length)c=null,d=!0;else for(var h=0;h=0&&e.splice(n,1),t},camelToDash:function(e){var t=/[A-Z]/g;return e.replace(t,function(e,t){return(t?"-":"")+e.toLowerCase()})},dashToCamel:function(e){var t=/([\:\-\_]+(.))/g,n=/^moz([A-Z])/;return e.replace(t,function(e,t,n,r){return r?n.toUpperCase():n}).replace(n,"Moz$1")},rename:function(e,t){if(t[0]&&t[0].attributes){var n=angular.element("<"+e+"/>");n.html(t.html());for(var r=t[0].attributes,i=0;i').html(this.getTemplate()),this.initCombos(),this.options.smartDays){var e=this;this.$widget.find("select").bind("change",function(t){(angular.element(t.target).hasClass("month")||angular.element(t.target).hasClass("year"))&&e.fillCombo("day")})}this.$widget.find("select").css("width","auto"),this.$element.css("display","none").after(this.$widget),this.setValue(this.$element.val()||this.options.value)},getTemplate:function(){var e=this.options.template,t=this.options.customClass;return angular.forEach(this.map,function(t,n){t=t[0];var r=new RegExp(t+"+"),i=t.length>1?t.substring(1,2):t;e=e.replace(r,"{"+i+"}")}),e=e.replace(/ /g," "),angular.forEach(this.map,function(n,r){n=n[0];var i=n.length>1?n.substring(1,2):n;e=e.replace("{"+i+"}",'')}),e},initCombos:function(){for(var e in this.map){var t=this.$widget[0].querySelectorAll("."+e);this["$"+e]=t.length?angular.element(t):null,this.fillCombo(e)}},fillCombo:function(e){var t=this["$"+e];if(t){var n="fill"+e.charAt(0).toUpperCase()+e.slice(1),r=this[n](),i=t.val();t.html("");for(var o=0;o'+r[o][1]+"");t.val(i)}},fillCommon:function(e){var t,n=[];if("name"===this.options.firstItem){t=moment.relativeTime||moment.langData()._relativeTime;var r="function"==typeof t[e]?t[e](1,!0,e,!1):t[e];r=r.split(" ").reverse()[0],n.push(["",r])}else"empty"===this.options.firstItem&&n.push(["",""]);return n},fillDay:function(){var e,t,n=this.fillCommon("d"),r=-1!==this.options.template.indexOf("DD"),i=31;if(this.options.smartDays&&this.$month&&this.$year){var o=parseInt(this.$month.val(),10),a=parseInt(this.$year.val(),10);isNaN(o)||isNaN(a)||(i=moment([a,o]).daysInMonth())}for(t=1;t<=i;t++)e=r?this.leadZero(t):t,n.push([t,e]);return n},fillMonth:function(){var e,t,n=this.fillCommon("M"),r=-1!==this.options.template.indexOf("MMMM"),i=-1!==this.options.template.indexOf("MMM"),o=-1!==this.options.template.indexOf("MM");for(t=0;t<=11;t++)e=r?moment().date(1).month(t).format("MMMM"):i?moment().date(1).month(t).format("MMM"):o?this.leadZero(t+1):t+1,n.push([t,e]);return n},fillYear:function(){var e,t,n=[],r=-1!==this.options.template.indexOf("YYYY");for(t=this.options.maxYear;t>=this.options.minYear;t--)e=r?t:(t+"").substring(2),n[this.options.yearDescending?"push":"unshift"]([t,e]);return n=this.fillCommon("y").concat(n)},fillHour:function(){var e,t,n=this.fillCommon("h"),r=-1!==this.options.template.indexOf("h"),i=(this.options.template.indexOf("H"),-1!==this.options.template.toLowerCase().indexOf("hh")),o=r?1:0,a=r?12:23;for(t=o;t<=a;t++)e=i?this.leadZero(t):t,n.push([t,e]);return n},fillMinute:function(){var e,t,n=this.fillCommon("m"),r=-1!==this.options.template.indexOf("mm");for(t=0;t<=59;t+=this.options.minuteStep)e=r?this.leadZero(t):t,n.push([t,e]);return n},fillSecond:function(){var e,t,n=this.fillCommon("s"),r=-1!==this.options.template.indexOf("ss");for(t=0;t<=59;t+=this.options.secondStep)e=r?this.leadZero(t):t,n.push([t,e]);return n},fillAmpm:function(){var e=-1!==this.options.template.indexOf("a");this.options.template.indexOf("A");return[["am",e?"am":"AM"],["pm",e?"pm":"PM"]]},getValue:function(e){var t,n={},r=this,i=!1;return angular.forEach(this.map,function(e,t){if("ampm"!==t){var o="day"===t?1:0;return n[t]=r["$"+t]?parseInt(r["$"+t].val(),10):o,isNaN(n[t])?(i=!0,!1):void 0}}),i?"":(this.$ampm&&(12===n.hour?n.hour="am"===this.$ampm.val()?0:12:n.hour="am"===this.$ampm.val()?n.hour:n.hour+12),t=moment([n.year,n.month,n.day,n.hour,n.minute,n.second]),this.highlight(t),e=void 0===e?this.options.format:e,null===e?t.isValid()?t:null:t.isValid()?t.format(e):"")},setValue:function(e){function t(e,t){var n={};return angular.forEach(e.children("option"),function(e,r){var i=angular.element(e).attr("value");if(""!==i){var o=Math.abs(i-t);(void 0===n.distance||o=12?(i.ampm="pm",i.hour>12&&(i.hour-=12)):(i.ampm="am",0===i.hour&&(i.hour=12))),angular.forEach(i,function(e,n){r["$"+n]&&("minute"===n&&r.options.minuteStep>1&&r.options.roundTime&&(e=t(r["$"+n],e)),"second"===n&&r.options.secondStep>1&&r.options.roundTime&&(e=t(r["$"+n],e)),r["$"+n].val(e))}),this.options.smartDays&&this.fillCombo("day"),this.$element.val(n.format(this.options.format)).triggerHandler("change"))}},highlight:function(e){e.isValid()?this.options.errorClass?this.$widget.removeClass(this.options.errorClass):this.$widget.find("select").css("border-color",this.borderColor):this.options.errorClass?this.$widget.addClass(this.options.errorClass):(this.borderColor||(this.borderColor=this.$widget.find("select").css("border-color")),this.$widget.find("select").css("border-color","red"))},leadZero:function(e){return e<=9?"0"+e:e},destroy:function(){this.$widget.remove(),this.$element.removeData("combodate").show()}},{getInstance:function(t,n){return new e(t,n)}}}]),angular.module("xeditable").factory("editableIcons",function(){return{default:{bs2:{ok:"icon-ok icon-white",cancel:"icon-remove",clear:"icon-trash"},bs3:{ok:"glyphicon glyphicon-ok",cancel:"glyphicon glyphicon-remove",clear:"glyphicon glyphicon-trash"}},external:{"font-awesome":{ok:"fa fa-check",cancel:"fa fa-times",clear:"fa fa-trash"}}}}),angular.module("xeditable").factory("editableThemes",function(){return{default:{formTpl:'
    ',noformTpl:'',controlsTpl:'',inputTpl:"",errorTpl:'
    ',buttonsTpl:'',submitTpl:'',cancelTpl:'',resetTpl:''},bs2:{formTpl:'
    ',noformTpl:'',controlsTpl:'
    ',inputTpl:"",errorTpl:'
    ',buttonsTpl:'',submitTpl:'',cancelTpl:'',resetTpl:''},bs3:{formTpl:'
    ',noformTpl:'',controlsTpl:'
    ',inputTpl:"",errorTpl:'
    ',buttonsTpl:'',submitTpl:'',cancelTpl:'',resetTpl:'',buttonsClass:"",inputClass:"",postrender:function(){switch(this.directiveName){case"editableText":case"editableSelect":case"editableTextarea":case"editableEmail":case"editableTel":case"editableNumber":case"editableUrl":case"editableSearch":case"editableDate":case"editableDatetime":case"editableBsdate":case"editableTime":case"editableMonth":case"editableWeek":case"editablePassword":case"editableDatetimeLocal":if(this.inputEl.addClass("form-control"),this.theme.inputClass){if(this.inputEl.attr("multiple")&&("input-sm"===this.theme.inputClass||"input-lg"===this.theme.inputClass))break;this.inputEl.addClass(this.theme.inputClass)}break;case"editableCheckbox":this.editorEl.addClass("checkbox")}this.buttonsEl&&this.theme.buttonsClass&&this.buttonsEl.find("button").addClass(this.theme.buttonsClass)}},semantic:{formTpl:'
    ',noformTpl:'',controlsTpl:'
    ',inputTpl:"",errorTpl:'
    ',buttonsTpl:'',submitTpl:'',cancelTpl:'',resetTpl:''}}}),define("common/angularXeditable",["common/angular"],function(){}),function(e,t){"function"==typeof define&&define.amd?define("common/rangy-core",e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e():t.rangy=e()}(function(){function e(e,t){var n=typeof e[t];return n==b||!(n!=y||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!==y||!e[t])}function n(e,t){return typeof e[t]!==w}function r(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}function i(e){return e&&S(e,k)&&_(e,E)}function o(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!==w&&e(console,"log")&&console.log(t)}function s(e,t){A&&t?alert(e):a(e)}function l(e){N.initialized=!0,N.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,N.config.alertOnFail)}function u(e){s("Rangy warning: "+e,N.config.alertOnWarn)}function c(e){return e.message||e.description||String(e)}function f(){if(A&&!N.initialized){var t,n=!1,r=!1;e(document,"createRange")&&(t=document.createRange(),S(t,C)&&_(t,x)&&(n=!0));var s=o(document);if(!s||"body"!=s.nodeName.toLowerCase())return void l("No body element found");if(s&&e(s,"createTextRange")&&(t=s.createTextRange(),i(t)&&(r=!0)),!n&&!r)return void l("Neither Range nor TextRange are available");N.initialized=!0,N.features={implementsDomRange:n,implementsTextRange:r};var u,f;for(var d in D)(u=D[d])instanceof m&&u.init(u,N);for(var p=0,h=P.length;pt?(o.node=r,o.offset-=t):o.node==e.parentNode&&o.offset>i(e)&&++o.offset;return r}function h(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!==A)return e.ownerDocument;if(typeof e.document!==A)return e.document;if(e.parentNode)return h(e.parentNode);throw t.createError("getDocument: no document found for node")}function m(e){var n=h(e);if(typeof n.defaultView!==A)return n.defaultView;if(typeof n.parentWindow!==A)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function g(e){if(typeof e.contentDocument!==A)return e.contentDocument;if(typeof e.contentWindow!==A)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function v(e){if(typeof e.contentWindow!==A)return e.contentWindow;if(typeof e.contentDocument!==A)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function $(e){return e&&O.isHostMethod(e,"setTimeout")&&O.isHostObject(e,"document")}function y(e,t,n){var r;if(e?O.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?g(e):h(e):$(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function b(e){for(var t;t=e.parentNode;)e=t;return e}function w(e,n,r,o){var s,l,c,f,d;if(e==r)return n===o?0:n[index:"+i(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function E(e){for(var t,n=h(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function k(e,t,n){var r=N(e),i=e.createElement("div");i.contentEditable=""+!!n,t&&(i.innerHTML=t);var o=r.firstChild;return o?r.insertBefore(i,o):r.appendChild(i),i}function S(e){return e.parentNode.removeChild(e)}function M(e){this.root=e,this._next=e}function _(e){return new M(e)}function T(e,t){this.node=e,this.offset=t}function D(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var A="undefined",O=e.util,N=O.getBody;O.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),O.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var R=document.createElement("div");O.areHostMethods(R,["insertBefore","appendChild","cloneNode"]||!O.areHostObjects(R,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),O.isHostProperty(R,"innerHTML")||t.fail("Element is missing innerHTML property");var I=document.createTextNode("test");O.areHostMethods(I,["splitText","deleteData","insertData","appendData","cloneNode"]||!O.areHostObjects(R,["previousSibling","nextSibling","childNodes","parentNode"])||!O.areHostProperties(I,["data"]))||t.fail("Incomplete Text Node implementation");var P=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},L=!1;!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="
    ",L=x(n),e.features.crashyTextNodes=L}();var F;typeof window.getComputedStyle!==A?F=function(e,t){return m(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!==A?F=function(e,t){return e.currentStyle?e.currentStyle[t]:""}:t.fail("No means of obtaining computed style properties found"),M.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},T.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+C(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},D.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},D.prototype.toString=function(){return this.message},e.dom={arrayContains:P,isHtmlNamespace:n,parentElement:r,getNodeIndex:i,getNodeLength:o,getCommonAncestor:a,isAncestorOf:s,isOrIsAncestorOf:l,getClosestAncestorIn:u,isCharacterDataNode:c,isTextOrCommentNode:f,insertAfter:d,splitDataNode:p,getDocument:h,getWindow:m,getIframeWindow:v,getIframeDocument:g,getBody:N,isWindow:$,getContentDocument:y,getRootContainer:b,comparePoints:w,isBrokenNode:x,inspectNode:C,getComputedStyleProperty:F,createTestElement:k,removeNode:S,fragmentFromNodeChildren:E,createIterator:_,DomPosition:T},e.DOMException=D}),N.createCoreModule("DomRange",["DomUtil"],function(e,t){function n(e,t){return 3!=e.nodeType&&(H(e,t.startContainer)||H(e,t.endContainer))}function r(e){return e.document||q(e.startContainer)}function i(e){return G(e.startContainer)}function o(e){return new L(e.parentNode,j(e))}function a(e){return new L(e.parentNode,j(e)+1)}function s(e,t,n){var r=11==e.nodeType?e.firstChild:e;return U(t)?n==t.length?I.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:B(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),r}function l(e,t,n){if(k(e),k(t),r(t)!=r(e))throw new F("WRONG_DOCUMENT_ERR");var i=V(e.startContainer,e.startOffset,t.endContainer,t.endOffset),o=V(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?i<=0&&o>=0:i<0&&o>0}function u(e){for(var t,n,i,o=r(e.range).createDocumentFragment();n=e.next();){if(t=e.isPartiallySelectedSubtree(),n=n.cloneNode(!t),t&&(i=e.getSubtreeIterator(),n.appendChild(u(i)),i.detach()),10==n.nodeType)throw new F("HIERARCHY_REQUEST_ERR");o.appendChild(n)}return o}function c(e,t,n){var r,i;n=n||{stop:!1};for(var o,a;o=e.next();)if(e.isPartiallySelectedSubtree()){if(!1===t(o))return void(n.stop=!0);if(a=e.getSubtreeIterator(),c(a,t,n),a.detach(),n.stop)return}else for(r=I.createIterator(o);i=r.next();)if(!1===t(i))return void(n.stop=!0)}function f(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),f(t),t.detach()):e.remove()}function d(e){for(var t,n,i=r(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),n=e.getSubtreeIterator(),t.appendChild(d(n)),n.detach()):e.remove(),10==t.nodeType)throw new F("HIERARCHY_REQUEST_ERR");i.appendChild(t)}return i}function p(e,t,n){var r,i=!(!t||!t.length),o=!!n;i&&(r=new RegExp("^("+t.join("|")+")$"));var a=[];return c(new m(e,!1),function(t){if((!i||r.test(t.nodeType))&&(!o||n(t))){var s=e.startContainer;if(t!=s||!U(s)||e.startOffset!=s.length){var l=e.endContainer;t==l&&U(l)&&0==e.endOffset||a.push(t)}}}),a}function h(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+I.inspectNode(e.startContainer)+":"+e.startOffset+", "+I.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function m(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&U(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||U(this.sc)?z(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||U(this.ec)?z(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function g(e){return function(t,n){for(var r,i=n?t:t.parentNode;i;){if(r=i.nodeType,W(e,r))return i;i=i.parentNode}return null}}function v(e,t){if(ie(e,t))throw new F("INVALID_NODE_TYPE_ERR")}function $(e,t){if(!W(t,e.nodeType))throw new F("INVALID_NODE_TYPE_ERR")}function y(e,t){if(t<0||t>(U(e)?e.length:e.childNodes.length))throw new F("INDEX_SIZE_ERR")}function b(e,t){if(ne(e,!0)!==ne(t,!0))throw new F("WRONG_DOCUMENT_ERR")}function w(e){if(re(e,!0))throw new F("NO_MODIFICATION_ALLOWED_ERR")}function x(e,t){if(!e)throw new F(t)}function C(e,t){return t<=(U(e)?e.length:e.childNodes.length)}function E(e){return!!e.startContainer&&!!e.endContainer&&!(K&&(I.isBrokenNode(e.startContainer)||I.isBrokenNode(e.endContainer)))&&G(e.startContainer)==G(e.endContainer)&&C(e.startContainer,e.startOffset)&&C(e.endContainer,e.endOffset)}function k(e){if(!E(e))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+e.inspect()+")")}function S(e,t){k(e);var n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,a=n===i;U(i)&&o>0&&o0&&r=j(n)&&o++,r=0),e.setStartAndEnd(n,r,i,o)}function M(e){k(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function _(e){e.START_TO_START=ue,e.START_TO_END=ce,e.END_TO_END=fe,e.END_TO_START=de,e.NODE_BEFORE=pe,e.NODE_AFTER=he,e.NODE_BEFORE_AND_AFTER=me,e.NODE_INSIDE=ge}function T(e){_(e),_(e.prototype)}function D(e,t){return function(){k(this);var n,r,i=this.startContainer,o=this.startOffset,s=this.commonAncestorContainer,l=new m(this,!0);i!==s&&(n=z(i,s,!0),r=a(n),i=r.node,o=r.offset),c(l,w),l.reset();var u=e(l);return l.detach(),t(this,i,o,i,o),u}}function A(t,r){function i(e,t){return function(n){$(n,J),$(G(n),Q);var r=(e?o:a)(n);(t?s:l)(this,r.node,r.offset)}}function s(e,t,n){var i=e.endContainer,o=e.endOffset;t===e.startContainer&&n===e.startOffset||(G(t)==G(i)&&1!=V(t,n,i,o)||(i=t,o=n),r(e,t,n,i,o))}function l(e,t,n){var i=e.startContainer,o=e.startOffset;t===e.endContainer&&n===e.endOffset||(G(t)==G(i)&&-1!=V(t,n,i,o)||(i=t,o=n),r(e,i,o,t,n))}var u=function(){};u.prototype=e.rangePrototype,t.prototype=new u,P.extend(t.prototype,{setStart:function(e,t){v(e,!0),y(e,t),s(this,e,t)},setEnd:function(e,t){v(e,!0),y(e,t),l(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],n=e[1],i=t,o=n;switch(e.length){case 3:o=e[2];break;case 4:i=e[2],o=e[3]}r(this,t,n,i,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:i(!0,!0),setStartAfter:i(!1,!0),setEndBefore:i(!0,!1),setEndAfter:i(!1,!1),collapse:function(e){k(this),e?r(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):r(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){v(e,!0),r(this,e,0,e,Y(e))},selectNode:function(e){v(e,!1),$(e,J);var t=o(e),n=a(e);r(this,t.node,t.offset,n.node,n.offset)},extractContents:D(d,r),deleteContents:D(f,r),canSurroundContents:function(){k(this),w(this.startContainer),w(this.endContainer);var e=new m(this,!0),t=e._first&&n(e._first,this)||e._last&&n(e._last,this);return e.detach(),!t},splitBoundaries:function(){S(this)},splitBoundariesPreservingPositions:function(e){S(this,e)},normalizeBoundaries:function(){k(this);var e,t=this.startContainer,n=this.startOffset,i=this.endContainer,o=this.endOffset,a=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(i=e,o=e.length,e.appendData(t.data),Z(t))},s=function(e){var r=e.previousSibling;if(r&&r.nodeType==e.nodeType){t=e;var a=e.length;if(n=r.length,e.insertData(0,r.data),Z(r),t==i)o+=n,i=t;else if(i==e.parentNode){var s=j(e);o==s?(i=e,o=a):o>s&&o--}}},l=!0;if(U(i))o==i.length?a(i):0==o&&(e=i.previousSibling)&&e.nodeType==i.nodeType&&(o=e.length,t==i&&(l=!1),e.appendData(i.data),Z(i),i=e);else{if(o>0){var u=i.childNodes[o-1];u&&U(u)&&a(u)}l=!this.collapsed}if(l){if(U(t))0==n?s(t):n==t.length&&(e=t.nextSibling)&&e.nodeType==t.nodeType&&(i==e&&(i=t,o+=t.length),t.appendData(e.data),Z(e));else if(nx",ae=3==oe.firstChild.nodeType}catch(e){}e.features.htmlParsingConforms=ae;var se=ae?function(e){var t=this.startContainer,n=q(t);if(!t)throw new F("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:U(t)&&(r=I.parentElement(t)),r=null===r||"HTML"==r.nodeName&&I.isHtmlNamespace(q(r).documentElement)&&I.isHtmlNamespace(r)?n.createElement("body"):r.cloneNode(!1),r.innerHTML=e,I.fragmentFromNodeChildren(r)}:function(e){var t=r(this),n=t.createElement("body");return n.innerHTML=e,I.fragmentFromNodeChildren(n)},le=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ue=0,ce=1,fe=2,de=3,pe=0,he=1,me=2,ge=3;P.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){k(this),b(this.startContainer,t.startContainer);var n,r,i,o,a=e==de||e==ue?"start":"end",s=e==ce||e==ue?"start":"end";return n=this[a+"Container"],r=this[a+"Offset"],i=t[s+"Container"],o=t[s+"Offset"],V(n,r,i,o)},insertNode:function(e){if(k(this),$(e,ee),w(this.startContainer),H(e,this.startContainer))throw new F("HIERARCHY_REQUEST_ERR") +;var t=s(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){k(this);var e,t;if(this.collapsed)return r(this).createDocumentFragment();if(this.startContainer===this.endContainer&&U(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=r(this).createDocumentFragment(),t.appendChild(e),t;var n=new m(this,!0);return e=u(n),n.detach(),e},canSurroundContents:function(){k(this),w(this.startContainer),w(this.endContainer);var e=new m(this,!0),t=e._first&&n(e._first,this)||e._last&&n(e._last,this);return e.detach(),!t},surroundContents:function(e){if($(e,te),!this.canSurroundContents())throw new F("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);s(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){k(this);for(var e,t=new R(r(this)),n=le.length;n--;)e=le[n],t[e]=this[e];return t},toString:function(){k(this);var e=this.startContainer;if(e===this.endContainer&&U(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new m(this,!0);return c(n,function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){k(this);var t=e.parentNode,n=j(e);if(!t)throw new F("NOT_FOUND_ERR");var r=this.comparePoint(t,n),i=this.comparePoint(t,n+1);return r<0?i>0?me:pe:i>0?he:ge},comparePoint:function(e,t){return k(this),x(e,"HIERARCHY_REQUEST_ERR"),b(e,this.startContainer),V(e,t,this.startContainer,this.startOffset)<0?-1:V(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:se,toHtml:function(){return M(this)},intersectsNode:function(e,t){if(k(this),G(e)!=i(this))return!1;var n=e.parentNode,r=j(e);if(!n)return!0;var o=V(n,r,this.endContainer,this.endOffset),a=V(n,r+1,this.startContainer,this.startOffset);return t?o<=0&&a>=0:o<0&&a>0},isPointInRange:function(e,t){return k(this),x(e,"HIERARCHY_REQUEST_ERR"),b(e,this.startContainer),V(e,t,this.startContainer,this.startOffset)>=0&&V(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return l(this,e,!1)},intersectsOrTouchesRange:function(e){return l(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=V(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=V(this.endContainer,this.endOffset,e.endContainer,e.endOffset),r=this.cloneRange();return-1==t&&r.setStart(e.startContainer,e.startOffset),1==n&&r.setEnd(e.endContainer,e.endOffset),r}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==V(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==V(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new F("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==ge},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,Y(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var r=n.pop();return t.setEnd(r,r.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return k(this),p(this,e,t)},getDocument:function(){return r(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var n=r(this),i=e.createRange(n);t=t||I.getBody(n),i.selectNodeContents(t);var o=this.intersection(i),a=0,s=0;return o&&(i.setEnd(o.startContainer,o.startOffset),a=i.toString().length,s=a+o.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var r,i,o,a,s=[t],l=!1,u=!1;!u&&(r=s.pop());)if(3==r.nodeType)i=n+r.length,!l&&e.start>=n&&e.start<=i&&(this.setStart(r,e.start-n),l=!0),l&&e.end>=n&&e.end<=i&&(this.setEnd(r,e.end-n),u=!0),n=i;else for(a=r.childNodes,o=a.length;o--;)s.push(a[o])},getName:function(){return"DomRange"},equals:function(e){return R.rangesEqual(this,e)},isValid:function(){return E(this)},inspect:function(){return h(this)},detach:function(){}}),A(R,N),P.extend(R,{rangeProperties:le,RangeIterator:m,copyComparisonConstants:T,createPrototypeRange:A,inspect:h,toHtml:M,getRangeDocument:r,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=R}),N.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,r,i=e.dom,o=e.util,a=i.DomPosition,s=e.DomRange,l=i.getBody,u=i.getContentDocument,c=i.isCharacterDataNode;if(e.features.implementsDomRange&&function(){function r(e){for(var t,n=d.length;n--;)t=d[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function a(e,t,n,r,i){var o=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==r||e.endOffset!=i,s=!e.equals(e.nativeRange);(o||a||s)&&(e.setEnd(r,i),e.setStart(t,n))}var c,f,d=s.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,r(this)},s.createPrototypeRange(n,a),c=n.prototype,c.selectNode=function(e){this.nativeRange.selectNode(e),r(this)},c.cloneContents=function(){return this.nativeRange.cloneContents()},c.surroundContents=function(e){this.nativeRange.surroundContents(e),r(this)},c.collapse=function(e){this.nativeRange.collapse(e),r(this)},c.cloneRange=function(){return new n(this.nativeRange.cloneRange())},c.refresh=function(){r(this)},c.toString=function(){return this.nativeRange.toString()};var p=document.createTextNode("test");l(document).appendChild(p);var h=document.createRange();h.setStart(p,0),h.setEnd(p,0);try{h.setStart(p,1),c.setStart=function(e,t){this.nativeRange.setStart(e,t),r(this)},c.setEnd=function(e,t){this.nativeRange.setEnd(e,t),r(this)},f=function(e){return function(t){this.nativeRange[e](t),r(this)}}}catch(e){c.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}r(this)},c.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}r(this)},f=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(r){this.nativeRange[t](n),this.nativeRange[e](n)}r(this)}}}c.setStartBefore=f("setStartBefore","setEndBefore"),c.setStartAfter=f("setStartAfter","setEndAfter"),c.setEndBefore=f("setEndBefore","setStartBefore"),c.setEndAfter=f("setEndAfter","setStartAfter"),c.selectNodeContents=function(e){this.setStartAndEnd(e,0,i.getNodeLength(e))},h.selectNodeContents(p),h.setEnd(p,3);var m=document.createRange();m.selectNodeContents(p),m.setEnd(p,4),m.setStart(p,2),-1==h.compareBoundaryPoints(h.START_TO_END,m)&&1==h.compareBoundaryPoints(h.END_TO_START,m)?c.compareBoundaryPoints=function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:c.compareBoundaryPoints=function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var g=document.createElement("div");g.innerHTML="123";var v=g.firstChild,$=l(document);$.appendChild(g),h.setStart(v,1),h.setEnd(v,2),h.deleteContents(),"13"==v.data&&(c.deleteContents=function(){this.nativeRange.deleteContents(),r(this)},c.extractContents=function(){var e=this.nativeRange.extractContents();return r(this),e}),$.removeChild(g),$=null,o.isHostMethod(h,"createContextualFragment")&&(c.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),l(document).removeChild(p),c.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=u(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var f=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var r=n.parentElement();n=e.duplicate(),n.collapse(!1);var o=n.parentElement(),a=r==o?r:i.getCommonAncestor(r,o);return a==t?a:i.getCommonAncestor(t,a)},d=function(e){return 0==e.compareEndPoints("StartToEnd",e)},p=function(e,t,n,r,o){var s=e.duplicate();s.collapse(n);var l=s.parentElement();if(i.isOrIsAncestorOf(t,l)||(l=t),!l.canHaveHTML){var u=new a(l.parentNode,i.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var f=i.getDocument(l).createElement("span");f.parentNode&&i.removeNode(f);for(var d,p,h,m,g,v=n?"StartToStart":"StartToEnd",$=o&&o.containerElement==l?o.nodeIndex:0,y=l.childNodes.length,b=y,w=b;;){if(w==y?l.appendChild(f):l.insertBefore(f,l.childNodes[w]),s.moveToElementText(f),0==(d=s.compareEndPoints(v,e))||$==b)break;if(-1==d){if(b==$+1)break;$=w}else b=b==$+1?$:w;w=Math.floor(($+b)/2),l.removeChild(f)}if(g=f.nextSibling,-1==d&&g&&c(g)){s.setEndPoint(n?"EndToStart":"EndToEnd",e);var x;if(/[\r\n]/.test(g.data)){var C=s.duplicate(),E=C.text.replace(/\r\n/g,"\r").length;for(x=C.moveStart("character",E);-1==(d=C.compareEndPoints("StartToEnd",C));)x++,C.moveStart("character",1)}else x=s.text.length;m=new a(g,x)}else p=(r||!n)&&f.previousSibling,h=(r||n)&&f.nextSibling,m=h&&c(h)?new a(h,0):p&&c(p)?new a(p,p.data.length):new a(l,i.getNodeIndex(f));return i.removeNode(f),{boundaryPosition:m,nodeInfo:{nodeIndex:w,containerElement:l}}},h=function(e,t){var n,r,o,a,s=e.offset,u=i.getDocument(e.node),f=l(u).createTextRange(),d=c(e.node);return d?(n=e.node,r=n.parentNode):(a=e.node.childNodes,n=s1,i=[],o=a(t),s=0;s=36)Y=!1;else{var d=c.cloneRange();c.setStart(u,0),d.setEnd(u,3),d.setStart(u,2),t.addRange(c),t.addRange(d),Y=2==t.rangeCount}}for(S.removeNode(l),t.removeAllRanges(),s=0;s1)b(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;t1?b(this,e):t&&this.addRange(e[0])}}ee.getRangeAt=function(e){if(e<0||e>=this.rangeCount)throw new A("INDEX_SIZE_ERR");return this._ranges[e].cloneRange()};var ne;if(U)ne=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=I(t.win.document).createTextRange(),n.collapse(!0)),"Control"==t.docSelection.type?m(t):p(n)?h(t,n):u(t)};else if(_(j,"getRangeAt")&&"number"==typeof j.rangeCount)ne=function(t){if(Z&&F&&"Control"==t.docSelection.type)m(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,r=t.rangeCount;n0)return e.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range")}),ee.getName=function(){return"WrappedSelection"},ee.inspect=function(){return C(this)},ee.detach=function(){y(this.win,"delete"),$(this)},v.detachAll=function(){y(null,"deleteAll")},v.inspect=C,v.isDirectionBackward=n,e.Selection=v,e.selectionPrototype=ee,e.addShimListener(function(e){void 0===e.getSelection&&(e.getSelection=function(){return X(e)}),e=null})});var F=!1,U=function(e){F||(F=!0,!N.initialized&&N.config.autoInitialize&&f())};return A&&("complete"==document.readyState?U():(e(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",U,!1),I(window,"load",U))),N},this),function(e,t){"function"==typeof define&&define.amd?define("common/rangy-selectionsaverestore",["./rangy-core"],e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e(require("rangy")):e(t.rangy)}(function(e){return e.createModule("SaveRestore",["WrappedRange"],function(e,t){function n(e,t){return(t||document).getElementById(e)}function r(e,t){var n,r="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),i=h.getDocument(e.startContainer),o=e.cloneRange();return o.collapse(t),n=i.createElement("span"),n.id=r,n.style.lineHeight="0",n.style.display="none",n.className="rangySelectionBoundary",n.appendChild(i.createTextNode(v)),o.insertNode(n),n}function i(e,r,i,o){var a=n(i,e);a?(r[o?"setStartBefore":"setEndBefore"](a),m(a)):t.warn("Marker element has been removed. Cannot restore selection.")}function o(e,t){return t.compareBoundaryPoints(e.START_TO_START,e)}function a(t,n){var i,o,a=e.DomRange.getRangeDocument(t),s=t.toString(),l=g(n);return t.collapsed?(o=r(t,!1),{document:a,markerId:o.id,collapsed:!0}):(o=r(t,!1),i=r(t,!0),{document:a,startMarkerId:i.id,endMarkerId:o.id,collapsed:!1,backward:l,toString:function(){return"original text: '"+s+"', new text: '"+t.toString()+"'"}})}function s(r,o){var a=r.document;void 0===o&&(o=!0);var s=e.createRange(a);if(r.collapsed){var l=n(r.markerId,a);if(l){l.style.display="inline";var u=l.previousSibling;u&&3==u.nodeType?(m(l),s.collapseToPoint(u,u.length)):(s.collapseBefore(l),m(l))}else t.warn("Marker element has been removed. Cannot restore selection.")}else i(a,s,r.startMarkerId,!0),i(a,s,r.endMarkerId,!1);return o&&s.normalizeBoundaries(),s}function l(t,r){var i,s,l=[],u=g(r);t=t.slice(0),t.sort(o);for(var c=0,f=t.length;c=0;--c)i=t[c],s=e.DomRange.getRangeDocument(i),i.collapsed?i.collapseAfter(n(l[c].markerId,s)):(i.setEndBefore(n(l[c].endMarkerId,s)),i.setStartAfter(n(l[c].startMarkerId,s)));return l}function u(n){if(!e.isSelectionValid(n))return t.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var r=e.getSelection(n),i=r.getAllRanges(),o=1==i.length&&r.isBackward(),a=l(i,o);return o?r.setSingleRange(i[0],o):r.setRanges(i),{win:n,rangeInfos:a,restored:!1}}function c(e){for(var t=[],n=e.length,r=n-1;r>=0;r--)t[r]=s(e[r],!0);return t}function f(t,n){if(!t.restored){var r=t.rangeInfos,i=e.getSelection(t.win),o=c(r);1==r.length&&n&&e.features.selectionHasExtend&&r[0].backward?(i.removeAllRanges(),i.addRange(o[0],!0)):i.setRanges(o),t.restored=!0}}function d(e,t){var r=n(t,e);r&&m(r)}function p(e){for(var t,n=e.rangeInfos,r=0,i=n.length;r=0&&c[o]!=r;o--);if(o>=0){for(i=c.length-1;i>=o;i--)n.end&&n.end(c[i]);c.length=o}}"string"!=typeof e&&(e=null===e||void 0===e?"":""+e);var o,a,l,u,c=[],f=e;for(c.last=function(){return c[c.length-1]};e;){if(u="",a=!0,c.last()&&O[c.last()])e=e.replace(new RegExp("([^]*)<\\s*\\/\\s*"+c.last()+"[^>]*>","i"),function(e,t){return t=t.replace($,"$1").replace(w,"$1"),n.chars&&n.chars(s(t)),""}),i("",c.last());else{if(E.test(e)){if(l=e.match(E)){l[0];n.whitespace&&n.whitespace(l[0]),e=e.replace(l[0],""),a=!1}}else y.test(e)?(l=e.match(y))&&(n.comment&&n.comment(l[1]),e=e.replace(l[0],""),a=!1):b.test(e)?(l=e.match(b))&&(e=e.replace(l[0],""),a=!1):v.test(e)?(l=e.match(h))&&(e=e.substring(l[0].length),l[0].replace(h,i),a=!1):g.test(e)&&(l=e.match(p),l?(l[4]&&(e=e.substring(l[0].length),l[0].replace(p,r)),a=!1):(u+="<",e=e.substring(1)));a&&(o=e.indexOf("<"),u+=o<0?e:e.substring(0,o),e=o<0?"":e.substring(o),n.chars&&n.chars(s(u)))}if(e==f)throw d("badparse","The sanitizer was unable to parse the following block of html: {0}",e);f=e}i()}function s(e){if(!e)return"";var t=U.exec(e),n=t[1],r=t[3],i=t[2];return i&&(F.innerHTML=i.replace(/=1536&&t<=1540||1807==t||6068==t||6069==t||t>=8204&&t<=8207||t>=8232&&t<=8239||t>=8288&&t<=8303||65279==t||t>=65520&&t<=65535?"&#"+t+";":e}).replace(//g,">")}function u(e){var n="",r=e.split(";");return t.forEach(r,function(e){var r=e.split(":");if(2==r.length){var i=j(t.isString(r[0])?r[0].toLowerCase():r[0]),e=j(t.isString(r[1])?r[1].toLowerCase():r[1]) +;(("color"===i||"background-color"===i)&&(e.match(/^rgb\([0-9%,\. ]*\)$/i)||e.match(/^rgba\([0-9%,\. ]*\)$/i)||e.match(/^hsl\([0-9%,\. ]*\)$/i)||e.match(/^hsla\([0-9%,\. ]*\)$/i)||e.match(/^#[0-9a-f]{3,6}$/i)||e.match(/^[a-z]*$/i))||"text-align"===i&&("left"===e||"right"===e||"center"===e||"justify"===e)||"text-decoration"===i&&("underline"===e||"line-through"===e)||"font-weight"===i&&"bold"===e||"font-style"===i&&"italic"===e||"float"===i&&("left"===e||"right"===e||"none"===e)||"vertical-align"===i&&("baseline"===e||"sub"===e||"super"===e||"test-top"===e||"text-bottom"===e||"middle"===e||"top"===e||"bottom"===e||e.match(/[0-9]*(px|em)/)||e.match(/[0-9]+?%/))||"font-size"===i&&("xx-small"===e||"x-small"===e||"small"===e||"medium"===e||"large"===e||"x-large"===e||"xx-large"===e||"larger"===e||"smaller"===e||e.match(/[0-9]*\.?[0-9]*(px|em|rem|mm|q|cm|in|pt|pc|%)/))||("width"===i||"height"===i)&&e.match(/[0-9\.]*(px|em|rem|%)/)||"direction"===i&&e.match(/^ltr|rtl|initial|inherit$/))&&(n+=i+": "+e+";")}}),n}function c(e,t,n,r){return!("img"!==e||!t["ta-insert-video"]||"ta-insert-video"!==n&&"allowfullscreen"!==n&&"frameborder"!==n&&("contenteditable"!==n||"false"!==r))}function f(e,n){var r=!1,i=t.bind(e,e.push);return{start:function(e,o,a){e=t.isString(e)?e.toLowerCase():e,!r&&O[e]&&(r=e),r||!0!==N[e]||(i("<"),i(e),t.forEach(o,function(r,a){var s=t.isString(a)?a.toLowerCase():a,f="img"===e&&"src"===s||"background"===s;("style"===s&&""!==(r=u(r))||c(e,o,s,r)||!0===L[s]&&(!0!==R[s]||n(r,f)))&&(i(" "),i(a),i('="'),i(l(r)),i('"'))}),i(a?"/>":">"))},comment:function(e){i(e)},whitespace:function(e){i(l(e))},end:function(e){e=t.isString(e)?e.toLowerCase():e,r||!0!==N[e]||(i("")),e==r&&(r=!1)},chars:function(e){r||i(l(e))}}}var d=t.$$minErr("$sanitize"),p=/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,h=/^<\/\s*([\w:-]+)[^>]*>/,m=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,g=/^/g,y=/(^)/,b=/]*?)>/i,w=//g,x=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,C=/([^\#-~| |!])/g,E=/^(\s+)/,k=o("area,br,col,hr,img,wbr,input"),S=o("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),M=o("rp,rt"),_=t.extend({},M,S),T=t.extend({},S,o("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")),D=t.extend({},M,o("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")),A=o("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"),O=o("script,style"),N=t.extend({},k,T,D,_,A),R=o("background,cite,href,longdesc,src,usemap,xlink:href"),I=o("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"),P=o("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=t.extend({},R,P,I),F=document.createElement("pre"),U=/^(\s*)([\s\S]*?)(\s*)$/,j=function(){return String.prototype.trim?function(e){return t.isString(e)?e.trim():e}:function(e){return t.isString(e)?e.replace(/^\s\s*/,"").replace(/\s\s*$/,""):e}}();t.module("ngSanitize",[]).provider("$sanitize",r),t.module("ngSanitize").filter("linky",["$sanitize",function(e){var n=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/,r=/^mailto:/;return function(o,a){function s(e){e&&d.push(i(e))}if(!o)return o;for(var l,u,c,f=o,d=[];l=f.match(n);)u=l[0],l[2]||l[4]||(u=(l[3]?"http://":"mailto:")+u),c=l.index,s(f.substr(0,c)),function(e,n){d.push("
    '),s(n),d.push("")}(u,l[0].replace(r,"")),f=f.substring(c+l[0].length);return s(f),e(d.join(""))}}])}(window,window.angular),define("common/text-angular-sanitize",function(){});var taTools={};angular.module("textAngularSetup",[]).constant("taRegisterTool",registerTextAngularTool).value("taTools",taTools).value("taOptions",{forceTextAngularSanitize:!0,keyMappings:[],toolbar:[["h1","h2","h3","h4","h5","h6","p","pre","quote"],["bold","italics","underline","strikeThrough","ul","ol","redo","undo","clear"],["justifyLeft","justifyCenter","justifyRight","justifyFull","indent","outdent"],["html","insertImage","insertLink","insertVideo","wordcount","charcount"]],classes:{focussed:"focussed",toolbar:"btn-toolbar",toolbarGroup:"btn-group",toolbarButton:"btn btn-default",toolbarButtonActive:"active",disabled:"disabled",textEditor:"form-control",htmlEditor:"form-control"},defaultTagAttributes:{a:{target:""}},setup:{textEditorSetup:function(e){},htmlEditorSetup:function(e){}},defaultFileDropHandler:function(e,t){var n=new FileReader;return"image"===e.type.substring(0,5)&&(n.onload=function(){""!==n.result&&t("insertImage",n.result,!0)},n.readAsDataURL(e),!0)}}).value("taSelectableElements",["a","img"]).value("taCustomRenderers",[{selector:"img",customAttribute:"ta-insert-video",renderLogic:function(e){var t=angular.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),M=w&&w.tagName&&w.tagName.toLowerCase()||"";if("insertorderedlist"===f.toLowerCase()||"insertunorderedlist"===f.toLowerCase()){var _=t("insertorderedlist"===f.toLowerCase()?"ol":"ul"),T=e.getOnlySelectedElements();if(T.length>1&&("ol"===M||"ul"===M))return o(S,T,_,_===M,a);if(M===_)return S[0].childNodes.length!==T.length&&1===T.length?(S=angular.element(T[0]),i(S.parent(),S,_,!0,a)):r(S,a);if("li"===M&&S.parent()[0].tagName.toLowerCase()===_&&1===S.parent().children().length)return r(S.parent(),a);if("li"===M&&S.parent()[0].tagName.toLowerCase()!==_&&1===S.parent().children().length)return s(S.parent(),_);if(M.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,a);if("ol"===M||"ul"===M)return s(S,_);var D=!1;return angular.forEach(S.children(),function(e){e.tagName.match(BLOCKELEMENTS)&&(D=!0)}),D?l(S.children(),S,_):l([angular.element("
    "+w.innerHTML+"
    ")[0]],S,_)}if(M.match(BLOCKELEMENTS)){if($=e.getOnlySelectedElements(),0===$.length)g=angular.element("<"+_+">
  • "+w.innerHTML+"
  • "),S.html(""),S.append(g);else{if(1===$.length&&("ol"===$[0].tagName.toLowerCase()||"ul"===$[0].tagName.toLowerCase()))return $[0].tagName.toLowerCase()===_?r(angular.element($[0]),a):s(angular.element($[0]),_);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("<"+_+">"+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"===M?S.parent():S;!g[0].tagName||!g[0].tagName.match(BLOCKELEMENTS)&&!g.parent().attr("contenteditable");)g=g.parent(),M=(g[0].tagName||"").toLowerCase();if(M===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(M.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"===M)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,M=p.taKeepStyles||l.keepStyles,_=/^(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,M),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&&!_.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="",Q(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?""+X(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,M=p.serial?p.serial:Math.floor(1e16*Math.random());f._name=p.name?p.name:"textAngularEditor"+M;var _=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"+M]():"redo"===e.toLowerCase()?f["$redoTaBindtaTextElement"+M]():(C(e,!1,t,f.defaultTagAttributes),n&&f["reApplyOnSelectorHandlerstaTextElement"+M](),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"),_(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),_(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),_(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"+M,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":d.attr("ng-model-options")}),f.displayElements.text.attr({id:"taTextElement"+M,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"+M],f.updateTaBindtaHtmlElement=f["updateTaBindtaHtmlElement"+M],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"+M]()},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"+M])}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"+M]()}),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"+M]()})}catch(e){l.error(e)}}),i.preventDefault(),i.stopPropagation()):t(function(){f["updateTaBindtaTextElement"+M]()},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 M=o(function(){b.sizeSearchInput()},50);angular.element(f).bind("resize",M),t.$on("$destroy",function(){b.searchInput.off("keyup keydown tagged blur paste"),angular.element(f).off("resize",M)}),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>Ma){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();Ma=!(a.f||a.e),r.remove()}}return Ma?(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)*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 Me(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),_e(t,n,e,r)}}function _e(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)}:$;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=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,_.c.toString(),t,r)}function l(e,t,r){return n(e,_.x.toString(),t,r)}function u(e,t,r){return n(e,_.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($),M=Be($);h.forEach(function(e,t){y.set(e.toLowerCase(),t)});var _={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:Xe,e:Xe,H:tt,I:tt,j:et,L:it,m:Qe,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 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 $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])<_a&&da(e[1]-t[1])<_a}function xt(e,t){e*=Ra;var n=Math.cos(t*=Ra);Ct(n*Math.cos(e),n*Math.sin(e),Math.sin(t))}function Ct(e,t,n){++$s,bs+=(e-bs)/$s,ws+=(t-ws)/$s,xs+=(n-xs)/$s}function Et(){function e(e,i){e*=Ra;var o=Math.cos(i*=Ra),a=o*Math.cos(e),s=o*Math.sin(e),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=n*l-r*s)*u+(u=r*a-t*l)*u+(u=t*s-n*a)*u),t*a+n*s+r*l);ys+=u,Cs+=u*(t+(t=a)),Es+=u*(n+(n=s)),ks+=u*(r+(r=l)),Ct(t,n,r)}var t,n,r;Ts.point=function(i,o){i*=Ra;var a=Math.cos(o*=Ra);t=a*Math.cos(i),n=a*Math.sin(i),r=Math.sin(o),Ts.point=e,Ct(t,n,r)}}function kt(){Ts.point=xt}function St(){function e(e,t){e*=Ra;var n=Math.cos(t*=Ra),a=n*Math.cos(e),s=n*Math.sin(e),l=Math.sin(t),u=i*l-o*s,c=o*a-r*l,f=r*s-i*a,d=Math.sqrt(u*u+c*c+f*f),p=r*a+i*s+o*l,h=d&&-ee(p)/d,m=Math.atan2(d,p);Ss+=h*u,Ms+=h*c,_s+=h*f,ys+=m,Cs+=m*(r+(r=a)),Es+=m*(i+(i=s)),ks+=m*(o+(o=l)),Ct(r,i,o)}var t,n,r,i,o;Ts.point=function(a,s){t=a,n=s,Ts.point=e,a*=Ra;var l=Math.cos(s*=Ra);r=l*Math.cos(a),i=l*Math.sin(a),o=Math.sin(s),Ct(r,i,o)},Ts.lineEnd=function(){e(t,n),Ts.lineEnd=kt,Ts.point=xt}}function Mt(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function _t(){return!0}function Tt(e,t,n,r,i){var o=[],a=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t];if(wt(n,r)){i.lineStart();for(var s=0;t>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-_a:Na-e[1])-((t=t.x)[0]<0?t[1]-Na-_a: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)<_a?(e.point(n,r=(r+a)/2>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)<_a&&(n-=i*_a),da(o-s)<_a&&(o-=s*_a),r=Lt(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}function Lt(e,t,n,r){var i,o,a=Math.sin(e-n);return da(a)>_a?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])>_a){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 M=gt(i,S);yt(M);var _=(E^w>=0?-1:1)*te(M[2]);(r>_||r===_&&(S[0]||S[1]))&&(a+=E^w>=0?1:-1)}if(!g++)break;d=v,h=y,m=b,f=e}}return(-_a>o||_a>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]+=_a,h[1]+=_a,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,M=da(S-Da)<_a,_=M||_a>S;if(!M&&E>k&&(w=E,E=k,k=w),_?M?E+k>0^b[1]<(da(b[0]-x)<_a?E:k):E<=b[1]&&b[1]<=k:S>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)>_a;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)<_a?i>0?0:3:da(r[0]-n)<_a?i>0?2:1:da(r[1]-t)<_a?i>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=[]),E=!0,C=!1,w=x=NaN}function p(){m&&(h($,y),b&&C&&M.rejoin(),m.push(M.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}};_(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,M=Rt(),_=Ht(e,t,n,r),T={point:f,lineStart:d,lineEnd:p,polygonStart:function(){s=M,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 Qt(){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),Ms+=a*(i+t),_s+=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 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(){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)<_a||da(r-d)<_a?(r+d)/2:Math.atan2(x,w),M=e(S,k),_=M[0],T=M[1],D=_-t,A=T-n,O=y*D-$*A;(O*O/b>o||da(($*D+y*A)/b-.5)>.3||a>s*p+l*h+u*m)&&(i(t,n,r,s,l,u,_,T,S,w/=E,x/=E,C,g,v),v.point(_,T),i(_,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=Mt(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?Mt(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-_a)%(2*Math.PI)}function gn(e,t,n){var r=na.range(e,t-_a,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-_a,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+_a>t&&(t=-Na+_a):t>Na-_a&&(t=Na-_a);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):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)<_a?ln:(n.invert=function(e,t){var n=o-t;return[Math.atan2(e,n)/i,o-Q(i)*Math.sqrt(e*e+n*n)]},n)}function kn(e,t){return[e,Math.log(Math.tan(Da/4+t/2))]}function Sn(e){var t,n=on(e),r=n.scale,i=n.translate,o=n.clipExtent;return n.scale=function(){var e=r.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.translate=function(){var e=i.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.clipExtent=function(e){var a=o.apply(n,arguments);if(a===n){if(t=null==e){var s=Da*r(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else t&&(a=null);return a},n.clipExtent(null)}function Mn(e,t){return[Math.log(Math.tan(Da/4+t/2)),-e]}function _n(e){return e[0]}function Tn(e){return e[1]}function Dn(e){for(var t=e.length,n=[0,1],r=2,i=2;t>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 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)<_a&&da(r-l.circle.cy)<_a;)o=l.P,s.unshift(l),Ln(l),l=o;s.unshift(l),Wn(l);for(var u=a;u.circle&&da(n-u.circle.x)<_a&&da(r-u.circle.cy)<_a;)a=u.N,s.push(u),Ln(u),u=a;s.push(u),Wn(u);var c,f=s.length;for(c=1;f>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 Un(e){for(var t,n,r,i,o=e.x,a=e.y,s=Js._;s;)if((r=jn(s,a)-o)>_a)s=s.L;else{if(!((i=o-Hn(s,a))>_a)){r>-_a?(t=s.P,n=s):i>-_a?(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};Xn(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)>_a||da(i-n)>_a)&&(s.splice(a,0,new er(Qn(o.site,c,da(r-f)<_a&&h-i>_a?{x:f,y:da(t-f)<_a?n:h}:da(i-h)<_a&&d-r>_a?{x:da(n-h)<_a?t:d,y:h}:da(r-d)<_a&&i-p>_a?{x:d,y:da(t-d)<_a?n:p}:da(i-p)<_a&&r-f>_a?{x:da(n-p)<_a?t:f,y:p}:null),o.site,null)),++l)}function Bn(e,t){return t.angle-e.angle}function zn(){nr(this),this.x=this.y=this.arc=this.site=this.cy=null}function Yn(e){var t=e.P,n=e.N;if(t&&n){var r=t.site,i=e.site,o=n.site;if(r!==o){var a=i.x,s=i.y,l=r.x-a,u=r.y-s,c=o.x-a,f=o.y-s,d=2*(l*f-u*c);if(!(d>=-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=Xs._;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 Mr(e){return 1-Math.cos(e*Na)}function _r(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 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(zi(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)},Bi(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,$=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,M=C-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)?_t: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=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],Xo(+n[1]+1),1>t?1:t)},r.tickFormat=function(){return n},r.copy=function(){return Qo(e.copy(),t,n)},Bi(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]},$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=_(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=_(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 M(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 Ma=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 _a=1e-6,Ta=_a*_a,Da=Math.PI,Aa=2*Da,Oa=Aa-_a,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(_[0],Math.min(_[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},M=[960,500],_=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=M[0],r=M[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?(_=null==t?ja:[+t[0],+t[1]],e):_},e.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],e):v},e.size=function(t){return arguments.length?(M=t&&[+t[0],+t[1]],e):M},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=Me($),na.dsv=function(e,t){function n(e,n,o){arguments.length<3&&(o=n,n=null);var a=_e(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[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,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;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($)>_a&&(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)):$>_a?p=90:-_a>$&&(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=Ms=_s=0,na.geo.stream(e,Ts);var t=Ss,n=Ms,r=_s,i=t*t+n*n+r*r;return Ta>i&&(t=Cs,n=Es,r=ks,_a>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,Ms,_s,Ts={sphere:w,point:xt,lineStart:Et,lineEnd:kt,polygonStart:function(){Ts.lineStart=St},polygonEnd:function(){Ts.lineStart=Et}},Ds=Ot(_t,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+_a,f+.12*u+_a],[c-.214*u-_a,f+.234*u-_a]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+_a,f+.166*u+_a],[c-.115*u-_a,f+.234*u-_a]]).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=Qt},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=Ms=_s=0,na.geo.stream(e,i(js)),_s?[Ss/_s,Ms/_s]: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 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)>_a}).map(c)).concat(na.range(Math.ceil(s/m)*m,a,m).filter(function(e){return da(e%v)>_a}).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+_a],[180,90-_a]]).minorExtent([[-180,-80-_a],[180,80+_a]])},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,Mn.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Na]},(na.geo.transverseMercator=function(){var e=Sn(Mn),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=Mn,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)/_a)*_a,y:Math.round(a(e,t)/_a)*_a,i:t}})}var r=_n,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&&(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=$,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},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),$=l[1]/(m.depth||1);Xr(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=Mi(a),i=Si(i),a&&i;)l=Si(l),o=Mi(o),o.a=e,r=a.z+f-i.z-u+s(a._,i._),r>0&&(_i(Di(a,e,n),e,r),u+=r,c+=r),f+=a.m,u+=i.m,d+=l.m,c+=o.m;a&&!Mi(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},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=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},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:$,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 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(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,M=0,_=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=o===Cl?Math.sqrt(e*e+u*u):+o.apply(this,arguments),p||(M*=-1),u&&(M=te(g/u*Math.sin(v))),e&&(S=te(g/e*Math.sin(v)))),u){$=u*Math.cos(c+M),y=u*Math.sin(c+M),b=u*Math.cos(f-M),w=u*Math.sin(f-M);var T=Math.abs(f-c-2*M)<=Da?0:1;if(M&&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?_.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]):_.push("M",H[0],"A",j,",",j," 0 1,",m," ",q[0])}else _.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?_.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]):_.push("L",z[0],"A",V,",",V," 0 0,",m," ",B[0])}else _.push("L",x,",",C)}else _.push("M",$,",",y),null!=b&&_.push("A",u,",",u," 0 ",T,",",p," ",b,",",w),_.push("L",x,",",C),null!=E&&_.push("A",e,",",e," 0 ",A,",",1-p," ",E,",",k);return _.push("Z"),_.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":Mo,bundle:_o,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],Ml=[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(_l.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 _l=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=_l.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",_a),g=na.transition(h.exit()).style("opacity",_a).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=m.select("line"),_=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)),M.attr(S,O*i),D.attr(k,O*y),_.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(),M=!/^(n|s)$/.test(S)&&u,_=!/^(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",_t]]),Yl={range:function(e,t,n){return na.range(Math.ceil(e/n)*n,+t,n).map(Xo)},floor:$,ceil:$};Bl.year=os.year,os.scale=function(){return Qo(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",_t]]);Wl.year=os.year.utc,os.scale.utc=function(){return Qo(na.scale.linear(),Wl,Gl)},na.text=Me(function(e){return e.responseText}),na.json=function(e,t){return _e(e,"application/json",ea,t)},na.html=function(e,t){return _e(e,"text/html",ta,t)},na.xml=Me(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&&_o(n)?e(n,r,i,a):Mt(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),_t(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||!_o(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(Xr.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),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=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=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=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),_t(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=_o(e)||xr(e);return t=bn(t,r,4),null==n&&(i||gr(e)?(r=e.constructor,n=i?_o(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,Mr(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,M,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,_t(t,0,-1))))return!1;t=Wn(t),n=ei.call(e,t)}return n||Rn(e.length)&&Dn(t,e.length)&&(_o(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=_o(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=Xe(et({},n||t),r,Qe),n=Xe(et({},t.imports),r.imports,Qe);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(Mi)},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||_o(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)?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(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=_o(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\]$/,Me=/^\d+$/,_e=/[\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[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[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[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 M(e){var t,n,r={};for(n in e)i(e,n)&&(t=S(n))&&(r[t]=e[n]);return r}function _(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),_(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 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(Xn.lastIndex=0;r>=0&&Xn.test(e);)e=e.replace(Xn,n),Xn.lastIndex=0,r-=1;return e}function U(e,t,n){yr[e]=_(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 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[Er]<0||n[Er]>24||24===n[Er]&&(0!==n[kr]||0!==n[Sr]||0!==n[Mr])?Er:n[kr]<0||n[kr]>59?kr:n[Sr]<0||n[Sr]>59?Sr:n[Mr]<0||n[Mr]>999?Mr:-1,l(e)._overflowDayOfYear&&(wr>t||t>Cr)&&(t=Cr),l(e)._overflowWeeks&&-1===t&&(t=_r),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[Mr]&&(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(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),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=M(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:Me(e),u(e)||(e._d=null),e))}function Me(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 _e(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 _e(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[Mr])*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=Le(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=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&&(_(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 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[Mr]=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 _(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 _(i)?i(e,t,n,r):i.replace(/%d/i,e)}function $n(e,t){var n=this._relativeTime[e>0?"future":"past"];return _(n)?n(t):n.replace(/%s/i,t)}function yn(e){var t,n;for(n in e)t=e[n],_(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 Mn(){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 _n(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 _n(this,e,t,1)}function Dn(e,t){return _n(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={},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})?/,$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,Mr=6,_r=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 Qr={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 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"),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=Mt,ui.toDate=kt,ui.toISOString=pt,ui.toJSON=_t,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=Q,ui.week=ui.weeks=Bt,ui.isoWeek=ui.isoWeeks=zt,ui.weeksInYear=Lt,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=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.",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",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=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.",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"),Mi=Un("minutes"),_i=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=Mn,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=Mi,Ii.hours=_i,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/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("contact-actions/contact-actions.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/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 U(new(U(function(){},{prototype:e})),t)}function i(e){return F(arguments,function(t){t!==e&&F(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 F(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 U({},u,t)}function u(e,t,n){if(!n){n=[];for(var r in e)n.push(r)}for(var i=0;i "));if($[n]=r,I(e))g.push(n,[function(){return t.get(e)}],u);else{var i=t.annotate(e);F(i,function(e){e!==n&&l.hasOwnProperty(e)&&p(l[e],e)}),g.push(n,e,i)}v.pop(),$[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=[],$={};return F(l,p),l=v=$=null,function(r,o,a){function s(){--y||(b||i($,o.$$values),p.$$values=$,p.$$promises=p.$$promises||!0,delete p.$$inheritedValues,u.resolve($))}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={},$=U({},r),y=1+g.length/3,b=!1;if(N(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i($,d(o.$$inheritedValues,m)),U(v,o.$$promises),o.$$values?(b=i($,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,$)),f.promise.then(function(e){$[n]=e,s()},u)}catch(e){u(e)}}var f=e.defer(),d=0;F(o,function(e){v.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&(d++,v[e].then(function(t){$[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=U({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;(l=u.exec(e))&&(v=s(l,!1),!(v.segment.indexOf("?")>=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 $(e){U(this,e)}function y(){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)||L(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(b[e.name],f.invoke(e.def))}}function c(e){U(this,e||{})}H=this;var f,d=!1,m=!0,g=!1,b={},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:/.*/}};y.$$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,U(o(),t))},this.isMatcher=function(e){if(!P(e))return!1;var t=!0;return F(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 b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new $(U({name:e},t)),n&&(x.push({name:e,def:n}),w||u()),this},F(C,function(e,t){b[t]=new $(U({name:t},e))}),b=r(b,{}),this.$get=["$injector",function(e){return f=e,w=!1,u(),F(C,function(e,t){b[t]||(b[t]=new $(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: '"+y+"' 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 $?t.type:new $(t.type):"config"===r?b.any:b.string)}(r,t,i);var m=function(){var t={array:"search"===i&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return U(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,y=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=L(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,y);U(this,{id:e,type:t,location:i,array:m,squash:y,replace:w,isOptional:v,value:u,dynamic:n,config:r,toString:c})},c.prototype={$$new:function(){return r(this,U(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(),F(t,function(t){F(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return F(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return F(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)&&!L(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)}]),U(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)}]),U(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=k[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(k.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&&!k[i])return p(i,t.self);for(var o in _)R(_[o])&&(t[o]=_[o](t,_.$delegates[o]));return k[n]=t,!t[M]&&t.url&&e.when(t.url,["$match","$stateParams",function(e,n){E.$current.navigable==t&&u(e,n)||E.transitionTo(t,e,{inherit:!0,location:!1})}]),m(n),t}function v(e){return e.indexOf("*")>-1}function $(e){for(var t=e.split("."),n=E.$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 y(e,t){return I(e)&&!N(t)?_[e]:R(t)&&I(e)?(_[e]&&!_.$delegates[e]&&(_.$delegates[e]=_[e]),_[e]=t,this):this}function b(e,t){return P(e)?t=e:t.name=e,g(t),this}function w(e,i,o,s,f,p,m,g,y){function b(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=E.transition=i.when(a.retry);return s.then(function(){return s!==E.transition?S:(t.options.$retry=!0,E.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 F(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)||L(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")),_=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:{}}},E={params:{},current:C.self,$current:C,transition:null},E.reload=function(e){return E.transitionTo(E.current,p,{reload:e||!0,inherit:!1,notify:!0})},E.go=function(e,t,n){return E.transitionTo(e,t,U({inherit:!0,relative:E.$current},n))},E.transitionTo=function(t,n,o){n=n||{},o=U({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},o||{});var a,u=E.$current,f=E.params,h=u.path,g=d(t,o.relative),v=n["#"];if(!N(g)){var $={to:t,toParams:n,options:o},y=b($,u.self,f,o);if(y)return y;if(t=$.to,n=$.toParams,o=$.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[M])throw new Error("Cannot transition to abstract state '"+t+"'");if(o.inherit&&(n=l(p,n||{},E.$current,g)),!g.params.$$validates(n))return D;n=g.params.$$values(n),t=g;var k=t.path,T=0,A=k[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 L=!0===o.reload?h[0]:d(o.reload);if(o.reload&&!L)throw new Error("No such reload state '"+(I(o.reload)?o.reload:o.reload.name)+"'");for(;A&&A===h[T]&&A!==L;)O=R[T]=A.locals,T++,A=k[T]}}else for(;A&&A===h[T]&&A.ownParams.$$equals(n,f);)O=R[T]=A.locals,T++,A=k[T];if(x(t,n,u,f,O,o))return v&&(n["#"]=v),E.params=n,j(E.params,p),o.location&&t.navigable&&t.navigable.url&&(m.push(t.navigable.url,n,{$$avoidResync:!0,replace:"replace"===o.location}),m.update(!0)),E.transition=null,i.when(E.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(),_;for(var F=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 M(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 _(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=M(a.uiSref,e.current.name),u=null,c=_(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},$=i.$eval(a.uiSrefOpts)||{};t.forEach(r,function(e){e in $&&(v[e]=$[e])});var y=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&&y(e)},!0), +u=t.copy(i.$eval(l.paramExpr))),y(),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 $=n[o+1];if(!1===g)null!=v&&(u+=L(v)?h(v,t).join("-"):encodeURIComponent(v)),u+=$;else if(!0===g){var y=u.match(/\/$/)?/\/?(.*)/:/(.*)/;u+=$.match(y)[1]}else I(g)&&(u+=g+$)}else{if(null==v||m&&!1!==g)continue;L(v)||(v=[v]),v=h(v,encodeURIComponent).join("&"+f+"="),u+=(a?"&":"?")+f+"="+v,a=!0}}return u},$.prototype.is=function(e,t){return!0},$.prototype.encode=function(e,t){return e},$.prototype.decode=function(e,t){return e},$.prototype.equals=function(e,t){return e==t},$.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},$.prototype.pattern=/.*/,$.prototype.toString=function(){return"{Type:"+this.name+"}"},$.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},$.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 L(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)}); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/org.civicrm.reqangular/js/dist/reqangular.min.js.map \ No newline at end of file From f2956a30607d775e489d730923ddad87a3fda1b4 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Fri, 27 Jul 2018 15:43:08 +0200 Subject: [PATCH 087/151] PCHR-3944: (Job Contract) More test fixing after bump to 1.7 --- .../form/form-general.controller.spec.js | 9 ++++++--- .../form/form-hour.controller.spec.js | 17 +++++++++-------- .../form/form-leave.controller.spec.js | 8 +++++--- .../form/form-pension.controller.spec.js | 9 ++++++--- 4 files changed, 26 insertions(+), 17 deletions(-) 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(); }); }); From edccb32c617c652d40a8026e545624465be6c765 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Fri, 27 Jul 2018 16:56:35 +0200 Subject: [PATCH 088/151] PCHR-3944: Update to last angular-ui-router legacy version --- org.civicrm.reqangular/js/dist/reqangular.min.js | 8 ++++---- .../js/src/common/vendor/angular/angular-ui-router.min.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/org.civicrm.reqangular/js/dist/reqangular.min.js b/org.civicrm.reqangular/js/dist/reqangular.min.js index 8688a05f8fa..0509f8e16a8 100644 --- a/org.civicrm.reqangular/js/dist/reqangular.min.js +++ b/org.civicrm.reqangular/js/dist/reqangular.min.js @@ -83,7 +83,7 @@ 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 */ @@ -116,7 +116,7 @@ end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},tr.proto ;return i[t]=o,e.apply(this,i)}}function fr(e,t){return e>t}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 U(new(U(function(){},{prototype:e})),t)}function i(e){return F(arguments,function(t){t!==e&&F(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 F(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 U({},u,t)}function u(e,t,n){if(!n){n=[];for(var r in e)n.push(r)}for(var i=0;i "));if($[n]=r,I(e))g.push(n,[function(){return t.get(e)}],u);else{var i=t.annotate(e);F(i,function(e){e!==n&&l.hasOwnProperty(e)&&p(l[e],e)}),g.push(n,e,i)}v.pop(),$[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=[],$={};return F(l,p),l=v=$=null,function(r,o,a){function s(){--y||(b||i($,o.$$values),p.$$values=$,p.$$promises=p.$$promises||!0,delete p.$$inheritedValues,u.resolve($))}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={},$=U({},r),y=1+g.length/3,b=!1;if(N(o.$$failure))return l(o.$$failure),p;o.$$inheritedValues&&i($,d(o.$$inheritedValues,m)),U(v,o.$$promises),o.$$values?(b=i($,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,$)),f.promise.then(function(e){$[n]=e,s()},u)}catch(e){u(e)}}var f=e.defer(),d=0;F(o,function(e){v.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&(d++,v[e].then(function(t){$[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=U({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;(l=u.exec(e))&&(v=s(l,!1),!(v.segment.indexOf("?")>=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 $(e){U(this,e)}function y(){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)||L(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(b[e.name],f.invoke(e.def))}}function c(e){U(this,e||{})}H=this;var f,d=!1,m=!0,g=!1,b={},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:/.*/}};y.$$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,U(o(),t))},this.isMatcher=function(e){if(!P(e))return!1;var t=!0;return F(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 b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new $(U({name:e},t)),n&&(x.push({name:e,def:n}),w||u()),this},F(C,function(e,t){b[t]=new $(U({name:t},e))}),b=r(b,{}),this.$get=["$injector",function(e){return f=e,w=!1,u(),F(C,function(e,t){b[t]||(b[t]=new $(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: '"+y+"' 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 $?t.type:new $(t.type):"config"===r?b.any:b.string)}(r,t,i);var m=function(){var t={array:"search"===i&&"auto"},n=e.match(/\[\]$/)?{array:!0}:{};return U(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,y=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=L(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,y);U(this,{id:e,type:t,location:i,array:m,squash:y,replace:w,isOptional:v,value:u,dynamic:n,config:r,toString:c})},c.prototype={$$new:function(){return r(this,U(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(),F(t,function(t){F(a(t),function(t){-1===s(e,t)&&-1===s(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return F(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return F(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)&&!L(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)}]),U(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)}]),U(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=k[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(k.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&&!k[i])return p(i,t.self);for(var o in M)R(M[o])&&(t[o]=M[o](t,M.$delegates[o]));return k[n]=t,!t[_]&&t.url&&e.when(t.url,["$match","$stateParams",function(e,n){E.$current.navigable==t&&u(e,n)||E.transitionTo(t,e,{inherit:!0,location:!1})}]),m(n),t}function v(e){return e.indexOf("*")>-1}function $(e){for(var t=e.split("."),n=E.$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 y(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 b(e,t){return P(e)?t=e:t.name=e,g(t),this}function w(e,i,o,s,f,p,m,g,y){function b(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=E.transition=i.when(a.retry);return s.then(function(){return s!==E.transition?S:(t.options.$retry=!0,E.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 F(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)||L(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:{}}},E={params:{},current:C.self,$current:C,transition:null},E.reload=function(e){return E.transitionTo(E.current,p,{reload:e||!0,inherit:!1,notify:!0})},E.go=function(e,t,n){return E.transitionTo(e,t,U({inherit:!0,relative:E.$current},n))},E.transitionTo=function(t,n,o){n=n||{},o=U({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},o||{});var a,u=E.$current,f=E.params,h=u.path,g=d(t,o.relative),v=n["#"];if(!N(g)){var $={to:t,toParams:n,options:o},y=b($,u.self,f,o);if(y)return y;if(t=$.to,n=$.toParams,o=$.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||{},E.$current,g)),!g.params.$$validates(n))return D;n=g.params.$$values(n),t=g;var k=t.path,T=0,A=k[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 L=!0===o.reload?h[0]:d(o.reload);if(o.reload&&!L)throw new Error("No such reload state '"+(I(o.reload)?o.reload:o.reload.name)+"'");for(;A&&A===h[T]&&A!==L;)O=R[T]=A.locals,T++,A=k[T]}}else for(;A&&A===h[T]&&A.ownParams.$$equals(n,f);)O=R[T]=A.locals,T++,A=k[T];if(x(t,n,u,f,O,o))return v&&(n["#"]=v),E.params=n,j(E.params,p),o.location&&t.navigable&&t.navigable.url&&(m.push(t.navigable.url,n,{$$avoidResync:!0,replace:"replace"===o.location}),m.update(!0)),E.transition=null,i.when(E.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 F=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},$=i.$eval(a.uiSrefOpts)||{};t.forEach(r,function(e){e in $&&(v[e]=$[e])});var y=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&&y(e)},!0),u=t.copy(i.$eval(l.paramExpr))),y(),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 $=n[o+1];if(!1===g)null!=v&&(u+=L(v)?h(v,t).join("-"):encodeURIComponent(v)),u+=$;else if(!0===g){var y=u.match(/\/$/)?/\/?(.*)/:/(.*)/;u+=$.match(y)[1]}else I(g)&&(u+=g+$)}else{if(null==v||m&&!1!==g)continue;L(v)||(v=[v]),v=h(v,encodeURIComponent).join("&"+f+"="),u+=(a?"&":"?")+f+"="+v,a=!0}}return u},$.prototype.is=function(e,t){return!0},$.prototype.encode=function(e,t){return e},$.prototype.decode=function(e,t){return e},$.prototype.equals=function(e,t){return e==t},$.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},$.prototype.pattern=/.*/,$.prototype.toString=function(){return"{Type:"+this.name+"}"},$.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},$.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 L(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)}); +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'),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)})}})}])}),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)}); //# 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/src/common/vendor/angular/angular-ui-router.min.js b/org.civicrm.reqangular/js/src/common/vendor/angular/angular-ui-router.min.js index 6010fd663f5..63775ae18e0 100644 --- a/org.civicrm.reqangular/js/src/common/vendor/angular/angular-ui-router.min.js +++ b/org.civicrm.reqangular/js/src/common/vendor/angular/angular-ui-router.min.js @@ -1,7 +1,7 @@ /** * 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 */ -"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return N(new(N(function(){},{prototype:a})),b)}function e(a){return M(arguments,function(b){b!==a&&M(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 M(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=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 Date: Fri, 27 Jul 2018 16:58:37 +0200 Subject: [PATCH 089/151] PCHR-3944: (L&A) Use common angular-ui-router instead of local one --- .../js/dist/absence-tab.min.js | 8 ++++---- .../js/dist/admin-dashboard.min.js | 17 ++++------------- .../js/dist/manager-leave.min.js | 17 ++++------------- .../js/dist/manager-notification-badge.min.js | 2 +- .../js/dist/my-leave.min.js | 17 ++++------------- .../src/leave-absences/admin-dashboard/app.js | 2 +- .../js/src/leave-absences/manager-leave/app.js | 2 +- .../js/src/leave-absences/my-leave/app.js | 2 +- .../js/src/leave-absences/shared/config.js | 7 ------- .../shared/vendor/angular-ui-router.min.js | 8 -------- .../js/test/test-main.js | 1 - 11 files changed, 20 insertions(+), 63 deletions(-) delete mode 100644 uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/vendor/angular-ui-router.min.js 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 10442147d15..c95ad0183e2 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){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(k(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 k(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:n().year(e.year()).month(e.month())}}function S(){var n=H.selectedPeriod.id;H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current}),n!==H.selectedPeriod.id&&p(),$(),B(),L("month")}function O(e){var t="previous"===e?"subtract":"add";F(n(H.selectedMonth.moment)[t](1,"month")),B(),L("month")}function L(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=S,H.paginateMonth=O,H.refresh=L}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:O()},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=k(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)&&L()}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!==O().indexOf(e.status_id)&&l(e)}function Y(e){return a.all(k(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/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(){h(),y()}function d(n){C=T.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===T.leaveRequest.request_type?o.open(v(n)):p(n)}function m(){return"admin"===T.role&&"public_holiday"===T.leaveRequest.request_type}function f(t){var a=T.absenceTypes[T.leaveRequest.type_id].allow_request_cancelation;return"admin"===T.role||("manager"===T.role?e.includes([A.awaitingApproval,A.moreInformationRequired],t):"3"===a?n().isBefore(T.leaveRequest.from_date):"2"===a)}function p(n){o.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return T.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(i.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){g(n)}}):v(n)})}})}function h(){e.isArray(T.leaveRequestStatuses)&&(T.leaveRequestStatuses=e.indexBy(T.leaveRequestStatuses,"value")),e.isArray(T.absenceTypes)&&(T.absenceTypes=e.indexBy(T.absenceTypes,"id"))}function v(e){var n=D[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return T.leaveRequest[e]().then(function(){_(e)}).catch(function(e){u.error("Error:",e)})}}}function b(e,n){e.stopPropagation(),s.openModal(n)}function g(e){s.openModal({leaveRequest:T.leaveRequest,leaveType:T.leaveRequest.request_type,selectedContactId:T.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:c.statusNames[P[e]]})}function _(n){var t=e.find(T.leaveRequestStatuses,function(e){return e.name===c.statusNames.awaitingApproval}).value;C===t&&r.publish("ManagerBadge:: Update Count"),r.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:T.leaveRequest})}function y(){var n=T.leaveRequestStatuses[T.leaveRequest.status_id].name,t=e.compact(e.map(D,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!f(n)&&e.pull(t,"cancel"),"admin"!==T.role&&e.pull(t,"delete"),"staff"===T.role&&e.pull(t,"approve","reject"),"staff"!==T.role&&q(t),m()&&t.push("delete"),T.allowedActions=e.map(t,function(e){return{key:e,label:D[e].label,isDirectAction:D[e].isDirectAction}})}function q(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 C,T=this,A=c.statusNames,D={edit:{label:"Edit",allowedStatuses:[A.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[A.moreInformationRequired]},view:{label:"View",allowedStatuses:[A.approved,A.rejected,A.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.approved,A.rejected,A.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.moreInformationRequired,A.approved,A.rejected,A.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},P={approve:"approved"};T.allowedActions=[],T.$onInit=l,T.action=d,T.openLeavePopup=b}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(){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(k).then(G).then(R).then(S).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(),O("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,O("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 k(){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 S(){o.$watch(function(){return te.uiOptions.times.from.time},function(e,n){e!==n&&(te.uiOptions.multipleDays||(Z(e),z()))})}function O(e){return te.selectedAbsenceType.calculation_unit_name===e}function L(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")&&(L("sickness")||O("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),(O("hours")||L("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=O,te.isLeaveType=L,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",S),_(),a.all([A(),C()]).then(y).finally(function(){S.filesLoaded=!0})}function m(){return S.fileUploader&&S.fileUploader.queue.length>0}function f(){return S.getFilesAmount()0?I.map(function(e){return e.label}).join(", "):""}function C(){return S.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){k[e.label]=n})})).catch(function(){k=null})}function A(){return c.valuesOf("safe_file_extension").then(function(e){I=e})}function D(e){return!e.attachment_id||S.canManage}function P(){e.forEach(w,function(e){e()})}function R(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var I=[],w=[],k={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=P,S.$onInit=d,S.canRemoveAttachment=D,S.canSubmit=m,S.canUploadMore=f,S.formatDateTime=p,S.getAuthorName=h,S.getFilesAmount=v,S.listFileTypes=q,S}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([x(),T(),C()]).then(function(){V.loading.page=!1}).then(function(){return t.all([P(),D()])}).then(E).then(function(){V.loading.content=!1}),U()}function p(e,n){n.data.push(e),n.dataIndex[e.id]=e}function h(){V.absenceTypes=V.absenceTypes.map(function(n){var t=e.find(V.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){N(e),V.sections.other.open&&p(e,V.sections.other)}function b(){Object.values(V.sections).forEach(function(e){e.data=[]})}function g(){V.absenceTypesFiltered=V.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function _(e){var n=G[e.status];n?n(e.leaveRequest):V.refresh()}function y(n){n.dataIndex=e.indexBy(n.data,"id")}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return s.all().then(function(n){V.absencePeriods=e.sortBy(n,"start_date"),V.selectedPeriod=e.find(V.absencePeriods,function(e){return!0===e.current})})}function T(){return i.all().then(i.loadCalculationUnits).then(function(n){V.absenceTypes=n,V.absenceTypesIndexed=e.indexBy(n,"id")})}function A(){return k("approved",{status_id:Y(m.statusNames.approved)})}function D(){var n={contact_id:V.contactId,period_id:V.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:[Y(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}}))]).then(function(e){V.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:V.contactId,period_id:V.selectedPeriod.id},!0).then(function(e){V.entitlements=e})}function R(){return r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id},V.entitlements).then(function(){return B(V.entitlements)}).then(function(e){V.sections.entitlements.data=e})}function I(){return t.all([r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id,expired:!0}),w({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:B(e[0]),expiredTOILS:F(e[1].list)})}).then(function(n){V.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),V.sections.expired.data=e.sortBy(V.sections.expired.data,"expiry_date")})}function w(n){return c.all(e.assign({contact_id:V.contactId,from_date:{from:V.selectedPeriod.start_date},to_date:{to:V.selectedPeriod.end_date},type_id:{IN:V.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function k(e,n){return w(n).then(function(n){V.sections[e].data=n.list})}function S(){return t.all(Object.values(V.sections).filter(function(e){return e.open}).map($))}function O(){return k("other",{status_id:{in:[Y(m.statusNames.rejected),Y(m.statusNames.cancelled)]}})}function L(){return k("pending",{status_id:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}})}function M(){return k("holidays",{public_holiday:!0})}function $(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function x(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){V.leaveRequestStatuses=e.indexBy(n,"value")})}function E(){h(),g()}function B(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(V.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 F(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 U(){l.subscribe("LeaveRequest::new",function(){V.refresh()}),l.subscribe("LeaveRequest::edit",function(){V.refresh()}),l.subscribe("LeaveRequest::statusUpdate",_),l.subscribe("LeaveRequest::delete",function(e){ -N(e)})}function N(n){e.forEach(V.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&&j(n,a))})}function j(n,t){var a=["future","current"],o=V.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(){V.loading.content=!0,t.all([P(),D()]).then(E).then(function(){V.loading.content=!1}).then(function(){return t.all([S(),b()])})}function H(e){var n=V.sections[e];n.open=!n.open,n.open&&!n.data.length&&$(n)}function Y(n){return e.find(V.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var G={delete:N,cancel:v},V=this;V.absencePeriods=[],V.absenceTypes=[],V.absenceTypesFiltered=[],V.absenceTypesIndexed={},V.dateFormat=d.DATE_FORMAT,V.leaveRequestStatuses={},V.selectedPeriod=null,V.role="absence-tab"===a.section?"admin":"staff",V.loading={content:!0,page:!0},V.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:A},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:R},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O}},V.$onInit=f,V.labelPeriod=q,V.refresh=W,V.toggleSection=H}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 $(),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 $(){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(),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=x,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=S,c.setDaysSelectionModeExtended=k,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/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 xe.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return xe.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 $(){return Ee.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function x(){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){xe.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($e="staff",!Ee.isSelfRecord)return c(y.permissions.admin.administer).then(function(e){e&&($e="admin")}).then(function(){return"staff"===$e&&c(y.permissions.ssp.manage).then(function(e){e&&($e="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 $e===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(x).then(L()&&ve).then(Te).then(function(){return Ee.isMode("edit")?Re():$()}).catch(function(n){Ee.request.status_id=e,n&&Y(n)}).finally(function(){Ee.submitting=!1})}function Te(){return o.all(xe.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",$e="",xe=[],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){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(){}); +!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(k(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 k(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:n().year(e.year()).month(e.month())}}function S(){var n=H.selectedPeriod.id;H.selectedPeriod=e.find(H.absencePeriods,function(e){return!!e.current}),n!==H.selectedPeriod.id&&p(),$(),B(),L("month")}function O(e){var t="previous"===e?"subtract":"add";F(n(H.selectedMonth.moment)[t](1,"month")),B(),L("month")}function L(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=S,H.paginateMonth=O,H.refresh=L}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:O()},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=k(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)&&L()}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!==O().indexOf(e.status_id)&&l(e)}function Y(e){return a.all(k(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/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(){h(),y()}function d(n){C=T.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===T.leaveRequest.request_type?o.open(v(n)):p(n)}function m(){return"admin"===T.role&&"public_holiday"===T.leaveRequest.request_type}function f(t){var a=T.absenceTypes[T.leaveRequest.type_id].allow_request_cancelation;return"admin"===T.role||("manager"===T.role?e.includes([A.awaitingApproval,A.moreInformationRequired],t):"3"===a?n().isBefore(T.leaveRequest.from_date):"2"===a)}function p(n){o.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return T.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(i.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){g(n)}}):v(n)})}})}function h(){e.isArray(T.leaveRequestStatuses)&&(T.leaveRequestStatuses=e.indexBy(T.leaveRequestStatuses,"value")),e.isArray(T.absenceTypes)&&(T.absenceTypes=e.indexBy(T.absenceTypes,"id"))}function v(e){var n=D[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return T.leaveRequest[e]().then(function(){_(e)}).catch(function(e){u.error("Error:",e)})}}}function b(e,n){e.stopPropagation(),s.openModal(n)}function g(e){s.openModal({leaveRequest:T.leaveRequest,leaveType:T.leaveRequest.request_type,selectedContactId:T.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:c.statusNames[P[e]]})}function _(n){var t=e.find(T.leaveRequestStatuses,function(e){return e.name===c.statusNames.awaitingApproval}).value;C===t&&r.publish("ManagerBadge:: Update Count"),r.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:T.leaveRequest})}function y(){var n=T.leaveRequestStatuses[T.leaveRequest.status_id].name,t=e.compact(e.map(D,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!f(n)&&e.pull(t,"cancel"),"admin"!==T.role&&e.pull(t,"delete"),"staff"===T.role&&e.pull(t,"approve","reject"),"staff"!==T.role&&q(t),m()&&t.push("delete"),T.allowedActions=e.map(t,function(e){return{key:e,label:D[e].label,isDirectAction:D[e].isDirectAction}})}function q(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 C,T=this,A=c.statusNames,D={edit:{label:"Edit",allowedStatuses:[A.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[A.moreInformationRequired]},view:{label:"View",allowedStatuses:[A.approved,A.rejected,A.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.approved,A.rejected,A.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.moreInformationRequired,A.approved,A.rejected,A.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},P={approve:"approved"};T.allowedActions=[],T.$onInit=l,T.action=d,T.openLeavePopup=b}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(){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(k).then(G).then(R).then(S).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(),O("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,O("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 k(){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 S(){o.$watch(function(){return te.uiOptions.times.from.time},function(e,n){e!==n&&(te.uiOptions.multipleDays||(Z(e),z()))})}function O(e){return te.selectedAbsenceType.calculation_unit_name===e}function L(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")&&(L("sickness")||O("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),(O("hours")||L("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=O,te.isLeaveType=L,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",S),_(),a.all([A(),C()]).then(y).finally(function(){S.filesLoaded=!0})}function m(){return S.fileUploader&&S.fileUploader.queue.length>0}function f(){return S.getFilesAmount()0?I.map(function(e){return e.label}).join(", "):""}function C(){return S.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){k[e.label]=n})})).catch(function(){k=null})}function A(){return c.valuesOf("safe_file_extension").then(function(e){I=e})}function D(e){return!e.attachment_id||S.canManage}function P(){e.forEach(w,function(e){e()})}function R(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var I=[],w=[],k={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=P,S.$onInit=d,S.canRemoveAttachment=D,S.canSubmit=m,S.canUploadMore=f,S.formatDateTime=p,S.getAuthorName=h,S.getFilesAmount=v,S.listFileTypes=q,S}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([x(),T(),C()]).then(function(){V.loading.page=!1}).then(function(){return t.all([P(),D()])}).then(E).then(function(){V.loading.content=!1}),U()}function p(e,n){n.data.push(e),n.dataIndex[e.id]=e}function h(){V.absenceTypes=V.absenceTypes.map(function(n){var t=e.find(V.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){N(e),V.sections.other.open&&p(e,V.sections.other)}function b(){Object.values(V.sections).forEach(function(e){e.data=[]})}function g(){V.absenceTypesFiltered=V.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function _(e){var n=G[e.status];n?n(e.leaveRequest):V.refresh()}function y(n){n.dataIndex=e.indexBy(n.data,"id")}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return s.all().then(function(n){V.absencePeriods=e.sortBy(n,"start_date"),V.selectedPeriod=e.find(V.absencePeriods,function(e){return!0===e.current})})}function T(){return i.all().then(i.loadCalculationUnits).then(function(n){V.absenceTypes=n,V.absenceTypesIndexed=e.indexBy(n,"id")})}function A(){return k("approved",{status_id:Y(m.statusNames.approved)})}function D(){var n={contact_id:V.contactId,period_id:V.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:[Y(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}}))]).then(function(e){V.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:V.contactId,period_id:V.selectedPeriod.id},!0).then(function(e){V.entitlements=e})}function R(){return r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id},V.entitlements).then(function(){return B(V.entitlements)}).then(function(e){V.sections.entitlements.data=e})}function I(){return t.all([r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id,expired:!0}),w({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:B(e[0]),expiredTOILS:F(e[1].list)})}).then(function(n){V.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),V.sections.expired.data=e.sortBy(V.sections.expired.data,"expiry_date")})}function w(n){return c.all(e.assign({contact_id:V.contactId,from_date:{from:V.selectedPeriod.start_date},to_date:{to:V.selectedPeriod.end_date},type_id:{IN:V.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function k(e,n){return w(n).then(function(n){V.sections[e].data=n.list})}function S(){return t.all(Object.values(V.sections).filter(function(e){return e.open}).map($))}function O(){return k("other",{status_id:{in:[Y(m.statusNames.rejected),Y(m.statusNames.cancelled)]}})}function L(){return k("pending",{status_id:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}})}function M(){return k("holidays",{public_holiday:!0})}function $(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function x(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){V.leaveRequestStatuses=e.indexBy(n,"value")})}function E(){h(),g()}function B(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(V.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 F(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 U(){l.subscribe("LeaveRequest::new",function(){V.refresh()}),l.subscribe("LeaveRequest::edit",function(){V.refresh()}),l.subscribe("LeaveRequest::statusUpdate",_),l.subscribe("LeaveRequest::delete",function(e){N(e)})}function N(n){e.forEach(V.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&&j(n,a))})}function j(n,t){var a=["future","current"],o=V.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(){V.loading.content=!0,t.all([P(),D()]).then(E).then(function(){V.loading.content=!1}).then(function(){return t.all([S(),b()])})}function H(e){var n=V.sections[e];n.open=!n.open,n.open&&!n.data.length&&$(n)}function Y(n){return e.find(V.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var G={delete:N,cancel:v},V=this;V.absencePeriods=[],V.absenceTypes=[],V.absenceTypesFiltered=[],V.absenceTypesIndexed={},V.dateFormat=d.DATE_FORMAT,V.leaveRequestStatuses={},V.selectedPeriod=null,V.role="absence-tab"===a.section?"admin":"staff",V.loading={content:!0,page:!0},V.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:A},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:R},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O}},V.$onInit=f,V.labelPeriod=q,V.refresh=W,V.toggleSection=H}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 $(),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 $(){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(),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=x,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=S,c.setDaysSelectionModeExtended=k,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/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 xe.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return xe.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 $(){return Ee.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function x(){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){xe.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($e="staff",!Ee.isSelfRecord)return c(y.permissions.admin.administer).then(function(e){e&&($e="admin")}).then(function(){return"staff"===$e&&c(y.permissions.ssp.manage).then(function(e){e&&($e="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 $e===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(x).then(L()&&ve).then(Te).then(function(){return Ee.isMode("edit")?Re():$()}).catch(function(n){Ee.request.status_id=e,n&&Y(n)}).finally(function(){Ee.submitting=!1})}function Te(){return o.all(xe.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",$e="",xe=[],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){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 4756603dd7c..0b0f8d18afa 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 $=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),m.push(b.segment),f=c.lastIndex;y=e.substring(f);var _=y.indexOf("?");if(_>=0){var $=this.sourceSearch=y.substring(_);if(y=y.substring(0,_),this.sourcePath=e.substring(0,f+_),$.length>0)for(f=0;u=l.exec($);)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(;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,f=!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)&&(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&&(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(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: '"+$+"' 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}),m(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: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(){F().then(g).then(b).then(_).then(R).then(function(){return a.all([q(),w(),D(),W.showFilters?T():e.noop])}).then(function(){m(),y(),j()}).then(function(){W.loading.page=!1})}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 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(S(n)),n.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(){o.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){W.supportData.absenceTypesToFilterBy=t,x(!0)})}function g(){o.$new().$watch(function(){return W.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(B(),j(),x())})}function y(e){W.injectMonth=!0,N("injected").then(function(){x(e)}).then(function(){W.loading.calendar=!1})}function _(){U=n("LeaveCalendar"+e.capitalize(H)+"Controller").init(W)}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return i.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(M)}function C(){return u.all().then(u.loadCalculationUnits)}function A(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function w(){return U.loadContacts().then(function(e){W.contacts=e})}function T(){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 c.all()}function D(){return a.all([C(),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 R(){var e=a.resolve();return W.injectMonth&&(e=N("destroyed"),W.injectMonth=!1),e}function S(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:t().year(e.year()).month(e.month())}}function I(){var t=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),t!==W.selectedPeriod.id&&p(),M(),j(),k("month")}function O(e){var n="previous"===e?"subtract":"add";B(t(W.selectedMonth.moment)[n](1,"month")),j(),k("month")}function k(t){t=e.includes(["contacts","period","month"],t)?t:"period",a.resolve().then(R).then("period"===t&&p).then("period"===t&&L).then("contacts"===t&&w).then("month"===t&&j).then(function(){y("contacts"===t)})}function x(e){o.$emit("LeaveCalendar::showMonth",!!e)}function M(){B(t())}function L(){B(W.months[0].moment)}function E(n){var a="previous"===n?"first":"last",r=e[a](W.months),o=t().year(r.year).month(r.month);W.monthPaginatorsAvailability[n]=!W.selectedMonth.moment.isSame(o,"month")}function j(){E("previous"),E("next")}function B(t){t&&(W.selectedMonthIndex=v(t)),W.selectedMonth=e.find(W.months,{index:W.selectedMonthIndex})}function F(){return a.all([d(s.permissions.admin.administer),d(s.permissions.ssp.manage)]).then(function(e){W.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",H=W.roleOverride?W.roleOverride:W.userPermissionRole})}function N(t){return a(function(n){var a=o.$on("LeaveCalendar::month"+e.capitalize(t),function(){a(),n()})})}r.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=f,W.canManageRequests=h,W.labelPeriod=$,W.navigateToCurrentMonth=I,W.paginateMonth=O,W.refresh=k}n.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,n={from_date:{to:J.month.days[J.month.days.length-1].date+" 23:59:59"},to_date:{from:J.month.days[0].date+" 00:00:00"},status_id:{IN:O()},contact_id:{IN:J.contacts.map(function(e){return e.id})},type_id:{IN:t?J.supportData.absenceTypesToFilterBy:e.pluck(J.supportData.absenceTypes,"id")}};return y(),s.all(n,null,null,null,!1).then(function(e){return X={},t&&(e.list=$(e.list)),A(e.list)})}function M(){var t=J.month.days[0].date,n=J.month.days[J.month.days.length-1].date;return o.get(J.contacts.map(function(e){return e.id}),t,n).then(function(t){z=e.indexBy(t,"contact_id")})}function L(){return J.contactIdsToReduceTo&&(J.contacts=J.contacts.filter(function(t){return e.includes(J.contactIdsToReduceTo,t.contact_id)||e.find(X,function(e){return e.contact_id===t.contact_id})})),a.resolve()}function E(t){var n=S(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 j(){r.$emit("LeaveCalendar::monthDestroyed"),G.map(function(e){e.remove?e.remove():e()})}function B(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(h(t.date)),s.isNonWorkingDay(h(t.date))]).then(function(a){e.assign(t.contactsData[n],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:D(t.date)})}),o.then(function(){return X[n]&&X[n][t.date]?X[n][t.date]:[]}).then(function(a){a=U(a),e.assign(t.contactsData[n],{leaveRequests:a,leaveRequestsToShowInCell:b(a),leaveRequestsAttributes:q(t,a)})})}function F(){return a.all(J.month.days.map(function(e){return a.all(J.contacts.map(function(t){return B(e,t.id)}))}))}function N(e,t){J.currentPage=0,J.visible=!0,(t||!Y)&&k()}function U(n){return e.sortBy(n,function(e){return+t(e.from_date).format("X")+(T("half_day_pm",e,e.from_date)?1:0)})}function H(t){var n=e.find(J.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){v(e),-1!==O().indexOf(e.status_id)&&l(e)}function V(e){return a.all(S(e).map(function(t){return B(t,e.contact_id,!0)}))}n.debug("Component: leave-calendar-month");var Y=!1,G=[],z={},X={},J=this;J.currentPage=0,J.pageSize=20,J.visible=!1,J.showContactName=!!J.showContactName,J.showOnlyWithLeaveRequests=!!J.showOnlyWithLeaveRequests,J.$onDestroy=j,J.$onInit=c,J.contactsList=p,J.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 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(){h(),_()}function d(t){q=C.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===C.leaveRequest.request_type?r.open(v(t)):p(t)}function f(){return"admin"===C.role&&"public_holiday"===C.leaveRequest.request_type}function m(n){var a=C.absenceTypes[C.leaveRequest.type_id].allow_request_cancelation;return"admin"===C.role||("manager"===C.role?e.includes([A.awaitingApproval,A.moreInformationRequired],n):"3"===a?t().isBefore(C.leaveRequest.from_date):"2"===a)}function p(t){r.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return C.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(s.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){g(t)}}):v(t)})}})}function h(){e.isArray(C.leaveRequestStatuses)&&(C.leaveRequestStatuses=e.indexBy(C.leaveRequestStatuses,"value")),e.isArray(C.absenceTypes)&&(C.absenceTypes=e.indexBy(C.absenceTypes,"id"))}function v(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 C.leaveRequest[e]().then(function(){y(e)}).catch(function(e){c.error("Error:",e)})}}}function b(e,t){e.stopPropagation(),o.openModal(t)}function g(e){o.openModal({leaveRequest:C.leaveRequest,leaveType:C.leaveRequest.request_type,selectedContactId:C.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:u.statusNames[T[e]]})}function y(t){var n=e.find(C.leaveRequestStatuses,function(e){return e.name===u.statusNames.awaitingApproval}).value;q===n&&i.publish("ManagerBadge:: Update Count"),i.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:C.leaveRequest})}function _(){var t=C.leaveRequestStatuses[C.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"!==C.role&&e.pull(n,"delete"),"staff"===C.role&&e.pull(n,"approve","reject"),"staff"!==C.role&&$(n),f()&&n.push("delete"),C.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,C=this,A=u.statusNames,w={edit:{label:"Edit",allowedStatuses:[A.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[A.moreInformationRequired]},view:{label:"View", -allowedStatuses:[A.approved,A.rejected,A.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.approved,A.rejected,A.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.moreInformationRequired,A.approved,A.rejected,A.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},T={approve:"approved"};C.allowedActions=[],C.$onInit=l,C.action=d,C.openLeavePopup=b}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(){r.$emit("LeaveRequestPopup::addTab",q),y(),_()}function l(){q.request.comments.push({contact_id:$,leave_request_id:q.request.id,text:q.comment.text}),q.comment.text=""}function d(){return q.comment.text.length>0}function f(e){return!e.comment_id||q.canManage}function m(e){return t.utc(e,s.serverDateTimeFormat).local().format(o.DATE_FORMAT.toUpperCase()+" HH:mm")}function p(){return q.request.comments.filter(function(e){return!e.toBeDeleted})}function h(e){return e===$?"Me":q.comment.contacts[e]?q.comment.contacts[e].display_name:void 0}function v(e){return q.mode===e}function b(){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 y(){return q.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),q.request.comments.length&&g()})}function _(){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.$onInit=c,q.addComment=l,q.canRemoveComment=f,q.canSubmit=d,q.formatDateTime=m,q.getActiveComments=p,q.getCommentorName=h,q.isMode=v,q.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,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(){n("RequestModalDetails"+e.capitalize(C(ne.leaveType,ne.request))+"Controller",{detailsController:ne}),ne.canManage=ne.isRole("manager")||ne.isRole("admin"),ne.loading.tab=!0,o.$emit("LeaveRequestPopup::addTab",ne),R(),ne.initChildController().then(function(){return s.all([L(),M()])}).then(!ne.isMode("create")&&D).then(V).then(function(){if(!ne.isMode("create"))return s.resolve().then(ne.initTimesExtended).then(z)}).then(!ne.isMode("create")&&W).then(S).then(Y).then(P).then(I).then(!ne.isMode("view")&&ne.initWatchersExtended).catch(T).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 h(e){return t(e,u.serverDateFormat).toDate()}function v(e){return t(e).format(u.serverDateFormat)}function b(e){var t;return s.resolve().then(function(){U(e),"from"===e&&N(),O("hours")&&(_(e),"from"!==e||ne.uiOptions.multipleDays||_("to")),ne.loading[e+"DayTypes"]=!0}).then(function(){return q(e)}).then(function(e){if(t=e.id!==ne.period.id,t&&(ne.period=e),!ne.period.id)return s.reject("Please change date as it is not in any absence period")}).then(W).then(function(){if(t)return L()}).then(function(){return ne.onDateChangeExtended&&ne.onDateChangeExtended(e)}).then(function(){if(z(),!t)return j();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(T).finally($)}function g(){return z(),j()}function y(){return ne.uiOptions.toDate=null,U("to"),s.resolve().then(z).then(ne.setDaysSelectionModeExtended).then($).then(!ne.uiOptions.multipleDays&&j)}function _(e){ne.uiOptions.times[e].loading=!0}function $(){["from","to"].forEach(function(e){ne.loading[e+"DayTypes"]=!1,O("hours")&&(ne.uiOptions.times[e].loading=!1)})}function q(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 C(){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 w(){return X(),ne.loading.balanceChange=!0,ne.request.getBalanceChangeBreakdown().then(H).catch(T)}function T(t){r.$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?j():w()}function D(){var e=ne.request.attributes();return ne.uiOptions.fromDate=h(ne.request.from_date),ne.request.to_date=e.to_date,ne.request.to_date_type=e.to_date_type,ne.uiOptions.toDate=h(ne.request.to_date),ne.initDayTypesExtended?ne.initDayTypesExtended():s.resolve()}function R(){te.push(r.$on("LeaveRequestPopup::absenceTypeChanged",function(){K()}),r.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,t){Q(t)}),r.$on("LeaveRequestPopup::recalculateBalanceChange",j))}function S(){ne.isMode("edit")&&(ne.isLeaveStatus(u.statusNames.approved)||ne.isLeaveStatus(u.statusNames.adminApproved))&&(ee={absenceTypeId:ne.request.type_id,value:ne.selectedAbsenceType.remainder-ne.request.balance_change})}function I(){r.$watch(function(){return ne.uiOptions.times.from.time},function(e,t){e!==t&&(ne.uiOptions.multipleDays||(Z(e),z()))})}function O(e){return ne.selectedAbsenceType.calculation_unit_name===e}function k(e){return ne.request.request_type===e}function x(t){return e.includes(["weekend","non_working_day","public_holiday"],t)}function M(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){ne.requestDayTypes=e})}function L(){return c.get(ne.request.contact_id,ne.period.start_date,ne.period.end_date).then(function(e){ne.calendar=e})}function E(){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 j(){return X(),ne.canCalculateChange()?(ne.loading.balanceChange=!0,ne.request.change_balance=!0,ne.calculateBalanceChange().then(H).catch(T).finally(function(){ne.loading.balanceChange=!1})):s.resolve()}function B(){ne.pagination.totalItems=ne.balance.change.breakdown.length,ne.pagination.filteredbreakdown=ne.balance.change.breakdown,ne.pagination.pageChanged()}function F(){return v(ne.request.from_date)===v(ne.request.to_date)}function N(){ne.uiOptions.toDate&&ne.uiOptions.fromDate&&ne.uiOptions.multipleDays&&t(ne.uiOptions.toDate).isSameOrBefore(ne.uiOptions.fromDate)&&(ne.uiOptions.toDate=null,U("to"))}function U(e){ne.resetUIInputsExtended&&ne.resetUIInputsExtended(e),z(),X()}function H(e){ne.balance.change=e,ne.request.balance_change=e.amount,p(),B(),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=h(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=h(ne.period.end_date)}function V(){return!ne.isMode("create")&&F()||ne.isMode("create")&&(k("sickness")||O("hours"))?ne.uiOptions.multipleDays=!1:ne.uiOptions.multipleDays=!0,s.resolve().then(ne.setDaysSelectionModeExtended)}function Y(){ee&&ee.absenceTypeId===ne.selectedAbsenceType.id?ne.balance.opening=ee.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 z(){var e=ne.uiOptions,t=e.times;ne.request.from_date=e.fromDate?v(e.fromDate):null,ne.request.to_date=e.toDate?v(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),(O("hours")||k("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 J(){e.forEach(te,function(e){e()})}function K(){var e,t=ne.selectedAbsenceType.calculation_unit_name;return G(),e=t!==ne.selectedAbsenceType.calculation_unit_name,Y(),s.resolve().then(e&&V).then(e&&ne.onAbsenceTypeUpdateExtended).then(e&&z).then($).then(j)}function Q(e){return ne.absenceTypes=e,G(),t(ne.uiOptions.toDate).isAfter(ne.period.end_date)&&(ne.uiOptions.toDate=void 0,U("to")),Y(),j()}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=u.statusNames,ne.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},ne.pagination={currentPage:1,filteredbreakdown:[],numPerPage:7,totalItems:0,pageChanged:E},ne.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},ne.$onInit=m,ne.convertDateFormatFromServer=h,ne.convertDateToServerFormat=v,ne.dateChangeHandler=b,ne.dateTypeChangeHandler=g,ne.daysSelectionModeChangeHandler=y,ne.disableAndShowLoadingTimeInput=_,ne.getMomentDateWithGivenTime=A,ne.handleError=T,ne.isCalculationUnit=O,ne.isLeaveType=k,ne.isNotWorkingDay=x,ne.performBalanceChangeCalculation=j,ne.setRequestDateTimesAndDateTypes=z,ne.updateEndTimeInputMinTime=Z,ne.$onDestroy=J}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(){r.$broadcast("LeaveRequestPopup::childComponent::register"),o.$emit("LeaveRequestPopup::addTab",I),y(),a.all([A(),q()]).then(_).finally(function(){I.filesLoaded=!0})}function f(){return I.fileUploader&&I.fileUploader.queue.length>0}function m(){return I.getFilesAmount()0?D.map(function(e){return e.label}).join(", "):""}function q(){return I.request.loadAttachments().then(function(){r.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function C(){return a.all(D.map(function(e){return l.getMimeTypeFor(e.label).then(function(t){S[e.label]=t})})).catch(function(){S=null})}function A(){return u.valuesOf("safe_file_extension").then(function(e){D=e})}function w(e){return!e.attachment_id||I.canManage}function T(){e.forEach(R,function(e){e()})}function P(e,t){I.fileUploader.queue&&I.fileUploader.queue.length>0?I.fileUploader.uploadAll({entityID:I.request.id}).then(function(){t()}).catch(t):t()}n.debug("Component: leave-request-popup-files-tab");var D=[],R=[],S={},I=Object.create(this);return I.filesLoaded=!1,I.fileUploader=null,I.today=Date.now(),I.userDateFormatWithTime=s.DATE_FORMAT+" HH:mm",I.userDateFormat=s.DATE_FORMAT,I.$onDestroy=T,I.$onInit=d,I.canRemoveAttachment=w,I.canSubmit=f,I.canUploadMore=m,I.formatDateTime=p,I.getAuthorName=h,I.getFilesAmount=v,I.listFileTypes=$,I}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(){o=n.parse(),o.openModal&&r({leaveType:o.openModal,selectedContactId:s.selectedContactId})}function r(e){t.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.$onInit=a,s.openLeavePopup=r}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(){o(i.permissions.admin.administer).then(function(e){H.isAdmin=e,n.all([A(),w(),O(),P(),S(),R(),k()]).then(function(){H.loading.page=!1,T()}),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(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 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(H.leaveRequestStatuses,function(e){return e.name===t}).value}function q(t){var n=e.find(H.filteredUsers,function(e){return e.id===t});return n?n.display_name:null}function C(e){return e.current?"Current Period ("+e.title+")":e.title}function A(){return u.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 w(){return c.all().then(c.loadCalculationUnits).then(function(e){H.absenceTypes=e})}function T(e){return(H.isAdmin?r.all(h()):r.leaveManagees(H.contactId,h())).then(function(t){return H.filteredUsers=H.isAdmin?t.list:t,e?D(e):n.all([D("table"),D("filter")])}).then(function(){H.filters.leaveRequest.leaveStatus!==W&&0===H.leaveRequests.table.list.length&&H.refresh(1,!0)})}function P(){return s.valuesOf("hrjc_department").then(function(e){H.departments=e})}function D(e){var t="filter"!==e,n="table"===e?e:"content",a="filter"===e?{size:0}:H.pagination,r="filter"===e?{return:["status_id"]}:{};return H.loading[n]=!0,l.all(I(t),a,"from_date DESC",r,!1).then(function(t){H.leaveRequests[e]=t}).catch(function(){H.leaveRequests[e].list=[]}).finally(function(){H.loading[n]=!1})}function R(){return s.valuesOf("hrjc_level_type").then(function(e){H.levelTypes=e})}function S(){return s.valuesOf("hrjc_location").then(function(e){H.locations=e})}function I(t){var n=H.filters.leaveRequest;return{contact_id:M(),managed_by:H.isAdmin&&"me"!==n.assignedTo.type?void 0:H.contactId,status_id:E(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 O(){return s.valuesOf("hrjc_region").then(function(e){H.regions=e})}function k(){return s.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){H.leaveRequestStatuses=e.concat(H.leaveRequestStatuses)})}function x(e){d.openModal(e)}function M(){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 L(e){var t=[$(i.statusNames.moreInformationRequired),$(i.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function E(e){var t=H.filters.leaveRequest,n=[];if(e&&t.leaveStatus&&t.leaveStatus.value&&n.push(t.leaveStatus.value),t.pending_requests&&(n=L(n)),n.length)return{IN:n}}function j(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,T(n))}function B(e){H.filters.leaveRequest.leaveStatus=e,H.refresh(1,!1,"table")}function F(e){H.filters.leaveRequest.assignedTo=e,H.refresh()}function N(){f.subscribe("LeaveRequest::updatedByManager",function(){H.refresh()}),f.subscribe("LeaveRequest::new",function(){H.refresh()}),f.subscribe("LeaveRequest::edit",function(){H.refresh()}),f.subscribe("LeaveRequest::delete",function(){H.refresh()}),f.subscribe("LeaveRequest::statusUpdate",function(){H.refresh()})}function U(){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=m,H.clearStaffSelection=p,H.countLeaveRequestByStatus=v,H.getAbsenceTypeByID=b,H.getArrayOfSize=g,H.getLeaveStatusByValue=y,H.getNavBadge=_,H.getUserNameByID=q,H.labelPeriod=C,H.openLeavePopup=x,H.refresh=j,H.refreshWithFilter=B,H.refreshWithFilterByAssignee=F,H.totalNoOfPages=U}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 $(){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 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&&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=$,s.initWatchersExtended=q,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 $(){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 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=$,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){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,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=$.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: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 $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(),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=qe,Ee.updateAbsenceType=Te,function(){Ee.loading.absenceTypes=!0,z(),K(),de().then(J).then(function(){return r.all([ee(),ue(),me()])}).then(Q).then($e).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(){s(),o()}function o(){return n("can administer calendar feeds").then(function(e){u.canCreateNewFeed=!!e})}function s(){return u.loading.feeds=!0,e.all().then(function(e){u.feeds=e}).finally(function(){u.loading.feeds=!1})}function i(e,n){t.open(e,n)}var u=this;u.canCreateNewFeed=!1,u.feeds=[],u.loading={feeds:!1},u.$onInit=r,u.openLinkModal=i}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(w(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 w(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:n().year(e.year()).month(e.month())}}function O(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&p(),$(),B(),L("month")}function k(e){var t="previous"===e?"subtract":"add";F(n(W.selectedMonth.moment)[t](1,"month")),B(),L("month")}function L(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=O,W.paginateMonth=k,W.refresh=L}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=w(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)&&L()}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(w(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/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(){h(),_()}function d(n){C=T.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===T.leaveRequest.request_type?o.open(v(n)):p(n)}function m(){return"admin"===T.role&&"public_holiday"===T.leaveRequest.request_type}function f(t){var a=T.absenceTypes[T.leaveRequest.type_id].allow_request_cancelation;return"admin"===T.role||("manager"===T.role?e.includes([A.awaitingApproval,A.moreInformationRequired],t):"3"===a?n().isBefore(T.leaveRequest.from_date):"2"===a)}function p(n){o.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return T.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(i.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){g(n)}}):v(n)})}})}function h(){e.isArray(T.leaveRequestStatuses)&&(T.leaveRequestStatuses=e.indexBy(T.leaveRequestStatuses,"value")),e.isArray(T.absenceTypes)&&(T.absenceTypes=e.indexBy(T.absenceTypes,"id"))}function v(e){var n=D[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return T.leaveRequest[e]().then(function(){y(e)}).catch(function(e){u.error("Error:",e)})}}}function b(e,n){e.stopPropagation(),s.openModal(n)}function g(e){s.openModal({leaveRequest:T.leaveRequest,leaveType:T.leaveRequest.request_type,selectedContactId:T.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:c.statusNames[R[e]]})}function y(n){var t=e.find(T.leaveRequestStatuses,function(e){return e.name===c.statusNames.awaitingApproval}).value;C===t&&r.publish("ManagerBadge:: Update Count"),r.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:T.leaveRequest})}function _(){var n=T.leaveRequestStatuses[T.leaveRequest.status_id].name,t=e.compact(e.map(D,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!f(n)&&e.pull(t,"cancel"),"admin"!==T.role&&e.pull(t,"delete"),"staff"===T.role&&e.pull(t,"approve","reject"),"staff"!==T.role&&q(t),m()&&t.push("delete"),T.allowedActions=e.map(t,function(e){return{key:e,label:D[e].label,isDirectAction:D[e].isDirectAction}})}function q(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 C,T=this,A=c.statusNames,D={edit:{label:"Edit",allowedStatuses:[A.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[A.moreInformationRequired]},view:{label:"View",allowedStatuses:[A.approved,A.rejected,A.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.approved,A.rejected,A.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.moreInformationRequired,A.approved,A.rejected,A.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},R={approve:"approved"};T.allowedActions=[],T.$onInit=l,T.action=d,T.openLeavePopup=b}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(){ +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(w).then(G).then(P).then(O).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 w(){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 O(){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 L(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")&&(L("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")||L("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=L,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",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(n){w[e.label]=n})})).catch(function(){w=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,n){O.fileUploader.queue&&O.fileUploader.queue.length>0?O.fileUploader.uploadAll({entityID:O.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var S=[],I=[],w={},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=h,O.getFilesAmount=v,O.listFileTypes=q,O}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(),w(),I(),L()]).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(O(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 w(){return i.valuesOf("hrjc_location").then(function(e){H.locations=e})}function O(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 L(){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),O(),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),w(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(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(n,t){i.isCalculationUnit("days")||n===t||(i.setRequestDateTimesAndDateTypes(),n&&w(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(){w(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){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 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(){w("from",!0)})):o.resolve()}function w(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 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 k(){return i.isCalculationUnit("hours")&&i.uiOptions.fromDate?R("from").then(function(){w("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=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(),L())})})}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(),L(),F()}function w(){return $(),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time),l(),j?j=!1:L(),F()}function O(e){c.uiOptions.times[e].time=""}function k(){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 $(){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(),L(),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=O,c.setDaysSelectionModeExtended=w,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/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 R(){var e=Ee.requestStatuses[_.statusNames.awaitingApproval].value;Oe.status_id===e&&e!==Ee.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return xe.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return xe.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return!Ee.loading.entitlements&&(!!re("admin")||!se("view")&&!(re("manager")&&!se("create")))}function w(){var e=P();return Ee.isMode("edit")&&(e=e&&(G()||S())),Ee.canManage&&Ee.requestStatuses&&(e=e&&!!Ee.getStatusFromValue(Ee.newStatusOnSave)),(e=e&&!!Ee.period.id)&&!Ee.isMode("view")}function O(){Ee.isSelfRecord?Ee.request.status_id=Ee.requestStatuses[_.statusNames.awaitingApproval].value:Ee.canManage&&(Ee.request.status_id=Ee.newStatusOnSave||Ee.request.status_id)}function k(){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 $(){return Ee.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function x(){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(Ie[e],function(e){return Ee.requestStatuses[e]})}function j(){return Ee.request?Ee.request.request_type:Ee.leaveType||null}function H(){return!Ee.request||e.equals({},Ee.requestStatuses)?[]:Ee.request.status_id?U():N("none")}function W(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(Oe,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(ye).then(ne).then(X).then(Ee.isMode("edit")?_e: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=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];Ie.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Ie.awaiting_approval=e,Ie.more_information_required=e,Ie.rejected=e,Ie.approved=e,Ie.cancelled=[_.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(){ke.push(s.$on("LeaveRequestPopup::requestObjectUpdated",_e),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(){we++})),i.$on("$destroy",De),i.$on("LeaveRequestPopup::addTab",function(e,n){xe.push(n)})}function K(){var e,n;Ee.request=Ee.leaveRequest||null,e=j(),n=Ee.initRequestAttributes(),"leave"===e?Ee.request=y.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($e="staff",!Ee.isSelfRecord)return c(_.permissions.admin.administer).then(function(e){e&&($e="admin")}).then(function(){return"staff"===$e&&c(_.permissions.ssp.manage).then(function(e){e&&($e="manager")})}).finally(function(){Ee.canManage=Ee.isRole("manager")||Ee.isRole("admin")})}function ne(){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 te(){return!Ee.request.status_id||!t.includes(["cancelled","rejected"],W(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 $e===e}function ce(){return h.all().then(function(e){Ee.absencePeriods=e})}function ue(){return v.all(F()).then(v.loadCalculationUnits).then(function(e){Se={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:Se.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){R(),d.publish(e,Ee.request),Ee.errors=[],Ee.dismissModal()}function ve(){["from","to"].forEach(function(e){Ee.request[e+"_date"]=Oe[e+"_date"]})}function be(e){if(Ee.absenceTypes=pe(Se.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 ye(){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 _e(){Oe=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 Ce(){var e=Ee.request.status_id;if(!Ee.isMode("view")&&!Ee.submitting)return Ee.submitting=!0,O(),D(),Ee.request.isValid().then(te()&&k).then(x).then(L()&&ve).then(Te).then(function(){return Ee.isMode("edit")?Pe():$()}).catch(function(n){Ee.request.status_id=e,n&&Y(n)}).finally(function(){Ee.submitting=!1})}function Te(){return o.all(xe.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Ae(){function e(e){e&&t.push(e),++a===we&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return we>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function De(){ke.forEach(function(e){e()})}function Re(){s.$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")})}n.debug("RequestCtrl");var Se,Ie={},we=0,Oe={},ke=[],Le="",Me="No entitlement",$e="",xe=[],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=I,Ee.canSubmit=w,Ee.closeAlert=M,Ee.deleteLeaveRequest=E,Ee.dismissModal=B,Ee.getStatuses=H,Ee.getStatusFromValue=W,Ee.initAfterContactSelection=V,Ee.initRequestAttributes=Z,Ee.isLeaveStatus=ae,Ee.isLeaveType=oe,Ee.isMode=se,Ee.isRole=re,Ee.submit=Ce,Ee.updateAbsenceType=Re,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"]}),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 1f077adb0ee..aecddfeb00e 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 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: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(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 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=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,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 k(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 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(){q(),g().then(function(){P.loading.component=!1})}function p(){return r.all({options:{sort:"title ASC"}}).then(function(e){P.absencePeriods=e})}function h(){return o.all().then(o.loadCalculationUnits).then(function(e){P.absenceTypes=e})}function v(){return s.all(null,null,"sort_name ASC").then(function(e){P.lookupContacts=e.list})}function g(){return n.all([p(),h(),v(),b(),$()]).catch(function(e){u.error("Error",e)})}function b(){return l.get().then(function(e){P.loggedInContactId=e.contactId})}function y(){return P.loading.report=!0,i.all(T,P.pagination,void 0,void 0,!1).then(function(e){P.report=_(e.list),P.reportCount=e.total}).catch(function(e){u.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),c.subscribe("LeaveRequest::new",C)}function $(){return f(d.permissions.admin.administer).then(function(e){P.userRole=e?"admin":"manager"})}function C(e){A(e,T)}function A(e,t){T=t,P.pagination.page=1,w(),P.loadReportCurrentPage()}function w(){P.selectedAbsenceTypes=P.absenceTypes.filter(function(e){return+e.id==+T.type_id})}var T={},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=m,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,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(){F().then(b).then(g).then(_).then(S).then(function(){return a.all([$(),w(),D(),W.showFilters?T():e.noop])}).then(function(){m(),y(),B()}).then(function(){W.loading.page=!1})}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 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(R(n)),n.add(1,"month");W.months=e}function h(){return e.includes(["admin","manager"],W.userPermissionRole)}function v(e){return e.format("YYYY-MM")}function g(){o.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){W.supportData.absenceTypesToFilterBy=t,L(!0)})}function b(){o.$new().$watch(function(){return W.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(j(),B(),L())})}function y(e){W.injectMonth=!0,N("injected").then(function(){L(e)}).then(function(){W.loading.calendar=!1})}function _(){U=n("LeaveCalendar"+e.capitalize(H)+"Controller").init(W)}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function $(){return i.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(M)}function C(){return u.all().then(u.loadCalculationUnits)}function A(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function w(){return U.loadContacts().then(function(e){W.contacts=e})}function T(){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 c.all()}function D(){return a.all([C(),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 S(){var e=a.resolve();return W.injectMonth&&(e=N("destroyed"),W.injectMonth=!1),e}function R(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:t().year(e.year()).month(e.month())}}function I(){var t=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),t!==W.selectedPeriod.id&&p(),M(),B(),x("month")}function O(e){var n="previous"===e?"subtract":"add";j(t(W.selectedMonth.moment)[n](1,"month")),B(),x("month")}function x(t){t=e.includes(["contacts","period","month"],t)?t:"period",a.resolve().then(S).then("period"===t&&p).then("period"===t&&k).then("contacts"===t&&w).then("month"===t&&B).then(function(){y("contacts"===t)})}function L(e){o.$emit("LeaveCalendar::showMonth",!!e)}function M(){j(t())}function k(){j(W.months[0].moment)}function E(n){var a="previous"===n?"first":"last",r=e[a](W.months),o=t().year(r.year).month(r.month);W.monthPaginatorsAvailability[n]=!W.selectedMonth.moment.isSame(o,"month")}function B(){E("previous"),E("next")}function j(t){t&&(W.selectedMonthIndex=v(t)),W.selectedMonth=e.find(W.months,{index:W.selectedMonthIndex})}function F(){return a.all([d(s.permissions.admin.administer),d(s.permissions.ssp.manage)]).then(function(e){W.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",H=W.roleOverride?W.roleOverride:W.userPermissionRole})}function N(t){return a(function(n){var a=o.$on("LeaveCalendar::month"+e.capitalize(t),function(){a(),n()})})}r.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=f,W.canManageRequests=h,W.labelPeriod=q,W.navigateToCurrentMonth=I,W.paginateMonth=O,W.refresh=x}n.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,n={from_date:{to:J.month.days[J.month.days.length-1].date+" 23:59:59"},to_date:{from:J.month.days[0].date+" 00:00:00"},status_id:{IN:O()},contact_id:{IN:J.contacts.map(function(e){return e.id})},type_id:{IN:t?J.supportData.absenceTypesToFilterBy:e.pluck(J.supportData.absenceTypes,"id")}};return y(),s.all(n,null,null,null,!1).then(function(e){return X={},t&&(e.list=q(e.list)),A(e.list)})}function M(){var t=J.month.days[0].date,n=J.month.days[J.month.days.length-1].date;return o.get(J.contacts.map(function(e){return e.id}),t,n).then(function(t){z=e.indexBy(t,"contact_id")})}function k(){return J.contactIdsToReduceTo&&(J.contacts=J.contacts.filter(function(t){return e.includes(J.contactIdsToReduceTo,t.contact_id)||e.find(X,function(e){return e.contact_id===t.contact_id})})),a.resolve()}function E(t){var n=R(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 B(){r.$emit("LeaveCalendar::monthDestroyed"),G.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(h(t.date)),s.isNonWorkingDay(h(t.date))]).then(function(a){e.assign(t.contactsData[n],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:D(t.date)})}),o.then(function(){return X[n]&&X[n][t.date]?X[n][t.date]:[]}).then(function(a){a=U(a),e.assign(t.contactsData[n],{leaveRequests:a,leaveRequestsToShowInCell:g(a),leaveRequestsAttributes:$(t,a)})})}function F(){return a.all(J.month.days.map(function(e){return a.all(J.contacts.map(function(t){return j(e,t.id)}))}))}function N(e,t){J.currentPage=0,J.visible=!0,(t||!Y)&&x()}function U(n){return e.sortBy(n,function(e){return+t(e.from_date).format("X")+(T("half_day_pm",e,e.from_date)?1:0)})}function H(t){var n=e.find(J.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){v(e),-1!==O().indexOf(e.status_id)&&l(e)}function V(e){return a.all(R(e).map(function(t){return j(t,e.contact_id,!0)}))}n.debug("Component: leave-calendar-month");var Y=!1,G=[],z={},X={},J=this;J.currentPage=0,J.pageSize=20,J.visible=!1,J.showContactName=!!J.showContactName,J.showOnlyWithLeaveRequests=!!J.showOnlyWithLeaveRequests,J.$onDestroy=B,J.$onInit=c,J.contactsList=p,J.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 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(){h(),_()}function d(t){$=C.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===C.leaveRequest.request_type?r.open(v(t)):p(t)}function f(){return"admin"===C.role&&"public_holiday"===C.leaveRequest.request_type}function m(n){var a=C.absenceTypes[C.leaveRequest.type_id].allow_request_cancelation;return"admin"===C.role||("manager"===C.role?e.includes([A.awaitingApproval,A.moreInformationRequired],n):"3"===a?t().isBefore(C.leaveRequest.from_date):"2"===a)}function p(t){r.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return C.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(s.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){b(t)}}):v(t)})}})}function h(){e.isArray(C.leaveRequestStatuses)&&(C.leaveRequestStatuses=e.indexBy(C.leaveRequestStatuses,"value")),e.isArray(C.absenceTypes)&&(C.absenceTypes=e.indexBy(C.absenceTypes,"id"))}function v(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 C.leaveRequest[e]().then(function(){y(e)}).catch(function(e){c.error("Error:",e)})}}}function g(e,t){e.stopPropagation(),o.openModal(t)}function b(e){o.openModal({leaveRequest:C.leaveRequest,leaveType:C.leaveRequest.request_type,selectedContactId:C.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:u.statusNames[T[e]]})}function y(t){var n=e.find(C.leaveRequestStatuses,function(e){return e.name===u.statusNames.awaitingApproval}).value;$===n&&i.publish("ManagerBadge:: Update Count"),i.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:C.leaveRequest})}function _(){var t=C.leaveRequestStatuses[C.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"!==C.role&&e.pull(n,"delete"),"staff"===C.role&&e.pull(n,"approve","reject"),"staff"!==C.role&&q(n),f()&&n.push("delete"),C.allowedActions=e.map(n,function(e){return{key:e,label:w[e].label,isDirectAction:w[e].isDirectAction}})}function q(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 $,C=this,A=u.statusNames,w={edit:{label:"Edit",allowedStatuses:[A.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[A.moreInformationRequired]},view:{label:"View",allowedStatuses:[A.approved,A.rejected,A.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.approved,A.rejected,A.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.moreInformationRequired,A.approved,A.rejected,A.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},T={approve:"approved"};C.allowedActions=[],C.$onInit=l,C.action=d,C.openLeavePopup=g}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(){r.$emit("LeaveRequestPopup::addTab",$),y(),_()}function l(){$.request.comments.push({contact_id:q,leave_request_id:$.request.id,text:$.comment.text}),$.comment.text=""}function d(){return $.comment.text.length>0}function f(e){return!e.comment_id||$.canManage}function m(e){return t.utc(e,s.serverDateTimeFormat).local().format(o.DATE_FORMAT.toUpperCase()+" HH:mm")}function p(){return $.request.comments.filter(function(e){return!e.toBeDeleted})}function h(e){return e===q?"Me":$.comment.contacts[e]?$.comment.contacts[e].display_name:void 0}function v(e){return $.mode===e}function g(){$.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 y(){return $.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),$.request.comments.length&&b()})}function _(){return $.loading.component=!0,u.get().then(function(e){q=e.contactId}).then(function(){$.loading.component=!1})}n.debug("Component: leave-request-popup-comments-tab");var q=null,$=this;$.loading={component:!0},$.comment={text:"",contacts:{}},$.$onInit=c,$.addComment=l,$.canRemoveComment=f,$.canSubmit=d,$.formatDateTime=m,$.getActiveComments=p,$.getCommentorName=h,$.isMode=v,$.onBeforeSubmit=g}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(){n("RequestModalDetails"+e.capitalize(C(ne.leaveType,ne.request))+"Controller",{detailsController:ne}),ne.canManage=ne.isRole("manager")||ne.isRole("admin"),ne.loading.tab=!0,o.$emit("LeaveRequestPopup::addTab",ne),S(),ne.initChildController().then(function(){return s.all([k(),M()])}).then(!ne.isMode("create")&&D).then(V).then(function(){if(!ne.isMode("create"))return s.resolve().then(ne.initTimesExtended).then(z)}).then(!ne.isMode("create")&&W).then(R).then(Y).then(P).then(I).then(!ne.isMode("view")&&ne.initWatchersExtended).catch(T).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 h(e){return t(e,u.serverDateFormat).toDate()}function v(e){return t(e).format(u.serverDateFormat)}function g(e){var t;return s.resolve().then(function(){U(e),"from"===e&&N(),O("hours")&&(_(e),"from"!==e||ne.uiOptions.multipleDays||_("to")),ne.loading[e+"DayTypes"]=!0}).then(function(){return $(e)}).then(function(e){if(t=e.id!==ne.period.id,t&&(ne.period=e),!ne.period.id)return s.reject("Please change date as it is not in any absence period")}).then(W).then(function(){if(t)return k()}).then(function(){return ne.onDateChangeExtended&&ne.onDateChangeExtended(e)}).then(function(){if(z(),!t)return B();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(T).finally(q)}function b(){return z(),B()}function y(){return ne.uiOptions.toDate=null,U("to"),s.resolve().then(z).then(ne.setDaysSelectionModeExtended).then(q).then(!ne.uiOptions.multipleDays&&B)}function _(e){ne.uiOptions.times[e].loading=!0}function q(){["from","to"].forEach(function(e){ne.loading[e+"DayTypes"]=!1,O("hours")&&(ne.uiOptions.times[e].loading=!1)})}function $(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 C(){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 w(){return X(),ne.loading.balanceChange=!0,ne.request.getBalanceChangeBreakdown().then(H).catch(T)}function T(t){r.$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?B():w()}function D(){var e=ne.request.attributes();return ne.uiOptions.fromDate=h(ne.request.from_date),ne.request.to_date=e.to_date,ne.request.to_date_type=e.to_date_type,ne.uiOptions.toDate=h(ne.request.to_date),ne.initDayTypesExtended?ne.initDayTypesExtended():s.resolve()}function S(){te.push(r.$on("LeaveRequestPopup::absenceTypeChanged",function(){K()}),r.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,t){Q(t)}),r.$on("LeaveRequestPopup::recalculateBalanceChange",B))}function R(){ne.isMode("edit")&&(ne.isLeaveStatus(u.statusNames.approved)||ne.isLeaveStatus(u.statusNames.adminApproved))&&(ee={absenceTypeId:ne.request.type_id,value:ne.selectedAbsenceType.remainder-ne.request.balance_change})}function I(){r.$watch(function(){return ne.uiOptions.times.from.time},function(e,t){e!==t&&(ne.uiOptions.multipleDays||(Z(e),z()))})}function O(e){return ne.selectedAbsenceType.calculation_unit_name===e}function x(e){return ne.request.request_type===e}function L(t){return e.includes(["weekend","non_working_day","public_holiday"],t)}function M(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){ne.requestDayTypes=e})}function k(){return c.get(ne.request.contact_id,ne.period.start_date,ne.period.end_date).then(function(e){ne.calendar=e})}function E(){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 B(){return X(),ne.canCalculateChange()?(ne.loading.balanceChange=!0,ne.request.change_balance=!0,ne.calculateBalanceChange().then(H).catch(T).finally(function(){ne.loading.balanceChange=!1})):s.resolve()}function j(){ne.pagination.totalItems=ne.balance.change.breakdown.length,ne.pagination.filteredbreakdown=ne.balance.change.breakdown,ne.pagination.pageChanged()}function F(){return v(ne.request.from_date)===v(ne.request.to_date)}function N(){ne.uiOptions.toDate&&ne.uiOptions.fromDate&&ne.uiOptions.multipleDays&&t(ne.uiOptions.toDate).isSameOrBefore(ne.uiOptions.fromDate)&&(ne.uiOptions.toDate=null,U("to"))}function U(e){ne.resetUIInputsExtended&&ne.resetUIInputsExtended(e),z(),X()}function H(e){ne.balance.change=e,ne.request.balance_change=e.amount,p(),j(),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=h(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=h(ne.period.end_date)}function V(){return!ne.isMode("create")&&F()||ne.isMode("create")&&(x("sickness")||O("hours"))?ne.uiOptions.multipleDays=!1:ne.uiOptions.multipleDays=!0,s.resolve().then(ne.setDaysSelectionModeExtended)}function Y(){ee&&ee.absenceTypeId===ne.selectedAbsenceType.id?ne.balance.opening=ee.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 z(){var e=ne.uiOptions,t=e.times;ne.request.from_date=e.fromDate?v(e.fromDate):null,ne.request.to_date=e.toDate?v(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),(O("hours")||x("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 J(){e.forEach(te,function(e){e()})}function K(){var e,t=ne.selectedAbsenceType.calculation_unit_name;return G(),e=t!==ne.selectedAbsenceType.calculation_unit_name,Y(),s.resolve().then(e&&V).then(e&&ne.onAbsenceTypeUpdateExtended).then(e&&z).then(q).then(B)}function Q(e){return ne.absenceTypes=e,G(),t(ne.uiOptions.toDate).isAfter(ne.period.end_date)&&(ne.uiOptions.toDate=void 0,U("to")),Y(),B()}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=u.statusNames,ne.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},ne.pagination={currentPage:1,filteredbreakdown:[],numPerPage:7,totalItems:0,pageChanged:E},ne.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},ne.$onInit=m,ne.convertDateFormatFromServer=h,ne.convertDateToServerFormat=v,ne.dateChangeHandler=g,ne.dateTypeChangeHandler=b,ne.daysSelectionModeChangeHandler=y,ne.disableAndShowLoadingTimeInput=_,ne.getMomentDateWithGivenTime=A,ne.handleError=T,ne.isCalculationUnit=O,ne.isLeaveType=x,ne.isNotWorkingDay=L,ne.performBalanceChangeCalculation=B,ne.setRequestDateTimesAndDateTypes=z,ne.updateEndTimeInputMinTime=Z,ne.$onDestroy=J}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(){r.$broadcast("LeaveRequestPopup::childComponent::register"),o.$emit("LeaveRequestPopup::addTab",I),y(),a.all([A(),$()]).then(_).finally(function(){I.filesLoaded=!0})}function f(){return I.fileUploader&&I.fileUploader.queue.length>0}function m(){return I.getFilesAmount()0?D.map(function(e){return e.label}).join(", "):""}function $(){return I.request.loadAttachments().then(function(){r.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function C(){return a.all(D.map(function(e){return l.getMimeTypeFor(e.label).then(function(t){R[e.label]=t})})).catch(function(){R=null})}function A(){return u.valuesOf("safe_file_extension").then(function(e){D=e})}function w(e){return!e.attachment_id||I.canManage}function T(){e.forEach(S,function(e){e()})}function P(e,t){I.fileUploader.queue&&I.fileUploader.queue.length>0?I.fileUploader.uploadAll({entityID:I.request.id}).then(function(){t()}).catch(t):t()}n.debug("Component: leave-request-popup-files-tab");var D=[],S=[],R={},I=Object.create(this);return I.filesLoaded=!1,I.fileUploader=null,I.today=Date.now(),I.userDateFormatWithTime=s.DATE_FORMAT+" HH:mm",I.userDateFormat=s.DATE_FORMAT,I.$onDestroy=T,I.$onInit=d,I.canRemoveAttachment=w,I.canSubmit=f,I.canUploadMore=m,I.formatDateTime=p,I.getAuthorName=h,I.getFilesAmount=v,I.listFileTypes=q,I}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(){o=n.parse(),o.openModal&&r({leaveType:o.openModal,selectedContactId:s.selectedContactId})}function r(e){t.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.$onInit=a,s.openLeavePopup=r}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(){o(i.permissions.admin.administer).then(function(e){H.isAdmin=e,n.all([A(),w(),O(),P(),R(),S(),x()]).then(function(){H.loading.page=!1,T()}),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(t){return t.status_id===e.value}).length}function g(t){return e.find(H.absenceTypes,{id:t})}function b(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 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 q(t){return e.find(H.leaveRequestStatuses,function(e){return e.name===t}).value}function $(t){var n=e.find(H.filteredUsers,function(e){return e.id===t});return n?n.display_name:null}function C(e){return e.current?"Current Period ("+e.title+")":e.title}function A(){return u.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 w(){return c.all().then(c.loadCalculationUnits).then(function(e){H.absenceTypes=e})}function T(e){return(H.isAdmin?r.all(h()):r.leaveManagees(H.contactId,h())).then(function(t){return H.filteredUsers=H.isAdmin?t.list:t,e?D(e):n.all([D("table"),D("filter")])}).then(function(){H.filters.leaveRequest.leaveStatus!==W&&0===H.leaveRequests.table.list.length&&H.refresh(1,!0)})}function P(){return s.valuesOf("hrjc_department").then(function(e){H.departments=e})}function D(e){var t="filter"!==e,n="table"===e?e:"content",a="filter"===e?{size:0}:H.pagination,r="filter"===e?{return:["status_id"]}:{};return H.loading[n]=!0,l.all(I(t),a,"from_date DESC",r,!1).then(function(t){H.leaveRequests[e]=t}).catch(function(){H.leaveRequests[e].list=[]}).finally(function(){H.loading[n]=!1})}function S(){return s.valuesOf("hrjc_level_type").then(function(e){H.levelTypes=e})}function R(){return s.valuesOf("hrjc_location").then(function(e){H.locations=e})}function I(t){var n=H.filters.leaveRequest;return{contact_id:M(),managed_by:H.isAdmin&&"me"!==n.assignedTo.type?void 0:H.contactId,status_id:E(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 O(){return s.valuesOf("hrjc_region").then(function(e){H.regions=e})}function x(){return s.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){H.leaveRequestStatuses=e.concat(H.leaveRequestStatuses)})}function L(e){d.openModal(e)}function M(){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 k(e){var t=[q(i.statusNames.moreInformationRequired),q(i.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function E(e){var t=H.filters.leaveRequest,n=[];if(e&&t.leaveStatus&&t.leaveStatus.value&&n.push(t.leaveStatus.value),t.pending_requests&&(n=k(n)),n.length)return{IN:n}}function B(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,T(n))}function j(e){H.filters.leaveRequest.leaveStatus=e,H.refresh(1,!1,"table")}function F(e){H.filters.leaveRequest.assignedTo=e,H.refresh()}function N(){f.subscribe("LeaveRequest::updatedByManager",function(){H.refresh()}),f.subscribe("LeaveRequest::new",function(){H.refresh()}),f.subscribe("LeaveRequest::edit",function(){H.refresh()}),f.subscribe("LeaveRequest::delete",function(){H.refresh()}),f.subscribe("LeaveRequest::statusUpdate",function(){H.refresh()})}function U(){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=m,H.clearStaffSelection=p,H.countLeaveRequestByStatus=v,H.getAbsenceTypeByID=g,H.getArrayOfSize=b,H.getLeaveStatusByValue=y,H.getNavBadge=_,H.getUserNameByID=$,H.labelPeriod=C,H.openLeavePopup=L,H.refresh=B,H.refreshWithFilter=j,H.refreshWithFilterByAssignee=F,H.totalNoOfPages=U}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),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),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 $(){["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 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(){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=O,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")&&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(),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 I(e){u.uiOptions.times[e].time=""}function O(){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 k(){u.setRequestDateTimesAndDateTypes(),l(),x(),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 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=k,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=I,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){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,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"===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 ke.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return ke.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 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 x(){return"toil"!==U()&&!Ee.request.change_balance}function L(){Ee.errors=[]}function M(){return Ee.request.create().then(Ae).then(function(){he("LeaveRequest::new")})}function k(){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 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(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(ge).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!==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 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=+xe==+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(ge).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",we),s.$on("LeaveRequestPopup::addTab",function(e,t){ke.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:xe}),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(j()).then(v.loadCalculationUnits).then(function(e){De={types:e,ids:e.map(function(e){return e.id})}})}function le(){return Ee.loading.entitlements=!0,g.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){xe=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!==xe})}):m.find(xe).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 ge(e){if(Ee.absenceTypes=pe(De.types,e),!Ee.absenceTypes.length)return r.reject(Le)}function be(){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(k).then(x()&&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(ke.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(){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,Se={},Re=0,Ie={},Oe=[],xe="",Le="No entitlement",Me="",ke=[],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=S,Ee.canSubmit=R,Ee.closeAlert=L,Ee.deleteLeaveRequest=E,Ee.dismissModal=B,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(be).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"]}),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(O(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 O(e){return{index:h(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:t().year(e.year()).month(e.month())}}function L(){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=L,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=O(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(O(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/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){ +function l(){v(),_()}function d(t){C=T.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===T.leaveRequest.request_type?o.open(h(t)):p(t)}function m(){return"admin"===T.role&&"public_holiday"===T.leaveRequest.request_type}function f(n){var a=T.absenceTypes[T.leaveRequest.type_id].allow_request_cancelation;return"admin"===T.role||("manager"===T.role?e.includes([A.awaitingApproval,A.moreInformationRequired],n):"3"===a?t().isBefore(T.leaveRequest.from_date):"2"===a)}function p(t){o.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return T.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(i.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){g(t)}}):h(t)})}})}function v(){e.isArray(T.leaveRequestStatuses)&&(T.leaveRequestStatuses=e.indexBy(T.leaveRequestStatuses,"value")),e.isArray(T.absenceTypes)&&(T.absenceTypes=e.indexBy(T.absenceTypes,"id"))}function h(e){var t=D[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return T.leaveRequest[e]().then(function(){y(e)}).catch(function(e){u.error("Error:",e)})}}}function b(e,t){e.stopPropagation(),s.openModal(t)}function g(e){s.openModal({leaveRequest:T.leaveRequest,leaveType:T.leaveRequest.request_type,selectedContactId:T.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:c.statusNames[R[e]]})}function y(t){var n=e.find(T.leaveRequestStatuses,function(e){return e.name===c.statusNames.awaitingApproval}).value;C===n&&r.publish("ManagerBadge:: Update Count"),r.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:T.leaveRequest})}function _(){var t=T.leaveRequestStatuses[T.leaveRequest.status_id].name,n=e.compact(e.map(D,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!f(t)&&e.pull(n,"cancel"),"admin"!==T.role&&e.pull(n,"delete"),"staff"===T.role&&e.pull(n,"approve","reject"),"staff"!==T.role&&q(n),m()&&n.push("delete"),T.allowedActions=e.map(n,function(e){return{key:e,label:D[e].label,isDirectAction:D[e].isDirectAction}})}function q(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 C,T=this,A=c.statusNames,D={edit:{label:"Edit",allowedStatuses:[A.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[A.moreInformationRequired]},view:{label:"View",allowedStatuses:[A.approved,A.rejected,A.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.approved,A.rejected,A.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.moreInformationRequired,A.approved,A.rejected,A.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},R={approve:"approved"};T.allowedActions=[],T.$onInit=l,T.action=d,T.openLeavePopup=b}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,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(O).then(G).then(P).then(L).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 O(){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 L(){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",L),y(),a.all([A(),C()]).then(_).finally(function(){L.filesLoaded=!0})}function m(){return L.fileUploader&&L.fileUploader.queue.length>0}function f(){return L.getFilesAmount()0?S.map(function(e){return e.label}).join(", "):""}function C(){return L.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){O[e.label]=t})})).catch(function(){O=null})}function A(){return c.valuesOf("safe_file_extension").then(function(e){S=e})}function D(e){return!e.attachment_id||L.canManage}function R(){e.forEach(I,function(e){e()})}function P(e,t){L.fileUploader.queue&&L.fileUploader.queue.length>0?L.fileUploader.uploadAll({entityID:L.request.id}).then(function(){t()}).catch(t):t()}n.debug("Component: leave-request-popup-files-tab");var S=[],I=[],O={},L=Object.create(this);return L.filesLoaded=!1,L.fileUploader=null,L.today=Date.now(),L.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",L.userDateFormat=i.DATE_FORMAT,L.$onDestroy=R,L.$onInit=d,L.canRemoveAttachment=D,L.canSubmit=m,L.canUploadMore=f,L.formatDateTime=p,L.getAuthorName=v,L.getFilesAmount=h,L.listFileTypes=q,L}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(),O(),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(L(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 O(){return i.valuesOf("hrjc_location").then(function(e){H.locations=e})}function L(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),L(),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),O(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(L)}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&&O(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(){O(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(){O("from",!0)})):o.resolve()}function O(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 L(){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(){O("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 O(){return k(),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time),l(),j?j=!1:w(),F()}function L(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=L,c.setDaysSelectionModeExtended=O,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/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 o(t,o,s,i,r,c,u,l,d,m,f,p,v,h,b,g,y,_,q,C,T){function A(e){"days"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function D(){["from","to"].forEach(A)}function R(){var e=Be.requestStatuses[_.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return xe.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return xe.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return!Be.loading.entitlements&&(!!re("admin")||!se("view")&&!(re("manager")&&!se("create")))}function O(){var e=P();return Be.isMode("edit")&&(e=e&&(G()||S())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function L(){Be.isSelfRecord?Be.request.status_id=Be.requestStatuses[_.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function M(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==j())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return T.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function w(){return"toil"!==j()&&!Be.request.change_balance}function $(){Be.errors=[]}function k(){return Be.request.create().then(Ae).then(function(){ve("LeaveRequest::new")})}function x(){ne()&&!Be.isRole("staff")&&(Be.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 Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.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(Be.getStatusFromValue(Be.request.status_id).name)}function U(e){return n.map(Ie[e],function(e){return Be.requestStatuses[e]})}function j(){return Be.request?Be.request.request_type:Be.leaveType||null}function H(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?N():U("none")}function W(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function Y(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function G(){return!e.equals(Le,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function V(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?o.resolve().then(ue).then(le).then(be).then(ye).then(te).then(X).then(Be.isMode("edit")?_e:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==$e)return o.reject(e)}):o.reject("The contact id was not set")}function z(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];Ie.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Ie.awaiting_approval=e,Ie.more_information_required=e,Ie.rejected=e,Ie.approved=e,Ie.cancelled=[_.statusNames.awaitingApproval].concat(e)}function X(){return Be.canManage?f.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):o.resolve()}function Q(){var e="my-leave"===s.section,t=+we==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function J(){Me.push(s.$on("LeaveRequestPopup::requestObjectUpdated",_e),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){le().then(be).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,t){Y(t)}),s.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),i.$on("$destroy",De),i.$on("LeaveRequestPopup::addTab",function(e,t){xe.push(t)})}function K(){var e,t;Be.request=Be.leaveRequest||null,e=j(),t=Be.initRequestAttributes(),"leave"===e?Be.request=y.init(t):"sickness"===e?Be.request=q.init(t):"toil"===e&&(Be.request=C.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:we}),e}function ee(){if(ke="staff",!Be.isSelfRecord)return c(_.permissions.admin.administer).then(function(e){e&&(ke="admin")}).then(function(){return"staff"===ke&&c(_.permissions.ssp.manage).then(function(e){e&&(ke="manager")})}).finally(function(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")})}function te(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[_.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[_.statusNames.approved].value)}function ne(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],W(Be.request.status_id).name)}function ae(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function oe(e){return Be.request&&Be.request.request_type===e}function se(e){return Be.mode===e}function ie(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 re(e){return ke===e}function ce(){return v.all().then(function(e){Be.absencePeriods=e})}function ue(){return h.all(F()).then(h.loadCalculationUnits).then(function(e){Se={types:e,ids:e.map(function(e){return e.id})}})}function le(){return Be.loading.entitlements=!0,b.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Se.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function de(){return p.get().then(function(e){we=e.contactId})}function me(){return Be.selectedContactId?f.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?f.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==we})}):f.find(we).then(function(e){return e.leaveManagees()}).then(function(e){Be.managedContacts=e})}function fe(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.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 ve(e){R(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function he(){["from","to"].forEach(function(e){Be.request[e+"_date"]=Le[e+"_date"]})}function be(e){if(Be.absenceTypes=pe(Se.types,e),!Be.absenceTypes.length)return o.reject($e)}function ge(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ie(Be.request,e)})}function ye(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function _e(){Le=e.copy(Be.request.attributes())}function qe(){var e;Be.request.id?(e=[Be.requestStatuses[_.statusNames.approved].value,Be.requestStatuses[_.statusNames.adminApproved].value,Be.requestStatuses[_.statusNames.rejected].value,Be.requestStatuses[_.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function Ce(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,L(),D(),Be.request.isValid().then(ne()&&M).then(x).then(w()&&he).then(Te).then(function(){return Be.isMode("edit")?Pe():k()}).catch(function(t){Be.request.status_id=e,t&&Y(t)}).finally(function(){Be.submitting=!1})}function Te(){return o.all(xe.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Ae(){function e(e){e&&n.push(e),++a===Oe&&(n.length>0?t.reject(n):t.resolve())}var t=o.defer(),n=[],a=0;return Oe>0?s.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function De(){Me.forEach(function(e){e()})}function Re(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Pe(){return Be.request.update().then(Ae).then(function(){Be.isRole("manager")?ve("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&ve("LeaveRequest::edit")})}t.debug("RequestCtrl");var Se,Ie={},Oe=0,Le={},Me=[],we="",$e="No entitlement",ke="",xe=[],Be=n.assign(this,m);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.loading={absenceTypes:!0, +entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=I,Be.canSubmit=O,Be.closeAlert=$,Be.deleteLeaveRequest=B,Be.dismissModal=E,Be.getStatuses=H,Be.getStatusFromValue=W,Be.initAfterContactSelection=V,Be.initRequestAttributes=Z,Be.isLeaveStatus=ae,Be.isLeaveType=oe,Be.isMode=se,Be.isRole=re,Be.submit=Ce,Be.updateAbsenceType=Re,function(){Be.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 Be.canManage&&!Be.isMode("edit")&&me()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(Y).finally(function(){Be.loading.absenceTypes=!1})}()}t.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,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 5ca82fa73dd..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){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(){}); +!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 6a82982c4d8..84b34847aee 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){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,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(){F().then(g).then(b).then(_).then(S).then(function(){return a.all([q(),A(),D(),W.showFilters?T():e.noop])}).then(function(){f(),y(),j()}).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(R(n)),n.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(){o.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){W.supportData.absenceTypesToFilterBy=t,k(!0)})}function g(){o.$new().$watch(function(){return W.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(B(),j(),k())})}function y(e){W.injectMonth=!0,N("injected").then(function(){k(e)}).then(function(){W.loading.calendar=!1})}function _(){U=n("LeaveCalendar"+e.capitalize(H)+"Controller").init(W)}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return i.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(L)}function C(){return u.all().then(u.loadCalculationUnits)}function w(){return l.valuesOf(["hrleaveandabsences_absence_type_calculation_unit","hrleaveandabsences_leave_request_day_type","hrleaveandabsences_leave_request_status","hrleaveandabsences_toil_amounts"])}function A(){return U.loadContacts().then(function(e){W.contacts=e})}function T(){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 c.all()}function D(){return a.all([C(),P(),w()]).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 S(){var e=a.resolve();return W.injectMonth&&(e=N("destroyed"),W.injectMonth=!1),e}function R(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:t().year(e.year()).month(e.month())}}function I(){var t=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),t!==W.selectedPeriod.id&&p(),L(),j(),O("month")}function x(e){var n="previous"===e?"subtract":"add";B(t(W.selectedMonth.moment)[n](1,"month")),j(),O("month")}function O(t){t=e.includes(["contacts","period","month"],t)?t:"period",a.resolve().then(S).then("period"===t&&p).then("period"===t&&M).then("contacts"===t&&A).then("month"===t&&j).then(function(){y("contacts"===t)})}function k(e){o.$emit("LeaveCalendar::showMonth",!!e)}function L(){B(t())}function M(){B(W.months[0].moment)}function E(n){var a="previous"===n?"first":"last",r=e[a](W.months),o=t().year(r.year).month(r.month);W.monthPaginatorsAvailability[n]=!W.selectedMonth.moment.isSame(o,"month")}function j(){E("previous"),E("next")}function B(t){t&&(W.selectedMonthIndex=v(t)),W.selectedMonth=e.find(W.months,{index:W.selectedMonthIndex})}function F(){ -return a.all([d(s.permissions.admin.administer),d(s.permissions.ssp.manage)]).then(function(e){W.userPermissionRole=e[0]?"admin":e[1]?"manager":"staff",H=W.roleOverride?W.roleOverride:W.userPermissionRole})}function N(t){return a(function(n){var a=o.$on("LeaveCalendar::month"+e.capitalize(t),function(){a(),n()})})}r.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=$,W.navigateToCurrentMonth=I,W.paginateMonth=x,W.refresh=O}n.component("leaveCalendar",{bindings:{contactId:"<",displaySingleContact:"0,n={from_date:{to:J.month.days[J.month.days.length-1].date+" 23:59:59"},to_date:{from:J.month.days[0].date+" 00:00:00"},status_id:{IN:x()},contact_id:{IN:J.contacts.map(function(e){return e.id})},type_id:{IN:t?J.supportData.absenceTypesToFilterBy:e.pluck(J.supportData.absenceTypes,"id")}};return y(),s.all(n,null,null,null,!1).then(function(e){return X={},t&&(e.list=$(e.list)),w(e.list)})}function L(){var t=J.month.days[0].date,n=J.month.days[J.month.days.length-1].date;return o.get(J.contacts.map(function(e){return e.id}),t,n).then(function(t){z=e.indexBy(t,"contact_id")})}function M(){return J.contactIdsToReduceTo&&(J.contacts=J.contacts.filter(function(t){return e.includes(J.contactIdsToReduceTo,t.contact_id)||e.find(X,function(e){return e.contact_id===t.contact_id})})),a.resolve()}function E(t){var n=R(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 j(){r.$emit("LeaveCalendar::monthDestroyed"),G.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(h(t.date)),s.isNonWorkingDay(h(t.date))]).then(function(a){e.assign(t.contactsData[n],{isWeekend:a[0],isNonWorkingDay:a[1],isPublicHoliday:D(t.date)})}),o.then(function(){return X[n]&&X[n][t.date]?X[n][t.date]:[]}).then(function(a){a=U(a),e.assign(t.contactsData[n],{leaveRequests:a,leaveRequestsToShowInCell:b(a),leaveRequestsAttributes:q(t,a)})})}function F(){return a.all(J.month.days.map(function(e){return a.all(J.contacts.map(function(t){return B(e,t.id)}))}))}function N(e,t){J.currentPage=0,J.visible=!0,(t||!Y)&&O()}function U(n){return e.sortBy(n,function(e){return+t(e.from_date).format("X")+(T("half_day_pm",e,e.from_date)?1:0)})}function H(t){var n=e.find(J.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){v(e),-1!==x().indexOf(e.status_id)&&l(e)}function V(e){return a.all(R(e).map(function(t){return B(t,e.contact_id,!0)}))}n.debug("Component: leave-calendar-month");var Y=!1,G=[],z={},X={},J=this;J.currentPage=0,J.pageSize=20,J.visible=!1,J.showContactName=!!J.showContactName,J.showOnlyWithLeaveRequests=!!J.showOnlyWithLeaveRequests,J.$onDestroy=j,J.$onInit=c,J.contactsList=p,J.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 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(){h(),_()}function d(t){q=C.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===C.leaveRequest.request_type?r.open(v(t)):p(t)}function m(){return"admin"===C.role&&"public_holiday"===C.leaveRequest.request_type}function f(n){var a=C.absenceTypes[C.leaveRequest.type_id].allow_request_cancelation;return"admin"===C.role||("manager"===C.role?e.includes([w.awaitingApproval,w.moreInformationRequired],n):"3"===a?t().isBefore(C.leaveRequest.from_date):"2"===a)}function p(t){r.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return C.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(s.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){g(t)}}):v(t)})}})}function h(){e.isArray(C.leaveRequestStatuses)&&(C.leaveRequestStatuses=e.indexBy(C.leaveRequestStatuses,"value")),e.isArray(C.absenceTypes)&&(C.absenceTypes=e.indexBy(C.absenceTypes,"id"))}function v(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 C.leaveRequest[e]().then(function(){y(e)}).catch(function(e){c.error("Error:",e)})}}}function b(e,t){e.stopPropagation(),o.openModal(t)}function g(e){o.openModal({leaveRequest:C.leaveRequest,leaveType:C.leaveRequest.request_type,selectedContactId:C.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:u.statusNames[T[e]]})}function y(t){var n=e.find(C.leaveRequestStatuses,function(e){return e.name===u.statusNames.awaitingApproval}).value;q===n&&i.publish("ManagerBadge:: Update Count"),i.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:C.leaveRequest})}function _(){var t=C.leaveRequestStatuses[C.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"!==C.role&&e.pull(n,"delete"),"staff"===C.role&&e.pull(n,"approve","reject"),"staff"!==C.role&&$(n),m()&&n.push("delete"),C.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,C=this,w=u.statusNames,A={edit:{label:"Edit",allowedStatuses:[w.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[w.moreInformationRequired]},view:{label:"View",allowedStatuses:[w.approved,w.rejected,w.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[w.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[w.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[w.awaitingApproval,w.approved,w.rejected,w.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[w.awaitingApproval,w.moreInformationRequired,w.approved,w.rejected,w.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},T={approve:"approved"};C.allowedActions=[],C.$onInit=l,C.action=d,C.openLeavePopup=b}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(){r.$emit("LeaveRequestPopup::addTab",q),y(),_()}function l(){q.request.comments.push({contact_id:$,leave_request_id:q.request.id,text:q.comment.text}),q.comment.text=""}function d(){return q.comment.text.length>0}function m(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 p(){return q.request.comments.filter(function(e){return!e.toBeDeleted})}function h(e){return e===$?"Me":q.comment.contacts[e]?q.comment.contacts[e].display_name:void 0}function v(e){return q.mode===e}function b(){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 y(){return q.request.loadComments().then(function(){a.$broadcast("LeaveRequestPopup::requestObjectUpdated"),q.request.comments.length&&g()})}function _(){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.$onInit=c,q.addComment=l,q.canRemoveComment=m,q.canSubmit=d,q.formatDateTime=f,q.getActiveComments=p,q.getCommentorName=h,q.isMode=v,q.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/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(){n("RequestModalDetails"+e.capitalize(C(ne.leaveType,ne.request))+"Controller",{detailsController:ne}),ne.canManage=ne.isRole("manager")||ne.isRole("admin"),ne.loading.tab=!0,o.$emit("LeaveRequestPopup::addTab",ne),S(),ne.initChildController().then(function(){return s.all([M(),L()])}).then(!ne.isMode("create")&&D).then(V).then(function(){if(!ne.isMode("create"))return s.resolve().then(ne.initTimesExtended).then(z)}).then(!ne.isMode("create")&&W).then(R).then(Y).then(P).then(I).then(!ne.isMode("view")&&ne.initWatchersExtended).catch(T).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 h(e){return t(e,u.serverDateFormat).toDate()}function v(e){return t(e).format(u.serverDateFormat)}function b(e){var t;return s.resolve().then(function(){U(e),"from"===e&&N(),x("hours")&&(_(e),"from"!==e||ne.uiOptions.multipleDays||_("to")),ne.loading[e+"DayTypes"]=!0}).then(function(){return q(e)}).then(function(e){if(t=e.id!==ne.period.id,t&&(ne.period=e),!ne.period.id)return s.reject("Please change date as it is not in any absence period")}).then(W).then(function(){if(t)return M()}).then(function(){return ne.onDateChangeExtended&&ne.onDateChangeExtended(e)}).then(function(){if(z(),!t)return j();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(T).finally($)}function g(){return z(),j()}function y(){return ne.uiOptions.toDate=null,U("to"),s.resolve().then(z).then(ne.setDaysSelectionModeExtended).then($).then(!ne.uiOptions.multipleDays&&j)}function _(e){ne.uiOptions.times[e].loading=!0}function $(){["from","to"].forEach(function(e){ne.loading[e+"DayTypes"]=!1,x("hours")&&(ne.uiOptions.times[e].loading=!1)})}function q(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 C(){return ne.request?ne.request.request_type:ne.leaveType||null}function w(e){return t().set({hours:e.split(":")[0],minutes:e.split(":")[1]})}function A(){return X(),ne.loading.balanceChange=!0,ne.request.getBalanceChangeBreakdown().then(H).catch(T)}function T(t){r.$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?j():A()}function D(){var e=ne.request.attributes();return ne.uiOptions.fromDate=h(ne.request.from_date),ne.request.to_date=e.to_date,ne.request.to_date_type=e.to_date_type,ne.uiOptions.toDate=h(ne.request.to_date),ne.initDayTypesExtended?ne.initDayTypesExtended():s.resolve()}function S(){te.push(r.$on("LeaveRequestPopup::absenceTypeChanged",function(){K()}),r.$on("LeaveRequestPopup::absencePeriodBalancesUpdated",function(e,t){Q(t)}),r.$on("LeaveRequestPopup::recalculateBalanceChange",j))}function R(){ne.isMode("edit")&&(ne.isLeaveStatus(u.statusNames.approved)||ne.isLeaveStatus(u.statusNames.adminApproved))&&(ee={absenceTypeId:ne.request.type_id,value:ne.selectedAbsenceType.remainder-ne.request.balance_change})}function I(){r.$watch(function(){return ne.uiOptions.times.from.time},function(e,t){e!==t&&(ne.uiOptions.multipleDays||(Z(e),z()))})}function x(e){return ne.selectedAbsenceType.calculation_unit_name===e}function O(e){return ne.request.request_type===e}function k(t){return e.includes(["weekend","non_working_day","public_holiday"],t)}function L(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){ne.requestDayTypes=e})}function M(){return c.get(ne.request.contact_id,ne.period.start_date,ne.period.end_date).then(function(e){ne.calendar=e})}function E(){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 j(){return X(),ne.canCalculateChange()?(ne.loading.balanceChange=!0,ne.request.change_balance=!0,ne.calculateBalanceChange().then(H).catch(T).finally(function(){ne.loading.balanceChange=!1})):s.resolve()}function B(){ne.pagination.totalItems=ne.balance.change.breakdown.length,ne.pagination.filteredbreakdown=ne.balance.change.breakdown,ne.pagination.pageChanged()}function F(){return v(ne.request.from_date)===v(ne.request.to_date)}function N(){ne.uiOptions.toDate&&ne.uiOptions.fromDate&&ne.uiOptions.multipleDays&&t(ne.uiOptions.toDate).isSameOrBefore(ne.uiOptions.fromDate)&&(ne.uiOptions.toDate=null,U("to"))}function U(e){ne.resetUIInputsExtended&&ne.resetUIInputsExtended(e),z(),X()}function H(e){ne.balance.change=e,ne.request.balance_change=e.amount,p(),B(),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=h(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=h(ne.period.end_date)}function V(){return!ne.isMode("create")&&F()||ne.isMode("create")&&(O("sickness")||x("hours"))?ne.uiOptions.multipleDays=!1:ne.uiOptions.multipleDays=!0,s.resolve().then(ne.setDaysSelectionModeExtended)}function Y(){ee&&ee.absenceTypeId===ne.selectedAbsenceType.id?ne.balance.opening=ee.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 z(){var e=ne.uiOptions,t=e.times;ne.request.from_date=e.fromDate?v(e.fromDate):null,ne.request.to_date=e.toDate?v(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),(x("hours")||O("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 J(){e.forEach(te,function(e){e()})}function K(){var e,t=ne.selectedAbsenceType.calculation_unit_name;return G(),e=t!==ne.selectedAbsenceType.calculation_unit_name,Y(),s.resolve().then(e&&V).then(e&&ne.onAbsenceTypeUpdateExtended).then(e&&z).then($).then(j)}function Q(e){return ne.absenceTypes=e,G(),t(ne.uiOptions.toDate).isAfter(ne.period.end_date)&&(ne.uiOptions.toDate=void 0,U("to")),Y(),j()}function Z(e){var t=w(e).add(ne.uiOptions.time_interval,"minutes");t.isAfter(w(ne.uiOptions.times.to.max))||(ne.uiOptions.times.to.min=t.format("HH:mm"),t.isAfter(w(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=u.statusNames,ne.loading={tab:!1,balanceChange:!1,fromDayTypes:!1,toDayTypes:!1},ne.pagination={currentPage:1,filteredbreakdown:[],numPerPage:7,totalItems:0,pageChanged:E},ne.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},ne.$onInit=f,ne.convertDateFormatFromServer=h,ne.convertDateToServerFormat=v,ne.dateChangeHandler=b,ne.dateTypeChangeHandler=g,ne.daysSelectionModeChangeHandler=y,ne.disableAndShowLoadingTimeInput=_,ne.getMomentDateWithGivenTime=w,ne.handleError=T,ne.isCalculationUnit=x,ne.isLeaveType=O,ne.isNotWorkingDay=k,ne.performBalanceChangeCalculation=j,ne.setRequestDateTimesAndDateTypes=z,ne.updateEndTimeInputMinTime=Z,ne.$onDestroy=J}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(){r.$broadcast("LeaveRequestPopup::childComponent::register"),o.$emit("LeaveRequestPopup::addTab",I),y(),a.all([w(),q()]).then(_).finally(function(){I.filesLoaded=!0})}function m(){return I.fileUploader&&I.fileUploader.queue.length>0}function f(){return I.getFilesAmount()0?D.map(function(e){return e.label}).join(", "):""}function q(){return I.request.loadAttachments().then(function(){r.$broadcast("LeaveRequestPopup::requestObjectUpdated")})}function C(){return a.all(D.map(function(e){return l.getMimeTypeFor(e.label).then(function(t){R[e.label]=t})})).catch(function(){R=null})}function w(){return u.valuesOf("safe_file_extension").then(function(e){D=e})}function A(e){return!e.attachment_id||I.canManage}function T(){e.forEach(S,function(e){e()})}function P(e,t){I.fileUploader.queue&&I.fileUploader.queue.length>0?I.fileUploader.uploadAll({entityID:I.request.id}).then(function(){t()}).catch(t):t()}n.debug("Component: leave-request-popup-files-tab");var D=[],S=[],R={},I=Object.create(this);return I.filesLoaded=!1,I.fileUploader=null,I.today=Date.now(),I.userDateFormatWithTime=s.DATE_FORMAT+" HH:mm",I.userDateFormat=s.DATE_FORMAT,I.$onDestroy=T,I.$onInit=d,I.canRemoveAttachment=A,I.canSubmit=m,I.canUploadMore=f,I.formatDateTime=p,I.getAuthorName=h,I.getFilesAmount=v,I.listFileTypes=$,I}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(){o=n.parse(),o.openModal&&r({leaveType:o.openModal,selectedContactId:s.selectedContactId})}function r(e){t.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.$onInit=a,s.openLeavePopup=r}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(){n.all([M(),C(),q()]).then(function(){G.loading.page=!1}).then(function(){return n.all([T(),A()])}).then(E).then(function(){G.loading.content=!1}),F()}function p(e,t){t.data.push(e),t.dataIndex[e.id]=e}function h(){G.absenceTypes=G.absenceTypes.map(function(t){var n=e.find(G.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 v(e){N(e),G.sections.other.open&&p(e,G.sections.other)}function b(){Object.values(G.sections).forEach(function(e){e.data=[]})}function g(){ -G.absenceTypesFiltered=G.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function y(e){var t=Y[e.status];t?t(e.leaveRequest):G.refresh()}function _(t){t.dataIndex=e.indexBy(t.data,"id")}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return o.all().then(function(t){G.absencePeriods=e.sortBy(t,"start_date"),G.selectedPeriod=e.find(G.absencePeriods,function(e){return!0===e.current})})}function C(){return s.all().then(s.loadCalculationUnits).then(function(t){G.absenceTypes=t,G.absenceTypesIndexed=e.indexBy(t,"id")})}function w(){return R("approved",{status_id:V(m.statusNames.approved)})}function A(){var t={contact_id:G.contactId,period_id:G.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:[V(m.statusNames.approved)]}})),u.balanceChangeByAbsenceType(e.assign({},t,{statuses:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}}))]).then(function(e){G.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 T(){return i.all({contact_id:G.contactId,period_id:G.selectedPeriod.id},!0).then(function(e){G.entitlements=e})}function P(){return i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id},G.entitlements).then(function(){return j(G.entitlements)}).then(function(e){G.sections.entitlements.data=e})}function D(){return n.all([i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id,expired:!0}),S({request_type:"toil",expired:!0})]).then(function(e){return n.all({expiredBalanceChangesFlatten:j(e[0]),expiredTOILS:B(e[1].list)})}).then(function(t){G.sections.expired.data=t.expiredBalanceChangesFlatten.concat(t.expiredTOILS),G.sections.expired.data=e.sortBy(G.sections.expired.data,"expiry_date")})}function S(t){return u.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})}},t),null,"from_date ASC",null,!1)}function R(e,t){return S(t).then(function(t){G.sections[e].data=t.list})}function I(){return n.all(Object.values(G.sections).filter(function(e){return e.open}).map(L))}function x(){return R("other",{status_id:{in:[V(m.statusNames.rejected),V(m.statusNames.cancelled)]}})}function O(){return R("pending",{status_id:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}})}function k(){return R("holidays",{public_holiday:!0})}function L(e){return e.loading=!0,e.loadLeaveRequests().then(_.bind(this,e)).then(function(){e.loading=!1})}function M(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){G.leaveRequestStatuses=e.indexBy(t,"value")})}function E(){h(),g()}function j(t){return n.resolve().then(function(){return t.map(function(t){var n=e.find(G.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 B(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 F(){l.subscribe("LeaveRequest::new",function(){G.refresh()}),l.subscribe("LeaveRequest::edit",function(){G.refresh()}),l.subscribe("LeaveRequest::statusUpdate",y),l.subscribe("LeaveRequest::delete",function(e){N(e)})}function N(t){e.forEach(G.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&&U(t,a))})}function U(t,n){var a=["future","current"],r=G.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 H(){G.loading.content=!0,n.all([T(),A()]).then(E).then(function(){G.loading.content=!1}).then(function(){return n.all([I(),b()])})}function W(e){var t=G.sections[e];t.open=!t.open,t.open&&!t.data.length&&L(t)}function V(t){return e.find(G.leaveRequestStatuses,function(e){return e.name===t}).value}t.debug("Component: staff-leave-report");var Y={delete:N,cancel:v},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:w},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:D},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:x}},G.$onInit=f,G.labelPeriod=$,G.refresh=H,G.toggleSection=W}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(){s(),o()}function o(){return n("can administer calendar feeds").then(function(e){u.canCreateNewFeed=!!e})}function s(){return u.loading.feeds=!0,e.all().then(function(e){u.feeds=e}).finally(function(){u.loading.feeds=!1})}function i(e,n){t.open(e,n)}var u=this;u.canCreateNewFeed=!1,u.feeds=[],u.loading={feeds:!1},u.$onInit=r,u.openLinkModal=i}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(w(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,U("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(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 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 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=U("destroyed"),W.injectMonth=!1),e}function w(e){return{index:v(e),month:e.month(),year:e.year(),name:e.format("MMMM"),moment:n().year(e.year()).month(e.month())}}function L(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&p(),x(),B(),k("month")}function O(e){var t="previous"===e?"subtract":"add";F(n(W.selectedMonth.moment)[t](1,"month")),B(),k("month")}function k(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 U(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=L,W.paginateMonth=O,W.refresh=k}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:O()},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=w(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 N(){return a.all(Q.month.days.map(function(e){return a.all(Q.contacts.map(function(n){return F(e,n.id)}))}))}function U(e,n){Q.currentPage=0,Q.visible=!0,(n||!G)&&k()}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!==O().indexOf(e.status_id)&&l(e)}function Y(e){return a.all(w(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/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(){h(),_()}function d(n){C=T.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===T.leaveRequest.request_type?o.open(v(n)):p(n)}function m(){return"admin"===T.role&&"public_holiday"===T.leaveRequest.request_type}function f(t){var a=T.absenceTypes[T.leaveRequest.type_id].allow_request_cancelation;return"admin"===T.role||("manager"===T.role?e.includes([A.awaitingApproval,A.moreInformationRequired],t):"3"===a?n().isBefore(T.leaveRequest.from_date):"2"===a)}function p(n){o.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return T.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(i.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){g(n)}}):v(n)})}})}function h(){e.isArray(T.leaveRequestStatuses)&&(T.leaveRequestStatuses=e.indexBy(T.leaveRequestStatuses,"value")),e.isArray(T.absenceTypes)&&(T.absenceTypes=e.indexBy(T.absenceTypes,"id"))}function v(e){var n=D[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return T.leaveRequest[e]().then(function(){y(e)}).catch(function(e){u.error("Error:",e)})}}}function b(e,n){e.stopPropagation(),s.openModal(n)}function g(e){s.openModal({leaveRequest:T.leaveRequest,leaveType:T.leaveRequest.request_type,selectedContactId:T.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:c.statusNames[R[e]]})}function y(n){var t=e.find(T.leaveRequestStatuses,function(e){return e.name===c.statusNames.awaitingApproval}).value;C===t&&r.publish("ManagerBadge:: Update Count"),r.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:T.leaveRequest})}function _(){var n=T.leaveRequestStatuses[T.leaveRequest.status_id].name,t=e.compact(e.map(D,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!f(n)&&e.pull(t,"cancel"),"admin"!==T.role&&e.pull(t,"delete"),"staff"===T.role&&e.pull(t,"approve","reject"),"staff"!==T.role&&q(t),m()&&t.push("delete"),T.allowedActions=e.map(t,function(e){return{key:e,label:D[e].label,isDirectAction:D[e].isDirectAction}})}function q(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 C,T=this,A=c.statusNames,D={edit:{label:"Edit",allowedStatuses:[A.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[A.moreInformationRequired]},view:{label:"View",allowedStatuses:[A.approved,A.rejected,A.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[A.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.approved,A.rejected,A.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[A.awaitingApproval,A.moreInformationRequired,A.approved,A.rejected,A.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},R={approve:"approved"};T.allowedActions=[],T.$onInit=l,T.action=d,T.openLeavePopup=b}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(){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(w).then(G).then(P).then(L).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&&U(),O("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,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,O("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 w(){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 L(){o.$watch(function(){return te.uiOptions.times.from.time},function(e,n){e!==n&&(te.uiOptions.multipleDays||(Z(e),z()))})}function O(e){return te.selectedAbsenceType.calculation_unit_name===e}function k(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 U(){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")&&N()||te.isMode("create")&&(k("sickness")||O("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),(O("hours")||k("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=O,te.isLeaveType=k,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",L),y(),a.all([A(),C()]).then(_).finally(function(){L.filesLoaded=!0})}function m(){return L.fileUploader&&L.fileUploader.queue.length>0}function f(){return L.getFilesAmount()0?I.map(function(e){return e.label}).join(", "):""}function C(){return L.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){w[e.label]=n})})).catch(function(){w=null})}function A(){return c.valuesOf("safe_file_extension").then(function(e){I=e})}function D(e){return!e.attachment_id||L.canManage}function R(){e.forEach(S,function(e){e()})}function P(e,n){L.fileUploader.queue&&L.fileUploader.queue.length>0?L.fileUploader.uploadAll({entityID:L.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var I=[],S=[],w={},L=Object.create(this);return L.filesLoaded=!1,L.fileUploader=null,L.today=Date.now(),L.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",L.userDateFormat=i.DATE_FORMAT,L.$onDestroy=R,L.$onInit=d,L.canRemoveAttachment=D,L.canSubmit=m,L.canUploadMore=f,L.formatDateTime=p,L.getAuthorName=h,L.getFilesAmount=v,L.listFileTypes=q,L}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([$(),T(),C()]).then(function(){V.loading.page=!1}).then(function(){return t.all([R(),D()])}).then(E).then(function(){V.loading.content=!1}),N()}function p(e,n){n.data.push(e),n.dataIndex[e.id]=e}function h(){V.absenceTypes=V.absenceTypes.map(function(n){var t=e.find(V.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),V.sections.other.open&&p(e,V.sections.other)}function b(){Object.values(V.sections).forEach(function(e){e.data=[]})}function g(){V.absenceTypesFiltered=V.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function y(e){var n=G[e.status];n?n(e.leaveRequest):V.refresh()}function _(n){n.dataIndex=e.indexBy(n.data,"id")}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return s.all().then(function(n){V.absencePeriods=e.sortBy(n,"start_date"),V.selectedPeriod=e.find(V.absencePeriods,function(e){return!0===e.current})})}function T(){return i.all().then(i.loadCalculationUnits).then(function(n){V.absenceTypes=n,V.absenceTypesIndexed=e.indexBy(n,"id")})}function A(){return w("approved",{status_id:Y(m.statusNames.approved)})}function D(){var n={contact_id:V.contactId,period_id:V.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:[Y(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}}))]).then(function(e){V.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:V.contactId,period_id:V.selectedPeriod.id},!0).then(function(e){V.entitlements=e})}function P(){return r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id},V.entitlements).then(function(){return B(V.entitlements)}).then(function(e){ +V.sections.entitlements.data=e})}function I(){return t.all([r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id,expired:!0}),S({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:B(e[0]),expiredTOILS:F(e[1].list)})}).then(function(n){V.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),V.sections.expired.data=e.sortBy(V.sections.expired.data,"expiry_date")})}function S(n){return c.all(e.assign({contact_id:V.contactId,from_date:{from:V.selectedPeriod.start_date},to_date:{to:V.selectedPeriod.end_date},type_id:{IN:V.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function w(e,n){return S(n).then(function(n){V.sections[e].data=n.list})}function L(){return t.all(Object.values(V.sections).filter(function(e){return e.open}).map(x))}function O(){return w("other",{status_id:{in:[Y(m.statusNames.rejected),Y(m.statusNames.cancelled)]}})}function k(){return w("pending",{status_id:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}})}function M(){return w("holidays",{public_holiday:!0})}function x(e){return e.loading=!0,e.loadLeaveRequests().then(_.bind(this,e)).then(function(){e.loading=!1})}function $(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){V.leaveRequestStatuses=e.indexBy(n,"value")})}function E(){h(),g()}function B(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(V.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 F(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(){V.refresh()}),l.subscribe("LeaveRequest::edit",function(){V.refresh()}),l.subscribe("LeaveRequest::statusUpdate",y),l.subscribe("LeaveRequest::delete",function(e){U(e)})}function U(n){e.forEach(V.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&&j(n,a))})}function j(n,t){var a=["future","current"],o=V.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(){V.loading.content=!0,t.all([R(),D()]).then(E).then(function(){V.loading.content=!1}).then(function(){return t.all([L(),b()])})}function W(e){var n=V.sections[e];n.open=!n.open,n.open&&!n.data.length&&x(n)}function Y(n){return e.find(V.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var G={delete:U,cancel:v},V=this;V.absencePeriods=[],V.absenceTypes=[],V.absenceTypesFiltered=[],V.absenceTypesIndexed={},V.dateFormat=d.DATE_FORMAT,V.leaveRequestStatuses={},V.selectedPeriod=null,V.role="absence-tab"===a.section?"admin":"staff",V.loading={content:!0,page:!0},V.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:A},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O}},V.$onInit=f,V.labelPeriod=q,V.refresh=H,V.toggleSection=W}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 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),L(),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),w(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(L)}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&&w(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(){w(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){k[e]=n,m(e,n),t&&"from"===e&&m("to",n)}).catch(function(n){return k[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(){w("from",!0)})):o.resolve()}function w(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=k[a].number_of_hours?h(s,r).toString():"0";o.maxAmount=c,n&&(o.amount=o.maxAmount)}function L(){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?R("from").then(function(){w("from",!0)}):o.resolve()}var k={};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=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=U.from_date!==c.request.from_date||U.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")&&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 R(){["from","to"].forEach(function(e){o.$watch(function(){return c.uiOptions.times[e].time},function(e,n){e!==n&&(c.setRequestDateTimesAndDateTypes(),F(),l(),k())})})}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(),k(),F()}function w(){return x(),c.uiOptions.multipleDays||c.updateEndTimeInputMinTime(c.uiOptions.times.from.time),l(),j?j=!1:k(),F()}function L(e){c.uiOptions.times[e].time=""}function O(){c.request.toil_to_accrue=c.uiOptions.toil_duration_in_hours}function k(){c.uiOptions.toil_duration_in_hours=c.uiOptions.max_toil_duration_and_accrual}function M(){U=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(),k(),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 N(){c.uiOptions.expiryDate&&(c.request.toil_expiry_date=c.convertDateToServerFormat(c.uiOptions.expiryDate))}t.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=h,c.initChildController=q,c.initTimesExtended=D,c.initWatchersExtended=P,c.onAbsenceTypeUpdateExtended=$,c.onDateChangeExtended=S,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=L,c.setDaysSelectionModeExtended=w,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/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 R(){var e=Ee.requestStatuses[_.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Ee.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){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 S(){return!Ee.loading.entitlements&&(!!re("admin")||!se("view")&&!(re("manager")&&!se("create")))}function w(){var e=P();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 L(){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"!==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 k(){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 N(){return U(Ee.getStatusFromValue(Ee.request.status_id).name)}function U(e){return t.map(Se[e],function(e){return Ee.requestStatuses[e]})}function j(){return Ee.request?Ee.request.request_type:Ee.leaveType||null}function H(){return!Ee.request||e.equals({},Ee.requestStatuses)?[]:Ee.request.status_id?N():U("none")}function W(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(Le,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(ye).then(ne).then(X).then(Ee.isMode("edit")?_e: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=[_.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}):o.resolve()}function Q(){var e="my-leave"===s.section,n=+ke==+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",_e),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(){we++})),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=y.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:ke}),e}function ee(){if(xe="staff",!Ee.isSelfRecord)return c(_.permissions.admin.administer).then(function(e){e&&(xe="admin")}).then(function(){return"staff"===xe&&c(_.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[_.statusNames[Ee.defaultStatus]].value:(Ee.isRole("admin")||Ee.isMode("create")&&Ee.isRole("manager"))&&(Ee.newStatusOnSave=Ee.requestStatuses[_.statusNames.approved].value)}function te(){return!Ee.request.status_id||!t.includes(["cancelled","rejected"],W(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){ke=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!==ke})}):f.find(ke).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){R(),d.publish(e,Ee.request),Ee.errors=[],Ee.dismissModal()}function ve(){["from","to"].forEach(function(e){Ee.request[e+"_date"]=Le[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 ye(){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 _e(){Le=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 Ce(){var e=Ee.request.status_id;if(!Ee.isMode("view")&&!Ee.submitting)return Ee.submitting=!0,L(),D(),Ee.request.isValid().then(te()&&O).then($).then(k()&&ve).then(Te).then(function(){return Ee.isMode("edit")?Pe():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===we&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return we>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function De(){Oe.forEach(function(e){e()})}function Re(){s.$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")})}n.debug("RequestCtrl");var Ie,Se={},we=0,Le={},Oe=[],ke="",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=S,Ee.canSubmit=w,Ee.closeAlert=M,Ee.deleteLeaveRequest=E,Ee.dismissModal=B,Ee.getStatuses=H,Ee.getStatusFromValue=W,Ee.initAfterContactSelection=V,Ee.initRequestAttributes=Z,Ee.isLeaveStatus=ae,Ee.isLeaveType=oe,Ee.isMode=se,Ee.isRole=re,Ee.submit=Ce,Ee.updateAbsenceType=Re,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/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/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/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/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/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/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 Date: Fri, 29 Jun 2018 11:30:50 +0200 Subject: [PATCH 090/151] PCHR-3599: Deletes Some Extended Demographic Fields And also prevents its creation on new sites An upgrader in this commit 1025 was renamed to 1023 in order to follow proper upgrader numbering --- .../CRM/HRCore/Upgrader.php | 1 + .../CRM/HRCore/Upgrader/Steps/1023.php | 48 ++++ .../extended_demographics_install.xml | 262 ------------------ .../resources/csv/civicrm_option_value.csv | 3 - 4 files changed, 49 insertions(+), 265 deletions(-) create mode 100644 uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php index f07642370ee..acce73b4a60 100755 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php @@ -30,6 +30,7 @@ class CRM_HRCore_Upgrader extends CRM_HRCore_Upgrader_Base { use CRM_HRCore_Upgrader_Steps_1020; use CRM_HRCore_Upgrader_Steps_1021; use CRM_HRCore_Upgrader_Steps_1022; + use CRM_HRCore_Upgrader_Steps_1023; /** * @var array diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php new file mode 100644 index 00000000000..c5f72d35502 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php @@ -0,0 +1,48 @@ +deleteExtendDemographicFields([ + 'Ethnicity', + 'Religion', + 'Sexual_Orientation', + ]); + + return TRUE; + } + + /** + * Deletes Custom Demographic Fields only if they are not used + * + * @param $fieldsToDelete + */ + private function deleteExtendDemographicFields($fieldsToDelete) { + $customGroup = civicrm_api3('CustomGroup', 'get', [ + 'name' => ['LIKE' => 'Extended_Demographics'], + ]); + $customGroup = array_shift($customGroup['values']); + $customFields = civicrm_api3('CustomField', 'get', [ + 'name' => ['IN' => $fieldsToDelete], + ]); + foreach ($customFields['values'] as $customField) { + $query = 'SELECT * FROM ' . $customGroup['table_name'] . ' WHERE ' . $customField['column_name'] . ' NOT LIKE "%Not Applicable%" AND ' . $customField['column_name'] . ' IS NOT NULL AND ' . $customField['column_name'] . ' <> ""'; + $dao = CRM_Core_DAO::executeQuery($query); + $isCustomFieldUsed = $dao->fetchAll(); + if (!empty($isCustomFieldUsed)) { + continue; + } + + civicrm_api3('CustomField', 'delete', [ + 'id' => $customField['id'], + ]); + } + } + +} diff --git a/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml b/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml index 70839e1a49c..361c5508397 100755 --- a/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml +++ b/uk.co.compucorp.civicrm.hrcore/xml/CustomGroups/extended_demographics_install.xml @@ -36,63 +36,6 @@ 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 @@ -132,24 +75,6 @@ - - ethnicity_20130725123943 - Ethnicity - 1 - 1 - - - religion_20130725124132 - Religion - 1 - 1 - - - sexual_orientation_20130725124348 - Sexual Orientation - 1 - 1 - marital_status_20130913084916 Marital Status @@ -164,193 +89,6 @@ - - - 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 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 From 29e5eb187cbae799b27fde53e8f2c4463739553c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Wed, 4 Jul 2018 17:02:21 +0200 Subject: [PATCH 091/151] PCHR-3599: Changed function name and formated the query for better reading and performance --- .../CRM/HRCore/Upgrader/Steps/1023.php | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php index c5f72d35502..858d00b840f 100644 --- a/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php +++ b/uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1023.php @@ -9,7 +9,7 @@ trait CRM_HRCore_Upgrader_Steps_1023 { */ public function upgrade_1023() { - $this->deleteExtendDemographicFields([ + $this->up1023_deleteExtendDemographicFields([ 'Ethnicity', 'Religion', 'Sexual_Orientation', @@ -21,21 +21,27 @@ public function upgrade_1023() { /** * Deletes Custom Demographic Fields only if they are not used * - * @param $fieldsToDelete + * @param array $fieldsToDelete */ - private function deleteExtendDemographicFields($fieldsToDelete) { + private function up1023_deleteExtendDemographicFields($fieldsToDelete) { $customGroup = civicrm_api3('CustomGroup', 'get', [ - 'name' => ['LIKE' => 'Extended_Demographics'], + 'name' => 'Extended_Demographics', ]); $customGroup = array_shift($customGroup['values']); $customFields = civicrm_api3('CustomField', 'get', [ 'name' => ['IN' => $fieldsToDelete], ]); + $tableName = $customGroup['table_name']; foreach ($customFields['values'] as $customField) { - $query = 'SELECT * FROM ' . $customGroup['table_name'] . ' WHERE ' . $customField['column_name'] . ' NOT LIKE "%Not Applicable%" AND ' . $customField['column_name'] . ' IS NOT NULL AND ' . $customField['column_name'] . ' <> ""'; - $dao = CRM_Core_DAO::executeQuery($query); - $isCustomFieldUsed = $dao->fetchAll(); - if (!empty($isCustomFieldUsed)) { + $column = $customField['column_name']; + $queryFormat = 'SELECT COUNT(id) FROM %s' + . ' WHERE %s NOT LIKE "%%Not Applicable%%"' + . ' AND %s IS NOT NULL' + . ' AND %s <> ""'; + + $query = sprintf($queryFormat, $tableName, $column, $column, $column); + $customFieldItems = CRM_Core_DAO::singleValueQuery($query); + if ($customFieldItems > 0) { continue; } From 8e7e02e9607505d26721f950bb4af7bf9bba8d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADsio=20Leonardo?= Date: Wed, 4 Jul 2018 18:18:29 +0200 Subject: [PATCH 092/151] PCHR-3599: Updated extended demographics test --- .../CRM/HRSampleData/Importer/ExtendedDemographicsTest.php | 6 ------ 1 file changed, 6 deletions(-) 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', ]; } From 3b51401b760fe930ab4d19b8fdbc6020e824e1b0 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Fri, 27 Jul 2018 16:48:58 +0100 Subject: [PATCH 093/151] PCHR-4045: Allow admins always approve their requests in the modal --- .../shared/controllers/request.controller.js | 54 +++++++++++-------- .../controllers/request.controller.spec.js | 46 ++++++++++++++-- 2 files changed, 75 insertions(+), 25 deletions(-) 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 228c95f4924..455df2994b6 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 @@ -105,6 +105,7 @@ define([ ]); }) .then(initCanManage) + .then(initIsSelfLeaveApprover) .then(initRequest) .then(setModalMode) .then(setInitialAbsencePeriod) @@ -148,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 */ @@ -531,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 @@ -618,28 +648,8 @@ define([ function initRole () { role = 'staff'; - return (vm.isSelfRecord - ? initRoleBasedOnSelfLeaveApproverState() - : initRoleBasedOnPermissions()); - } - - /** - * Initiates the user role based on their self leave approver state. - * If the user is creating or editing their own leave request, they will be - * treated as an "admin". - * - * @return {Promise} - */ - function initRoleBasedOnSelfLeaveApproverState () { - return loggedInContact.checkIfSelfLeaveApprover() - .then(function (isSelfLeaveApprover) { - if (!isSelfLeaveApprover) { - return; - } - - role = 'admin'; - vm.isSelfLeaveApprover = true; - }); + return initRoleBasedOnPermissions() + .then(vm.isSelfRecord && !vm.isRole('admin') && amendRoleBasedOnSelfLeaveApproverState); } /** diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js index 542521f9073..4290586aa97 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js @@ -1367,14 +1367,54 @@ spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.returnValue($q.resolve(false)); }); - ['staff', 'manager', 'admin'].forEach(function (permissionsRole) { + describe('when user is admin', function () { beforeEach(function () { - role = permissionsRole; + role = 'admin'; + + initTestController({ leaveRequest: leaveRequest }); + }); + + it('sets the "admin" role', function () { + expect(controller.isRole('admin')).toBe(true); + }); + + it('sets the `isSelfLeaveApprover` public property to `true`', function () { + expect(controller.isSelfLeaveApprover).toBe(true); + }); + + it('sets the `canManage` public property to `true`', function () { + expect(controller.canManage).toBe(true); + }); + }); + + describe('when user is manager', function () { + beforeEach(function () { + role = 'manager'; + + initTestController({ leaveRequest: leaveRequest }); + }); + + it('sets the "manager" role', function () { + expect(controller.isRole('manager')).toBe(true); + }); + + it('sets the `isSelfLeaveApprover` public property to `false`', function () { + expect(controller.isSelfLeaveApprover).toBe(false); + }); + + it('sets the `canManage` public property to `true`', function () { + expect(controller.canManage).toBe(true); + }); + }); + + describe('when user is staff', function () { + beforeEach(function () { + role = 'staff'; initTestController({ leaveRequest: leaveRequest }); }); - it('sets the staff role', function () { + it('sets the "staff" role', function () { expect(controller.isRole('staff')).toBe(true); }); From 34f3f0fcb250502ca7bce973d64b723fd981c29e Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Fri, 27 Jul 2018 17:42:23 +0100 Subject: [PATCH 094/151] PCHR-4045: Allow admins always approve their requests via quick actions --- .../js/dist/absence-tab.min.js | 6 +- .../js/dist/admin-dashboard.min.js | 10 +-- .../js/dist/manager-leave.min.js | 6 +- .../js/dist/my-leave.min.js | 6 +- .../leave-request-actions.component.js | 3 +- .../staff-leave-report.component.js | 23 ++++- .../leave-request-actions.component.spec.js | 17 +++- .../staff-leave-report.component.spec.js | 83 +++++++++++++++---- .../staff-leave-report-requests-rows.html | 2 +- 9 files changed, 119 insertions(+), 37 deletions(-) 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 01014a33327..f0ec81e05b0 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,O(!0)})}function b(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(B(),E(),O())})}function g(e){W.injectMonth=!0,U("injected").then(function(){O(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 S(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&f(),M(),E(),L("month")}function k(e){var t="previous"===e?"subtract":"add";B(n(W.selectedMonth.moment)[t](1,"month")),E(),L("month")}function L(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 O(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=S,W.paginateMonth=k,W.refresh=L,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:k()},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)&&L()}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!==k().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/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(n){w=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===S.leaveRequest.request_type?i.open(y(n)):v(n)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(t){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(S.leaveRequest.from_date):"2"===a)}function v(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){T(n)}}):y(n)})}})}function b(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return I===S.leaveRequest.contact_id}function _(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function y(e){var n=L[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return m.get().then(function(e){I=e.contactId})}function C(e,n){e.stopPropagation(),r.openModal(n)}function T(e){r.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function A(n){var t=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;w===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:S.leaveRequest})}function D(){var n=S.leaveRequestStatuses[S.leaveRequest.status_id].name,t=e.compact(e.map(L,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!h(n)&&e.pull(t,"cancel"),"admin"!==S.role&&e.pull(t,"delete"),"staff"===S.role&&e.pull(t,"approve","reject"),"staff"!==S.role&&R(t),p()&&t.push("delete"),S.allowedActions=e.map(t,function(e){return{key:e,label:L[e].label,isDirectAction:L[e].isDirectAction}})}function P(){return b().then(function(e){e&&(S.role="admin")})}function R(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,w,S=this,k=l.statusNames,L={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"}}},O={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=f,S.openLeavePopup=C,function(){a.resolve().then(_).then(q).then(function(){return g()&&P()}).then(D).finally(function(){S.loading.component=!1})}()}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(){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(),k("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,k("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 S(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function k(e){return ne.selectedAbsenceType.calculation_unit_name===e}function L(e){return ne.request.request_type===e}function O(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")&&(L("sickness")||k("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),(k("hours")||L("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=k,ne.isLeaveType=L,ne.isNotWorkingDay=O,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(S).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 S.fileUploader&&S.fileUploader.queue.length>0}function m(){return S.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return S.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||S.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=D,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=m,S.formatDateTime=f,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",S),g(),a.all([T(),q()]).then(_).finally(function(){S.filesLoaded=!0})}(),S}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 S(){return t.all(Object.values(G.sections).filter(function(e){return e.open}).map(M))}function k(){return w("other",{status_id:{in:[H(m.statusNames.rejected),H(m.statusNames.cancelled)]}})}function L(){return w("pending",{status_id:{in:[H(m.statusNames.awaitingApproval),H(m.statusNames.moreInformationRequired)]}})}function O(){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([S(),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:O},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k}},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),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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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/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"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function A(){["from","to"].forEach(T)}function D(){var e=Fe.requestStatuses[_.statusNames.awaitingApproval].value;Me.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function R(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function I(){return!Fe.loading.entitlements&&(!!ue("admin")||!re("view")&&!(ue("manager")&&!re("create")))}function w(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||R())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function S(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[_.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function k(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==N())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return C.promptBalanceChangeRecalculation().then(function(){s.$emit("LeaveRequestPopup::recalculateBalanceChange")}),o.reject()})}function L(){return"toil"!==N()&&!Fe.request.change_balance}function O(){Fe.errors=[]}function M(){return Fe.request.create().then(Pe).then(function(){be("LeaveRequest::new")})}function x(){oe()&&!Fe.isRole("staff")&&(Fe.request.change_balance=!0)}function $(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.request)})}})}function E(){r.dismiss({$value:"cancel"})}function B(){var e=N();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function F(){return U(Fe.getStatusFromValue(Fe.request.status_id).name)}function U(e){return t.map(Le[e],function(e){return Fe.requestStatuses[e]})}function N(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function j(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():U("none")}function W(e){return t.find(Fe.requestStatuses,function(n){return n.value===e})}function H(e){Fe.errors=t.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(Me,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?o.resolve().then(de).then(me).then(_e).then(qe).then(ae).then(X).then(Fe.isMode("edit")?Ce:t.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==$e)return o.reject(e)}):o.reject("The contact id was not set")}function V(){var e=[_.statusNames.moreInformationRequired,_.statusNames.approved,_.statusNames.rejected,_.statusNames.cancelled];Le.none=[_.statusNames.moreInformationRequired,_.statusNames.approved],Le.awaiting_approval=e,Le.more_information_required=e,Le.rejected=e,Le.approved=e,Le.cancelled=[_.statusNames.awaitingApproval].concat(e)}function z(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function X(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):o.resolve()}function Q(){var e="my-leave"===s.section,n=+ke.id==+t.get(Fe,"leaveRequest.contact_id"),a=!t.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(n||a)}function J(){xe.push(s.$on("LeaveRequestPopup::requestObjectUpdated",Ce),s.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(_e).then(function(){s.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),s.$on("LeaveRequestPopup::handleError",function(e,n){H(n)}),s.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),i.$on("$destroy",Re),i.$on("LeaveRequestPopup::addTab",function(e,n){Be.push(n)})}function K(){var e,n;Fe.request=Fe.leaveRequest||null,e=N(),n=Fe.initRequestAttributes(),"leave"===e?Fe.request=g.init(n):"sickness"===e?Fe.request=y.init(n):"toil"===e&&(Fe.request=q.init(n))}function Z(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:ke.id}),e}function ee(){return Ee="staff",Fe.isSelfRecord?ne():te()}function ne(){return ke.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Fe.isSelfLeaveApprover=!0)})}function te(){return c(_.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&c(_.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[_.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[_.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!t.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var n=Fe.getStatusFromValue(Fe.request.status_id);return!!n&&n.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function re(e){return Fe.mode===e}function ce(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 ue(e){return Ee===e}function le(){return p.all().then(function(e){Fe.absencePeriods=e})}function de(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Se={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Se.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function fe(){return f.getLoggedIn().then(function(e){ke=e})}function pe(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=t.remove(e.list,function(e){return e.id!==ke.id})}):ke.leaveManagees().then(function(e){Fe.managedContacts=e})}function he(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.requestStatuses=t.indexBy(e,"name")})}function ve(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 be(e){D(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ge(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Me[e+"_date"]})}function _e(e){if(Fe.absenceTypes=ve(Se.types,e),!Fe.absenceTypes.length)return o.reject($e)}function ye(){Fe.period=t.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=t.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Me=e.copy(Fe.request.attributes())}function Te(){var e;Fe.request.id?(e=[Fe.requestStatuses[_.statusNames.approved].value,Fe.requestStatuses[_.statusNames.adminApproved].value,Fe.requestStatuses[_.statusNames.rejected].value,Fe.requestStatuses[_.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,S(),A(),Fe.request.isValid().then(oe()&&k).then(x).then(L()&&ge).then(De).then(function(){return Fe.isMode("edit")?we():M()}).catch(function(n){Fe.request.status_id=e,n&&H(n)}).finally(function(){Fe.submitting=!1})}function De(){return o.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&t.push(e),++a===Oe&&(t.length>0?n.reject(t):n.resolve())}var n=o.defer(),t=[],a=0;return Oe>0?s.$broadcast("LeaveRequestPopup::submit",e):n.resolve(),n.promise}function Re(){xe.forEach(function(e){e()})}function Ie(){s.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function we(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?be("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&be("LeaveRequest::edit")})}n.debug("RequestCtrl");var Se,ke,Le={},Oe=0,Me={},xe=[],$e="No entitlement",Ee="",Be=[],Fe=t.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=I,Fe.canSubmit=w,Fe.closeAlert=O,Fe.deleteLeaveRequest=$,Fe.dismissModal=E,Fe.getStatuses=j,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=Z,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=re,Fe.isRole=ue,Fe.submit=Ae,Fe.updateAbsenceType=Ie,function(){Fe.loading.absenceTypes=!0,V(),J(),fe().then(Q).then(function(){return o.all([ee(),le(),he()])}).then(z).then(K).then(Te).then(ye).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&pe()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(H).finally(function(){Fe.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){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(){}); +;return!u.absenceTypesToFilterBy.length||t}function s(e){return{backgroundColor:e.color}}function i(){t.$new().$watch(function(){return u.absenceTypesToFilterBy},function(e,n){e!==n&&t.$emit("LeaveCalendar::updateFiltersByAbsenceType",u.absenceTypesToFilterBy)},!0)}function r(){u.absenceTypesToFilterBy=[]}function c(n){e.includes(u.absenceTypesToFilterBy,n)?e.remove(u.absenceTypesToFilterBy,function(e){return n===e}):u.absenceTypesToFilterBy.push(n)}n.debug("Component: leave-calendar-legend");var u=this;u.absenceTypesToFilterBy=[],u.legendCollapsed=!1,u.nonWorkingDayTypes=[{label:"Weekend",cssClassSuffix:"weekend"},{label:"Public Holiday",cssClassSuffix:"public-holiday"},{label:"Non Working Day",cssClassSuffix:"non-working-day"}],u.otherBadges=[{label:"AM",description:"AM Only"},{label:"PM",description:"PM Only"},{label:"HH:MM",description:"Time",cssClassSuffix:"hours"},{label:"",description:"Requested",cssClassSuffix:"requested"},{label:"AT",description:"Accrued TOIL"}],u.checkIfAbsenceTypeIdIsDefined=a,u.checkIfAbsenceTypeIsSelectedForFiltering=o,u.getAbsenceTypeStyle=s,u.resetFilteringByAbsenceTypes=r,u.toggleFilteringByAbsenceType=c,function(){i()}()}n.component("leaveCalendarLegend",{bindings:{absenceTypes:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-legend.html"}],controllerAs:"legend",controller:t}),t.$inject=["$log","$rootScope"]}),define("leave-absences/shared/components/leave-calendar-month.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/pub-sub"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(e){T([e]),H(e)}function l(e){return{index:e.format("YYYY-MM"),month:e.month(),year:e.year(),name:e.format("MMMM"),loading:!0,days:d(e)}}function d(t){var a=n(),o=t.clone().startOf("month");return e.map(e.times(t.daysInMonth()),function(){var e={date:o.format("YYYY-MM-DD"),name:o.format("ddd"),index:o.format("D"),current:a.isSame(o,"day"),enabled:o.isSameOrAfter(X.period.start_date)&&o.isSameOrBefore(X.period.end_date),contactsData:{}};return o.add(1,"day"),e})}function m(e){return V[e]}function f(){return X.showOnlyWithLeaveRequests?X.contacts.filter(function(n){var t=Object.keys(z[n.id]||{}).length,a=e.includes(X.showTheseContacts,n.id);return t||a}):X.contacts}function p(e){return n(e,c.serverDateFormat)}function h(e){var n=b(e);n&&($(n),H(n))}function v(n){var t={request_type:"toil"};return e.some(n,t)&&!e.every(n,t)?e.filter(n,t):n}function b(n){var t;return e.find(z[n.contact_id],function(a){return t=e.find(a,function(e){return+e.id==+n.id})}),t}function g(){X.month.days.forEach(function(e){e.contactsData={}})}function _(e){return CRM.url("civicrm/contact/view",{cid:e})}function y(n){return e.filter(n,function(e){return!!e.type_id})}function q(e,t){var a={};return t.forEach(function(t){a[t.id]={styles:j(t),isAccruedTOIL:P(t,"toil"),isRequested:I(t),isAM:D("half_day_am",t,e.date),isPM:D("half_day_pm",t,e.date),isSingleDay:n(t.from_date).isSame(t.to_date,"day")}}),a}function C(){X.supportData.dayTypes=e.indexBy(X.supportData.dayTypes,"name"),X.supportData.leaveRequestStatuses=e.indexBy(X.supportData.leaveRequestStatuses,"value"),X.supportData.publicHolidays=e.transform(X.supportData.publicHolidays,function(e,n){e[p(n.date).valueOf()]=n},{})}function T(e){return e.forEach(function(e){var n=w(e);z[e.contact_id]=z[e.contact_id]||{},n.forEach(function(n){z[e.contact_id][n.date]||(z[e.contact_id][n.date]=[]),z[e.contact_id][n.date].push(e)})}),a.resolve()}function A(){G.push(o.$on("LeaveCalendar::showMonth",U)),G.push(r.subscribe("LeaveRequest::new",u)),G.push(r.subscribe("LeaveRequest::edit",W)),G.push(r.subscribe("LeaveRequest::updatedByManager",W)),G.push(r.subscribe("LeaveRequest::delete",h)),G.push(r.subscribe("LeaveRequest::statusUpdate",function(e){"delete"===e.status?h(e.leaveRequest):W(e.leaveRequest)}))}function D(e,t,a){var o=X.supportData.dayTypes[e];return n(a).isSame(t.from_date,"day")?o.value===t.from_date_type:n(a).isSame(t.to_date,"day")?o.value===t.to_date_type:void 0}function P(e,n){return e.request_type===n}function R(e){return!!X.supportData.publicHolidays[p(e).valueOf()]}function I(n){var t=X.supportData.leaveRequestStatuses[n.status_id].name;return e.contains([c.statusNames.awaitingApproval,c.statusNames.moreInformationRequired],t)}function w(t){for(var a=[],o=n(t.from_date).startOf("day"),s=n(t.to_date).startOf("day");o.isSameOrBefore(s);)o.month()===X.month.month&&o.year()===X.month.year&&a.push(e.find(X.month.days,function(e){return e.date===o.format("YYYY-MM-DD")})),o.add(1,"day");return a}function S(n){var t=e.find(X.supportData.leaveRequestStatuses,function(e){return e.name===n});return t?t.value:null}function k(){return[S(c.statusNames.approved),S(c.statusNames.adminApproved),S(c.statusNames.awaitingApproval),S(c.statusNames.moreInformationRequired)]}function L(){return X.month.loading=!0,a.all([M(),O()]).then(x).then(F).then(function(){Y=!0,X.month.loading=!1})}function O(){var n=X.supportData.absenceTypesToFilterBy.length>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:k()},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)&&L()}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!==k().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/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(n){w=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===S.leaveRequest.request_type?i.open(y(n)):v(n)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(t){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(S.leaveRequest.from_date):"2"===a)}function v(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){T(n)}}):y(n)})}})}function b(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return I===S.leaveRequest.contact_id}function _(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function y(e){var n=L[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return m.get().then(function(e){I=e.contactId})}function C(e,n){e.stopPropagation(),r.openModal(n)}function T(e){r.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function A(n){var t=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;w===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:S.leaveRequest})}function D(){var n=S.leaveRequestStatuses[S.leaveRequest.status_id].name,t=e.compact(e.map(L,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!h(n)&&e.pull(t,"cancel"),"admin"!==S.role&&e.pull(t,"delete"),"staff"===S.role&&e.pull(t,"approve","reject"),"staff"!==S.role&&R(t),p()&&t.push("delete"),S.allowedActions=e.map(t,function(e){return{key:e,label:L[e].label,isDirectAction:L[e].isDirectAction}})}function P(){return b().then(function(e){e&&(S.role="admin")})}function R(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,w,S=this,k=l.statusNames,L={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"}}},O={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=f,S.openLeavePopup=C,function(){a.resolve().then(_).then(q).then(function(){return g()&&"admin"!==S.role&&P()}).then(D).finally(function(){S.loading.component=!1})}()}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(){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(),k("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,k("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 S(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function k(e){return ne.selectedAbsenceType.calculation_unit_name===e}function L(e){return ne.request.request_type===e}function O(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")&&(L("sickness")||k("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),(k("hours")||L("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=k,ne.isLeaveType=L,ne.isNotWorkingDay=O,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(S).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 S.fileUploader&&S.fileUploader.queue.length>0}function m(){return S.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return S.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||S.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=D,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=m,S.formatDateTime=f,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",S),g(),a.all([T(),q()]).then(_).finally(function(){S.filesLoaded=!0})}(),S}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(){V.absenceTypes=V.absenceTypes.map(function(n){var t=e.find(V.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){N(e),V.sections.other.open&&f(e,V.sections.other)}function v(){Object.values(V.sections).forEach(function(e){e.data=[]})}function b(){V.absenceTypesFiltered=V.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function g(e){var n=G[e.status];n?n(e.leaveRequest):V.refresh()}function _(n){n.dataIndex=e.indexBy(n.data,"id")}function y(){return V.role="staff","absence-tab"===a.section?void(V.role="admin"):o(m.permissions.admin.administer).then(function(e){e&&(V.role="admin")})}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return s.all().then(function(n){V.absencePeriods=e.sortBy(n,"start_date"),V.selectedPeriod=e.find(V.absencePeriods,function(e){return!0===e.current})})}function T(){return i.all().then(i.loadCalculationUnits).then(function(n){V.absenceTypes=n,V.absenceTypesIndexed=e.indexBy(n,"id")})}function A(){return S("approved",{status_id:Y(m.statusNames.approved)})}function D(){var n={contact_id:V.contactId,period_id:V.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:[Y(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}}))]).then(function(e){V.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:V.contactId,period_id:V.selectedPeriod.id},!0).then(function(e){V.entitlements=e})}function R(){return r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id},V.entitlements).then(function(){return B(V.entitlements)}).then(function(e){V.sections.entitlements.data=e})}function I(){return t.all([r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id,expired:!0}),w({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:B(e[0]),expiredTOILS:F(e[1].list)})}).then(function(n){V.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),V.sections.expired.data=e.sortBy(V.sections.expired.data,"expiry_date")})}function w(n){return c.all(e.assign({contact_id:V.contactId,from_date:{from:V.selectedPeriod.start_date},to_date:{to:V.selectedPeriod.end_date},type_id:{IN:V.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function S(e,n){return w(n).then(function(n){V.sections[e].data=n.list})}function k(){return t.all(Object.values(V.sections).filter(function(e){return e.open}).map(x))}function L(){return S("other",{status_id:{in:[Y(m.statusNames.rejected),Y(m.statusNames.cancelled)]}})}function O(){return S("pending",{status_id:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}})}function M(){return S("holidays",{public_holiday:!0})}function x(e){return e.loading=!0,e.loadLeaveRequests().then(_.bind(this,e)).then(function(){e.loading=!1})}function $(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){V.leaveRequestStatuses=e.indexBy(n,"value")})}function E(){p(),b()}function B(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(V.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 F(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 U(){l.subscribe("LeaveRequest::new",function(){V.refresh()}),l.subscribe("LeaveRequest::edit",function(){V.refresh()}),l.subscribe("LeaveRequest::statusUpdate",g),l.subscribe("LeaveRequest::delete",function(e){N(e)})}function N(n){e.forEach(V.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&&j(n,a))})}function j(n,t){var a=["future","current"],o=V.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(){V.loading.content=!0,t.all([P(),D()]).then(E).then(function(){V.loading.content=!1}).then(function(){return t.all([k(),v()])})}function H(e){var n=V.sections[e];n.open=!n.open,n.open&&!n.data.length&&x(n)}function Y(n){return e.find(V.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var G={delete:N,cancel:h},V=this;V.absencePeriods=[],V.absenceTypes=[],V.absenceTypesFiltered=[],V.absenceTypesIndexed={},V.dateFormat=d.DATE_FORMAT,V.leaveRequestStatuses={},V.selectedPeriod=null,V.role,V.loading={content:!0,page:!0},V.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:A},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:R},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L}},V.labelPeriod=q,V.refresh=W,V.toggleSection=H,function(){t.all([y(),$(),T(),C()]).then(function(){V.loading.page=!1}).then(function(){return t.all([P(),D()])}).then(E).then(function(){V.loading.content=!1}),U()}()}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),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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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/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;xe.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 x(){return Ue.request.create().then(Re).then(function(){ge("LeaveRequest::new")})}function $(){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(xe,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&&(n||a)}function Z(){$e.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=t.remove(e.list,function(e){return e.id!==Le.id})}):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"]=xe[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(){xe=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($).then(O()&&_e).then(Pe).then(function(){return Ue.isMode("edit")?Se():x()}).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(){$e.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,xe={},$e=[],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){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(){}); //# 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 6099737a491..ece63d0cbef 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 @@ -6,9 +6,9 @@ */ -!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 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){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=L[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),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!==B?(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 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 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 O(e,t){return{relative:S(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=R(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 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=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 x(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;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(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,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(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(),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&&x).then("contacts"===t&&A).then("month"===t&&E).then(function(){g("contacts"===t)})}function k(e){o.$emit("LeaveCalendar::showMonth",!!e)}function L(){j(t())}function x(){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=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 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 x(){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=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(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=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/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,r,o,s,i,u,c,l,d,f){function m(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=O[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[k[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(O,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},k={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return g()&&T()}).then(w).finally(function(){R.loading.component=!1})}()}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,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 x()}).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 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 O(e){return te.request.request_type===e}function k(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 x(){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(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: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=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([x(),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),g(),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 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(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:M(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 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 x(e){var t=[_(i.statusNames.moreInformationRequired),_(i.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function M(e){var t=U.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&&(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(),S(),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),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 $(){["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){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 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=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(){R("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=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 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 S(){return l(),k(),B()}function R(){return x(),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 L(){N=e.cloneDeep(u.request.attributes())}function x(){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(),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=M,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=I,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){L(),x(),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/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,$){function C(e){"days"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function A(){["from","to"].forEach(C)}function w(){var e=Be.requestStatuses[y.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function T(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function P(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return!Be.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function S(){var e=T();return Be.isMode("edit")&&(e=e&&(V()||P())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function R(){Be.isSelfRecord&&!Be.isSelfLeaveApprover?Be.request.status_id=Be.requestStatuses[y.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function I(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==N())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return $.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==N()&&!Be.request.change_balance}function k(){Be.errors=[]}function L(){return Be.request.create().then(Te).then(function(){be("LeaveRequest::new")})}function x(){re()&&!Be.isRole("staff")&&(Be.request.change_balance=!0)}function M(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.request)})}})}function E(){i.dismiss({$value:"cancel"})}function j(){var e=N();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function B(){return F(Be.getStatusFromValue(Be.request.status_id).name)}function F(e){return n.map(Oe[e],function(e){return Be.requestStatuses[e]})}function N(){return Be.request?Be.request.request_type:Be.leaveType||null}function U(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?B():F("none")}function H(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function W(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function V(){return!e.equals(Le,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function Y(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?r.resolve().then(de).then(fe).then(ye).then(qe).then(ae).then(X).then(Be.isMode("edit")?$e:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return r.reject(e)}):r.reject("The contact id was not set")}function G(){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 z(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")}function X(){return Be.canManage?m.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function K(){xe.push(o.$on("LeaveRequestPopup::requestObjectUpdated",$e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){W(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function Q(){var e,t;Be.request=Be.leaveRequest||null,e=N(),t=Be.initRequestAttributes(),"leave"===e?Be.request=g.init(t):"sickness"===e?Be.request=_.init(t):"toil"===e&&(Be.request=q.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:Ie.id}),e}function ee(){return Ee="staff",Be.isSelfRecord?te():ne()}function te(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Be.isSelfLeaveApprover=!0)})}function ne(){return u(y.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(y.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[y.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[y.statusNames.approved].value)}function re(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],H(Be.request.status_id).name)}function oe(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function se(e){return Be.request&&Be.request.request_type===e}function ie(e){return Be.mode===e}function ue(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 ce(e){return Ee===e}function le(){return p.all().then(function(e){Be.absencePeriods=e})}function de(){return h.all(j()).then(h.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Be.loading.entitlements=!0,v.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Re.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function me(){return m.getLoggedIn().then(function(e){Ie=e})}function pe(){return Be.selectedContactId?m.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?m.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Be.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.requestStatuses=n.indexBy(e,"name")})}function ve(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 be(e){w(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function ge(){["from","to"].forEach(function(e){Be.request[e+"_date"]=Le[e+"_date"]}) -}function ye(e){if(Be.absenceTypes=ve(Re.types,e),!Be.absenceTypes.length)return r.reject(Me)}function _e(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ue(Be.request,e)})}function qe(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function $e(){Le=e.copy(Be.request.attributes())}function Ce(){var e;Be.request.id?(e=[Be.requestStatuses[y.statusNames.approved].value,Be.requestStatuses[y.statusNames.adminApproved].value,Be.requestStatuses[y.statusNames.rejected].value,Be.requestStatuses[y.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function Ae(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,R(),A(),Be.request.isValid().then(re()&&I).then(x).then(O()&&ge).then(we).then(function(){return Be.isMode("edit")?Se():L()}).catch(function(t){Be.request.status_id=e,t&&W(t)}).finally(function(){Be.submitting=!1})}function we(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){xe.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Be.request.update().then(Te).then(function(){Be.isRole("manager")?be("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Ie,Oe={},ke=0,Le={},xe=[],Me="No entitlement",Ee="",je=[],Be=n.assign(this,f);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.isSelfLeaveApprover=!1,Be.loading={absenceTypes:!0,entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=D,Be.canSubmit=S,Be.closeAlert=k,Be.deleteLeaveRequest=M,Be.dismissModal=E,Be.getStatuses=U,Be.getStatusFromValue=H,Be.initAfterContactSelection=Y,Be.initRequestAttributes=Z,Be.isLeaveStatus=oe,Be.isLeaveType=se,Be.isMode=ie,Be.isRole=ce,Be.submit=Ae,Be.updateAbsenceType=De,function(){Be.loading.absenceTypes=!0,G(),K(),me().then(J).then(function(){return r.all([ee(),le(),he()])}).then(z).then(Q).then(Ce).then(_e).then(function(){return Be.canManage&&!Be.isMode("edit")&&pe()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(W).finally(function(){Be.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$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,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(){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=L[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 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=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 x(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 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;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(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 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(),L(),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&&x).then("contacts"===t&&A).then("month"===t&&E).then(function(){g("contacts"===t)})}function k(e){o.$emit("LeaveCalendar::showMonth",!!e)}function L(){j(t())}function x(){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=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 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 x(){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=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/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,r,o,s,i,u,c,l,d,f){function m(t){R=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===S.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(n){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(S.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===S.leaveRequest.contact_id}function y(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function _(e){var t=O[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[k[e]]})}function A(t){var n=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;R===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:S.leaveRequest})}function w(){var t=S.leaveRequestStatuses[S.leaveRequest.status_id].name,n=e.compact(e.map(O,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==S.role&&e.pull(n,"delete"),"staff"===S.role&&e.pull(n,"approve","reject"),"staff"!==S.role&&P(n),p()&&n.push("delete"),S.allowedActions=e.map(n,function(e){return{key:e,label:O[e].label,isDirectAction:O[e].isDirectAction}})}function T(){return b().then(function(e){e&&(S.role="admin")})}function P(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 D,R,S=this,I=l.statusNames,O={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},k={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=m,S.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return g()&&"admin"!==S.role&&T()}).then(w).finally(function(){S.loading.component=!1})}()}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,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 x()}).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 L(){return l.valuesOf("hrleaveandabsences_leave_request_day_type").then(function(e){te.requestDayTypes=e})}function x(){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(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: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=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([x(),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(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:L(),managed_by:U.isAdmin&&"me"!==n.assignedTo.type?void 0:U.contactId,status_id:M(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 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 x(e){var t=[_(i.statusNames.moreInformationRequired),_(i.statusNames.awaitingApproval)];return 0===e.length&&(e=e.concat(t)),e}function M(e){var t=U.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&&(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 x(),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 L(){N=e.cloneDeep(u.request.attributes())}function x(){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(),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=M,u.onDateChangeExtended=R,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=I,u.setDaysSelectionModeExtended=S,u.updateExpiryDate=F,function(){L(),x(),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/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,$){function C(e){"days"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function A(){["from","to"].forEach(C)}function w(){return Oe.checkIfSelfLeaveApprover().then(function(e){e&&(je="admin")})}function T(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;xe.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function R(){return!Fe.loading.entitlements&&(!!le("admin")||!ue("view")&&!(le("manager")&&!ue("create")))}function S(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||D())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function I(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function O(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==U())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return $.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function k(){return"toil"!==U()&&!Fe.request.change_balance}function L(){Fe.errors=[]}function x(){return Fe.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function M(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return n.map(ke[e],function(e){return Fe.requestStatuses[e]})}function U(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function H(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():N("none")}function W(e){return n.find(Fe.requestStatuses,function(t){return t.value===e})}function V(e){Fe.errors=n.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(xe,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?r.resolve().then(fe).then(me).then(_e).then($e).then(re).then(J).then(Fe.isMode("edit")?Ce:n.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return r.reject(e)}):r.reject("The contact id was not set")}function z(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];ke.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],ke.awaiting_approval=e,ke.more_information_required=e,ke.rejected=e,ke.approved=e,ke.cancelled=[y.statusNames.awaitingApproval].concat(e)}function X(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function J(){return Fe.canManage?m.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):r.resolve()}function K(){Fe.isRole("admin")&&Fe.isSelfRecord&&(Fe.isSelfLeaveApprover=!0)}function Q(){var e="my-leave"===o.section,t=+Oe.id==+n.get(Fe,"leaveRequest.contact_id"),a=!n.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(t||a)}function Z(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",Ce),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(_e).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Le++})),s.$on("$destroy",De),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function ee(){var e,t;Fe.request=Fe.leaveRequest||null,e=U(),t=Fe.initRequestAttributes(),"leave"===e?Fe.request=g.init(t):"sickness"===e?Fe.request=_.init(t):"toil"===e&&(Fe.request=q.init(t))}function te(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:Oe.id}),e}function ne(){return je="staff",ae().then(Fe.isSelfRecord&&!Fe.isRole("admin")&&w)}function ae(){return u(y.permissions.admin.administer).then(function(e){e&&(je="admin")}).then(function(){return"admin"!==je&&u(y.permissions.ssp.manage)}).then(function(e){e&&(je="manager")})}function re(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!n.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var t=Fe.getStatusFromValue(Fe.request.status_id);return!!t&&t.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function ue(e){return Fe.mode===e}function ce(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 le(e){return je===e}function de(){return p.all().then(function(e){Fe.absencePeriods=e})}function fe(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Ie={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Ie.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function pe(){return m.getLoggedIn().then(function(e){Oe=e})}function he(){return Fe.selectedContactId?m.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?m.all().then(function(e){Fe.managedContacts=n.remove(e.list,function(e){return e.id!==Oe.id})}):Oe.leaveManagees().then(function(e){Fe.managedContacts=e})}function ve(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.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){T(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()} +function ye(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=xe[e+"_date"]})}function _e(e){if(Fe.absenceTypes=be(Ie.types,e),!Fe.absenceTypes.length)return r.reject(Ee)}function qe(){Fe.period=n.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function $e(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=n.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){xe=e.copy(Fe.request.attributes())}function Ae(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function we(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,I(),A(),Fe.request.isValid().then(oe()&&O).then(M).then(k()&&ye).then(Te).then(function(){return Fe.isMode("edit")?Se():x()}).catch(function(t){Fe.request.status_id=e,t&&V(t)}).finally(function(){Fe.submitting=!1})}function Te(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&n.push(e),++a===Le&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Le>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function De(){Me.forEach(function(e){e()})}function Re(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Ie,Oe,ke={},Le=0,xe={},Me=[],Ee="No entitlement",je="",Be=[],Fe=n.assign(this,f);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=R,Fe.canSubmit=S,Fe.closeAlert=L,Fe.deleteLeaveRequest=E,Fe.dismissModal=j,Fe.getStatuses=H,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=te,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=ue,Fe.isRole=le,Fe.submit=we,Fe.updateAbsenceType=Re,function(){Fe.loading.absenceTypes=!0,z(),Z(),pe().then(Q).then(function(){return r.all([ne(),de(),ve()])}).then(X).then(K).then(ee).then(Ae).then(qe).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&he()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(V).finally(function(){Fe.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$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,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(){}); //# 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 44317aff2c9..aa572040efa 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 @@ -8,7 +8,7 @@ !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=x[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 L(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 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=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 k(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 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,L(!0)})}function g(){o.$new().$watch(function(){return H.selectedMonthIndex},function(e,t){null!==t&&e!==t&&(B(),E(),L())})}function b(e){H.injectMonth=!0,F("injected").then(function(){L(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 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(),x(),E(),I("month")}function O(e){var n="previous"===e?"subtract":"add";B(t(H.selectedMonth.moment)[n](1,"month")),E(),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&&E).then(function(){b("contacts"===t)})}function L(e){o.$emit("LeaveCalendar::showMonth",!!e)}function x(){B(t())}function M(){B(H.months[0].moment)}function k(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(){k("previous"),k("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(),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: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 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 k(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 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=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/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,r,o,s,i,u,c,l,d,f){function m(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([O.awaitingApproval,O.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function g(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function b(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=I[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[L[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(I,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:I[e].label,isDirectAction:I[e].isDirectAction}})}function T(){return g().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,O=l.statusNames,I={edit:{label:"Edit",allowedStatuses:[O.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[O.moreInformationRequired]},view:{label:"View",allowedStatuses:[O.approved,O.rejected,O.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.approved,O.rejected,O.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.moreInformationRequired,O.approved,O.rejected,O.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},L={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return b()&&T()}).then(w).finally(function(){R.loading.component=!1})}()}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,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 E();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(w).finally(_)}function g(){return G(),E()}function b(){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,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?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 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 L(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 k(){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 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(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:k},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=L,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(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:x(),managed_by:U.isAdmin&&"me"!==n.assignedTo.type?void 0:U.contactId,status_id:k(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 L(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 k(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 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=L,U.refresh=E,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){ -L[e]=t,f(e,t),n&&"from"===e&&f("to",t)}).catch(function(t){return L[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=L[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 L={};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(),L())})})}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(),L(),j()}function R(){return M(),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time),l(),U?U=!1:L(),j()}function O(e){u.uiOptions.times[e].time=""}function I(){u.request.toil_to_accrue=u.uiOptions.toil_duration_in_hours}function L(){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 k(){u.setRequestDateTimesAndDateTypes(),l(),L(),u.isCalculationUnit("hours")?I():u.request.toil_to_accrue=null}function E(){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=k,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=O,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){x(),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/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,$){function C(e){"days"===je.selectedAbsenceType.calculation_unit_name?delete je.request[e+"_date_amount"]:delete je.request[e+"_date_type"]}function A(){["from","to"].forEach(C)}function w(){var e=je.requestStatuses[y.statusNames.awaitingApproval].value;xe.status_id===e&&e!==je.request.status_id&&d.publish("ManagerBadge:: Update Count")}function T(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function P(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return!je.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function S(){var e=T();return je.isMode("edit")&&(e=e&&(V()||P())),je.canManage&&je.requestStatuses&&(e=e&&!!je.getStatusFromValue(je.newStatusOnSave)),(e=e&&!!je.period.id)&&!je.isMode("view")}function R(){je.isSelfRecord&&!je.isSelfLeaveApprover?je.request.status_id=je.requestStatuses[y.statusNames.awaitingApproval].value:je.canManage&&(je.request.status_id=je.newStatusOnSave||je.request.status_id)}function O(){if(je.isMode("edit")&&!je.isRole("staff")&&"toil"!==N())return je.request.calculateBalanceChange(je.selectedAbsenceType.calculation_unit_name).then(function(e){if(+je.balance.change.amount!=+e.amount)return $.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function I(){return"toil"!==N()&&!je.request.change_balance}function L(){je.errors=[]}function x(){return je.request.create().then(Te).then(function(){ge("LeaveRequest::new")})}function M(){re()&&!je.isRole("staff")&&(je.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 je.request.delete().then(function(){je.dismissModal(),d.publish("LeaveRequest::delete",je.request)})}})}function E(){i.dismiss({$value:"cancel"})}function B(){var e=N();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function j(){return F(je.getStatusFromValue(je.request.status_id).name)}function F(e){return n.map(Ie[e],function(e){return je.requestStatuses[e]})}function N(){return je.request?je.request.request_type:je.leaveType||null}function U(){return!je.request||e.equals({},je.requestStatuses)?[]:je.request.status_id?j():F("none")}function H(e){return n.find(je.requestStatuses,function(t){return t.value===e})}function W(e){je.errors=n.isArray(e)?e:[e],je.loading.absenceTypes=!1,je.submitting=!1}function V(){return!e.equals(xe,je.request.attributes())||je.canManage&&je.newStatusOnSave}function Y(){return je.postContactSelection=!0,je.staffMemberSelectionComplete=!1,je.request.contact_id?r.resolve().then(de).then(fe).then(ye).then(qe).then(ae).then(X).then(je.isMode("edit")?$e:n.noop).then(function(){je.postContactSelection=!1,je.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==ke)return r.reject(e)}):r.reject("The contact id was not set")}function G(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];Ie.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],Ie.awaiting_approval=e,Ie.more_information_required=e,Ie.rejected=e,Ie.approved=e,Ie.cancelled=[y.statusNames.awaitingApproval].concat(e)}function z(){je.canManage=je.isRole("manager")||je.isRole("admin")}function X(){return je.canManage?m.find(je.request.contact_id).then(function(e){je.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Oe.id==+n.get(je,"leaveRequest.contact_id"),a=!n.get(je,"leaveRequest.id");je.isSelfRecord=e&&(t||a)}function K(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",$e),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",je.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){W(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Le++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function Q(){var e,t;je.request=je.leaveRequest||null,e=N(),t=je.initRequestAttributes(),"leave"===e?je.request=b.init(t):"sickness"===e?je.request=_.init(t):"toil"===e&&(je.request=q.init(t))}function Z(){var e={};return je.request?e=je.request.attributes():je.canManage||(e={contact_id:Oe.id}),e}function ee(){return Ee="staff",je.isSelfRecord?te():ne()}function te(){return Oe.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",je.isSelfLeaveApprover=!0)})}function ne(){return u(y.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(y.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){je.defaultStatus?je.newStatusOnSave=je.requestStatuses[y.statusNames[je.defaultStatus]].value:(je.isRole("admin")||je.isMode("create")&&je.isRole("manager"))&&(je.newStatusOnSave=je.requestStatuses[y.statusNames.approved].value)}function re(){return!je.request.status_id||!n.includes(["cancelled","rejected"],H(je.request.status_id).name)}function oe(e){var t=je.getStatusFromValue(je.request.status_id);return!!t&&t.name===e}function se(e){return je.request&&je.request.request_type===e}function ie(e){return je.mode===e}function ue(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 ce(e){return Ee===e}function le(){return p.all().then(function(e){je.absencePeriods=e})}function de(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return je.loading.entitlements=!0,v.all({contact_id:je.request.contact_id,period_id:je.period.id,type_id:{IN:Re.ids}},!0).finally(function(){je.loading.entitlements=!1})}function me(){return m.getLoggedIn().then(function(e){Oe=e})}function pe(){return je.selectedContactId?m.find(je.selectedContactId).then(function(e){je.managedContacts=[e]}):je.isRole("admin")?m.all().then(function(e){je.managedContacts=n.remove(e.list,function(e){return e.id!==Oe.id})}):Oe.leaveManagees().then(function(e){je.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){je.requestStatuses=n.indexBy(e,"name")})}function ve(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){w(),d.publish(e,je.request),je.errors=[],je.dismissModal()}function be(){["from","to"].forEach(function(e){je.request[e+"_date"]=xe[e+"_date"]})}function ye(e){if(je.absenceTypes=ve(Re.types,e),!je.absenceTypes.length)return r.reject(ke)}function _e(){ -je.period=n.find(je.absencePeriods,function(e){return je.isMode("create")?e.current:ue(je.request,e)})}function qe(){je.isMode("create")?(je.selectedAbsenceType=je.absenceTypes[0],je.request.type_id=je.selectedAbsenceType.id):je.selectedAbsenceType=n.find(je.absenceTypes,function(e){return e.id===je.request.type_id})}function $e(){xe=e.copy(je.request.attributes())}function Ce(){var e;je.request.id?(e=[je.requestStatuses[y.statusNames.approved].value,je.requestStatuses[y.statusNames.adminApproved].value,je.requestStatuses[y.statusNames.rejected].value,je.requestStatuses[y.statusNames.cancelled].value],je.mode="edit",je.isRole("staff")&&e.indexOf(je.request.status_id)>-1&&(je.mode="view")):je.mode="create"}function Ae(){var e=je.request.status_id;if(!je.isMode("view")&&!je.submitting)return je.submitting=!0,R(),A(),je.request.isValid().then(re()&&O).then(M).then(I()&&be).then(we).then(function(){return je.isMode("edit")?Se():x()}).catch(function(t){je.request.status_id=e,t&&W(t)}).finally(function(){je.submitting=!1})}function we(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===Le&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Le>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){Me.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return je.request.update().then(Te).then(function(){je.isRole("manager")?ge("LeaveRequest::updatedByManager"):(je.isRole("staff")||je.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Oe,Ie={},Le=0,xe={},Me=[],ke="No entitlement",Ee="",Be=[],je=n.assign(this,f);je.absencePeriods=[],je.absenceTypes=[],je.canManage=!1,je.contactName=null,je.errors=[],je.isSelfLeaveApprover=!1,je.loading={absenceTypes:!0,entitlements:!0},je.managedContacts=[],je.mode="",je.newStatusOnSave=null,je.period={},je.postContactSelection=!1,je.requestStatuses={},je.selectedAbsenceType={},je.staffMemberSelectionComplete=!1,je.submitting=!1,je.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},je.canChangeAbsenceType=D,je.canSubmit=S,je.closeAlert=L,je.deleteLeaveRequest=k,je.dismissModal=E,je.getStatuses=U,je.getStatusFromValue=H,je.initAfterContactSelection=Y,je.initRequestAttributes=Z,je.isLeaveStatus=oe,je.isLeaveType=se,je.isMode=ie,je.isRole=ce,je.submit=Ae,je.updateAbsenceType=De,function(){je.loading.absenceTypes=!0,G(),K(),me().then(J).then(function(){return r.all([ee(),le(),he()])}).then(z).then(Q).then(Ce).then(_e).then(function(){return je.canManage&&!je.isMode("edit")&&pe()}).then(function(){if(je.selectedContactId&&(je.request.contact_id=je.selectedContactId),je.request.contact_id)return je.initAfterContactSelection()}).catch(W).finally(function(){je.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$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,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(){}); +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/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,r,o,s,i,u,c,l,d,f){function m(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([O.awaitingApproval,O.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function g(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function b(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=I[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return f.get().then(function(e){D=e.contactId})}function $(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[L[e]]})}function A(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function w(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(I,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:I[e].label,isDirectAction:I[e].isDirectAction}})}function T(){return g().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,O=l.statusNames,I={edit:{label:"Edit",allowedStatuses:[O.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[O.moreInformationRequired]},view:{label:"View",allowedStatuses:[O.approved,O.rejected,O.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[O.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.approved,O.rejected,O.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[O.awaitingApproval,O.moreInformationRequired,O.approved,O.rejected,O.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},L={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=m,R.openLeavePopup=$,function(){a.resolve().then(y).then(q).then(function(){return b()&&"admin"!==R.role&&T()}).then(w).finally(function(){R.loading.component=!1})}()}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,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 E();r.$broadcast("LeaveRequestPopup::absencePeriodChanged")}).catch(w).finally(_)}function g(){return G(),E()}function b(){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,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?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 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 L(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 k(){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 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(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:k},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=L,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(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:x(),managed_by:U.isAdmin&&"me"!==n.assignedTo.type?void 0:U.contactId,status_id:k(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 L(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 k(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 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=L,U.refresh=E,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){L[e]=t,f(e,t),n&&"from"===e&&f("to",t)}).catch(function(t){return L[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=L[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 L={};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(),L())})})}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(),L(),j()}function R(){return M(),u.uiOptions.multipleDays||u.updateEndTimeInputMinTime(u.uiOptions.times.from.time),l(),U?U=!1:L(),j()}function O(e){u.uiOptions.times[e].time=""}function I(){u.request.toil_to_accrue=u.uiOptions.toil_duration_in_hours}function L(){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 k(){u.setRequestDateTimesAndDateTypes(),l(),L(),u.isCalculationUnit("hours")?I():u.request.toil_to_accrue=null}function E(){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=k,u.onDateChangeExtended=S,u.openToilInDaysAccrualOptionsEditor=E,u.resetUIInputsExtended=O,u.setDaysSelectionModeExtended=R,u.updateExpiryDate=F,function(){x(),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/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,$){function C(e){"days"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function A(){["from","to"].forEach(C)}function w(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Be="admin")})}function T(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;Me.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Fe.loading.entitlements&&(!!le("admin")||!ue("view")&&!(le("manager")&&!ue("create")))}function R(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||D())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function O(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function I(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==U())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return $.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function L(){return"toil"!==U()&&!Fe.request.change_balance}function x(){Fe.errors=[]}function M(){return Fe.request.create().then(Pe).then(function(){be("LeaveRequest::new")})}function k(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return n.map(Le[e],function(e){return Fe.requestStatuses[e]})}function U(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function H(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():N("none")}function W(e){return n.find(Fe.requestStatuses,function(t){return t.value===e})}function V(e){Fe.errors=n.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(Me,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?r.resolve().then(fe).then(me).then(_e).then($e).then(re).then(J).then(Fe.isMode("edit")?Ce:n.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return r.reject(e)}):r.reject("The contact id was not set")}function z(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];Le.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],Le.awaiting_approval=e,Le.more_information_required=e,Le.rejected=e,Le.approved=e,Le.cancelled=[y.statusNames.awaitingApproval].concat(e)}function X(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function J(){return Fe.canManage?m.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):r.resolve()}function K(){Fe.isRole("admin")&&Fe.isSelfRecord&&(Fe.isSelfLeaveApprover=!0)}function Q(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Fe,"leaveRequest.contact_id"),a=!n.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(t||a)}function Z(){ke.push(o.$on("LeaveRequestPopup::requestObjectUpdated",Ce),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(_e).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){xe++})),s.$on("$destroy",De),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function ee(){var e,t;Fe.request=Fe.leaveRequest||null,e=U(),t=Fe.initRequestAttributes(),"leave"===e?Fe.request=b.init(t):"sickness"===e?Fe.request=_.init(t):"toil"===e&&(Fe.request=q.init(t))}function te(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:Ie.id}),e}function ne(){return Be="staff",ae().then(Fe.isSelfRecord&&!Fe.isRole("admin")&&w)}function ae(){return u(y.permissions.admin.administer).then(function(e){e&&(Be="admin")}).then(function(){return"admin"!==Be&&u(y.permissions.ssp.manage)}).then(function(e){e&&(Be="manager")})}function re(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!n.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var t=Fe.getStatusFromValue(Fe.request.status_id);return!!t&&t.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function ue(e){return Fe.mode===e}function ce(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 le(e){return Be===e}function de(){return p.all().then(function(e){Fe.absencePeriods=e})}function fe(){return h.all(j()).then(h.loadCalculationUnits).then(function(e){Oe={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Oe.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function pe(){return m.getLoggedIn().then(function(e){Ie=e})}function he(){return Fe.selectedContactId?m.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?m.all().then(function(e){Fe.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Fe.managedContacts=e})}function ve(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.requestStatuses=n.indexBy(e,"name")})}function ge(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 be(e){T(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ye(){ +["from","to"].forEach(function(e){Fe.request[e+"_date"]=Me[e+"_date"]})}function _e(e){if(Fe.absenceTypes=ge(Oe.types,e),!Fe.absenceTypes.length)return r.reject(Ee)}function qe(){Fe.period=n.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function $e(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=n.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Me=e.copy(Fe.request.attributes())}function Ae(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function we(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,O(),A(),Fe.request.isValid().then(oe()&&I).then(k).then(L()&&ye).then(Te).then(function(){return Fe.isMode("edit")?Re():M()}).catch(function(t){Fe.request.status_id=e,t&&V(t)}).finally(function(){Fe.submitting=!1})}function Te(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&n.push(e),++a===xe&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return xe>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function De(){ke.forEach(function(e){e()})}function Se(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Re(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?be("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Oe,Ie,Le={},xe=0,Me={},ke=[],Ee="No entitlement",Be="",je=[],Fe=n.assign(this,f);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=S,Fe.canSubmit=R,Fe.closeAlert=x,Fe.deleteLeaveRequest=E,Fe.dismissModal=B,Fe.getStatuses=H,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=te,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=ue,Fe.isRole=le,Fe.submit=we,Fe.updateAbsenceType=Se,function(){Fe.loading.absenceTypes=!0,z(),Z(),pe().then(Q).then(function(){return r.all([ne(),de(),ve()])}).then(X).then(K).then(ee).then(Ae).then(qe).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&he()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(V).finally(function(){Fe.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$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,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(){}); //# 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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index db616d98965..658f3c31173 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 @@ -8,7 +8,7 @@ !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/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,r,o,s,i,u,c,l,d,m){function f(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=x[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){w(e)}).catch(function(e){d.error("Error:",e)})}}}function $(){return m.get().then(function(e){D=e.contactId})}function q(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function w(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function A(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(x,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:x[e].label,isDirectAction:x[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,x={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},O={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=f,R.openLeavePopup=q,function(){a.resolve().then(y).then($).then(function(){return g()&&T()}).then(A).finally(function(){R.loading.component=!1})}()}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,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/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){function C(e){"days"===Be.selectedAbsenceType.calculation_unit_name?delete Be.request[e+"_date_amount"]:delete Be.request[e+"_date_type"]}function w(){["from","to"].forEach(C)}function A(){var e=Be.requestStatuses[y.statusNames.awaitingApproval].value;ke.status_id===e&&e!==Be.request.status_id&&d.publish("ManagerBadge:: Update Count")}function T(){return je.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function P(){return je.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return!Be.loading.entitlements&&(!!ce("admin")||!ie("view")&&!(ce("manager")&&!ie("create")))}function S(){var e=T();return Be.isMode("edit")&&(e=e&&(V()||P())),Be.canManage&&Be.requestStatuses&&(e=e&&!!Be.getStatusFromValue(Be.newStatusOnSave)),(e=e&&!!Be.period.id)&&!Be.isMode("view")}function R(){Be.isSelfRecord&&!Be.isSelfLeaveApprover?Be.request.status_id=Be.requestStatuses[y.statusNames.awaitingApproval].value:Be.canManage&&(Be.request.status_id=Be.newStatusOnSave||Be.request.status_id)}function I(){if(Be.isMode("edit")&&!Be.isRole("staff")&&"toil"!==N())return Be.request.calculateBalanceChange(Be.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Be.balance.change.amount!=+e.amount)return q.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function x(){return"toil"!==N()&&!Be.request.change_balance}function O(){Be.errors=[]}function k(){return Be.request.create().then(Te).then(function(){be("LeaveRequest::new")})}function L(){re()&&!Be.isRole("staff")&&(Be.request.change_balance=!0)}function M(){l.open({title:"Confirm Deletion?",copyCancel:"Cancel",copyConfirm:"Confirm",classConfirm:"btn-danger",msg:"This cannot be undone",onConfirm:function(){return Be.request.delete().then(function(){Be.dismissModal(),d.publish("LeaveRequest::delete",Be.request)})}})}function E(){i.dismiss({$value:"cancel"})}function j(){var e=N();return"leave"===e?{is_sick:!1}:"sickness"===e?{is_sick:!0}:"toil"===e?{allow_accruals_request:!0}:void 0}function B(){return F(Be.getStatusFromValue(Be.request.status_id).name)}function F(e){return n.map(xe[e],function(e){return Be.requestStatuses[e]})}function N(){return Be.request?Be.request.request_type:Be.leaveType||null}function U(){return!Be.request||e.equals({},Be.requestStatuses)?[]:Be.request.status_id?B():F("none")}function H(e){return n.find(Be.requestStatuses,function(t){return t.value===e})}function W(e){Be.errors=n.isArray(e)?e:[e],Be.loading.absenceTypes=!1,Be.submitting=!1}function V(){return!e.equals(ke,Be.request.attributes())||Be.canManage&&Be.newStatusOnSave}function Y(){return Be.postContactSelection=!0,Be.staffMemberSelectionComplete=!1,Be.request.contact_id?r.resolve().then(de).then(me).then(ye).then($e).then(ae).then(X).then(Be.isMode("edit")?qe:n.noop).then(function(){Be.postContactSelection=!1,Be.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Me)return r.reject(e)}):r.reject("The contact id was not set")}function G(){var e=[y.statusNames.moreInformationRequired,y.statusNames.approved,y.statusNames.rejected,y.statusNames.cancelled];xe.none=[y.statusNames.moreInformationRequired,y.statusNames.approved],xe.awaiting_approval=e,xe.more_information_required=e,xe.rejected=e,xe.approved=e,xe.cancelled=[y.statusNames.awaitingApproval].concat(e)}function z(){Be.canManage=Be.isRole("manager")||Be.isRole("admin")}function X(){return Be.canManage?f.find(Be.request.contact_id).then(function(e){Be.contactName=e.display_name}):r.resolve()}function J(){var e="my-leave"===o.section,t=+Ie.id==+n.get(Be,"leaveRequest.contact_id"),a=!n.get(Be,"leaveRequest.id");Be.isSelfRecord=e&&(t||a)}function K(){Le.push(o.$on("LeaveRequestPopup::requestObjectUpdated",qe),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){me().then(ye).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Be.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){W(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){Oe++})),s.$on("$destroy",Pe),s.$on("LeaveRequestPopup::addTab",function(e,t){je.push(t)})}function Q(){var e,t;Be.request=Be.leaveRequest||null,e=N(),t=Be.initRequestAttributes(),"leave"===e?Be.request=g.init(t):"sickness"===e?Be.request=_.init(t):"toil"===e&&(Be.request=$.init(t))}function Z(){var e={};return Be.request?e=Be.request.attributes():Be.canManage||(e={contact_id:Ie.id}),e}function ee(){return Ee="staff",Be.isSelfRecord?te():ne()}function te(){return Ie.checkIfSelfLeaveApprover().then(function(e){e&&(Ee="admin",Be.isSelfLeaveApprover=!0)})}function ne(){return u(y.permissions.admin.administer).then(function(e){e&&(Ee="admin")}).then(function(){return"admin"!==Ee&&u(y.permissions.ssp.manage)}).then(function(e){e&&(Ee="manager")})}function ae(){Be.defaultStatus?Be.newStatusOnSave=Be.requestStatuses[y.statusNames[Be.defaultStatus]].value:(Be.isRole("admin")||Be.isMode("create")&&Be.isRole("manager"))&&(Be.newStatusOnSave=Be.requestStatuses[y.statusNames.approved].value)}function re(){return!Be.request.status_id||!n.includes(["cancelled","rejected"],H(Be.request.status_id).name)}function oe(e){var t=Be.getStatusFromValue(Be.request.status_id);return!!t&&t.name===e}function se(e){return Be.request&&Be.request.request_type===e}function ie(e){return Be.mode===e}function ue(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 ce(e){return Ee===e}function le(){return p.all().then(function(e){Be.absencePeriods=e})}function de(){return h.all(j()).then(h.loadCalculationUnits).then(function(e){Re={types:e,ids:e.map(function(e){return e.id})}})}function me(){return Be.loading.entitlements=!0,v.all({contact_id:Be.request.contact_id,period_id:Be.period.id,type_id:{IN:Re.ids}},!0).finally(function(){Be.loading.entitlements=!1})}function fe(){return f.getLoggedIn().then(function(e){Ie=e})}function pe(){return Be.selectedContactId?f.find(Be.selectedContactId).then(function(e){Be.managedContacts=[e]}):Be.isRole("admin")?f.all().then(function(e){Be.managedContacts=n.remove(e.list,function(e){return e.id!==Ie.id})}):Ie.leaveManagees().then(function(e){Be.managedContacts=e})}function he(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Be.requestStatuses=n.indexBy(e,"name")})}function ve(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 be(e){A(),d.publish(e,Be.request),Be.errors=[],Be.dismissModal()}function ge(){["from","to"].forEach(function(e){Be.request[e+"_date"]=ke[e+"_date"]})}function ye(e){if(Be.absenceTypes=ve(Re.types,e),!Be.absenceTypes.length)return r.reject(Me)}function _e(){Be.period=n.find(Be.absencePeriods,function(e){return Be.isMode("create")?e.current:ue(Be.request,e)})}function $e(){Be.isMode("create")?(Be.selectedAbsenceType=Be.absenceTypes[0],Be.request.type_id=Be.selectedAbsenceType.id):Be.selectedAbsenceType=n.find(Be.absenceTypes,function(e){return e.id===Be.request.type_id})}function qe(){ke=e.copy(Be.request.attributes())}function Ce(){var e;Be.request.id?(e=[Be.requestStatuses[y.statusNames.approved].value,Be.requestStatuses[y.statusNames.adminApproved].value,Be.requestStatuses[y.statusNames.rejected].value,Be.requestStatuses[y.statusNames.cancelled].value],Be.mode="edit",Be.isRole("staff")&&e.indexOf(Be.request.status_id)>-1&&(Be.mode="view")):Be.mode="create"}function we(){var e=Be.request.status_id;if(!Be.isMode("view")&&!Be.submitting)return Be.submitting=!0,R(),w(),Be.request.isValid().then(re()&&I).then(L).then(x()&&ge).then(Ae).then(function(){return Be.isMode("edit")?Se():k()}).catch(function(t){Be.request.status_id=e,t&&W(t)}).finally(function(){Be.submitting=!1})}function Ae(){return r.all(je.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Te(){function e(e){e&&n.push(e),++a===Oe&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return Oe>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function Pe(){Le.forEach(function(e){e()})}function De(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Se(){return Be.request.update().then(Te).then(function(){Be.isRole("manager")?be("LeaveRequest::updatedByManager"):(Be.isRole("staff")||Be.isRole("admin"))&&be("LeaveRequest::edit")})}t.debug("RequestCtrl");var Re,Ie,xe={},Oe=0,ke={},Le=[],Me="No entitlement",Ee="",je=[],Be=n.assign(this,m);Be.absencePeriods=[],Be.absenceTypes=[],Be.canManage=!1,Be.contactName=null,Be.errors=[],Be.isSelfLeaveApprover=!1,Be.loading={absenceTypes:!0,entitlements:!0},Be.managedContacts=[],Be.mode="",Be.newStatusOnSave=null,Be.period={},Be.postContactSelection=!1,Be.requestStatuses={},Be.selectedAbsenceType={},Be.staffMemberSelectionComplete=!1,Be.submitting=!1,Be.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Be.canChangeAbsenceType=D,Be.canSubmit=S,Be.closeAlert=O,Be.deleteLeaveRequest=M,Be.dismissModal=E,Be.getStatuses=U,Be.getStatusFromValue=H,Be.initAfterContactSelection=Y,Be.initRequestAttributes=Z,Be.isLeaveStatus=oe,Be.isLeaveType=se,Be.isMode=ie,Be.isRole=ce,Be.submit=we,Be.updateAbsenceType=De,function(){Be.loading.absenceTypes=!0,G(),K(),fe().then(J).then(function(){return r.all([ee(),le(),he()])}).then(z).then(Q).then(Ce).then(_e).then(function(){return Be.canManage&&!Be.isMode("edit")&&pe()}).then(function(){if(Be.selectedContactId&&(Be.request.contact_id=Be.selectedContactId),Be.request.contact_id)return Be.initAfterContactSelection()}).catch(W).finally(function(){Be.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r),r.$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,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(){}); +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/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,r,o,s,i,u,c,l,d,m){function f(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=x[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){w(e)}).catch(function(e){d.error("Error:",e)})}}}function $(){return m.get().then(function(e){D=e.contactId})}function q(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function w(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function A(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(x,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:x[e].label,isDirectAction:x[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,x={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},O={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=f,R.openLeavePopup=q,function(){a.resolve().then(y).then($).then(function(){return g()&&"admin"!==R.role&&T()}).then(A).finally(function(){R.loading.component=!1})}()}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,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(){G.absenceTypes=G.absenceTypes.map(function(t){var n=e.find(G.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){N(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 t=Y[e.status];t?t(e.leaveRequest):G.refresh()}function y(t){t.dataIndex=e.indexBy(t.data,"id")}function _(){return G.role="staff","absence-tab"===a.section?void(G.role="admin"):r(m.permissions.admin.administer).then(function(e){e&&(G.role="admin")})}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return o.all().then(function(t){G.absencePeriods=e.sortBy(t,"start_date"),G.selectedPeriod=e.find(G.absencePeriods,function(e){return!0===e.current})})}function C(){return s.all().then(s.loadCalculationUnits).then(function(t){G.absenceTypes=t,G.absenceTypesIndexed=e.indexBy(t,"id")})}function w(){return R("approved",{status_id:V(m.statusNames.approved)})}function A(){var t={contact_id:G.contactId,period_id:G.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:[V(m.statusNames.approved)]}})),u.balanceChangeByAbsenceType(e.assign({},t,{statuses:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}}))]).then(function(e){G.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 T(){return i.all({contact_id:G.contactId,period_id:G.selectedPeriod.id},!0).then(function(e){G.entitlements=e})}function P(){return i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id},G.entitlements).then(function(){return j(G.entitlements)}).then(function(e){G.sections.entitlements.data=e})}function D(){return n.all([i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id,expired:!0}),S({request_type:"toil",expired:!0})]).then(function(e){return n.all({expiredBalanceChangesFlatten:j(e[0]),expiredTOILS:B(e[1].list)})}).then(function(t){G.sections.expired.data=t.expiredBalanceChangesFlatten.concat(t.expiredTOILS),G.sections.expired.data=e.sortBy(G.sections.expired.data,"expiry_date")})}function S(t){return u.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})}},t),null,"from_date ASC",null,!1)}function R(e,t){return S(t).then(function(t){G.sections[e].data=t.list})}function I(){return n.all(Object.values(G.sections).filter(function(e){return e.open}).map(L))}function x(){return R("other",{status_id:{in:[V(m.statusNames.rejected),V(m.statusNames.cancelled)]}})}function O(){return R("pending",{status_id:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}})}function k(){return R("holidays",{public_holiday:!0})}function L(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function M(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){G.leaveRequestStatuses=e.indexBy(t,"value")})}function E(){p(),b()}function j(t){return n.resolve().then(function(){return t.map(function(t){var n=e.find(G.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 B(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 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){N(e)})}function N(t){e.forEach(G.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&&U(t,a))})}function U(t,n){var a=["future","current"],r=G.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 H(){G.loading.content=!0,n.all([T(),A()]).then(E).then(function(){G.loading.content=!1}).then(function(){return n.all([I(),v()])})}function W(e){var t=G.sections[e];t.open=!t.open,t.open&&!t.data.length&&L(t)}function V(t){return e.find(G.leaveRequestStatuses,function(e){return e.name===t}).value}t.debug("Component: staff-leave-report");var Y={delete:N,cancel:h},G=this;G.absencePeriods=[],G.absenceTypes=[],G.absenceTypesFiltered=[],G.absenceTypesIndexed={},G.dateFormat=d.DATE_FORMAT,G.leaveRequestStatuses={},G.selectedPeriod=null,G.role,G.loading={content:!0,page:!0},G.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:w},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:D},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:x}},G.labelPeriod=$,G.refresh=H,G.toggleSection=W,function(){n.all([_(),M(),C(),q()]).then(function(){G.loading.page=!1}).then(function(){return n.all([T(),A()])}).then(E).then(function(){G.loading.content=!1}),F()}()}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/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){function C(e){"days"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function w(){["from","to"].forEach(C)}function A(){return xe.checkIfSelfLeaveApprover().then(function(e){e&&(je="admin")})}function T(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Fe.loading.entitlements&&(!!le("admin")||!ue("view")&&!(le("manager")&&!ue("create")))}function R(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||D())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function I(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function x(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==U())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return q.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==U()&&!Fe.request.change_balance}function k(){Fe.errors=[]}function L(){return Fe.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function M(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return n.map(Oe[e],function(e){return Fe.requestStatuses[e]})}function U(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function H(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():N("none")}function W(e){return n.find(Fe.requestStatuses,function(t){return t.value===e})}function V(e){Fe.errors=n.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(Le,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?r.resolve().then(me).then(fe).then(_e).then(qe).then(re).then(J).then(Fe.isMode("edit")?Ce:n.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return r.reject(e)}):r.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(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function J(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):r.resolve()}function K(){Fe.isRole("admin")&&Fe.isSelfRecord&&(Fe.isSelfLeaveApprover=!0)}function Q(){var e="my-leave"===o.section,t=+xe.id==+n.get(Fe,"leaveRequest.contact_id"),a=!n.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(t||a)}function Z(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",Ce),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(_e).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",De),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function ee(){var e,t;Fe.request=Fe.leaveRequest||null,e=U(),t=Fe.initRequestAttributes(),"leave"===e?Fe.request=g.init(t):"sickness"===e?Fe.request=_.init(t):"toil"===e&&(Fe.request=$.init(t))}function te(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:xe.id}),e}function ne(){return je="staff",ae().then(Fe.isSelfRecord&&!Fe.isRole("admin")&&A)}function ae(){return u(y.permissions.admin.administer).then(function(e){e&&(je="admin")}).then(function(){return"admin"!==je&&u(y.permissions.ssp.manage)}).then(function(e){e&&(je="manager")})}function re(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!n.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var t=Fe.getStatusFromValue(Fe.request.status_id);return!!t&&t.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function ue(e){return Fe.mode===e}function ce(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 le(e){return je===e}function de(){return p.all().then(function(e){Fe.absencePeriods=e})}function me(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Ie={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Ie.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){xe=e})}function he(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=n.remove(e.list,function(e){return e.id!==xe.id})}):xe.leaveManagees().then(function(e){Fe.managedContacts=e})}function ve(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.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){T(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ye(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Le[e+"_date"]})}function _e(e){if(Fe.absenceTypes=be(Ie.types,e),!Fe.absenceTypes.length)return r.reject(Ee)}function $e(){Fe.period=n.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=n.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Le=e.copy(Fe.request.attributes())}function we(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,I(),w(),Fe.request.isValid().then(oe()&&x).then(M).then(O()&&ye).then(Te).then(function(){return Fe.isMode("edit")?Re():L()}).catch(function(t){Fe.request.status_id=e,t&&V(t)}).finally(function(){Fe.submitting=!1})}function Te(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function De(){Me.forEach(function(e){e()})}function Se(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Re(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Ie,xe,Oe={},ke=0,Le={},Me=[],Ee="No entitlement",je="",Be=[],Fe=n.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=S,Fe.canSubmit=R,Fe.closeAlert=k,Fe.deleteLeaveRequest=E,Fe.dismissModal=j,Fe.getStatuses=H,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=te,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=ue,Fe.isRole=le,Fe.submit=Ae,Fe.updateAbsenceType=Se,function(){Fe.loading.absenceTypes=!0,z(),Z(),pe().then(Q).then(function(){return r.all([ne(),de(),ve()])}).then(X).then(K).then(ee).then(we).then($e).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&he()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(V).finally(function(){Fe.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r), +r.$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,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(){}); //# 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/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 ffc75f73e42..d527fea4125 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 @@ -130,7 +130,8 @@ define([ .then(indexSupportData) .then(loadCurrentlyLoggedInContactId) .then(function () { - return checkIfOwnLeaveRequest() && setRoleToAdminIfSelfLeaveApprover(); + return checkIfOwnLeaveRequest() && vm.role !== 'admin' && + setRoleToAdminIfSelfLeaveApprover(); }) .then(setAllowedActions) .finally(function () { 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..30503bc1d49 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 @@ -39,7 +39,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 @@ -59,6 +59,7 @@ define([ (function init () { $q.all([ + initRole(), loadStatuses(), loadAbsenceTypes(), loadAbsencePeriods() @@ -175,6 +176,26 @@ 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. + */ + function initRole () { + vm.role = 'staff'; + + if ($rootScope.section === 'absence-tab') { + vm.role = 'admin'; + + return; + } + + 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 * diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js index 2ce2d433345..ca36d1df8ba 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/leave-request-actions.component.spec.js @@ -691,8 +691,8 @@ define([ beforeEach(function () { leaveRequest.contact_id = '112358'; - spyOn(Contact, 'find').and.callThrough(); - spyOn(ContactInstance, 'checkIfSelfLeaveApprover').and.callThrough(); + spyOn(Contact, 'find'); + spyOn(ContactInstance, 'checkIfSelfLeaveApprover'); compileComponentAndDigest(); }); @@ -706,6 +706,19 @@ define([ ['edit', 'cancel']); }); }); + + describe('when the role is set as "admin"', function () { + beforeEach(function () { + spyOn(Contact, 'find'); + spyOn(ContactInstance, 'checkIfSelfLeaveApprover'); + compileComponentAndDigest('admin'); + }); + + it('does not check if the contact can approve their own requests', function () { + expect(Contact.find).not.toHaveBeenCalled(); + expect(ContactInstance.checkIfSelfLeaveApprover).not.toHaveBeenCalled(); + }); + }); }); /** diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/staff-leave-report.component.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/staff-leave-report.component.spec.js index d8f18a7e322..baad4346446 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/staff-leave-report.component.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/components/staff-leave-report.component.spec.js @@ -93,32 +93,35 @@ }); })); - beforeEach(function () { - compileComponent(); - }); + describe('before initialisation', function () { + beforeEach(function () { + compileComponent(); + }); - it('is initialized', function () { - expect($log.debug).toHaveBeenCalled(); - }); + it('is initialized', function () { + expect($log.debug).toHaveBeenCalled(); + }); - it('holds the date format', function () { - expect(controller.dateFormat).toBeDefined(); - expect(controller.dateFormat).toBe(HRSettings.DATE_FORMAT); - }); + it('holds the date format', function () { + expect(controller.dateFormat).toBeDefined(); + expect(controller.dateFormat).toBe(HRSettings.DATE_FORMAT); + }); - it('has all the sections collapsed', function () { - expect(Object.values(controller.sections).every(function (section) { - return section.open === false; - })).toBe(true); - }); + it('has all the sections collapsed', function () { + expect(Object.values(controller.sections).every(function (section) { + return section.open === false; + })).toBe(true); + }); - it('is in loading mode', function () { - expect(controller.loading.page).toBe(true); - expect(controller.loading.content).toBe(true); + it('is in loading mode', function () { + expect(controller.loading.page).toBe(true); + expect(controller.loading.content).toBe(true); + }); }); describe('in the middle of initialisation', function () { beforeEach(function () { + compileComponent(); EntitlementAllSpy.and.returnValue($q.reject()); $rootScope.$digest(); }); @@ -134,6 +137,7 @@ describe('after initialisation', function () { beforeEach(function () { + compileComponent(); $rootScope.$digest(); }); @@ -876,6 +880,49 @@ }); }); + describe('when it is "absence-tab" section', function () { + beforeEach(function () { + $rootScope.section = 'absence-tab'; + + compileComponent(); + $rootScope.$digest(); + }); + + afterEach(function () { + delete $rootScope.section; + }); + + it('sets the role to "admin"', function () { + expect(controller.role).toBe('admin'); + }); + }); + + describe('when user is staff', function () { + beforeEach(function () { + isUserAdmin = false; + + compileComponent(); + $rootScope.$digest(); + }); + + it('sets the role to "staff"', function () { + expect(controller.role).toBe('staff'); + }); + }); + + describe('when user is admin', function () { + beforeEach(function () { + isUserAdmin = true; + + compileComponent(); + $rootScope.$digest(); + }); + + it('sets the role to "admin"', function () { + expect(controller.role).toBe('admin'); + }); + }); + /** * Returns the value of the given leave request status * 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 @@ From 58aad1da5707c64b27613b2ba847dbbd3ba3003b Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Mon, 30 Jul 2018 11:41:29 +0200 Subject: [PATCH 095/151] PCHR-3944: Use .uniqueId in spec --- .../js/test/shared/instances/leave-request.instance.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/instances/leave-request.instance.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/instances/leave-request.instance.spec.js index 17f0b4e7cf6..8190f6b6dcc 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/instances/leave-request.instance.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/instances/leave-request.instance.spec.js @@ -184,7 +184,7 @@ define([ function commonSetup (methodName) { instance = LeaveRequestInstance.init(helper.createRandomLeaveRequest()); - instance.id = _.random(1, 10); + instance.id = _.uniqueId(); spyOn(instance, 'update').and.callThrough(); From 956e00a3d35d210fc528b0127c0362742b966b12 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Mon, 30 Jul 2018 10:52:09 +0100 Subject: [PATCH 096/151] PCHR-4045: Refactor code --- .../js/dist/absence-tab.min.js | 2 +- .../js/dist/my-leave.min.js | 2 +- .../components/staff-leave-report.component.js | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) 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 f0ec81e05b0..e672758c44c 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,O(!0)})}function b(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(B(),E(),O())})}function g(e){W.injectMonth=!0,U("injected").then(function(){O(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 S(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&f(),M(),E(),L("month")}function k(e){var t="previous"===e?"subtract":"add";B(n(W.selectedMonth.moment)[t](1,"month")),E(),L("month")}function L(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 O(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=S,W.paginateMonth=k,W.refresh=L,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:k()},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)&&L()}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!==k().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/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(n){w=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===S.leaveRequest.request_type?i.open(y(n)):v(n)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(t){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(S.leaveRequest.from_date):"2"===a)}function v(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){T(n)}}):y(n)})}})}function b(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return I===S.leaveRequest.contact_id}function _(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function y(e){var n=L[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return m.get().then(function(e){I=e.contactId})}function C(e,n){e.stopPropagation(),r.openModal(n)}function T(e){r.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function A(n){var t=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;w===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:S.leaveRequest})}function D(){var n=S.leaveRequestStatuses[S.leaveRequest.status_id].name,t=e.compact(e.map(L,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!h(n)&&e.pull(t,"cancel"),"admin"!==S.role&&e.pull(t,"delete"),"staff"===S.role&&e.pull(t,"approve","reject"),"staff"!==S.role&&R(t),p()&&t.push("delete"),S.allowedActions=e.map(t,function(e){return{key:e,label:L[e].label,isDirectAction:L[e].isDirectAction}})}function P(){return b().then(function(e){e&&(S.role="admin")})}function R(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,w,S=this,k=l.statusNames,L={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"}}},O={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=f,S.openLeavePopup=C,function(){a.resolve().then(_).then(q).then(function(){return g()&&"admin"!==S.role&&P()}).then(D).finally(function(){S.loading.component=!1})}()}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(){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(),k("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,k("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 S(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function k(e){return ne.selectedAbsenceType.calculation_unit_name===e}function L(e){return ne.request.request_type===e}function O(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")&&(L("sickness")||k("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),(k("hours")||L("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=k,ne.isLeaveType=L,ne.isNotWorkingDay=O,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(S).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 S.fileUploader&&S.fileUploader.queue.length>0}function m(){return S.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return S.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||S.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=D,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=m,S.formatDateTime=f,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",S),g(),a.all([T(),q()]).then(_).finally(function(){S.filesLoaded=!0})}(),S}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(){V.absenceTypes=V.absenceTypes.map(function(n){var t=e.find(V.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){N(e),V.sections.other.open&&f(e,V.sections.other)}function v(){Object.values(V.sections).forEach(function(e){e.data=[]})}function b(){V.absenceTypesFiltered=V.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function g(e){var n=G[e.status];n?n(e.leaveRequest):V.refresh()}function _(n){n.dataIndex=e.indexBy(n.data,"id")}function y(){return V.role="staff","absence-tab"===a.section?void(V.role="admin"):o(m.permissions.admin.administer).then(function(e){e&&(V.role="admin")})}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return s.all().then(function(n){V.absencePeriods=e.sortBy(n,"start_date"),V.selectedPeriod=e.find(V.absencePeriods,function(e){return!0===e.current})})}function T(){return i.all().then(i.loadCalculationUnits).then(function(n){V.absenceTypes=n,V.absenceTypesIndexed=e.indexBy(n,"id")})}function A(){return S("approved",{status_id:Y(m.statusNames.approved)})}function D(){var n={contact_id:V.contactId,period_id:V.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:[Y(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}}))]).then(function(e){V.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:V.contactId,period_id:V.selectedPeriod.id},!0).then(function(e){V.entitlements=e})}function R(){return r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id},V.entitlements).then(function(){return B(V.entitlements)}).then(function(e){V.sections.entitlements.data=e})}function I(){return t.all([r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id,expired:!0}),w({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:B(e[0]),expiredTOILS:F(e[1].list)})}).then(function(n){V.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),V.sections.expired.data=e.sortBy(V.sections.expired.data,"expiry_date")})}function w(n){return c.all(e.assign({contact_id:V.contactId,from_date:{from:V.selectedPeriod.start_date},to_date:{to:V.selectedPeriod.end_date},type_id:{IN:V.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function S(e,n){return w(n).then(function(n){V.sections[e].data=n.list})}function k(){return t.all(Object.values(V.sections).filter(function(e){return e.open}).map(x))}function L(){return S("other",{status_id:{in:[Y(m.statusNames.rejected),Y(m.statusNames.cancelled)]}})}function O(){return S("pending",{status_id:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}})}function M(){return S("holidays",{public_holiday:!0})}function x(e){return e.loading=!0,e.loadLeaveRequests().then(_.bind(this,e)).then(function(){e.loading=!1})}function $(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){V.leaveRequestStatuses=e.indexBy(n,"value")})}function E(){p(),b()}function B(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(V.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 F(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 U(){l.subscribe("LeaveRequest::new",function(){V.refresh()}),l.subscribe("LeaveRequest::edit",function(){V.refresh()}),l.subscribe("LeaveRequest::statusUpdate",g),l.subscribe("LeaveRequest::delete",function(e){N(e)})}function N(n){e.forEach(V.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&&j(n,a))})}function j(n,t){var a=["future","current"],o=V.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(){V.loading.content=!0,t.all([P(),D()]).then(E).then(function(){V.loading.content=!1}).then(function(){return t.all([k(),v()])})}function H(e){var n=V.sections[e];n.open=!n.open,n.open&&!n.data.length&&x(n)}function Y(n){return e.find(V.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var G={delete:N,cancel:h},V=this;V.absencePeriods=[],V.absenceTypes=[],V.absenceTypesFiltered=[],V.absenceTypesIndexed={},V.dateFormat=d.DATE_FORMAT,V.leaveRequestStatuses={},V.selectedPeriod=null,V.role,V.loading={content:!0,page:!0},V.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:A},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:R},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L}},V.labelPeriod=q,V.refresh=W,V.toggleSection=H,function(){t.all([y(),$(),T(),C()]).then(function(){V.loading.page=!1}).then(function(){return t.all([P(),D()])}).then(E).then(function(){V.loading.content=!1}),U()}()}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),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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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/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;xe.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 x(){return Ue.request.create().then(Re).then(function(){ge("LeaveRequest::new")})}function $(){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(xe,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&&(n||a)}function Z(){$e.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=t.remove(e.list,function(e){return e.id!==Le.id})}):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"]=xe[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(){xe=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($).then(O()&&_e).then(Pe).then(function(){return Ue.isMode("edit")?Se():x()}).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(){$e.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,xe={},$e=[],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"]}), +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 U(){l.subscribe("LeaveRequest::new",function(){V.refresh()}),l.subscribe("LeaveRequest::edit",function(){V.refresh()}),l.subscribe("LeaveRequest::statusUpdate",g),l.subscribe("LeaveRequest::delete",function(e){N(e)})}function N(n){e.forEach(V.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&&j(n,a))})}function j(n,t){var a=["future","current"],o=V.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(){V.loading.content=!0,t.all([P(),D()]).then(E).then(function(){V.loading.content=!1}).then(function(){return t.all([k(),v()])})}function H(e){var n=V.sections[e];n.open=!n.open,n.open&&!n.data.length&&x(n)}function Y(n){return e.find(V.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var G={delete:N,cancel:h},V=this;V.absencePeriods=[],V.absenceTypes=[],V.absenceTypesFiltered=[],V.absenceTypesIndexed={},V.dateFormat=d.DATE_FORMAT,V.leaveRequestStatuses={},V.selectedPeriod=null,V.role=null,V.loading={content:!0,page:!0},V.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:A},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:R},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L}},V.labelPeriod=q,V.refresh=W,V.toggleSection=H,function(){t.all([y(),$(),T(),C()]).then(function(){V.loading.page=!1}).then(function(){return t.all([P(),D()])}).then(E).then(function(){V.loading.content=!1}),U()}()}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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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/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;xe.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 x(){return Ue.request.create().then(Re).then(function(){ge("LeaveRequest::new")})}function $(){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(xe,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&&(n||a)}function Z(){$e.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=t.remove(e.list,function(e){return e.id!==Le.id})}):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"]=xe[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(){xe=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($).then(O()&&_e).then(Pe).then(function(){return Ue.isMode("edit")?Se():x()}).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(){$e.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,xe={},$e=[],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){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(){}); //# 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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index 658f3c31173..40db21d450a 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 @@ -9,6 +9,6 @@ !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/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,r,o,s,i,u,c,l,d,m){function f(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=x[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){w(e)}).catch(function(e){d.error("Error:",e)})}}}function $(){return m.get().then(function(e){D=e.contactId})}function q(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function w(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function A(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(x,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:x[e].label,isDirectAction:x[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,x={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},O={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=f,R.openLeavePopup=q,function(){a.resolve().then(y).then($).then(function(){return g()&&"admin"!==R.role&&T()}).then(A).finally(function(){R.loading.component=!1})}()}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,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(){G.absenceTypes=G.absenceTypes.map(function(t){var n=e.find(G.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){N(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 t=Y[e.status];t?t(e.leaveRequest):G.refresh()}function y(t){t.dataIndex=e.indexBy(t.data,"id")}function _(){return G.role="staff","absence-tab"===a.section?void(G.role="admin"):r(m.permissions.admin.administer).then(function(e){e&&(G.role="admin")})}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return o.all().then(function(t){G.absencePeriods=e.sortBy(t,"start_date"),G.selectedPeriod=e.find(G.absencePeriods,function(e){return!0===e.current})})}function C(){return s.all().then(s.loadCalculationUnits).then(function(t){G.absenceTypes=t,G.absenceTypesIndexed=e.indexBy(t,"id")})}function w(){return R("approved",{status_id:V(m.statusNames.approved)})}function A(){var t={contact_id:G.contactId,period_id:G.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:[V(m.statusNames.approved)]}})),u.balanceChangeByAbsenceType(e.assign({},t,{statuses:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}}))]).then(function(e){G.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 T(){return i.all({contact_id:G.contactId,period_id:G.selectedPeriod.id},!0).then(function(e){G.entitlements=e})}function P(){return i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id},G.entitlements).then(function(){return j(G.entitlements)}).then(function(e){G.sections.entitlements.data=e})}function D(){return n.all([i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id,expired:!0}),S({request_type:"toil",expired:!0})]).then(function(e){return n.all({expiredBalanceChangesFlatten:j(e[0]),expiredTOILS:B(e[1].list)})}).then(function(t){G.sections.expired.data=t.expiredBalanceChangesFlatten.concat(t.expiredTOILS),G.sections.expired.data=e.sortBy(G.sections.expired.data,"expiry_date")})}function S(t){return u.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})}},t),null,"from_date ASC",null,!1)}function R(e,t){return S(t).then(function(t){G.sections[e].data=t.list})}function I(){return n.all(Object.values(G.sections).filter(function(e){return e.open}).map(L))}function x(){return R("other",{status_id:{in:[V(m.statusNames.rejected),V(m.statusNames.cancelled)]}})}function O(){return R("pending",{status_id:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}})}function k(){return R("holidays",{public_holiday:!0})}function L(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function M(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){G.leaveRequestStatuses=e.indexBy(t,"value")})}function E(){p(),b()}function j(t){return n.resolve().then(function(){return t.map(function(t){var n=e.find(G.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 B(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 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){N(e)})}function N(t){e.forEach(G.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&&U(t,a))})}function U(t,n){var a=["future","current"],r=G.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 H(){G.loading.content=!0,n.all([T(),A()]).then(E).then(function(){G.loading.content=!1}).then(function(){return n.all([I(),v()])})}function W(e){var t=G.sections[e];t.open=!t.open,t.open&&!t.data.length&&L(t)}function V(t){return e.find(G.leaveRequestStatuses,function(e){return e.name===t}).value}t.debug("Component: staff-leave-report");var Y={delete:N,cancel:h},G=this;G.absencePeriods=[],G.absenceTypes=[],G.absenceTypesFiltered=[],G.absenceTypesIndexed={},G.dateFormat=d.DATE_FORMAT,G.leaveRequestStatuses={},G.selectedPeriod=null,G.role,G.loading={content:!0,page:!0},G.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:w},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:D},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:x}},G.labelPeriod=$,G.refresh=H,G.toggleSection=W,function(){n.all([_(),M(),C(),q()]).then(function(){G.loading.page=!1}).then(function(){return n.all([T(),A()])}).then(E).then(function(){G.loading.content=!1}),F()}()}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/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){function C(e){"days"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function w(){["from","to"].forEach(C)}function A(){return xe.checkIfSelfLeaveApprover().then(function(e){e&&(je="admin")})}function T(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Fe.loading.entitlements&&(!!le("admin")||!ue("view")&&!(le("manager")&&!ue("create")))}function R(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||D())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function I(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function x(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==U())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return q.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==U()&&!Fe.request.change_balance}function k(){Fe.errors=[]}function L(){return Fe.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function M(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return n.map(Oe[e],function(e){return Fe.requestStatuses[e]})}function U(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function H(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():N("none")}function W(e){return n.find(Fe.requestStatuses,function(t){return t.value===e})}function V(e){Fe.errors=n.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(Le,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?r.resolve().then(me).then(fe).then(_e).then(qe).then(re).then(J).then(Fe.isMode("edit")?Ce:n.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return r.reject(e)}):r.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(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function J(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):r.resolve()}function K(){Fe.isRole("admin")&&Fe.isSelfRecord&&(Fe.isSelfLeaveApprover=!0)}function Q(){var e="my-leave"===o.section,t=+xe.id==+n.get(Fe,"leaveRequest.contact_id"),a=!n.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(t||a)}function Z(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",Ce),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(_e).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",De),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function ee(){var e,t;Fe.request=Fe.leaveRequest||null,e=U(),t=Fe.initRequestAttributes(),"leave"===e?Fe.request=g.init(t):"sickness"===e?Fe.request=_.init(t):"toil"===e&&(Fe.request=$.init(t))}function te(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:xe.id}),e}function ne(){return je="staff",ae().then(Fe.isSelfRecord&&!Fe.isRole("admin")&&A)}function ae(){return u(y.permissions.admin.administer).then(function(e){e&&(je="admin")}).then(function(){return"admin"!==je&&u(y.permissions.ssp.manage)}).then(function(e){e&&(je="manager")})}function re(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!n.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var t=Fe.getStatusFromValue(Fe.request.status_id);return!!t&&t.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function ue(e){return Fe.mode===e}function ce(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 le(e){return je===e}function de(){return p.all().then(function(e){Fe.absencePeriods=e})}function me(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Ie={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Ie.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){xe=e})}function he(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=n.remove(e.list,function(e){return e.id!==xe.id})}):xe.leaveManagees().then(function(e){Fe.managedContacts=e})}function ve(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.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){T(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ye(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Le[e+"_date"]})}function _e(e){if(Fe.absenceTypes=be(Ie.types,e),!Fe.absenceTypes.length)return r.reject(Ee)}function $e(){Fe.period=n.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=n.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Le=e.copy(Fe.request.attributes())}function we(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,I(),w(),Fe.request.isValid().then(oe()&&x).then(M).then(O()&&ye).then(Te).then(function(){return Fe.isMode("edit")?Re():L()}).catch(function(t){Fe.request.status_id=e,t&&V(t)}).finally(function(){Fe.submitting=!1})}function Te(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function De(){Me.forEach(function(e){e()})}function Se(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Re(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Ie,xe,Oe={},ke=0,Le={},Me=[],Ee="No entitlement",je="",Be=[],Fe=n.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=S,Fe.canSubmit=R,Fe.closeAlert=k,Fe.deleteLeaveRequest=E,Fe.dismissModal=j,Fe.getStatuses=H,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=te,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=ue,Fe.isRole=le,Fe.submit=Ae,Fe.updateAbsenceType=Se,function(){Fe.loading.absenceTypes=!0,z(),Z(),pe().then(Q).then(function(){return r.all([ne(),de(),ve()])}).then(X).then(K).then(ee).then(we).then($e).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&he()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(V).finally(function(){Fe.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r), +future:0},t})}function h(e){N(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 t=Y[e.status];t?t(e.leaveRequest):G.refresh()}function y(t){t.dataIndex=e.indexBy(t.data,"id")}function _(){return G.role="staff","absence-tab"===a.section?void(G.role="admin"):r(m.permissions.admin.administer).then(function(e){e&&(G.role="admin")})}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return o.all().then(function(t){G.absencePeriods=e.sortBy(t,"start_date"),G.selectedPeriod=e.find(G.absencePeriods,function(e){return!0===e.current})})}function C(){return s.all().then(s.loadCalculationUnits).then(function(t){G.absenceTypes=t,G.absenceTypesIndexed=e.indexBy(t,"id")})}function w(){return R("approved",{status_id:V(m.statusNames.approved)})}function A(){var t={contact_id:G.contactId,period_id:G.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:[V(m.statusNames.approved)]}})),u.balanceChangeByAbsenceType(e.assign({},t,{statuses:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}}))]).then(function(e){G.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 T(){return i.all({contact_id:G.contactId,period_id:G.selectedPeriod.id},!0).then(function(e){G.entitlements=e})}function P(){return i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id},G.entitlements).then(function(){return j(G.entitlements)}).then(function(e){G.sections.entitlements.data=e})}function D(){return n.all([i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id,expired:!0}),S({request_type:"toil",expired:!0})]).then(function(e){return n.all({expiredBalanceChangesFlatten:j(e[0]),expiredTOILS:B(e[1].list)})}).then(function(t){G.sections.expired.data=t.expiredBalanceChangesFlatten.concat(t.expiredTOILS),G.sections.expired.data=e.sortBy(G.sections.expired.data,"expiry_date")})}function S(t){return u.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})}},t),null,"from_date ASC",null,!1)}function R(e,t){return S(t).then(function(t){G.sections[e].data=t.list})}function I(){return n.all(Object.values(G.sections).filter(function(e){return e.open}).map(L))}function x(){return R("other",{status_id:{in:[V(m.statusNames.rejected),V(m.statusNames.cancelled)]}})}function O(){return R("pending",{status_id:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}})}function k(){return R("holidays",{public_holiday:!0})}function L(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function M(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){G.leaveRequestStatuses=e.indexBy(t,"value")})}function E(){p(),b()}function j(t){return n.resolve().then(function(){return t.map(function(t){var n=e.find(G.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 B(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 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){N(e)})}function N(t){e.forEach(G.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&&U(t,a))})}function U(t,n){var a=["future","current"],r=G.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 H(){G.loading.content=!0,n.all([T(),A()]).then(E).then(function(){G.loading.content=!1}).then(function(){return n.all([I(),v()])})}function W(e){var t=G.sections[e];t.open=!t.open,t.open&&!t.data.length&&L(t)}function V(t){return e.find(G.leaveRequestStatuses,function(e){return e.name===t}).value}t.debug("Component: staff-leave-report");var Y={delete:N,cancel:h},G=this;G.absencePeriods=[],G.absenceTypes=[],G.absenceTypesFiltered=[],G.absenceTypesIndexed={},G.dateFormat=d.DATE_FORMAT,G.leaveRequestStatuses={},G.selectedPeriod=null,G.role=null,G.loading={content:!0,page:!0},G.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:w},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:D},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:x}},G.labelPeriod=$,G.refresh=H,G.toggleSection=W,function(){n.all([_(),M(),C(),q()]).then(function(){G.loading.page=!1}).then(function(){return n.all([T(),A()])}).then(E).then(function(){G.loading.content=!1}),F()}()}n.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,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/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){function C(e){"days"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function w(){["from","to"].forEach(C)}function A(){return xe.checkIfSelfLeaveApprover().then(function(e){e&&(je="admin")})}function T(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Fe.loading.entitlements&&(!!le("admin")||!ue("view")&&!(le("manager")&&!ue("create")))}function R(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||D())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function I(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function x(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==U())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return q.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==U()&&!Fe.request.change_balance}function k(){Fe.errors=[]}function L(){return Fe.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function M(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return n.map(Oe[e],function(e){return Fe.requestStatuses[e]})}function U(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function H(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():N("none")}function W(e){return n.find(Fe.requestStatuses,function(t){return t.value===e})}function V(e){Fe.errors=n.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(Le,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?r.resolve().then(me).then(fe).then(_e).then(qe).then(re).then(J).then(Fe.isMode("edit")?Ce:n.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return r.reject(e)}):r.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(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function J(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):r.resolve()}function K(){Fe.isRole("admin")&&Fe.isSelfRecord&&(Fe.isSelfLeaveApprover=!0)}function Q(){var e="my-leave"===o.section,t=+xe.id==+n.get(Fe,"leaveRequest.contact_id"),a=!n.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(t||a)}function Z(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",Ce),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(_e).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",De),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function ee(){var e,t;Fe.request=Fe.leaveRequest||null,e=U(),t=Fe.initRequestAttributes(),"leave"===e?Fe.request=g.init(t):"sickness"===e?Fe.request=_.init(t):"toil"===e&&(Fe.request=$.init(t))}function te(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:xe.id}),e}function ne(){return je="staff",ae().then(Fe.isSelfRecord&&!Fe.isRole("admin")&&A)}function ae(){return u(y.permissions.admin.administer).then(function(e){e&&(je="admin")}).then(function(){return"admin"!==je&&u(y.permissions.ssp.manage)}).then(function(e){e&&(je="manager")})}function re(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!n.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var t=Fe.getStatusFromValue(Fe.request.status_id);return!!t&&t.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function ue(e){return Fe.mode===e}function ce(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 le(e){return je===e}function de(){return p.all().then(function(e){Fe.absencePeriods=e})}function me(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Ie={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Ie.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){xe=e})}function he(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=n.remove(e.list,function(e){return e.id!==xe.id})}):xe.leaveManagees().then(function(e){Fe.managedContacts=e})}function ve(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.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){T(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ye(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Le[e+"_date"]})}function _e(e){if(Fe.absenceTypes=be(Ie.types,e),!Fe.absenceTypes.length)return r.reject(Ee)}function $e(){Fe.period=n.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=n.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Le=e.copy(Fe.request.attributes())}function we(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,I(),w(),Fe.request.isValid().then(oe()&&x).then(M).then(O()&&ye).then(Te).then(function(){return Fe.isMode("edit")?Re():L()}).catch(function(t){Fe.request.status_id=e,t&&V(t)}).finally(function(){Fe.submitting=!1})}function Te(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function De(){Me.forEach(function(e){e()})}function Se(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Re(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Ie,xe,Oe={},ke=0,Le={},Me=[],Ee="No entitlement",je="",Be=[],Fe=n.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=S,Fe.canSubmit=R,Fe.closeAlert=k,Fe.deleteLeaveRequest=E,Fe.dismissModal=j,Fe.getStatuses=H,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=te,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=ue,Fe.isRole=le,Fe.submit=Ae,Fe.updateAbsenceType=Se,function(){Fe.loading.absenceTypes=!0,z(),Z(),pe().then(Q).then(function(){return r.all([ne(),de(),ve()])}).then(X).then(K).then(ee).then(we).then($e).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&he()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(V).finally(function(){Fe.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r), r.$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,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(){}); //# 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/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 30503bc1d49..abe34fe4925 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'); From 2466ee9c8f640c9d7554adc7c488b50e87d3f6e7 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Mon, 30 Jul 2018 12:11:44 +0100 Subject: [PATCH 097/151] PCHR-4045: PR Feedback --- .../js/dist/absence-tab.min.js | 2 +- .../js/dist/my-leave.min.js | 2 +- .../shared/components/staff-leave-report.component.js | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) 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 e672758c44c..50e5d5d9d80 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,O(!0)})}function b(){s.$new().$watch(function(){return W.selectedMonthIndex},function(e,n){null!==n&&e!==n&&(B(),E(),O())})}function g(e){W.injectMonth=!0,U("injected").then(function(){O(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 S(){var n=W.selectedPeriod.id;W.selectedPeriod=e.find(W.absencePeriods,function(e){return!!e.current}),n!==W.selectedPeriod.id&&f(),M(),E(),L("month")}function k(e){var t="previous"===e?"subtract":"add";B(n(W.selectedMonth.moment)[t](1,"month")),E(),L("month")}function L(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 O(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=S,W.paginateMonth=k,W.refresh=L,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:k()},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)&&L()}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!==k().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/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(n){w=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===S.leaveRequest.request_type?i.open(y(n)):v(n)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(t){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(S.leaveRequest.from_date):"2"===a)}function v(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){T(n)}}):y(n)})}})}function b(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return I===S.leaveRequest.contact_id}function _(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function y(e){var n=L[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return m.get().then(function(e){I=e.contactId})}function C(e,n){e.stopPropagation(),r.openModal(n)}function T(e){r.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function A(n){var t=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;w===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:S.leaveRequest})}function D(){var n=S.leaveRequestStatuses[S.leaveRequest.status_id].name,t=e.compact(e.map(L,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!h(n)&&e.pull(t,"cancel"),"admin"!==S.role&&e.pull(t,"delete"),"staff"===S.role&&e.pull(t,"approve","reject"),"staff"!==S.role&&R(t),p()&&t.push("delete"),S.allowedActions=e.map(t,function(e){return{key:e,label:L[e].label,isDirectAction:L[e].isDirectAction}})}function P(){return b().then(function(e){e&&(S.role="admin")})}function R(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,w,S=this,k=l.statusNames,L={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"}}},O={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=f,S.openLeavePopup=C,function(){a.resolve().then(_).then(q).then(function(){return g()&&"admin"!==S.role&&P()}).then(D).finally(function(){S.loading.component=!1})}()}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(){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(),k("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,k("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 S(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function k(e){return ne.selectedAbsenceType.calculation_unit_name===e}function L(e){return ne.request.request_type===e}function O(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")&&(L("sickness")||k("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),(k("hours")||L("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=k,ne.isLeaveType=L,ne.isNotWorkingDay=O,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(S).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 S.fileUploader&&S.fileUploader.queue.length>0}function m(){return S.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return S.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||S.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=D,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=m,S.formatDateTime=f,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",S),g(),a.all([T(),q()]).then(_).finally(function(){S.filesLoaded=!0})}(),S}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(){V.absenceTypes=V.absenceTypes.map(function(n){var t=e.find(V.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){N(e),V.sections.other.open&&f(e,V.sections.other)}function v(){Object.values(V.sections).forEach(function(e){e.data=[]})}function b(){V.absenceTypesFiltered=V.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function g(e){var n=G[e.status];n?n(e.leaveRequest):V.refresh()}function _(n){n.dataIndex=e.indexBy(n.data,"id")}function y(){return V.role="staff","absence-tab"===a.section?void(V.role="admin"):o(m.permissions.admin.administer).then(function(e){e&&(V.role="admin")})}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return s.all().then(function(n){V.absencePeriods=e.sortBy(n,"start_date"),V.selectedPeriod=e.find(V.absencePeriods,function(e){return!0===e.current})})}function T(){return i.all().then(i.loadCalculationUnits).then(function(n){V.absenceTypes=n,V.absenceTypesIndexed=e.indexBy(n,"id")})}function A(){return S("approved",{status_id:Y(m.statusNames.approved)})}function D(){var n={contact_id:V.contactId,period_id:V.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:[Y(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}}))]).then(function(e){V.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:V.contactId,period_id:V.selectedPeriod.id},!0).then(function(e){V.entitlements=e})}function R(){return r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id},V.entitlements).then(function(){return B(V.entitlements)}).then(function(e){V.sections.entitlements.data=e})}function I(){return t.all([r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id,expired:!0}),w({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:B(e[0]),expiredTOILS:F(e[1].list)})}).then(function(n){V.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),V.sections.expired.data=e.sortBy(V.sections.expired.data,"expiry_date")})}function w(n){return c.all(e.assign({contact_id:V.contactId,from_date:{from:V.selectedPeriod.start_date},to_date:{to:V.selectedPeriod.end_date},type_id:{IN:V.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function S(e,n){return w(n).then(function(n){V.sections[e].data=n.list})}function k(){return t.all(Object.values(V.sections).filter(function(e){return e.open}).map(x))}function L(){return S("other",{status_id:{in:[Y(m.statusNames.rejected),Y(m.statusNames.cancelled)]}})}function O(){return S("pending",{status_id:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}})}function M(){return S("holidays",{public_holiday:!0})}function x(e){return e.loading=!0,e.loadLeaveRequests().then(_.bind(this,e)).then(function(){e.loading=!1})}function $(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){V.leaveRequestStatuses=e.indexBy(n,"value")})}function E(){p(),b()}function B(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(V.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 F(n){return t.resolve().then(function(){ +;return!u.absenceTypesToFilterBy.length||t}function s(e){return{backgroundColor:e.color}}function i(){t.$new().$watch(function(){return u.absenceTypesToFilterBy},function(e,n){e!==n&&t.$emit("LeaveCalendar::updateFiltersByAbsenceType",u.absenceTypesToFilterBy)},!0)}function r(){u.absenceTypesToFilterBy=[]}function c(n){e.includes(u.absenceTypesToFilterBy,n)?e.remove(u.absenceTypesToFilterBy,function(e){return n===e}):u.absenceTypesToFilterBy.push(n)}n.debug("Component: leave-calendar-legend");var u=this;u.absenceTypesToFilterBy=[],u.legendCollapsed=!1,u.nonWorkingDayTypes=[{label:"Weekend",cssClassSuffix:"weekend"},{label:"Public Holiday",cssClassSuffix:"public-holiday"},{label:"Non Working Day",cssClassSuffix:"non-working-day"}],u.otherBadges=[{label:"AM",description:"AM Only"},{label:"PM",description:"PM Only"},{label:"HH:MM",description:"Time",cssClassSuffix:"hours"},{label:"",description:"Requested",cssClassSuffix:"requested"},{label:"AT",description:"Accrued TOIL"}],u.checkIfAbsenceTypeIdIsDefined=a,u.checkIfAbsenceTypeIsSelectedForFiltering=o,u.getAbsenceTypeStyle=s,u.resetFilteringByAbsenceTypes=r,u.toggleFilteringByAbsenceType=c,function(){i()}()}n.component("leaveCalendarLegend",{bindings:{absenceTypes:"<"},templateUrl:["shared-settings",function(e){return e.sharedPathTpl+"components/leave-calendar-legend.html"}],controllerAs:"legend",controller:t}),t.$inject=["$log","$rootScope"]}),define("leave-absences/shared/components/leave-calendar-month.component",["common/lodash","common/moment","leave-absences/shared/modules/components","common/services/pub-sub"],function(e,n,t){function a(t,a,o,s,i,r,c){function u(e){T([e]),H(e)}function l(e){return{index:e.format("YYYY-MM"),month:e.month(),year:e.year(),name:e.format("MMMM"),loading:!0,days:d(e)}}function d(t){var a=n(),o=t.clone().startOf("month");return e.map(e.times(t.daysInMonth()),function(){var e={date:o.format("YYYY-MM-DD"),name:o.format("ddd"),index:o.format("D"),current:a.isSame(o,"day"),enabled:o.isSameOrAfter(X.period.start_date)&&o.isSameOrBefore(X.period.end_date),contactsData:{}};return o.add(1,"day"),e})}function m(e){return V[e]}function f(){return X.showOnlyWithLeaveRequests?X.contacts.filter(function(n){var t=Object.keys(z[n.id]||{}).length,a=e.includes(X.showTheseContacts,n.id);return t||a}):X.contacts}function p(e){return n(e,c.serverDateFormat)}function h(e){var n=b(e);n&&($(n),H(n))}function v(n){var t={request_type:"toil"};return e.some(n,t)&&!e.every(n,t)?e.filter(n,t):n}function b(n){var t;return e.find(z[n.contact_id],function(a){return t=e.find(a,function(e){return+e.id==+n.id})}),t}function g(){X.month.days.forEach(function(e){e.contactsData={}})}function _(e){return CRM.url("civicrm/contact/view",{cid:e})}function y(n){return e.filter(n,function(e){return!!e.type_id})}function q(e,t){var a={};return t.forEach(function(t){a[t.id]={styles:j(t),isAccruedTOIL:P(t,"toil"),isRequested:I(t),isAM:D("half_day_am",t,e.date),isPM:D("half_day_pm",t,e.date),isSingleDay:n(t.from_date).isSame(t.to_date,"day")}}),a}function C(){X.supportData.dayTypes=e.indexBy(X.supportData.dayTypes,"name"),X.supportData.leaveRequestStatuses=e.indexBy(X.supportData.leaveRequestStatuses,"value"),X.supportData.publicHolidays=e.transform(X.supportData.publicHolidays,function(e,n){e[p(n.date).valueOf()]=n},{})}function T(e){return e.forEach(function(e){var n=w(e);z[e.contact_id]=z[e.contact_id]||{},n.forEach(function(n){z[e.contact_id][n.date]||(z[e.contact_id][n.date]=[]),z[e.contact_id][n.date].push(e)})}),a.resolve()}function A(){G.push(o.$on("LeaveCalendar::showMonth",U)),G.push(r.subscribe("LeaveRequest::new",u)),G.push(r.subscribe("LeaveRequest::edit",W)),G.push(r.subscribe("LeaveRequest::updatedByManager",W)),G.push(r.subscribe("LeaveRequest::delete",h)),G.push(r.subscribe("LeaveRequest::statusUpdate",function(e){"delete"===e.status?h(e.leaveRequest):W(e.leaveRequest)}))}function D(e,t,a){var o=X.supportData.dayTypes[e];return n(a).isSame(t.from_date,"day")?o.value===t.from_date_type:n(a).isSame(t.to_date,"day")?o.value===t.to_date_type:void 0}function P(e,n){return e.request_type===n}function R(e){return!!X.supportData.publicHolidays[p(e).valueOf()]}function I(n){var t=X.supportData.leaveRequestStatuses[n.status_id].name;return e.contains([c.statusNames.awaitingApproval,c.statusNames.moreInformationRequired],t)}function w(t){for(var a=[],o=n(t.from_date).startOf("day"),s=n(t.to_date).startOf("day");o.isSameOrBefore(s);)o.month()===X.month.month&&o.year()===X.month.year&&a.push(e.find(X.month.days,function(e){return e.date===o.format("YYYY-MM-DD")})),o.add(1,"day");return a}function S(n){var t=e.find(X.supportData.leaveRequestStatuses,function(e){return e.name===n});return t?t.value:null}function k(){return[S(c.statusNames.approved),S(c.statusNames.adminApproved),S(c.statusNames.awaitingApproval),S(c.statusNames.moreInformationRequired)]}function L(){return X.month.loading=!0,a.all([M(),O()]).then(x).then(F).then(function(){Y=!0,X.month.loading=!1})}function O(){var n=X.supportData.absenceTypesToFilterBy.length>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:k()},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)&&L()}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!==k().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/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(n){w=S.leaveRequest.status_id,e.includes(["cancel","reject","delete"],n)||"toil"===S.leaveRequest.request_type?i.open(y(n)):v(n)}function p(){return"admin"===S.role&&"public_holiday"===S.leaveRequest.request_type}function h(t){var a=S.absenceTypes[S.leaveRequest.type_id].allow_request_cancelation;return"admin"===S.role||("manager"===S.role?e.includes([k.awaitingApproval,k.moreInformationRequired],t):"3"===a?n().isBefore(S.leaveRequest.from_date):"2"===a)}function v(n){i.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return S.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(t){return t?e.assign(c.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){T(n)}}):y(n)})}})}function b(){return s.find(I).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return I===S.leaveRequest.contact_id}function _(){e.isArray(S.leaveRequestStatuses)&&(S.leaveRequestStatuses=e.indexBy(S.leaveRequestStatuses,"value")),e.isArray(S.absenceTypes)&&(S.absenceTypes=e.indexBy(S.absenceTypes,"id"))}function y(e){var n=L[e].dialog;return{title:"Confirm "+n.title+"?",copyCancel:"Cancel",copyConfirm:n.btnLabel,classConfirm:"btn-"+n.btnClass,msg:n.msg,onConfirm:function(){return S.leaveRequest[e]().then(function(){A(e)}).catch(function(e){d.error("Error:",e)})}}}function q(){return m.get().then(function(e){I=e.contactId})}function C(e,n){e.stopPropagation(),r.openModal(n)}function T(e){r.openModal({leaveRequest:S.leaveRequest,leaveType:S.leaveRequest.request_type,selectedContactId:S.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function A(n){var t=e.find(S.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;w===t&&u.publish("ManagerBadge:: Update Count"),u.publish("LeaveRequest::statusUpdate",{status:n,leaveRequest:S.leaveRequest})}function D(){var n=S.leaveRequestStatuses[S.leaveRequest.status_id].name,t=e.compact(e.map(L,function(t,a){return e.includes(t.allowedStatuses,n)?a:null}));!h(n)&&e.pull(t,"cancel"),"admin"!==S.role&&e.pull(t,"delete"),"staff"===S.role&&e.pull(t,"approve","reject"),"staff"!==S.role&&R(t),p()&&t.push("delete"),S.allowedActions=e.map(t,function(e){return{key:e,label:L[e].label,isDirectAction:L[e].isDirectAction}})}function P(){return b().then(function(e){e&&(S.role="admin")})}function R(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,w,S=this,k=l.statusNames,L={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"}}},O={approve:"approved"};S.allowedActions=[],S.loading={component:!0},S.action=f,S.openLeavePopup=C,function(){a.resolve().then(_).then(q).then(function(){return g()&&"admin"!==S.role&&P()}).then(D).finally(function(){S.loading.component=!1})}()}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(){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(),k("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,k("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 S(){o.$watch(function(){return ne.uiOptions.times.from.time},function(e,n){e!==n&&(ne.uiOptions.multipleDays||(K(e),V()))})}function k(e){return ne.selectedAbsenceType.calculation_unit_name===e}function L(e){return ne.request.request_type===e}function O(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")&&(L("sickness")||k("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),(k("hours")||L("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=k,ne.isLeaveType=L,ne.isNotWorkingDay=O,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(S).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 S.fileUploader&&S.fileUploader.queue.length>0}function m(){return S.getFilesAmount()0?R.map(function(e){return e.label}).join(", "):""}function q(){return S.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||S.canManage}function D(){e.forEach(I,function(e){e()})}function P(e,n){S.fileUploader.queue&&S.fileUploader.queue.length>0?S.fileUploader.uploadAll({entityID:S.request.id}).then(function(){n()}).catch(n):n()}t.debug("Component: leave-request-popup-files-tab");var R=[],I=[],w={},S=Object.create(this);return S.filesLoaded=!1,S.fileUploader=null,S.today=Date.now(),S.userDateFormatWithTime=i.DATE_FORMAT+" HH:mm",S.userDateFormat=i.DATE_FORMAT,S.$onDestroy=D,S.canRemoveAttachment=A,S.canSubmit=d,S.canUploadMore=m,S.formatDateTime=f,S.getAuthorName=p,S.getFilesAmount=h,S.listFileTypes=y,function(){o.$broadcast("LeaveRequestPopup::childComponent::register"),s.$emit("LeaveRequestPopup::addTab",S),g(),a.all([T(),q()]).then(_).finally(function(){S.filesLoaded=!0})}(),S}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(){V.absenceTypes=V.absenceTypes.map(function(n){var t=e.find(V.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){N(e),V.sections.other.open&&f(e,V.sections.other)}function v(){Object.values(V.sections).forEach(function(e){e.data=[]})}function b(){V.absenceTypesFiltered=V.absenceTypes.filter(function(e){return!(0===e.entitlement&&"1"!==e.allow_overuse&&"1"!==e.allow_accruals_request)})}function g(e){var n=G[e.status];n?n(e.leaveRequest):V.refresh()}function _(n){n.dataIndex=e.indexBy(n.data,"id")}function y(){return V.role="staff","absence-tab"===a.section?(V.role="admin",t.resolve()):o(m.permissions.admin.administer).then(function(e){e&&(V.role="admin")})}function q(e){return e.current?"Current Period ("+e.title+")":e.title}function C(){return s.all().then(function(n){V.absencePeriods=e.sortBy(n,"start_date"),V.selectedPeriod=e.find(V.absencePeriods,function(e){return!0===e.current})})}function T(){return i.all().then(i.loadCalculationUnits).then(function(n){V.absenceTypes=n,V.absenceTypesIndexed=e.indexBy(n,"id")})}function A(){return S("approved",{status_id:Y(m.statusNames.approved)})}function D(){var n={contact_id:V.contactId,period_id:V.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:[Y(m.statusNames.approved)]}})),c.balanceChangeByAbsenceType(e.assign({},n,{statuses:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}}))]).then(function(e){V.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:V.contactId,period_id:V.selectedPeriod.id},!0).then(function(e){V.entitlements=e})}function R(){return r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id},V.entitlements).then(function(){return B(V.entitlements)}).then(function(e){V.sections.entitlements.data=e})}function I(){return t.all([r.breakdown({contact_id:V.contactId,period_id:V.selectedPeriod.id,expired:!0}),w({request_type:"toil",expired:!0})]).then(function(e){return t.all({expiredBalanceChangesFlatten:B(e[0]),expiredTOILS:F(e[1].list)})}).then(function(n){V.sections.expired.data=n.expiredBalanceChangesFlatten.concat(n.expiredTOILS),V.sections.expired.data=e.sortBy(V.sections.expired.data,"expiry_date")})}function w(n){return c.all(e.assign({contact_id:V.contactId,from_date:{from:V.selectedPeriod.start_date},to_date:{to:V.selectedPeriod.end_date},type_id:{IN:V.absenceTypes.map(function(e){return e.id})}},n),null,"from_date ASC",null,!1)}function S(e,n){return w(n).then(function(n){V.sections[e].data=n.list})}function k(){return t.all(Object.values(V.sections).filter(function(e){return e.open}).map(x))}function L(){return S("other",{status_id:{in:[Y(m.statusNames.rejected),Y(m.statusNames.cancelled)]}})}function O(){return S("pending",{status_id:{in:[Y(m.statusNames.awaitingApproval),Y(m.statusNames.moreInformationRequired)]}})}function M(){return S("holidays",{public_holiday:!0})}function x(e){return e.loading=!0,e.loadLeaveRequests().then(_.bind(this,e)).then(function(){e.loading=!1})}function $(){return u.valuesOf("hrleaveandabsences_leave_request_status").then(function(n){V.leaveRequestStatuses=e.indexBy(n,"value")})}function E(){p(),b()}function B(n){return t.resolve().then(function(){return n.map(function(n){var t=e.find(V.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 F(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 U(){l.subscribe("LeaveRequest::new",function(){V.refresh()}),l.subscribe("LeaveRequest::edit",function(){V.refresh()}),l.subscribe("LeaveRequest::statusUpdate",g),l.subscribe("LeaveRequest::delete",function(e){N(e)})}function N(n){e.forEach(V.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&&j(n,a))})}function j(n,t){var a=["future","current"],o=V.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(){V.loading.content=!0,t.all([P(),D()]).then(E).then(function(){V.loading.content=!1}).then(function(){return t.all([k(),v()])})}function H(e){var n=V.sections[e];n.open=!n.open,n.open&&!n.data.length&&x(n)}function Y(n){return e.find(V.leaveRequestStatuses,function(e){return e.name===n}).value}n.debug("Component: staff-leave-report");var G={delete:N,cancel:h},V=this;V.absencePeriods=[],V.absenceTypes=[],V.absenceTypesFiltered=[],V.absenceTypesIndexed={},V.dateFormat=d.DATE_FORMAT,V.leaveRequestStatuses={},V.selectedPeriod=null,V.role=null,V.loading={content:!0,page:!0},V.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:A},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:R},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:I},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:M},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:L}},V.labelPeriod=q,V.refresh=W,V.toggleSection=H,function(){t.all([y(),$(),T(),C()]).then(function(){V.loading.page=!1}).then(function(){return t.all([P(),D()])}).then(E).then(function(){V.loading.content=!1}),U()}()}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 x(),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 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")?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=$,c.onDateChangeExtended=w,c.openToilInDaysAccrualOptionsEditor=E,c.resetUIInputsExtended=k,c.setDaysSelectionModeExtended=S,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/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;xe.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 x(){return Ue.request.create().then(Re).then(function(){ge("LeaveRequest::new")})}function $(){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(xe,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&&(n||a)}function Z(){$e.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=t.remove(e.list,function(e){return e.id!==Le.id})}):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"]=xe[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(){xe=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($).then(O()&&_e).then(Pe).then(function(){return Ue.isMode("edit")?Se():x()}).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(){$e.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,xe={},$e=[],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){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(){}); //# 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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index 40db21d450a..1424f2bc2cd 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 @@ -9,6 +9,6 @@ !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/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,r,o,s,i,u,c,l,d,m){function f(t){S=R.leaveRequest.status_id,e.includes(["cancel","reject","delete"],t)||"toil"===R.leaveRequest.request_type?s.open(_(t)):v(t)}function p(){return"admin"===R.role&&"public_holiday"===R.leaveRequest.request_type}function h(n){var a=R.absenceTypes[R.leaveRequest.type_id].allow_request_cancelation;return"admin"===R.role||("manager"===R.role?e.includes([I.awaitingApproval,I.moreInformationRequired],n):"3"===a?t().isBefore(R.leaveRequest.from_date):"2"===a)}function v(t){s.open({title:"Verifying balance...",loading:!0,optionsPromise:function(){return R.leaveRequest.checkIfBalanceChangeNeedsRecalculation().then(function(n){return n?e.assign(u.getBalanceChangeRecalculationPromptOptions(),{onCloseAfterConfirm:function(){C(t)}}):_(t)})}})}function b(){return o.find(D).then(function(e){return e.checkIfSelfLeaveApprover()})}function g(){return D===R.leaveRequest.contact_id}function y(){e.isArray(R.leaveRequestStatuses)&&(R.leaveRequestStatuses=e.indexBy(R.leaveRequestStatuses,"value")),e.isArray(R.absenceTypes)&&(R.absenceTypes=e.indexBy(R.absenceTypes,"id"))}function _(e){var t=x[e].dialog;return{title:"Confirm "+t.title+"?",copyCancel:"Cancel",copyConfirm:t.btnLabel,classConfirm:"btn-"+t.btnClass,msg:t.msg,onConfirm:function(){return R.leaveRequest[e]().then(function(){w(e)}).catch(function(e){d.error("Error:",e)})}}}function $(){return m.get().then(function(e){D=e.contactId})}function q(e,t){e.stopPropagation(),i.openModal(t)}function C(e){i.openModal({leaveRequest:R.leaveRequest,leaveType:R.leaveRequest.request_type,selectedContactId:R.leaveRequest.contact_id,forceRecalculateBalanceChange:!0,defaultStatus:l.statusNames[O[e]]})}function w(t){var n=e.find(R.leaveRequestStatuses,function(e){return e.name===l.statusNames.awaitingApproval}).value;S===n&&c.publish("ManagerBadge:: Update Count"),c.publish("LeaveRequest::statusUpdate",{status:t,leaveRequest:R.leaveRequest})}function A(){var t=R.leaveRequestStatuses[R.leaveRequest.status_id].name,n=e.compact(e.map(x,function(n,a){return e.includes(n.allowedStatuses,t)?a:null}));!h(t)&&e.pull(n,"cancel"),"admin"!==R.role&&e.pull(n,"delete"),"staff"===R.role&&e.pull(n,"approve","reject"),"staff"!==R.role&&P(n),p()&&n.push("delete"),R.allowedActions=e.map(n,function(e){return{key:e,label:x[e].label,isDirectAction:x[e].isDirectAction}})}function T(){return b().then(function(e){e&&(R.role="admin")})}function P(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 D,S,R=this,I=l.statusNames,x={edit:{label:"Edit",allowedStatuses:[I.awaitingApproval]},respond:{label:"Respond",allowedStatuses:[I.moreInformationRequired]},view:{label:"View",allowedStatuses:[I.approved,I.rejected,I.cancelled]},approve:{label:"Approve",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Approval",btnClass:"success",btnLabel:"Approve",msg:"Please confirm approval"}},reject:{label:"Reject",isDirectAction:!0,allowedStatuses:[I.awaitingApproval],dialog:{title:"Rejection",btnClass:"warning",btnLabel:"Reject",msg:"Please confirm rejection"}},cancel:{label:"Cancel",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.approved,I.rejected,I.moreInformationRequired],dialog:{title:"Cancellation",btnClass:"danger",btnLabel:"Confirm",msg:"Please confirm cancellation"}},delete:{label:"Delete",isDirectAction:!0,allowedStatuses:[I.awaitingApproval,I.moreInformationRequired,I.approved,I.rejected,I.cancelled],dialog:{title:"Deletion",btnClass:"danger",btnLabel:"Confirm",msg:"This cannot be undone"}}},O={approve:"approved"};R.allowedActions=[],R.loading={component:!0},R.action=f,R.openLeavePopup=q,function(){a.resolve().then(y).then($).then(function(){return g()&&"admin"!==R.role&&T()}).then(A).finally(function(){R.loading.component=!1})}()}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,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(){G.absenceTypes=G.absenceTypes.map(function(t){var n=e.find(G.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){N(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 t=Y[e.status];t?t(e.leaveRequest):G.refresh()}function y(t){t.dataIndex=e.indexBy(t.data,"id")}function _(){return G.role="staff","absence-tab"===a.section?void(G.role="admin"):r(m.permissions.admin.administer).then(function(e){e&&(G.role="admin")})}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return o.all().then(function(t){G.absencePeriods=e.sortBy(t,"start_date"),G.selectedPeriod=e.find(G.absencePeriods,function(e){return!0===e.current})})}function C(){return s.all().then(s.loadCalculationUnits).then(function(t){G.absenceTypes=t,G.absenceTypesIndexed=e.indexBy(t,"id")})}function w(){return R("approved",{status_id:V(m.statusNames.approved)})}function A(){var t={contact_id:G.contactId,period_id:G.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:[V(m.statusNames.approved)]}})),u.balanceChangeByAbsenceType(e.assign({},t,{statuses:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}}))]).then(function(e){G.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 T(){return i.all({contact_id:G.contactId,period_id:G.selectedPeriod.id},!0).then(function(e){G.entitlements=e})}function P(){return i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id},G.entitlements).then(function(){return j(G.entitlements)}).then(function(e){G.sections.entitlements.data=e})}function D(){return n.all([i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id,expired:!0}),S({request_type:"toil",expired:!0})]).then(function(e){return n.all({expiredBalanceChangesFlatten:j(e[0]),expiredTOILS:B(e[1].list)})}).then(function(t){G.sections.expired.data=t.expiredBalanceChangesFlatten.concat(t.expiredTOILS),G.sections.expired.data=e.sortBy(G.sections.expired.data,"expiry_date")})}function S(t){return u.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})}},t),null,"from_date ASC",null,!1)}function R(e,t){return S(t).then(function(t){G.sections[e].data=t.list})}function I(){return n.all(Object.values(G.sections).filter(function(e){return e.open}).map(L))}function x(){return R("other",{status_id:{in:[V(m.statusNames.rejected),V(m.statusNames.cancelled)]}})}function O(){return R("pending",{status_id:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}})}function k(){return R("holidays",{public_holiday:!0})}function L(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function M(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){G.leaveRequestStatuses=e.indexBy(t,"value")})}function E(){p(),b()}function j(t){return n.resolve().then(function(){return t.map(function(t){var n=e.find(G.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 B(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 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){N(e)})}function N(t){e.forEach(G.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&&U(t,a))})}function U(t,n){var a=["future","current"],r=G.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 H(){G.loading.content=!0,n.all([T(),A()]).then(E).then(function(){G.loading.content=!1}).then(function(){return n.all([I(),v()])})}function W(e){var t=G.sections[e];t.open=!t.open,t.open&&!t.data.length&&L(t)}function V(t){return e.find(G.leaveRequestStatuses,function(e){return e.name===t}).value}t.debug("Component: staff-leave-report");var Y={delete:N,cancel:h},G=this;G.absencePeriods=[],G.absenceTypes=[],G.absenceTypesFiltered=[],G.absenceTypesIndexed={},G.dateFormat=d.DATE_FORMAT,G.leaveRequestStatuses={},G.selectedPeriod=null,G.role=null,G.loading={content:!0,page:!0},G.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:w},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:D},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:x}},G.labelPeriod=$,G.refresh=H,G.toggleSection=W,function(){n.all([_(),M(),C(),q()]).then(function(){G.loading.page=!1}).then(function(){return n.all([T(),A()])}).then(E).then(function(){G.loading.content=!1}),F()}()}n.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,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/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){function C(e){"days"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function w(){["from","to"].forEach(C)}function A(){return xe.checkIfSelfLeaveApprover().then(function(e){e&&(je="admin")})}function T(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Fe.loading.entitlements&&(!!le("admin")||!ue("view")&&!(le("manager")&&!ue("create")))}function R(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||D())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function I(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function x(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==U())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return q.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==U()&&!Fe.request.change_balance}function k(){Fe.errors=[]}function L(){return Fe.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function M(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return n.map(Oe[e],function(e){return Fe.requestStatuses[e]})}function U(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function H(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():N("none")}function W(e){return n.find(Fe.requestStatuses,function(t){return t.value===e})}function V(e){Fe.errors=n.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(Le,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?r.resolve().then(me).then(fe).then(_e).then(qe).then(re).then(J).then(Fe.isMode("edit")?Ce:n.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return r.reject(e)}):r.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(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function J(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):r.resolve()}function K(){Fe.isRole("admin")&&Fe.isSelfRecord&&(Fe.isSelfLeaveApprover=!0)}function Q(){var e="my-leave"===o.section,t=+xe.id==+n.get(Fe,"leaveRequest.contact_id"),a=!n.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(t||a)}function Z(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",Ce),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(_e).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",De),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function ee(){var e,t;Fe.request=Fe.leaveRequest||null,e=U(),t=Fe.initRequestAttributes(),"leave"===e?Fe.request=g.init(t):"sickness"===e?Fe.request=_.init(t):"toil"===e&&(Fe.request=$.init(t))}function te(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:xe.id}),e}function ne(){return je="staff",ae().then(Fe.isSelfRecord&&!Fe.isRole("admin")&&A)}function ae(){return u(y.permissions.admin.administer).then(function(e){e&&(je="admin")}).then(function(){return"admin"!==je&&u(y.permissions.ssp.manage)}).then(function(e){e&&(je="manager")})}function re(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!n.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var t=Fe.getStatusFromValue(Fe.request.status_id);return!!t&&t.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function ue(e){return Fe.mode===e}function ce(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 le(e){return je===e}function de(){return p.all().then(function(e){Fe.absencePeriods=e})}function me(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Ie={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Ie.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){xe=e})}function he(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=n.remove(e.list,function(e){return e.id!==xe.id})}):xe.leaveManagees().then(function(e){Fe.managedContacts=e})}function ve(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.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){T(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ye(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Le[e+"_date"]})}function _e(e){if(Fe.absenceTypes=be(Ie.types,e),!Fe.absenceTypes.length)return r.reject(Ee)}function $e(){Fe.period=n.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=n.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Le=e.copy(Fe.request.attributes())}function we(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,I(),w(),Fe.request.isValid().then(oe()&&x).then(M).then(O()&&ye).then(Te).then(function(){return Fe.isMode("edit")?Re():L()}).catch(function(t){Fe.request.status_id=e,t&&V(t)}).finally(function(){Fe.submitting=!1})}function Te(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function De(){Me.forEach(function(e){e()})}function Se(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Re(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Ie,xe,Oe={},ke=0,Le={},Me=[],Ee="No entitlement",je="",Be=[],Fe=n.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=S,Fe.canSubmit=R,Fe.closeAlert=k,Fe.deleteLeaveRequest=E,Fe.dismissModal=j,Fe.getStatuses=H,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=te,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=ue,Fe.isRole=le,Fe.submit=Ae,Fe.updateAbsenceType=Se,function(){Fe.loading.absenceTypes=!0,z(),Z(),pe().then(Q).then(function(){return r.all([ne(),de(),ve()])}).then(X).then(K).then(ee).then(we).then($e).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&he()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(V).finally(function(){Fe.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r), +future:0},t})}function h(e){N(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 t=Y[e.status];t?t(e.leaveRequest):G.refresh()}function y(t){t.dataIndex=e.indexBy(t.data,"id")}function _(){return G.role="staff","absence-tab"===a.section?(G.role="admin",n.resolve()):r(m.permissions.admin.administer).then(function(e){e&&(G.role="admin")})}function $(e){return e.current?"Current Period ("+e.title+")":e.title}function q(){return o.all().then(function(t){G.absencePeriods=e.sortBy(t,"start_date"),G.selectedPeriod=e.find(G.absencePeriods,function(e){return!0===e.current})})}function C(){return s.all().then(s.loadCalculationUnits).then(function(t){G.absenceTypes=t,G.absenceTypesIndexed=e.indexBy(t,"id")})}function w(){return R("approved",{status_id:V(m.statusNames.approved)})}function A(){var t={contact_id:G.contactId,period_id:G.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:[V(m.statusNames.approved)]}})),u.balanceChangeByAbsenceType(e.assign({},t,{statuses:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}}))]).then(function(e){G.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 T(){return i.all({contact_id:G.contactId,period_id:G.selectedPeriod.id},!0).then(function(e){G.entitlements=e})}function P(){return i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id},G.entitlements).then(function(){return j(G.entitlements)}).then(function(e){G.sections.entitlements.data=e})}function D(){return n.all([i.breakdown({contact_id:G.contactId,period_id:G.selectedPeriod.id,expired:!0}),S({request_type:"toil",expired:!0})]).then(function(e){return n.all({expiredBalanceChangesFlatten:j(e[0]),expiredTOILS:B(e[1].list)})}).then(function(t){G.sections.expired.data=t.expiredBalanceChangesFlatten.concat(t.expiredTOILS),G.sections.expired.data=e.sortBy(G.sections.expired.data,"expiry_date")})}function S(t){return u.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})}},t),null,"from_date ASC",null,!1)}function R(e,t){return S(t).then(function(t){G.sections[e].data=t.list})}function I(){return n.all(Object.values(G.sections).filter(function(e){return e.open}).map(L))}function x(){return R("other",{status_id:{in:[V(m.statusNames.rejected),V(m.statusNames.cancelled)]}})}function O(){return R("pending",{status_id:{in:[V(m.statusNames.awaitingApproval),V(m.statusNames.moreInformationRequired)]}})}function k(){return R("holidays",{public_holiday:!0})}function L(e){return e.loading=!0,e.loadLeaveRequests().then(y.bind(this,e)).then(function(){e.loading=!1})}function M(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(t){G.leaveRequestStatuses=e.indexBy(t,"value")})}function E(){p(),b()}function j(t){return n.resolve().then(function(){return t.map(function(t){var n=e.find(G.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 B(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 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){N(e)})}function N(t){e.forEach(G.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&&U(t,a))})}function U(t,n){var a=["future","current"],r=G.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 H(){G.loading.content=!0,n.all([T(),A()]).then(E).then(function(){G.loading.content=!1}).then(function(){return n.all([I(),v()])})}function W(e){var t=G.sections[e];t.open=!t.open,t.open&&!t.data.length&&L(t)}function V(t){return e.find(G.leaveRequestStatuses,function(e){return e.name===t}).value}t.debug("Component: staff-leave-report");var Y={delete:N,cancel:h},G=this;G.absencePeriods=[],G.absenceTypes=[],G.absenceTypesFiltered=[],G.absenceTypesIndexed={},G.dateFormat=d.DATE_FORMAT,G.leaveRequestStatuses={},G.selectedPeriod=null,G.role=null,G.loading={content:!0,page:!0},G.sections={approved:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:w},entitlements:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:P},expired:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:D},holidays:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:k},pending:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:O},other:{open:!1,data:[],dataIndex:{},loading:!1,loadLeaveRequests:x}},G.labelPeriod=$,G.refresh=H,G.toggleSection=W,function(){n.all([_(),M(),C(),q()]).then(function(){G.loading.page=!1}).then(function(){return n.all([T(),A()])}).then(E).then(function(){G.loading.content=!1}),F()}()}n.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,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/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){function C(e){"days"===Fe.selectedAbsenceType.calculation_unit_name?delete Fe.request[e+"_date_amount"]:delete Fe.request[e+"_date_type"]}function w(){["from","to"].forEach(C)}function A(){return xe.checkIfSelfLeaveApprover().then(function(e){e&&(je="admin")})}function T(){var e=Fe.requestStatuses[y.statusNames.awaitingApproval].value;Le.status_id===e&&e!==Fe.request.status_id&&d.publish("ManagerBadge:: Update Count")}function P(){return Be.filter(function(e){return e.isRequired}).every(function(e){return e.canSubmit&&e.canSubmit()})}function D(){return Be.filter(function(e){return!e.isRequired}).some(function(e){return e.canSubmit&&e.canSubmit()})}function S(){return!Fe.loading.entitlements&&(!!le("admin")||!ue("view")&&!(le("manager")&&!ue("create")))}function R(){var e=P();return Fe.isMode("edit")&&(e=e&&(Y()||D())),Fe.canManage&&Fe.requestStatuses&&(e=e&&!!Fe.getStatusFromValue(Fe.newStatusOnSave)),(e=e&&!!Fe.period.id)&&!Fe.isMode("view")}function I(){Fe.isSelfRecord&&!Fe.isSelfLeaveApprover?Fe.request.status_id=Fe.requestStatuses[y.statusNames.awaitingApproval].value:Fe.canManage&&(Fe.request.status_id=Fe.newStatusOnSave||Fe.request.status_id)}function x(){if(Fe.isMode("edit")&&!Fe.isRole("staff")&&"toil"!==U())return Fe.request.calculateBalanceChange(Fe.selectedAbsenceType.calculation_unit_name).then(function(e){if(+Fe.balance.change.amount!=+e.amount)return q.promptBalanceChangeRecalculation().then(function(){o.$emit("LeaveRequestPopup::recalculateBalanceChange")}),r.reject()})}function O(){return"toil"!==U()&&!Fe.request.change_balance}function k(){Fe.errors=[]}function L(){return Fe.request.create().then(Pe).then(function(){ge("LeaveRequest::new")})}function M(){oe()&&!Fe.isRole("staff")&&(Fe.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 Fe.request.delete().then(function(){Fe.dismissModal(),d.publish("LeaveRequest::delete",Fe.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(Fe.getStatusFromValue(Fe.request.status_id).name)}function N(e){return n.map(Oe[e],function(e){return Fe.requestStatuses[e]})}function U(){return Fe.request?Fe.request.request_type:Fe.leaveType||null}function H(){return!Fe.request||e.equals({},Fe.requestStatuses)?[]:Fe.request.status_id?F():N("none")}function W(e){return n.find(Fe.requestStatuses,function(t){return t.value===e})}function V(e){Fe.errors=n.isArray(e)?e:[e],Fe.loading.absenceTypes=!1,Fe.submitting=!1}function Y(){return!e.equals(Le,Fe.request.attributes())||Fe.canManage&&Fe.newStatusOnSave}function G(){return Fe.postContactSelection=!0,Fe.staffMemberSelectionComplete=!1,Fe.request.contact_id?r.resolve().then(me).then(fe).then(_e).then(qe).then(re).then(J).then(Fe.isMode("edit")?Ce:n.noop).then(function(){Fe.postContactSelection=!1,Fe.staffMemberSelectionComplete=!0}).catch(function(e){if(e!==Ee)return r.reject(e)}):r.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(){Fe.canManage=Fe.isRole("manager")||Fe.isRole("admin")}function J(){return Fe.canManage?f.find(Fe.request.contact_id).then(function(e){Fe.contactName=e.display_name}):r.resolve()}function K(){Fe.isRole("admin")&&Fe.isSelfRecord&&(Fe.isSelfLeaveApprover=!0)}function Q(){var e="my-leave"===o.section,t=+xe.id==+n.get(Fe,"leaveRequest.contact_id"),a=!n.get(Fe,"leaveRequest.id");Fe.isSelfRecord=e&&(t||a)}function Z(){Me.push(o.$on("LeaveRequestPopup::requestObjectUpdated",Ce),o.$on("LeaveRequestPopup::absencePeriodChanged",function(){fe().then(_e).then(function(){o.$emit("LeaveRequestPopup::absencePeriodBalancesUpdated",Fe.absenceTypes)})}),o.$on("LeaveRequestPopup::handleError",function(e,t){V(t)}),o.$on("LeaveRequestPopup::childComponent::register",function(){ke++})),s.$on("$destroy",De),s.$on("LeaveRequestPopup::addTab",function(e,t){Be.push(t)})}function ee(){var e,t;Fe.request=Fe.leaveRequest||null,e=U(),t=Fe.initRequestAttributes(),"leave"===e?Fe.request=g.init(t):"sickness"===e?Fe.request=_.init(t):"toil"===e&&(Fe.request=$.init(t))}function te(){var e={};return Fe.request?e=Fe.request.attributes():Fe.canManage||(e={contact_id:xe.id}),e}function ne(){return je="staff",ae().then(Fe.isSelfRecord&&!Fe.isRole("admin")&&A)}function ae(){return u(y.permissions.admin.administer).then(function(e){e&&(je="admin")}).then(function(){return"admin"!==je&&u(y.permissions.ssp.manage)}).then(function(e){e&&(je="manager")})}function re(){Fe.defaultStatus?Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames[Fe.defaultStatus]].value:(Fe.isRole("admin")||Fe.isMode("create")&&Fe.isRole("manager"))&&(Fe.newStatusOnSave=Fe.requestStatuses[y.statusNames.approved].value)}function oe(){return!Fe.request.status_id||!n.includes(["cancelled","rejected"],W(Fe.request.status_id).name)}function se(e){var t=Fe.getStatusFromValue(Fe.request.status_id);return!!t&&t.name===e}function ie(e){return Fe.request&&Fe.request.request_type===e}function ue(e){return Fe.mode===e}function ce(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 le(e){return je===e}function de(){return p.all().then(function(e){Fe.absencePeriods=e})}function me(){return h.all(B()).then(h.loadCalculationUnits).then(function(e){Ie={types:e,ids:e.map(function(e){return e.id})}})}function fe(){return Fe.loading.entitlements=!0,v.all({contact_id:Fe.request.contact_id,period_id:Fe.period.id,type_id:{IN:Ie.ids}},!0).finally(function(){Fe.loading.entitlements=!1})}function pe(){return f.getLoggedIn().then(function(e){xe=e})}function he(){return Fe.selectedContactId?f.find(Fe.selectedContactId).then(function(e){Fe.managedContacts=[e]}):Fe.isRole("admin")?f.all().then(function(e){Fe.managedContacts=n.remove(e.list,function(e){return e.id!==xe.id})}):xe.leaveManagees().then(function(e){Fe.managedContacts=e})}function ve(){return c.valuesOf("hrleaveandabsences_leave_request_status").then(function(e){Fe.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){T(),d.publish(e,Fe.request),Fe.errors=[],Fe.dismissModal()}function ye(){["from","to"].forEach(function(e){Fe.request[e+"_date"]=Le[e+"_date"]})}function _e(e){if(Fe.absenceTypes=be(Ie.types,e),!Fe.absenceTypes.length)return r.reject(Ee)}function $e(){Fe.period=n.find(Fe.absencePeriods,function(e){return Fe.isMode("create")?e.current:ce(Fe.request,e)})}function qe(){Fe.isMode("create")?(Fe.selectedAbsenceType=Fe.absenceTypes[0],Fe.request.type_id=Fe.selectedAbsenceType.id):Fe.selectedAbsenceType=n.find(Fe.absenceTypes,function(e){return e.id===Fe.request.type_id})}function Ce(){Le=e.copy(Fe.request.attributes())}function we(){var e;Fe.request.id?(e=[Fe.requestStatuses[y.statusNames.approved].value,Fe.requestStatuses[y.statusNames.adminApproved].value,Fe.requestStatuses[y.statusNames.rejected].value,Fe.requestStatuses[y.statusNames.cancelled].value],Fe.mode="edit",Fe.isRole("staff")&&e.indexOf(Fe.request.status_id)>-1&&(Fe.mode="view")):Fe.mode="create"}function Ae(){var e=Fe.request.status_id;if(!Fe.isMode("view")&&!Fe.submitting)return Fe.submitting=!0,I(),w(),Fe.request.isValid().then(oe()&&x).then(M).then(O()&&ye).then(Te).then(function(){return Fe.isMode("edit")?Re():L()}).catch(function(t){Fe.request.status_id=e,t&&V(t)}).finally(function(){Fe.submitting=!1})}function Te(){return r.all(Be.map(function(e){return e.onBeforeSubmit&&e.onBeforeSubmit()}))}function Pe(){function e(e){e&&n.push(e),++a===ke&&(n.length>0?t.reject(n):t.resolve())}var t=r.defer(),n=[],a=0;return ke>0?o.$broadcast("LeaveRequestPopup::submit",e):t.resolve(),t.promise}function De(){Me.forEach(function(e){e()})}function Se(){o.$broadcast("LeaveRequestPopup::absenceTypeChanged")}function Re(){return Fe.request.update().then(Pe).then(function(){Fe.isRole("manager")?ge("LeaveRequest::updatedByManager"):(Fe.isRole("staff")||Fe.isRole("admin"))&&ge("LeaveRequest::edit")})}t.debug("RequestCtrl");var Ie,xe,Oe={},ke=0,Le={},Me=[],Ee="No entitlement",je="",Be=[],Fe=n.assign(this,m);Fe.absencePeriods=[],Fe.absenceTypes=[],Fe.canManage=!1,Fe.contactName=null,Fe.errors=[],Fe.isSelfLeaveApprover=!1,Fe.loading={absenceTypes:!0,entitlements:!0},Fe.managedContacts=[],Fe.mode="",Fe.newStatusOnSave=null,Fe.period={},Fe.postContactSelection=!1,Fe.requestStatuses={},Fe.selectedAbsenceType={},Fe.staffMemberSelectionComplete=!1,Fe.submitting=!1,Fe.balance={closing:0,opening:0,change:{amount:0,breakdown:[]}},Fe.canChangeAbsenceType=S,Fe.canSubmit=R,Fe.closeAlert=k,Fe.deleteLeaveRequest=E,Fe.dismissModal=j,Fe.getStatuses=H,Fe.getStatusFromValue=W,Fe.initAfterContactSelection=G,Fe.initRequestAttributes=te,Fe.isLeaveStatus=se,Fe.isLeaveType=ie,Fe.isMode=ue,Fe.isRole=le,Fe.submit=Ae,Fe.updateAbsenceType=Se,function(){Fe.loading.absenceTypes=!0,z(),Z(),pe().then(Q).then(function(){return r.all([ne(),de(),ve()])}).then(X).then(K).then(ee).then(we).then($e).then(function(){return Fe.canManage&&!Fe.isMode("edit")&&he()}).then(function(){if(Fe.selectedContactId&&(Fe.request.contact_id=Fe.selectedContactId),Fe.request.contact_id)return Fe.initAfterContactSelection()}).catch(V).finally(function(){Fe.loading.absenceTypes=!1})}()}t.controller("RequestCtrl",r), r.$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,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(){}); //# 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/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 abe34fe4925..5421562ccdc 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 @@ -182,6 +182,8 @@ define([ * 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'; @@ -189,7 +191,7 @@ define([ if ($rootScope.section === 'absence-tab') { vm.role = 'admin'; - return; + return $q.resolve(); } return checkPermissions(sharedSettings.permissions.admin.administer) @@ -616,6 +618,7 @@ define([ */ function toggleSection (sectionName) { var section = vm.sections[sectionName]; + section.open = !section.open; if (section.open && !section.data.length) { From a4693c1f9fc89dff15256bb8aa548f7f5e8e43a1 Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Wed, 11 Jul 2018 11:20:18 +0100 Subject: [PATCH 098/151] PCHR-3600: Move hrdemog fields in contact profile Resolved merged conflict and updated the hrui.min.js file --- hrui/js/dist/hrui.min.js | 2 +- hrui/js/src/hrui/main.js | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hrui/js/dist/hrui.min.js b/hrui/js/dist/hrui.min.js index 8983781b726..218b906cd77 100644 --- a/hrui/js/dist/hrui.min.js +++ b/hrui/js/dist/hrui.min.js @@ -1,2 +1,2 @@ -!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 i(n){1===t(n).length&&t(n).on("change",f)}function o(){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())}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 i=t(n),o=t("
    ");o.attr("id",e),o.append(t("#civicrm-menu")),o.append(i),o.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(),i=t("");i.append(n.find("label")),i.append(t("
    ")),i.append(e.html()),t("#nick_name").parent().after(i)})}function C(){t(".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()}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(){i("input[type='file']"),e(),o(),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,i){void 0!==i.contract&&n(i.contract),void 0!==i.roles&&e(i.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},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){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 i(){r=m.clone(!0).appendTo(n).addClass("civihr-popup")}function o(){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(),i(),c(),a(),o()}()})})}(CRM.$),function(t){t(["hrui/main","hrui/contact","hrui/civihr-popup/attrchange","hrui/civihr-popup/civihr-popup"])}(require); +!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/hrui/main.js b/hrui/js/src/hrui/main.js index 6265975a4c0..3c94f4204de 100755 --- a/hrui/js/src/hrui/main.js +++ b/hrui/js/src/hrui/main.js @@ -136,8 +136,10 @@ } if ($('.Inline_Custom_Data').length) { - repositionInlineCustomDataBlockInPersonalDetailsTab(); + repositionPersonalDetailsBlock('.Inline_Custom_Data'); } + + repositionPersonalDetailsBlock('.Extended_Demographics'); } } @@ -275,14 +277,15 @@ } /** - * Moves the "Inline Custom Data" block towards the top of the - * personal details tab + * Moves the specified selector element to the personal details tab + * + * @param selector */ - function repositionInlineCustomDataBlockInPersonalDetailsTab () { - $('.Inline_Custom_Data') + function repositionPersonalDetailsBlock (selector) { + $(selector) .removeClass('crm-collapsible collapsed') .addClass('crm-summary-block') - .insertAfter('.crm-summary-contactinfo-block') + .appendTo('.contactTopBar .contactCardLeft') .find('.collapsible-title').hide().end() .find('.crm-summary-block').show(); } From c039623903792097e6e6b8c8f14e207db44e63df Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Mon, 30 Jul 2018 15:47:21 +0100 Subject: [PATCH 099/151] PCHR-4049: Upgrade gulp --- package-lock.json | 1426 ++-- .../gulp/tasks/requirejs.js | 5 +- .../gulp/tasks/sass.js | 3 +- .../gulp/tasks/test.js | 4 +- uk.co.compucorp.civicrm.hrcore/gulpfile.js | 25 +- .../package-lock.json | 5943 +++++++++-------- uk.co.compucorp.civicrm.hrcore/package.json | 11 +- 7 files changed, 3846 insertions(+), 3571 deletions(-) diff --git a/package-lock.json b/package-lock.json index a752c6ba895..59d508afa9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", "dev": true, "requires": { - "acorn": "3.3.0" + "acorn": "^3.0.4" }, "dependencies": { "acorn": { @@ -32,10 +32,10 @@ "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.1" + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "ajv-keywords": { @@ -62,7 +62,7 @@ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "color-convert": "1.9.1" + "color-convert": "^1.9.0" } }, "any-observable": { @@ -83,7 +83,7 @@ "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", "dev": true, "requires": { - "sprintf-js": "1.0.3" + "sprintf-js": "~1.0.2" } }, "arr-diff": { @@ -92,7 +92,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "1.1.0" + "arr-flatten": "^1.0.1" } }, "arr-flatten": { @@ -113,8 +113,8 @@ "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", "dev": true, "requires": { - "define-properties": "1.1.2", - "es-abstract": "1.10.0" + "define-properties": "^1.1.2", + "es-abstract": "^1.7.0" } }, "array-iterate": { @@ -129,7 +129,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "1.0.3" + "array-uniq": "^1.0.1" } }, "array-uniq": { @@ -162,12 +162,12 @@ "integrity": "sha512-Iq8TRIB+/9eQ8rbGhcP7ct5cYb/3qjNYAR2SnzLCEcwF6rvVOax8+9+fccgXk4bEhQGjOZd5TLhsksmAdsbGqQ==", "dev": true, "requires": { - "browserslist": "2.11.3", - "caniuse-lite": "1.0.30000808", - "normalize-range": "0.1.2", - "num2fraction": "1.2.2", - "postcss": "6.0.17", - "postcss-value-parser": "3.3.0" + "browserslist": "^2.11.3", + "caniuse-lite": "^1.0.30000805", + "normalize-range": "^0.1.2", + "num2fraction": "^1.2.2", + "postcss": "^6.0.17", + "postcss-value-parser": "^3.2.3" } }, "babel-code-frame": { @@ -176,9 +176,9 @@ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" }, "dependencies": { "ansi-styles": { @@ -193,11 +193,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "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" } }, "supports-color": { @@ -226,7 +226,7 @@ "integrity": "sha512-/+o3o6OV1cm3WKrO7U4wykU+ZICE6HiMEuravc2d03NIuM/VaRn5iMcoQ7NyxFXjvpmRICP2EER0YOnh4yIapA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -236,9 +236,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" } }, "browserslist": { @@ -247,8 +247,8 @@ "integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==", "dev": true, "requires": { - "caniuse-lite": "1.0.30000808", - "electron-to-chromium": "1.3.33" + "caniuse-lite": "^1.0.30000792", + "electron-to-chromium": "^1.3.30" } }, "builtin-modules": { @@ -263,7 +263,7 @@ "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", "dev": true, "requires": { - "callsites": "0.2.0" + "callsites": "^0.2.0" } }, "callsites": { @@ -284,9 +284,9 @@ "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", "dev": true, "requires": { - "camelcase": "4.1.0", - "map-obj": "2.0.0", - "quick-lru": "1.1.0" + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" } }, "caniuse-lite": { @@ -307,9 +307,9 @@ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "dev": true, "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "ansi-styles": "^3.1.0", + "escape-string-regexp": "^1.0.5", + "supports-color": "^4.0.0" } }, "character-entities": { @@ -360,7 +360,7 @@ "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", "dev": true, "requires": { - "restore-cursor": "1.0.1" + "restore-cursor": "^1.0.1" } }, "cli-spinners": { @@ -376,7 +376,7 @@ "dev": true, "requires": { "slice-ansi": "0.0.4", - "string-width": "1.0.2" + "string-width": "^1.0.1" } }, "cli-width": { @@ -391,9 +391,9 @@ "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", "dev": true, "requires": { - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "wrap-ansi": "2.1.0" + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" }, "dependencies": { "is-fullwidth-code-point": { @@ -408,8 +408,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "strip-ansi": { @@ -418,7 +418,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } } } @@ -429,8 +429,8 @@ "integrity": "sha1-6uCiQT9VwJQvgYwin+/OhF1/Oxw=", "dev": true, "requires": { - "is-regexp": "1.0.0", - "is-supported-regexp-flag": "1.0.0" + "is-regexp": "^1.0.0", + "is-supported-regexp-flag": "^1.0.0" } }, "co": { @@ -457,7 +457,7 @@ "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "dev": true, "requires": { - "color-name": "1.1.3" + "color-name": "^1.1.1" } }, "color-name": { @@ -484,9 +484,9 @@ "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" } }, "contains-path": { @@ -513,10 +513,10 @@ "integrity": "sha512-6e5vDdrXZD+t5v0L8CrurPeybg4Fmf+FCSYxXKYVAqLUtyCSbuyqE059d0kDthTNRzKVjL7QMgNpEUlsoYH3iQ==", "dev": true, "requires": { - "is-directory": "0.3.1", - "js-yaml": "3.10.0", - "parse-json": "4.0.0", - "require-from-string": "2.0.1" + "is-directory": "^0.3.1", + "js-yaml": "^3.9.0", + "parse-json": "^4.0.0", + "require-from-string": "^2.0.1" } }, "cross-spawn": { @@ -525,9 +525,9 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.3.0" + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" } }, "currently-unhandled": { @@ -536,7 +536,7 @@ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "array-find-index": "1.0.2" + "array-find-index": "^1.0.1" } }, "date-fns": { @@ -572,8 +572,8 @@ "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", "dev": true, "requires": { - "decamelize": "1.2.0", - "map-obj": "1.0.1" + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" }, "dependencies": { "map-obj": { @@ -602,8 +602,8 @@ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", "dev": true, "requires": { - "foreach": "2.0.5", - "object-keys": "1.0.11" + "foreach": "^2.0.5", + "object-keys": "^1.0.8" } }, "deglob": { @@ -612,12 +612,12 @@ "integrity": "sha1-TUSr4W7zLHebSXK9FBqAMlApoUo=", "dev": true, "requires": { - "find-root": "1.1.0", - "glob": "7.1.2", - "ignore": "3.3.7", - "pkg-config": "1.1.1", - "run-parallel": "1.1.6", - "uniq": "1.0.1" + "find-root": "^1.0.0", + "glob": "^7.0.5", + "ignore": "^3.0.9", + "pkg-config": "^1.1.0", + "run-parallel": "^1.1.2", + "uniq": "^1.0.1" } }, "del": { @@ -626,13 +626,13 @@ "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", "dev": true, "requires": { - "globby": "5.0.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "rimraf": "2.6.2" + "globby": "^5.0.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "rimraf": "^2.2.8" }, "dependencies": { "pify": { @@ -649,8 +649,8 @@ "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", "dev": true, "requires": { - "arrify": "1.0.1", - "path-type": "3.0.0" + "arrify": "^1.0.1", + "path-type": "^3.0.0" }, "dependencies": { "path-type": { @@ -659,7 +659,7 @@ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "3.0.0" + "pify": "^3.0.0" } } } @@ -670,7 +670,7 @@ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "2.0.2" + "esutils": "^2.0.2" } }, "dom-serializer": { @@ -679,8 +679,8 @@ "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", "dev": true, "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" + "domelementtype": "~1.1.1", + "entities": "~1.1.1" }, "dependencies": { "domelementtype": { @@ -703,7 +703,7 @@ "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", "dev": true, "requires": { - "domelementtype": "1.3.0" + "domelementtype": "1" } }, "domutils": { @@ -712,8 +712,8 @@ "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", "dev": true, "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" + "dom-serializer": "0", + "domelementtype": "1" } }, "dot-prop": { @@ -722,7 +722,7 @@ "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", "dev": true, "requires": { - "is-obj": "1.0.1" + "is-obj": "^1.0.0" } }, "electron-to-chromium": { @@ -743,7 +743,7 @@ "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", "dev": true, "requires": { - "iconv-lite": "0.4.19" + "iconv-lite": "~0.4.13" } }, "entities": { @@ -758,7 +758,7 @@ "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true, "requires": { - "is-arrayish": "0.2.1" + "is-arrayish": "^0.2.1" } }, "es-abstract": { @@ -767,11 +767,11 @@ "integrity": "sha512-/uh/DhdqIOSkAWifU+8nG78vlQxdLckUdI/sPgy0VhuXi2qJ7T8czBmqIYtLQVpCIFYafChnsRsB5pyb1JdmCQ==", "dev": true, "requires": { - "es-to-primitive": "1.1.1", - "function-bind": "1.1.1", - "has": "1.0.1", - "is-callable": "1.1.3", - "is-regex": "1.0.4" + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" } }, "es-to-primitive": { @@ -780,9 +780,9 @@ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", "dev": true, "requires": { - "is-callable": "1.1.3", - "is-date-object": "1.0.1", - "is-symbol": "1.0.1" + "is-callable": "^1.1.1", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.1" } }, "escape-string-regexp": { @@ -797,43 +797,43 @@ "integrity": "sha512-Ul6CSGRjKscEyg0X/EeNs7o2XdnbTEOD1OM8cTjmx85RPcBJQrEhZLevhuJZNAE/vS2iVl5Uhgiqf3h5uLMCJQ==", "dev": true, "requires": { - "ajv": "5.5.2", - "babel-code-frame": "6.26.0", - "chalk": "2.3.0", - "concat-stream": "1.6.0", - "cross-spawn": "5.1.0", - "debug": "3.1.0", - "doctrine": "2.1.0", - "eslint-scope": "3.7.1", - "eslint-visitor-keys": "1.0.0", - "espree": "3.5.3", - "esquery": "1.0.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "functional-red-black-tree": "1.0.1", - "glob": "7.1.2", - "globals": "11.3.0", - "ignore": "3.3.7", - "imurmurhash": "0.1.4", - "inquirer": "3.3.0", - "is-resolvable": "1.1.0", - "js-yaml": "3.10.0", - "json-stable-stringify-without-jsonify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.5", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "7.0.0", - "progress": "2.0.0", - "require-uncached": "1.0.3", - "semver": "5.5.0", - "strip-ansi": "4.0.0", - "strip-json-comments": "2.0.1", - "table": "4.0.2", - "text-table": "0.2.0" + "ajv": "^5.3.0", + "babel-code-frame": "^6.22.0", + "chalk": "^2.1.0", + "concat-stream": "^1.6.0", + "cross-spawn": "^5.1.0", + "debug": "^3.1.0", + "doctrine": "^2.0.2", + "eslint-scope": "^3.7.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^3.5.2", + "esquery": "^1.0.0", + "esutils": "^2.0.2", + "file-entry-cache": "^2.0.0", + "functional-red-black-tree": "^1.0.1", + "glob": "^7.1.2", + "globals": "^11.0.1", + "ignore": "^3.3.3", + "imurmurhash": "^0.1.4", + "inquirer": "^3.0.6", + "is-resolvable": "^1.0.0", + "js-yaml": "^3.9.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.4", + "minimatch": "^3.0.2", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "path-is-inside": "^1.0.2", + "pluralize": "^7.0.0", + "progress": "^2.0.0", + "require-uncached": "^1.0.3", + "semver": "^5.3.0", + "strip-ansi": "^4.0.0", + "strip-json-comments": "~2.0.1", + "table": "^4.0.1", + "text-table": "~0.2.0" }, "dependencies": { "strip-ansi": { @@ -842,7 +842,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } } } @@ -871,8 +871,8 @@ "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", "dev": true, "requires": { - "debug": "2.6.9", - "resolve": "1.5.0" + "debug": "^2.6.9", + "resolve": "^1.5.0" }, "dependencies": { "debug": { @@ -892,8 +892,8 @@ "integrity": "sha512-jDI/X5l/6D1rRD/3T43q8Qgbls2nq5km5KSqiwlyUbGo5+04fXhMKdCPhjwbqAa6HXWaMxj8Q4hQDIh7IadJQw==", "dev": true, "requires": { - "debug": "2.6.9", - "pkg-dir": "1.0.0" + "debug": "^2.6.8", + "pkg-dir": "^1.0.0" }, "dependencies": { "debug": { @@ -913,16 +913,16 @@ "integrity": "sha512-Rf7dfKJxZ16QuTgVv1OYNxkZcsu/hULFnC+e+w0Gzi6jMC3guQoWQgxYxc54IDRinlb6/0v5z/PxxIKmVctN+g==", "dev": true, "requires": { - "builtin-modules": "1.1.1", - "contains-path": "0.1.0", - "debug": "2.6.9", + "builtin-modules": "^1.1.1", + "contains-path": "^0.1.0", + "debug": "^2.6.8", "doctrine": "1.5.0", - "eslint-import-resolver-node": "0.3.2", - "eslint-module-utils": "2.1.1", - "has": "1.0.1", - "lodash.cond": "4.5.2", - "minimatch": "3.0.4", - "read-pkg-up": "2.0.0" + "eslint-import-resolver-node": "^0.3.1", + "eslint-module-utils": "^2.1.1", + "has": "^1.0.1", + "lodash.cond": "^4.3.0", + "minimatch": "^3.0.3", + "read-pkg-up": "^2.0.0" }, "dependencies": { "debug": { @@ -940,8 +940,8 @@ "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", "dev": true, "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" + "esutils": "^2.0.2", + "isarray": "^1.0.0" } } } @@ -952,9 +952,9 @@ "integrity": "sha512-xhPXrh0Vl/b7870uEbaumb2Q+LxaEcOQ3kS1jtIXanBAwpMre1l5q/l2l/hESYJGEFKuI78bp6Uw50hlpr7B+g==", "dev": true, "requires": { - "ignore": "3.3.7", - "minimatch": "3.0.4", - "resolve": "1.5.0", + "ignore": "^3.3.6", + "minimatch": "^3.0.4", + "resolve": "^1.3.3", "semver": "5.3.0" }, "dependencies": { @@ -978,10 +978,10 @@ "integrity": "sha512-YGSjB9Qu6QbVTroUZi66pYky3DfoIPLdHQ/wmrBGyBRnwxQsBXAov9j2rpXt/55i8nyMv6IRWJv2s4d4YnduzQ==", "dev": true, "requires": { - "doctrine": "2.1.0", - "has": "1.0.1", - "jsx-ast-utils": "2.0.1", - "prop-types": "15.6.0" + "doctrine": "^2.0.0", + "has": "^1.0.1", + "jsx-ast-utils": "^2.0.0", + "prop-types": "^15.6.0" } }, "eslint-plugin-standard": { @@ -996,8 +996,8 @@ "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", "dev": true, "requires": { - "esrecurse": "4.2.0", - "estraverse": "4.2.0" + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" } }, "eslint-visitor-keys": { @@ -1012,8 +1012,8 @@ "integrity": "sha512-Zy3tAJDORxQZLl2baguiRU1syPERAIg0L+JB2MWorORgTu/CplzvxS9WWA7Xh4+Q+eOQihNs/1o1Xep8cvCxWQ==", "dev": true, "requires": { - "acorn": "5.4.1", - "acorn-jsx": "3.0.1" + "acorn": "^5.4.0", + "acorn-jsx": "^3.0.0" } }, "esprima": { @@ -1028,7 +1028,7 @@ "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", "dev": true, "requires": { - "estraverse": "4.2.0" + "estraverse": "^4.0.0" } }, "esrecurse": { @@ -1037,8 +1037,8 @@ "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", "dev": true, "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" + "estraverse": "^4.1.0", + "object-assign": "^4.0.1" } }, "estraverse": { @@ -1059,13 +1059,13 @@ "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", "dev": true, "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" } }, "execall": { @@ -1074,7 +1074,7 @@ "integrity": "sha1-c9CQTjlbPKsGWLCNCewlMH8pu3M=", "dev": true, "requires": { - "clone-regexp": "1.0.0" + "clone-regexp": "^1.0.0" } }, "exit-hook": { @@ -1089,7 +1089,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "0.1.1" + "is-posix-bracket": "^0.1.0" } }, "expand-range": { @@ -1098,7 +1098,7 @@ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "fill-range": "2.2.3" + "fill-range": "^2.1.0" } }, "extend": { @@ -1113,9 +1113,9 @@ "integrity": "sha512-E44iT5QVOUJBKij4IIV3uvxuNlbKS38Tw1HiupxEIHPv9qtC2PrDYohbXV5U+1jnfIXttny8gUhj+oZvflFlzA==", "dev": true, "requires": { - "chardet": "0.4.2", - "iconv-lite": "0.4.19", - "tmp": "0.0.33" + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" } }, "extglob": { @@ -1124,7 +1124,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" }, "dependencies": { "is-extglob": { @@ -1159,13 +1159,13 @@ "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", "dev": true, "requires": { - "core-js": "1.2.7", - "isomorphic-fetch": "2.2.1", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "promise": "7.3.1", - "setimmediate": "1.0.5", - "ua-parser-js": "0.7.17" + "core-js": "^1.0.0", + "isomorphic-fetch": "^2.1.1", + "loose-envify": "^1.0.0", + "object-assign": "^4.1.0", + "promise": "^7.1.1", + "setimmediate": "^1.0.5", + "ua-parser-js": "^0.7.9" } }, "figures": { @@ -1174,8 +1174,8 @@ "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", "dev": true, "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1" + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" } }, "file-entry-cache": { @@ -1184,8 +1184,8 @@ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", "dev": true, "requires": { - "flat-cache": "1.3.0", - "object-assign": "4.1.1" + "flat-cache": "^1.2.1", + "object-assign": "^4.0.1" } }, "filename-regex": { @@ -1200,11 +1200,11 @@ "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true, "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^1.1.3", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" } }, "find-parent-dir": { @@ -1225,8 +1225,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "flat-cache": { @@ -1235,10 +1235,10 @@ "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", "dev": true, "requires": { - "circular-json": "0.3.3", - "del": "2.2.2", - "graceful-fs": "4.1.11", - "write": "0.2.1" + "circular-json": "^0.3.1", + "del": "^2.0.2", + "graceful-fs": "^4.1.2", + "write": "^0.2.1" } }, "for-in": { @@ -1253,7 +1253,7 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { - "for-in": "1.0.2" + "for-in": "^1.0.1" } }, "foreach": { @@ -1310,12 +1310,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "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" } }, "glob-base": { @@ -1324,8 +1324,8 @@ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" }, "dependencies": { "is-extglob": { @@ -1340,7 +1340,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } } } @@ -1351,7 +1351,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "2.0.1" + "is-glob": "^2.0.0" }, "dependencies": { "is-extglob": { @@ -1366,7 +1366,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } } } @@ -1383,12 +1383,12 @@ "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { - "array-union": "1.0.2", - "arrify": "1.0.1", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" }, "dependencies": { "pify": { @@ -1411,7 +1411,7 @@ "integrity": "sha512-Kjhohco0esHQnOiqqdJeNz/5fyPkOMD/d6XVjwTAoPGUFh0mCollPUTUTa2OZy4dYNAqlPIQdTiNzJTWdd9Htw==", "dev": true, "requires": { - "minimist": "1.1.3" + "minimist": "1.1.x" }, "dependencies": { "minimist": { @@ -1434,7 +1434,7 @@ "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", "dev": true, "requires": { - "function-bind": "1.1.1" + "function-bind": "^1.0.2" } }, "has-ansi": { @@ -1443,7 +1443,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" }, "dependencies": { "ansi-regex": { @@ -1478,12 +1478,12 @@ "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", "dev": true, "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.4.1", - "domutils": "1.7.0", - "entities": "1.1.1", - "inherits": "2.0.3", - "readable-stream": "2.3.3" + "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" } }, "husky": { @@ -1492,9 +1492,9 @@ "integrity": "sha512-e21wivqHpstpoiWA/Yi8eFti8E+sQDSS53cpJsPptPs295QTOQR0ZwnHo2TXy1XOpZFD9rPOd3NpmqTK6uMLJA==", "dev": true, "requires": { - "is-ci": "1.1.0", - "normalize-path": "1.0.0", - "strip-indent": "2.0.0" + "is-ci": "^1.0.10", + "normalize-path": "^1.0.0", + "strip-indent": "^2.0.0" } }, "iconv-lite": { @@ -1521,7 +1521,7 @@ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, "requires": { - "repeating": "2.0.1" + "repeating": "^2.0.0" } }, "indexes-of": { @@ -1536,8 +1536,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -1552,20 +1552,20 @@ "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", "dev": true, "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.3.0", - "cli-cursor": "2.1.0", - "cli-width": "2.2.0", - "external-editor": "2.1.0", - "figures": "2.0.0", - "lodash": "4.17.5", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.0.4", + "figures": "^2.0.0", + "lodash": "^4.3.0", "mute-stream": "0.0.7", - "run-async": "2.3.0", - "rx-lite": "4.0.8", - "rx-lite-aggregates": "4.0.8", - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "through": "2.3.8" + "run-async": "^2.2.0", + "rx-lite": "^4.0.8", + "rx-lite-aggregates": "^4.0.8", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" }, "dependencies": { "ansi-escapes": { @@ -1580,7 +1580,7 @@ "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, "requires": { - "restore-cursor": "2.0.0" + "restore-cursor": "^2.0.0" } }, "figures": { @@ -1589,7 +1589,7 @@ "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", "dev": true, "requires": { - "escape-string-regexp": "1.0.5" + "escape-string-regexp": "^1.0.5" } }, "is-fullwidth-code-point": { @@ -1604,7 +1604,7 @@ "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", "dev": true, "requires": { - "mimic-fn": "1.2.0" + "mimic-fn": "^1.0.0" } }, "restore-cursor": { @@ -1613,8 +1613,8 @@ "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", "dev": true, "requires": { - "onetime": "2.0.1", - "signal-exit": "3.0.2" + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" } }, "string-width": { @@ -1623,8 +1623,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "strip-ansi": { @@ -1633,7 +1633,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } } } @@ -1662,8 +1662,8 @@ "integrity": "sha1-37SqTRCF4zvbYcLe6cgOnGwZ9Ts=", "dev": true, "requires": { - "is-alphabetical": "1.0.1", - "is-decimal": "1.0.1" + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" } }, "is-arrayish": { @@ -1684,7 +1684,7 @@ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { - "builtin-modules": "1.1.1" + "builtin-modules": "^1.0.0" } }, "is-callable": { @@ -1699,7 +1699,7 @@ "integrity": "sha512-c7TnwxLePuqIlxHgr7xtxzycJPegNHFuIrBkwbf8hc58//+Op1CqFkyS+xnIMkwn9UsJIwc174BIjkyBmSpjKg==", "dev": true, "requires": { - "ci-info": "1.1.2" + "ci-info": "^1.0.0" } }, "is-date-object": { @@ -1732,7 +1732,7 @@ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { - "is-primitive": "2.0.0" + "is-primitive": "^2.0.0" } }, "is-extendable": { @@ -1753,7 +1753,7 @@ "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-fullwidth-code-point": { @@ -1762,7 +1762,7 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-glob": { @@ -1771,7 +1771,7 @@ "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", "dev": true, "requires": { - "is-extglob": "2.1.1" + "is-extglob": "^2.1.1" } }, "is-hexadecimal": { @@ -1786,7 +1786,7 @@ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" } }, "is-obj": { @@ -1801,7 +1801,7 @@ "integrity": "sha1-s2ExHYPG5dcmyr9eJQsCNxBvWuI=", "dev": true, "requires": { - "symbol-observable": "0.2.4" + "symbol-observable": "^0.2.2" } }, "is-path-cwd": { @@ -1816,7 +1816,7 @@ "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", "dev": true, "requires": { - "is-path-inside": "1.0.1" + "is-path-inside": "^1.0.0" } }, "is-path-inside": { @@ -1825,7 +1825,7 @@ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { - "path-is-inside": "1.0.2" + "path-is-inside": "^1.0.1" } }, "is-plain-obj": { @@ -1858,7 +1858,7 @@ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { - "has": "1.0.1" + "has": "^1.0.1" } }, "is-regexp": { @@ -1930,8 +1930,8 @@ "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", "dev": true, "requires": { - "node-fetch": "1.7.3", - "whatwg-fetch": "2.0.3" + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" } }, "jest-get-type": { @@ -1946,10 +1946,10 @@ "integrity": "sha512-k4HLI1rZQjlU+EC682RlQ6oZvLrE5SCh3brseQc24vbZTxzT/k/3urar5QMCVgjadmSO7lECeGdc6YxnM3yEGg==", "dev": true, "requires": { - "chalk": "2.3.0", - "jest-get-type": "21.2.0", - "leven": "2.1.0", - "pretty-format": "21.2.1" + "chalk": "^2.0.1", + "jest-get-type": "^21.2.0", + "leven": "^2.1.0", + "pretty-format": "^21.2.1" } }, "js-base64": { @@ -1970,8 +1970,8 @@ "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", "dev": true, "requires": { - "argparse": "1.0.9", - "esprima": "4.0.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, "json-parse-better-errors": { @@ -1998,7 +1998,7 @@ "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=", "dev": true, "requires": { - "array-includes": "3.0.3" + "array-includes": "^3.0.3" } }, "kind-of": { @@ -2007,7 +2007,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } }, "known-css-properties": { @@ -2022,7 +2022,7 @@ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { - "invert-kv": "1.0.0" + "invert-kv": "^1.0.0" } }, "leven": { @@ -2037,8 +2037,8 @@ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" } }, "lint-staged": { @@ -2047,26 +2047,26 @@ "integrity": "sha512-RMB6BUd2bEKaPnj06F7j8RRB8OHM+UP4fQS2LT8lF+X9BjSaezw1oVB5hc4elLhYvzlFCkhAaatzYz+x53YHgw==", "dev": true, "requires": { - "app-root-path": "2.0.1", - "chalk": "2.3.0", - "commander": "2.14.1", - "cosmiconfig": "4.0.0", - "debug": "3.1.0", - "dedent": "0.7.0", - "execa": "0.8.0", - "find-parent-dir": "0.3.0", - "is-glob": "4.0.0", - "jest-validate": "21.2.1", - "listr": "0.13.0", - "lodash": "4.17.5", - "log-symbols": "2.2.0", - "minimatch": "3.0.4", - "npm-which": "3.0.1", - "p-map": "1.2.0", - "path-is-inside": "1.0.2", - "pify": "3.0.0", + "app-root-path": "^2.0.0", + "chalk": "^2.1.0", + "commander": "^2.11.0", + "cosmiconfig": "^4.0.0", + "debug": "^3.1.0", + "dedent": "^0.7.0", + "execa": "^0.8.0", + "find-parent-dir": "^0.3.0", + "is-glob": "^4.0.0", + "jest-validate": "^21.1.0", + "listr": "^0.13.0", + "lodash": "^4.17.4", + "log-symbols": "^2.0.0", + "minimatch": "^3.0.0", + "npm-which": "^3.0.1", + "p-map": "^1.1.1", + "path-is-inside": "^1.0.2", + "pify": "^3.0.0", "staged-git-files": "0.0.4", - "stringify-object": "3.2.2" + "stringify-object": "^3.2.0" } }, "listr": { @@ -2075,23 +2075,23 @@ "integrity": "sha1-ILsLowuuZg7oTMBQPfS+PVYjiH0=", "dev": true, "requires": { - "chalk": "1.1.3", - "cli-truncate": "0.2.1", - "figures": "1.7.0", - "indent-string": "2.1.0", - "is-observable": "0.2.0", - "is-promise": "2.1.0", - "is-stream": "1.1.0", - "listr-silent-renderer": "1.1.1", - "listr-update-renderer": "0.4.0", - "listr-verbose-renderer": "0.4.1", - "log-symbols": "1.0.2", - "log-update": "1.0.2", - "ora": "0.2.3", - "p-map": "1.2.0", - "rxjs": "5.5.6", - "stream-to-observable": "0.2.0", - "strip-ansi": "3.0.1" + "chalk": "^1.1.3", + "cli-truncate": "^0.2.1", + "figures": "^1.7.0", + "indent-string": "^2.1.0", + "is-observable": "^0.2.0", + "is-promise": "^2.1.0", + "is-stream": "^1.1.0", + "listr-silent-renderer": "^1.1.1", + "listr-update-renderer": "^0.4.0", + "listr-verbose-renderer": "^0.4.0", + "log-symbols": "^1.0.2", + "log-update": "^1.0.2", + "ora": "^0.2.3", + "p-map": "^1.1.1", + "rxjs": "^5.4.2", + "stream-to-observable": "^0.2.0", + "strip-ansi": "^3.0.1" }, "dependencies": { "ansi-styles": { @@ -2106,11 +2106,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "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" } }, "log-symbols": { @@ -2119,7 +2119,7 @@ "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", "dev": true, "requires": { - "chalk": "1.1.3" + "chalk": "^1.0.0" } }, "supports-color": { @@ -2142,14 +2142,14 @@ "integrity": "sha1-NE2YDaLKLosUW6MFkI8yrj9MyKc=", "dev": true, "requires": { - "chalk": "1.1.3", - "cli-truncate": "0.2.1", - "elegant-spinner": "1.0.1", - "figures": "1.7.0", - "indent-string": "3.2.0", - "log-symbols": "1.0.2", - "log-update": "1.0.2", - "strip-ansi": "3.0.1" + "chalk": "^1.1.3", + "cli-truncate": "^0.2.1", + "elegant-spinner": "^1.0.1", + "figures": "^1.7.0", + "indent-string": "^3.0.0", + "log-symbols": "^1.0.2", + "log-update": "^1.0.2", + "strip-ansi": "^3.0.1" }, "dependencies": { "ansi-styles": { @@ -2164,11 +2164,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "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" } }, "indent-string": { @@ -2183,7 +2183,7 @@ "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", "dev": true, "requires": { - "chalk": "1.1.3" + "chalk": "^1.0.0" } }, "supports-color": { @@ -2200,10 +2200,10 @@ "integrity": "sha1-ggb0z21S3cWCfl/RSYng6WWTOjU=", "dev": true, "requires": { - "chalk": "1.1.3", - "cli-cursor": "1.0.2", - "date-fns": "1.29.0", - "figures": "1.7.0" + "chalk": "^1.1.3", + "cli-cursor": "^1.0.2", + "date-fns": "^1.27.2", + "figures": "^1.7.0" }, "dependencies": { "ansi-styles": { @@ -2218,11 +2218,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "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" } }, "supports-color": { @@ -2239,10 +2239,10 @@ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "strip-bom": "3.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" }, "dependencies": { "parse-json": { @@ -2251,7 +2251,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "^1.2.0" } }, "pify": { @@ -2268,8 +2268,8 @@ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { - "p-locate": "2.0.0", - "path-exists": "3.0.0" + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" }, "dependencies": { "path-exists": { @@ -2298,7 +2298,7 @@ "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", "dev": true, "requires": { - "chalk": "2.3.0" + "chalk": "^2.0.1" } }, "log-update": { @@ -2307,8 +2307,8 @@ "integrity": "sha1-GZKfZMQJPS0ucHWh2tivWcKWuNE=", "dev": true, "requires": { - "ansi-escapes": "1.4.0", - "cli-cursor": "1.0.2" + "ansi-escapes": "^1.0.0", + "cli-cursor": "^1.0.2" } }, "longest-streak": { @@ -2323,7 +2323,7 @@ "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", "dev": true, "requires": { - "js-tokens": "3.0.2" + "js-tokens": "^3.0.0" } }, "loud-rejection": { @@ -2332,8 +2332,8 @@ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", "dev": true, "requires": { - "currently-unhandled": "0.4.1", - "signal-exit": "3.0.2" + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" } }, "lru-cache": { @@ -2342,8 +2342,8 @@ "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" } }, "map-obj": { @@ -2376,8 +2376,8 @@ "integrity": "sha1-zbX4TitqLTEU3zO9BdnLMuPECDo=", "dev": true, "requires": { - "unist-util-modify-children": "1.1.1", - "unist-util-visit": "1.3.0" + "unist-util-modify-children": "^1.0.0", + "unist-util-visit": "^1.1.0" } }, "mem": { @@ -2386,7 +2386,7 @@ "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { - "mimic-fn": "1.2.0" + "mimic-fn": "^1.0.0" } }, "meow": { @@ -2395,15 +2395,15 @@ "integrity": "sha512-Me/kel335m6vMKmEmA6c87Z6DUFW3JqkINRnxkbC+A/PUm0D5Fl2dEBQrPKnqCL9Te/CIa1MUt/0InMJhuC/sw==", "dev": true, "requires": { - "camelcase-keys": "4.2.0", - "decamelize-keys": "1.1.0", - "loud-rejection": "1.6.0", - "minimist": "1.2.0", - "minimist-options": "3.0.2", - "normalize-package-data": "2.4.0", - "read-pkg-up": "3.0.0", - "redent": "2.0.0", - "trim-newlines": "2.0.0" + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" }, "dependencies": { "find-up": { @@ -2412,7 +2412,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "2.0.0" + "locate-path": "^2.0.0" } }, "load-json-file": { @@ -2421,10 +2421,10 @@ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "4.0.0", - "pify": "3.0.0", - "strip-bom": "3.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" } }, "minimist": { @@ -2439,7 +2439,7 @@ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "3.0.0" + "pify": "^3.0.0" } }, "read-pkg": { @@ -2448,9 +2448,9 @@ "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { - "load-json-file": "4.0.0", - "normalize-package-data": "2.4.0", - "path-type": "3.0.0" + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" } }, "read-pkg-up": { @@ -2459,8 +2459,8 @@ "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { - "find-up": "2.1.0", - "read-pkg": "3.0.0" + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" } } } @@ -2471,19 +2471,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" }, "dependencies": { "is-extglob": { @@ -2498,7 +2498,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } }, "normalize-path": { @@ -2507,7 +2507,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "1.1.0" + "remove-trailing-separator": "^1.0.1" } } } @@ -2524,7 +2524,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.9" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -2539,8 +2539,8 @@ "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { - "arrify": "1.0.1", - "is-plain-obj": "1.1.0" + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" } }, "mkdirp": { @@ -2576,8 +2576,8 @@ "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", "dev": true, "requires": { - "encoding": "0.1.12", - "is-stream": "1.1.0" + "encoding": "^0.1.11", + "is-stream": "^1.0.1" } }, "normalize-package-data": { @@ -2586,10 +2586,10 @@ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true, "requires": { - "hosted-git-info": "2.5.0", - "is-builtin-module": "1.0.0", - "semver": "5.5.0", - "validate-npm-package-license": "3.0.1" + "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": { @@ -2616,7 +2616,7 @@ "integrity": "sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==", "dev": true, "requires": { - "which": "1.3.0" + "which": "^1.2.10" } }, "npm-run-path": { @@ -2625,7 +2625,7 @@ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { - "path-key": "2.0.1" + "path-key": "^2.0.0" } }, "npm-which": { @@ -2634,9 +2634,9 @@ "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", "dev": true, "requires": { - "commander": "2.14.1", - "npm-path": "2.0.4", - "which": "1.3.0" + "commander": "^2.9.0", + "npm-path": "^2.0.2", + "which": "^1.2.10" } }, "num2fraction": { @@ -2669,8 +2669,8 @@ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" } }, "once": { @@ -2679,7 +2679,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "onetime": { @@ -2694,12 +2694,12 @@ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" } }, "ora": { @@ -2708,10 +2708,10 @@ "integrity": "sha1-N1J9Igrc1Tw5tzVx11QVbV22V6Q=", "dev": true, "requires": { - "chalk": "1.1.3", - "cli-cursor": "1.0.2", - "cli-spinners": "0.1.2", - "object-assign": "4.1.1" + "chalk": "^1.1.1", + "cli-cursor": "^1.0.2", + "cli-spinners": "^0.1.2", + "object-assign": "^4.0.1" }, "dependencies": { "ansi-styles": { @@ -2726,11 +2726,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "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" } }, "supports-color": { @@ -2747,9 +2747,9 @@ "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { - "execa": "0.7.0", - "lcid": "1.0.0", - "mem": "1.1.0" + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" }, "dependencies": { "execa": { @@ -2758,13 +2758,13 @@ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" } } } @@ -2787,7 +2787,7 @@ "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", "dev": true, "requires": { - "p-try": "1.0.0" + "p-try": "^1.0.0" } }, "p-locate": { @@ -2796,7 +2796,7 @@ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { - "p-limit": "1.2.0" + "p-limit": "^1.1.0" } }, "p-map": { @@ -2817,12 +2817,12 @@ "integrity": "sha1-gRLYhHExnyerrk1klksSL+ThuJA=", "dev": true, "requires": { - "character-entities": "1.2.1", - "character-entities-legacy": "1.1.1", - "character-reference-invalid": "1.1.1", - "is-alphanumerical": "1.0.1", - "is-decimal": "1.0.1", - "is-hexadecimal": "1.0.1" + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-hexadecimal": "^1.0.0" } }, "parse-glob": { @@ -2831,10 +2831,10 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" }, "dependencies": { "is-extglob": { @@ -2849,7 +2849,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } } } @@ -2860,8 +2860,8 @@ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "1.3.1", - "json-parse-better-errors": "1.0.1" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" } }, "path-exists": { @@ -2870,7 +2870,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "2.0.1" + "pinkie-promise": "^2.0.0" } }, "path-is-absolute": { @@ -2903,7 +2903,7 @@ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", "dev": true, "requires": { - "pify": "2.3.0" + "pify": "^2.0.0" }, "dependencies": { "pify": { @@ -2932,7 +2932,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" } }, "pkg-conf": { @@ -2941,8 +2941,8 @@ "integrity": "sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=", "dev": true, "requires": { - "find-up": "2.1.0", - "load-json-file": "4.0.0" + "find-up": "^2.0.0", + "load-json-file": "^4.0.0" }, "dependencies": { "find-up": { @@ -2951,7 +2951,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "2.0.0" + "locate-path": "^2.0.0" } }, "load-json-file": { @@ -2960,10 +2960,10 @@ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "4.0.0", - "pify": "3.0.0", - "strip-bom": "3.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" } } } @@ -2974,9 +2974,9 @@ "integrity": "sha1-VX7yLXPaPIg3EHdmxS6tq94pj+Q=", "dev": true, "requires": { - "debug-log": "1.0.1", - "find-root": "1.1.0", - "xtend": "4.0.1" + "debug-log": "^1.0.0", + "find-root": "^1.0.0", + "xtend": "^4.0.1" } }, "pkg-dir": { @@ -2985,7 +2985,7 @@ "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", "dev": true, "requires": { - "find-up": "1.1.2" + "find-up": "^1.0.0" } }, "pluralize": { @@ -3000,9 +3000,9 @@ "integrity": "sha512-Bl1nybsSzWYbP8O4gAVD8JIjZIul9hLNOPTGBIlVmZNUnNAGL+W0cpYWzVwfImZOwumct4c1SDvSbncVWKtXUw==", "dev": true, "requires": { - "chalk": "2.3.0", - "source-map": "0.6.1", - "supports-color": "5.2.0" + "chalk": "^2.3.0", + "source-map": "^0.6.1", + "supports-color": "^5.1.0" }, "dependencies": { "has-flag": { @@ -3017,7 +3017,7 @@ "integrity": "sha512-F39vS48la4YvTZUPVeTqsjsFNrvcMwrV3RLZINsmHo+7djCvuUzSIeXOnZ5hmjef4bajL1dNccN+tg5XAliO5Q==", "dev": true, "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } } } @@ -3028,9 +3028,9 @@ "integrity": "sha512-KxKUpj7AY7nlCbLcTOYxdfJnGE7QFAfU2n95ADj1Q90RM/pOLdz8k3n4avOyRFs7MDQHcRzJQWM1dehCwJxisQ==", "dev": true, "requires": { - "htmlparser2": "3.9.2", - "remark": "8.0.0", - "unist-util-find-all-after": "1.0.1" + "htmlparser2": "^3.9.2", + "remark": "^8.0.0", + "unist-util-find-all-after": "^1.0.1" } }, "postcss-less": { @@ -3039,7 +3039,7 @@ "integrity": "sha512-WS0wsQxRm+kmN8wEYAGZ3t4lnoNfoyx9EJZrhiPR1K0lMHR0UNWnz52Ya5QRXChHtY75Ef+kDc05FpnBujebgw==", "dev": true, "requires": { - "postcss": "5.2.18" + "postcss": "^5.2.16" }, "dependencies": { "ansi-styles": { @@ -3054,11 +3054,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "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" }, "dependencies": { "supports-color": { @@ -3081,10 +3081,10 @@ "integrity": "sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==", "dev": true, "requires": { - "chalk": "1.1.3", - "js-base64": "2.4.3", - "source-map": "0.5.7", - "supports-color": "3.2.3" + "chalk": "^1.1.3", + "js-base64": "^2.1.9", + "source-map": "^0.5.6", + "supports-color": "^3.2.3" } }, "source-map": { @@ -3099,7 +3099,7 @@ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" } } } @@ -3116,10 +3116,10 @@ "integrity": "sha512-rBkDbaHAu5uywbCR2XE8a25tats3xSOsGNx6mppK6Q9kSFGKc/FyAzfci+fWM2l+K402p1D0pNcfDGxeje5IKg==", "dev": true, "requires": { - "chalk": "2.3.0", - "lodash": "4.17.5", - "log-symbols": "2.2.0", - "postcss": "6.0.17" + "chalk": "^2.0.1", + "lodash": "^4.17.4", + "log-symbols": "^2.0.0", + "postcss": "^6.0.8" } }, "postcss-resolve-nested-selector": { @@ -3134,7 +3134,7 @@ "integrity": "sha1-t1Pv9sfArqXoN1++TN6L+QY/8UI=", "dev": true, "requires": { - "postcss": "6.0.17" + "postcss": "^6.0.6" } }, "postcss-sass": { @@ -3143,8 +3143,8 @@ "integrity": "sha512-cUmYzkP747fPCQE6d+CH2l1L4VSyIlAzZsok3HPjb5Gzsq3jE+VjpAdGlPsnQ310WKWI42sw+ar0UNN59/f3hg==", "dev": true, "requires": { - "gonzales-pe": "4.2.3", - "postcss": "6.0.17" + "gonzales-pe": "^4.0.3", + "postcss": "^6.0.6" } }, "postcss-scss": { @@ -3153,7 +3153,7 @@ "integrity": "sha512-N2ZPDOV5PGEGVwdiB7b1QppxKkmkHodNWkemja7PV+/mHqbUlA6ZcYRreden5Ag5nwBBX8/aRE7lfg1xjdszyg==", "dev": true, "requires": { - "postcss": "6.0.17" + "postcss": "^6.0.15" } }, "postcss-selector-parser": { @@ -3162,9 +3162,9 @@ "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", "dev": true, "requires": { - "dot-prop": "4.2.0", - "indexes-of": "1.0.1", - "uniq": "1.0.1" + "dot-prop": "^4.1.1", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" } }, "postcss-sorting": { @@ -3173,8 +3173,8 @@ "integrity": "sha512-YCPTcJwGIInF1LpMD1lIYvMHTGUL4s97o/OraA6eKvoauhhk6vjwOWDDjm6uRKqug/kyDPMKEzmYZ6FtW6RDgw==", "dev": true, "requires": { - "lodash": "4.17.5", - "postcss": "6.0.17" + "lodash": "^4.17.4", + "postcss": "^6.0.13" } }, "postcss-value-parser": { @@ -3201,8 +3201,8 @@ "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", "dev": true, "requires": { - "ansi-regex": "3.0.0", - "ansi-styles": "3.2.0" + "ansi-regex": "^3.0.0", + "ansi-styles": "^3.2.0" } }, "process-nextick-args": { @@ -3223,7 +3223,7 @@ "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "dev": true, "requires": { - "asap": "2.0.6" + "asap": "~2.0.3" } }, "prop-types": { @@ -3232,9 +3232,9 @@ "integrity": "sha1-zq8IMCL8RrSjX2nhPvda7Q1jmFY=", "dev": true, "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1" + "fbjs": "^0.8.16", + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" } }, "pseudomap": { @@ -3255,8 +3255,8 @@ "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", "dev": true, "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" + "is-number": "^3.0.0", + "kind-of": "^4.0.0" }, "dependencies": { "is-number": { @@ -3265,7 +3265,7 @@ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -3274,7 +3274,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -3285,7 +3285,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -3296,9 +3296,9 @@ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", "dev": true, "requires": { - "load-json-file": "2.0.0", - "normalize-package-data": "2.4.0", - "path-type": "2.0.0" + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" } }, "read-pkg-up": { @@ -3307,8 +3307,8 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true, "requires": { - "find-up": "2.1.0", - "read-pkg": "2.0.0" + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" }, "dependencies": { "find-up": { @@ -3317,7 +3317,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "2.0.0" + "locate-path": "^2.0.0" } } } @@ -3328,13 +3328,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "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" } }, "redent": { @@ -3343,8 +3343,8 @@ "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", "dev": true, "requires": { - "indent-string": "3.2.0", - "strip-indent": "2.0.0" + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" }, "dependencies": { "indent-string": { @@ -3361,7 +3361,7 @@ "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { - "is-equal-shallow": "0.1.3" + "is-equal-shallow": "^0.1.3" } }, "remark": { @@ -3370,9 +3370,9 @@ "integrity": "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw==", "dev": true, "requires": { - "remark-parse": "4.0.0", - "remark-stringify": "4.0.0", - "unified": "6.1.6" + "remark-parse": "^4.0.0", + "remark-stringify": "^4.0.0", + "unified": "^6.0.0" } }, "remark-parse": { @@ -3381,21 +3381,21 @@ "integrity": "sha512-XZgICP2gJ1MHU7+vQaRM+VA9HEL3X253uwUM/BGgx3iv6TH2B3bF3B8q00DKcyP9YrJV+/7WOWEWBFF/u8cIsw==", "dev": true, "requires": { - "collapse-white-space": "1.0.3", - "is-alphabetical": "1.0.1", - "is-decimal": "1.0.1", - "is-whitespace-character": "1.0.1", - "is-word-character": "1.0.1", - "markdown-escapes": "1.0.1", - "parse-entities": "1.1.1", - "repeat-string": "1.6.1", - "state-toggle": "1.0.0", + "collapse-white-space": "^1.0.2", + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "is-word-character": "^1.0.0", + "markdown-escapes": "^1.0.0", + "parse-entities": "^1.0.2", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", "trim": "0.0.1", - "trim-trailing-lines": "1.1.0", - "unherit": "1.1.0", - "unist-util-remove-position": "1.1.1", - "vfile-location": "2.0.2", - "xtend": "4.0.1" + "trim-trailing-lines": "^1.0.0", + "unherit": "^1.0.4", + "unist-util-remove-position": "^1.0.0", + "vfile-location": "^2.0.0", + "xtend": "^4.0.1" } }, "remark-stringify": { @@ -3404,20 +3404,20 @@ "integrity": "sha512-xLuyKTnuQer3ke9hkU38SUYLiTmS078QOnoFavztmbt/pAJtNSkNtFgR0U//uCcmG0qnyxao+PDuatQav46F1w==", "dev": true, "requires": { - "ccount": "1.0.2", - "is-alphanumeric": "1.0.0", - "is-decimal": "1.0.1", - "is-whitespace-character": "1.0.1", - "longest-streak": "2.0.2", - "markdown-escapes": "1.0.1", - "markdown-table": "1.1.1", - "mdast-util-compact": "1.0.1", - "parse-entities": "1.1.1", - "repeat-string": "1.6.1", - "state-toggle": "1.0.0", - "stringify-entities": "1.3.1", - "unherit": "1.1.0", - "xtend": "4.0.1" + "ccount": "^1.0.0", + "is-alphanumeric": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "longest-streak": "^2.0.1", + "markdown-escapes": "^1.0.0", + "markdown-table": "^1.1.0", + "mdast-util-compact": "^1.0.0", + "parse-entities": "^1.0.2", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "stringify-entities": "^1.0.1", + "unherit": "^1.0.4", + "xtend": "^4.0.1" } }, "remove-trailing-separator": { @@ -3444,7 +3444,7 @@ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { - "is-finite": "1.0.2" + "is-finite": "^1.0.0" } }, "replace-ext": { @@ -3477,8 +3477,8 @@ "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", "dev": true, "requires": { - "caller-path": "0.1.0", - "resolve-from": "1.0.1" + "caller-path": "^0.1.0", + "resolve-from": "^1.0.0" } }, "resolve": { @@ -3487,7 +3487,7 @@ "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", "dev": true, "requires": { - "path-parse": "1.0.5" + "path-parse": "^1.0.5" } }, "resolve-from": { @@ -3502,8 +3502,8 @@ "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", "dev": true, "requires": { - "exit-hook": "1.1.1", - "onetime": "1.1.0" + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" } }, "rimraf": { @@ -3512,7 +3512,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "run-async": { @@ -3521,7 +3521,7 @@ "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", "dev": true, "requires": { - "is-promise": "2.1.0" + "is-promise": "^2.1.0" } }, "run-parallel": { @@ -3542,7 +3542,7 @@ "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", "dev": true, "requires": { - "rx-lite": "4.0.8" + "rx-lite": "*" } }, "rxjs": { @@ -3574,16 +3574,16 @@ "integrity": "sha512-jykJZVDYWFZ7Hej9bYwynBa+A8yQFksm4zZoli4O+KkqMuQTdlBzkJvtFRER7xufSnB6+XnBS423tjI3Gtrg7Q==", "dev": true, "requires": { - "eslint": "4.14.0", - "eslint-config-semistandard": "12.0.0", + "eslint": "~4.14.0", + "eslint-config-semistandard": "^12.0.0", "eslint-config-standard": "11.0.0-beta.0", - "eslint-config-standard-jsx": "4.0.2", - "eslint-plugin-import": "2.8.0", - "eslint-plugin-node": "5.2.1", - "eslint-plugin-promise": "3.6.0", - "eslint-plugin-react": "7.5.1", - "eslint-plugin-standard": "3.0.1", - "standard-engine": "7.2.0" + "eslint-config-standard-jsx": "~4.0.2", + "eslint-plugin-import": "~2.8.0", + "eslint-plugin-node": "~5.2.1", + "eslint-plugin-promise": "~3.6.0", + "eslint-plugin-react": "~7.5.1", + "eslint-plugin-standard": "~3.0.1", + "standard-engine": "~7.2.0" } }, "semver": { @@ -3610,7 +3610,7 @@ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { - "shebang-regex": "1.0.0" + "shebang-regex": "^1.0.0" } }, "shebang-regex": { @@ -3649,7 +3649,7 @@ "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", "dev": true, "requires": { - "spdx-license-ids": "1.2.2" + "spdx-license-ids": "^1.0.2" } }, "spdx-expression-parse": { @@ -3688,10 +3688,10 @@ "integrity": "sha512-4MTVXRZQjEWeD7tNt8lK1Yh7VLXbmZ/hj34uF9tpSdtYNNPosms2TLCnw/7MUl/rW1Uhx80s7CL8LtBdUtgrtw==", "dev": true, "requires": { - "deglob": "2.1.0", - "get-stdin": "5.0.1", - "minimist": "1.2.0", - "pkg-conf": "2.1.0" + "deglob": "^2.1.0", + "get-stdin": "^5.0.1", + "minimist": "^1.1.0", + "pkg-conf": "^2.0.0" }, "dependencies": { "minimist": { @@ -3714,7 +3714,7 @@ "integrity": "sha1-WdbqOT2HwsDdrBCqDVYbxrpvDhA=", "dev": true, "requires": { - "any-observable": "0.2.0" + "any-observable": "^0.2.0" } }, "string-width": { @@ -3723,9 +3723,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string_decoder": { @@ -3734,7 +3734,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "stringify-entities": { @@ -3743,10 +3743,10 @@ "integrity": "sha1-sVDsLXKsTBtfMktR+2soyc3/BYw=", "dev": true, "requires": { - "character-entities-html4": "1.1.1", - "character-entities-legacy": "1.1.1", - "is-alphanumerical": "1.0.1", - "is-hexadecimal": "1.0.1" + "character-entities-html4": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-hexadecimal": "^1.0.0" } }, "stringify-object": { @@ -3755,9 +3755,9 @@ "integrity": "sha512-O696NF21oLiDy8PhpWu8AEqoZHw++QW6mUv0UvKZe8gWSdSvMXkiLufK7OmnP27Dro4GU5kb9U7JIO0mBuCRQg==", "dev": true, "requires": { - "get-own-enumerable-property-symbols": "2.0.1", - "is-obj": "1.0.1", - "is-regexp": "1.0.0" + "get-own-enumerable-property-symbols": "^2.0.1", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" } }, "strip-ansi": { @@ -3766,7 +3766,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" }, "dependencies": { "ansi-regex": { @@ -3813,45 +3813,45 @@ "integrity": "sha512-56hPH5mTFnk8LzlEuTWq0epa34fHuS54UFYQidBOFt563RJBNi1nz1F2HK2MoT1X1waq47milvRsRahFCCJs/Q==", "dev": true, "requires": { - "autoprefixer": "7.2.6", - "balanced-match": "1.0.0", - "chalk": "2.3.0", - "cosmiconfig": "3.1.0", - "debug": "3.1.0", - "execall": "1.0.0", - "file-entry-cache": "2.0.0", - "get-stdin": "5.0.1", - "globby": "7.1.1", - "globjoin": "0.1.4", - "html-tags": "2.0.0", - "ignore": "3.3.7", - "imurmurhash": "0.1.4", - "known-css-properties": "0.5.0", - "lodash": "4.17.5", - "log-symbols": "2.2.0", - "mathml-tag-names": "2.0.1", - "meow": "4.0.0", - "micromatch": "2.3.11", - "normalize-selector": "0.2.0", - "pify": "3.0.0", - "postcss": "6.0.17", - "postcss-html": "0.12.0", - "postcss-less": "1.1.3", - "postcss-media-query-parser": "0.2.3", - "postcss-reporter": "5.0.0", - "postcss-resolve-nested-selector": "0.1.1", - "postcss-safe-parser": "3.0.1", - "postcss-sass": "0.2.0", - "postcss-scss": "1.0.3", - "postcss-selector-parser": "3.1.1", - "postcss-value-parser": "3.3.0", - "resolve-from": "4.0.0", - "specificity": "0.3.2", - "string-width": "2.1.1", - "style-search": "0.1.0", - "sugarss": "1.0.1", - "svg-tags": "1.0.0", - "table": "4.0.2" + "autoprefixer": "^7.1.2", + "balanced-match": "^1.0.0", + "chalk": "^2.0.1", + "cosmiconfig": "^3.1.0", + "debug": "^3.0.0", + "execall": "^1.0.0", + "file-entry-cache": "^2.0.0", + "get-stdin": "^5.0.1", + "globby": "^7.0.0", + "globjoin": "^0.1.4", + "html-tags": "^2.0.0", + "ignore": "^3.3.3", + "imurmurhash": "^0.1.4", + "known-css-properties": "^0.5.0", + "lodash": "^4.17.4", + "log-symbols": "^2.0.0", + "mathml-tag-names": "^2.0.1", + "meow": "^4.0.0", + "micromatch": "^2.3.11", + "normalize-selector": "^0.2.0", + "pify": "^3.0.0", + "postcss": "^6.0.6", + "postcss-html": "^0.12.0", + "postcss-less": "^1.1.0", + "postcss-media-query-parser": "^0.2.3", + "postcss-reporter": "^5.0.0", + "postcss-resolve-nested-selector": "^0.1.1", + "postcss-safe-parser": "^3.0.1", + "postcss-sass": "^0.2.0", + "postcss-scss": "^1.0.2", + "postcss-selector-parser": "^3.1.0", + "postcss-value-parser": "^3.3.0", + "resolve-from": "^4.0.0", + "specificity": "^0.3.1", + "string-width": "^2.1.0", + "style-search": "^0.1.0", + "sugarss": "^1.0.0", + "svg-tags": "^1.0.0", + "table": "^4.0.1" }, "dependencies": { "cosmiconfig": { @@ -3860,10 +3860,10 @@ "integrity": "sha512-zedsBhLSbPBms+kE7AH4vHg6JsKDz6epSv2/+5XHs8ILHlgDciSJfSWf8sX9aQ52Jb7KI7VswUTsLpR/G0cr2Q==", "dev": true, "requires": { - "is-directory": "0.3.1", - "js-yaml": "3.10.0", - "parse-json": "3.0.0", - "require-from-string": "2.0.1" + "is-directory": "^0.3.1", + "js-yaml": "^3.9.0", + "parse-json": "^3.0.0", + "require-from-string": "^2.0.1" } }, "globby": { @@ -3872,12 +3872,12 @@ "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", "dev": true, "requires": { - "array-union": "1.0.2", - "dir-glob": "2.0.0", - "glob": "7.1.2", - "ignore": "3.3.7", - "pify": "3.0.0", - "slash": "1.0.0" + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" } }, "is-fullwidth-code-point": { @@ -3892,7 +3892,7 @@ "integrity": "sha1-+m9HsY4jgm6tMvJj50TQ4ehH+xM=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "^1.3.1" } }, "resolve-from": { @@ -3907,8 +3907,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "strip-ansi": { @@ -3917,7 +3917,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } } } @@ -3934,9 +3934,9 @@ "integrity": "sha512-XwJO7rIAt/hnBJjOsDgEwNSeqw+5jE22da4pVKaePbojM9bGwhOoAWV7Q2BL8caOg81IlTesmYCEf8s0+2Cc5g==", "dev": true, "requires": { - "lodash": "4.17.5", - "postcss": "6.0.17", - "postcss-sorting": "3.1.0" + "lodash": "^4.17.4", + "postcss": "^6.0.14", + "postcss-sorting": "^3.1.0" } }, "stylelint-scss": { @@ -3945,11 +3945,11 @@ "integrity": "sha512-+joZpza5nQxAyGwzRMancFEl0EH9+1Vy88YzBghRMS0wHulzDPE9fEkBi6ZOlz+I3tYIBI4x9NbqO5/LkbeE3Q==", "dev": true, "requires": { - "lodash": "4.17.5", - "postcss-media-query-parser": "0.2.3", - "postcss-resolve-nested-selector": "0.1.1", - "postcss-selector-parser": "3.1.1", - "postcss-value-parser": "3.3.0" + "lodash": "^4.17.4", + "postcss-media-query-parser": "^0.2.3", + "postcss-resolve-nested-selector": "^0.1.1", + "postcss-selector-parser": "^3.1.1", + "postcss-value-parser": "^3.3.0" } }, "sugarss": { @@ -3958,7 +3958,7 @@ "integrity": "sha512-3qgLZytikQQEVn1/FrhY7B68gPUUGY3R1Q1vTiD5xT+Ti1DP/8iZuwFet9ONs5+bmL8pZoDQ6JrQHVgrNlK6mA==", "dev": true, "requires": { - "postcss": "6.0.17" + "postcss": "^6.0.14" } }, "supports-color": { @@ -3967,7 +3967,7 @@ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "^2.0.0" } }, "svg-tags": { @@ -3988,12 +3988,12 @@ "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", "dev": true, "requires": { - "ajv": "5.5.2", - "ajv-keywords": "2.1.1", - "chalk": "2.3.0", - "lodash": "4.17.5", + "ajv": "^5.2.3", + "ajv-keywords": "^2.1.0", + "chalk": "^2.1.0", + "lodash": "^4.17.4", "slice-ansi": "1.0.0", - "string-width": "2.1.1" + "string-width": "^2.1.1" }, "dependencies": { "is-fullwidth-code-point": { @@ -4008,7 +4008,7 @@ "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0" + "is-fullwidth-code-point": "^2.0.0" } }, "string-width": { @@ -4017,8 +4017,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "strip-ansi": { @@ -4027,7 +4027,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } } } @@ -4050,7 +4050,7 @@ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { - "os-tmpdir": "1.0.2" + "os-tmpdir": "~1.0.2" } }, "trim": { @@ -4083,7 +4083,7 @@ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "prelude-ls": "1.1.2" + "prelude-ls": "~1.1.2" } }, "typedarray": { @@ -4104,8 +4104,8 @@ "integrity": "sha1-a5qu379z3xdWrZ4xbdmBiFhAzX0=", "dev": true, "requires": { - "inherits": "2.0.3", - "xtend": "4.0.1" + "inherits": "^2.0.1", + "xtend": "^4.0.1" } }, "unified": { @@ -4114,13 +4114,13 @@ "integrity": "sha512-pW2f82bCIo2ifuIGYcV12fL96kMMYgw7JKVEgh7ODlrM9rj6vXSY3BV+H6lCcv1ksxynFf582hwWLnA1qRFy4w==", "dev": true, "requires": { - "bail": "1.0.2", - "extend": "3.0.1", - "is-plain-obj": "1.1.0", - "trough": "1.0.1", - "vfile": "2.3.0", - "x-is-function": "1.0.4", - "x-is-string": "0.1.0" + "bail": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^1.1.0", + "trough": "^1.0.0", + "vfile": "^2.0.0", + "x-is-function": "^1.0.4", + "x-is-string": "^0.1.0" } }, "uniq": { @@ -4135,7 +4135,7 @@ "integrity": "sha1-TlUSq/734GFnga7Pex7XUcAK+Qg=", "dev": true, "requires": { - "unist-util-is": "2.1.1" + "unist-util-is": "^2.0.0" } }, "unist-util-is": { @@ -4150,7 +4150,7 @@ "integrity": "sha1-ZtfmpEnm9nIguXarPLi166w55R0=", "dev": true, "requires": { - "array-iterate": "1.1.1" + "array-iterate": "^1.0.0" } }, "unist-util-remove-position": { @@ -4159,7 +4159,7 @@ "integrity": "sha1-WoXBVV/BugwQG4ZwfRXlD6TIcbs=", "dev": true, "requires": { - "unist-util-visit": "1.3.0" + "unist-util-visit": "^1.1.0" } }, "unist-util-stringify-position": { @@ -4174,7 +4174,7 @@ "integrity": "sha512-9ntYcxPFtl44gnwXrQKZ5bMqXMY0ZHzUpqMFiU4zcc8mmf/jzYm8GhYgezuUlX4cJIM1zIDYaO6fG/fI+L6iiQ==", "dev": true, "requires": { - "unist-util-is": "2.1.1" + "unist-util-is": "^2.1.1" } }, "util-deprecate": { @@ -4189,8 +4189,8 @@ "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", "dev": true, "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" + "spdx-correct": "~1.0.0", + "spdx-expression-parse": "~1.0.0" } }, "vfile": { @@ -4199,10 +4199,10 @@ "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", "dev": true, "requires": { - "is-buffer": "1.1.6", + "is-buffer": "^1.1.4", "replace-ext": "1.0.0", - "unist-util-stringify-position": "1.1.1", - "vfile-message": "1.0.0" + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" } }, "vfile-location": { @@ -4217,7 +4217,7 @@ "integrity": "sha512-HPREhzTOB/sNDc9/Mxf8w0FmHnThg5CRSJdR9VRFkD2riqYWs+fuXlj5z8mIpv2LrD7uU41+oPWFOL4Mjlf+dw==", "dev": true, "requires": { - "unist-util-stringify-position": "1.1.1" + "unist-util-stringify-position": "^1.1.1" } }, "whatwg-fetch": { @@ -4232,7 +4232,7 @@ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" } }, "which-module": { @@ -4253,8 +4253,8 @@ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" } }, "wrappy": { @@ -4269,7 +4269,7 @@ "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", "dev": true, "requires": { - "mkdirp": "0.5.1" + "mkdirp": "^0.5.1" } }, "x-is-function": { @@ -4314,18 +4314,18 @@ "integrity": "sha512-B0vRAp1hRX4jgIOWFtjfNjd9OA9RWYZ6tqGA9/I/IrTMsxmKvtWy+ersM+jzpQqbC3YfLzeABPdeTgcJ9eu1qQ==", "dev": true, "requires": { - "cliui": "4.1.0", - "decamelize": "2.0.0", - "find-up": "3.0.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "4.0.0", - "yargs-parser": "10.1.0" + "cliui": "^4.0.0", + "decamelize": "^2.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^10.1.0" }, "dependencies": { "decamelize": { @@ -4343,7 +4343,7 @@ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { - "locate-path": "3.0.0" + "locate-path": "^3.0.0" } }, "is-fullwidth-code-point": { @@ -4358,8 +4358,8 @@ "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { - "p-locate": "3.0.0", - "path-exists": "3.0.0" + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" } }, "p-limit": { @@ -4368,7 +4368,7 @@ "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", "dev": true, "requires": { - "p-try": "2.0.0" + "p-try": "^2.0.0" } }, "p-locate": { @@ -4377,7 +4377,7 @@ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { - "p-limit": "2.0.0" + "p-limit": "^2.0.0" } }, "p-try": { @@ -4398,8 +4398,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "strip-ansi": { @@ -4408,7 +4408,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } } } @@ -4419,7 +4419,7 @@ "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", "dev": true, "requires": { - "camelcase": "4.1.0" + "camelcase": "^4.1.0" } } } diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js index f769879a958..8a9e77920cd 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js @@ -3,7 +3,6 @@ var exec = require('child_process').exec; var find = require('find'); var fs = require('fs'); var gulp = require('gulp'); -var gulpSequence = require('gulp-sequence'); var path = require('path'); var replace = require('gulp-replace'); @@ -71,7 +70,7 @@ function extensionDependenciesTask (cb) { return utils.spawnTaskForExtension('requirejs', requireJsTask, extension); }); - sequence.length ? gulpSequence.apply(null, sequence)(function () { + sequence.length ? gulp.series.apply(null, sequence)(function () { // Restore the original extension (used in the CLI) as the current extension // before marking the task as done utils.setCurrentExtension(originalExtension); @@ -205,7 +204,7 @@ function requireJsTask (cb) { ); } - gulpSequence.apply(null, sequence)(cb); + gulp.series.apply(null, sequence)(cb); } else { console.log('Not eligible for this task, skipping...'); cb(); diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js index 6f47e947cc1..ef9dc6b7974 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js @@ -1,7 +1,6 @@ var bulk = require('gulp-sass-bulk-import'); var civicrmScssRoot = require('civicrm-scssroot')(); var gulp = require('gulp'); -var gulpSequence = require('gulp-sequence'); var path = require('path'); var sass = require('gulp-sass'); var stripCssComments = require('gulp-strip-css-comments'); @@ -20,7 +19,7 @@ module.exports = [ utils.spawnTaskForExtension('sass:main', mainTask) ], 'sass'); - gulpSequence.apply(null, sequence)(cb); + gulp.series.apply(null, sequence)(cb); } else { console.log('Not eligible for this task, skipping...'); cb(); diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js index 7d4e7ec1861..d46a24069d7 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js @@ -1,7 +1,5 @@ var gulp = require('gulp'); -var gulpSequence = require('gulp-sequence'); var path = require('path'); - var test = require('../test'); var utils = require('../utils'); @@ -16,7 +14,7 @@ module.exports = [ utils.spawnTaskForExtension('test:main', mainTask) ], 'test'); - gulpSequence.apply(null, sequence)(cb); + gulp.series.apply(null, sequence)(cb); } else { console.log('Not eligible for this task, skipping...'); cb(); diff --git a/uk.co.compucorp.civicrm.hrcore/gulpfile.js b/uk.co.compucorp.civicrm.hrcore/gulpfile.js index 1792d93856f..4542adefda1 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulpfile.js +++ b/uk.co.compucorp.civicrm.hrcore/gulpfile.js @@ -1,7 +1,6 @@ var _ = require('lodash'); var find = require('find'); var gulp = require('gulp'); -var gulpSequence = require('gulp-sequence'); var utils = require('./gulp/utils'); var tasks = getMainTasks(); @@ -10,21 +9,17 @@ _.each(tasks, function (fn, name) { gulp.task(name, fn); }); -gulp.task('watch', function (cb) { - gulpSequence( - utils.spawnTaskForExtension('sass:watch', tasks['sass:watch']), - utils.spawnTaskForExtension('requirejs:watch', tasks['requirejs:watch']), - utils.spawnTaskForExtension('test:watch', tasks['test:watch']) - )(cb); -}); +gulp.task('watch', gulp.series( + utils.spawnTaskForExtension('sass:watch', tasks['sass:watch']), + utils.spawnTaskForExtension('requirejs:watch', tasks['requirejs:watch']), + utils.spawnTaskForExtension('test:watch', tasks['test:watch']) +)); -gulp.task('build', function (cb) { - gulpSequence( - utils.spawnTaskForExtension('sass', tasks['sass']), - utils.spawnTaskForExtension('requirejs', tasks['requirejs']), - utils.spawnTaskForExtension('test', tasks['test']) - )(cb); -}); +gulp.task('build', gulp.series( + utils.spawnTaskForExtension('sass', tasks['sass']), + utils.spawnTaskForExtension('requirejs', tasks['requirejs']), + utils.spawnTaskForExtension('test', tasks['test']) +)); /** * Gets all the task listed in the files under the gulp/task folder diff --git a/uk.co.compucorp.civicrm.hrcore/package-lock.json b/uk.co.compucorp.civicrm.hrcore/package-lock.json index 7889e910649..01183b8ea47 100644 --- a/uk.co.compucorp.civicrm.hrcore/package-lock.json +++ b/uk.co.compucorp.civicrm.hrcore/package-lock.json @@ -39,7 +39,7 @@ "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", "dev": true, "requires": { - "mime-types": "2.1.18", + "mime-types": "~2.1.18", "negotiator": "0.6.1" } }, @@ -55,7 +55,7 @@ "integrity": "sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ=", "dev": true, "requires": { - "acorn": "4.0.13" + "acorn": "^4.0.3" }, "dependencies": { "acorn": { @@ -85,7 +85,7 @@ "integrity": "sha512-c+R/U5X+2zz2+UCrCFv6odQzJdoqI+YecuhnAJLa1zYaMc13zPfwMwZrr91Pd1DYNo/yPRbiM4WVf9whgwFsIg==", "dev": true, "requires": { - "es6-promisify": "5.0.0" + "es6-promisify": "^5.0.0" } }, "ajv": { @@ -94,10 +94,10 @@ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.1.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "ajv-keywords": { @@ -112,9 +112,9 @@ "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { - "kind-of": "3.2.2", - "longest": "1.0.1", - "repeat-string": "1.6.1" + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" }, "dependencies": { "kind-of": { @@ -123,7 +123,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -141,11 +141,11 @@ "dev": true, "optional": true, "requires": { - "bitsyntax": "0.0.4", - "bluebird": "3.5.1", + "bitsyntax": "~0.0.4", + "bluebird": "^3.4.6", "buffer-more-ints": "0.0.2", - "readable-stream": "1.1.14", - "safe-buffer": "5.1.1" + "readable-stream": "1.x >=1.1.9", + "safe-buffer": "^5.0.1" }, "dependencies": { "isarray": { @@ -162,10 +162,10 @@ "dev": true, "optional": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -183,7 +183,7 @@ "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "dev": true, "requires": { - "ansi-wrap": "0.1.0" + "ansi-wrap": "^0.1.0" } }, "ansi-cyan": { @@ -243,8 +243,25 @@ "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", "dev": true, "requires": { - "micromatch": "3.1.5", - "normalize-path": "2.1.1" + "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" + }, + "dependencies": { + "buffer-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", + "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", + "dev": true + } } }, "aproba": { @@ -260,13 +277,13 @@ "dev": true }, "are-we-there-yet": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", - "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.3" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, "arr-diff": { @@ -275,24 +292,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", @@ -317,8 +346,43 @@ "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", "dev": true, "requires": { - "define-properties": "1.1.2", - "es-abstract": "1.11.0" + "define-properties": "^1.1.2", + "es-abstract": "^1.7.0" + } + }, + "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": { @@ -327,13 +391,32 @@ "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", "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-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "1.0.3" + "array-uniq": "^1.0.1" } }, "array-uniq": { @@ -378,9 +461,9 @@ "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", "dev": true, "requires": { - "bn.js": "4.11.8", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" } }, "assert": { @@ -417,7 +500,7 @@ "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", "dev": true, "requires": { - "lodash": "4.17.10" + "lodash": "^4.14.0" } }, "async-chain-proxy": { @@ -426,7 +509,19 @@ "integrity": "sha512-JYUzBrCWkKdBQ02H2f1N8xR4JXeWGcw2V8i2AzJjeXGTz40rqqbKkDmQieL8iHNp70W1M44WXqFsvk4Cx49H1Q==", "dev": true, "requires": { - "babel-polyfill": "6.26.0" + "babel-polyfill": "^6.23.0" + } + }, + "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": { @@ -447,6 +542,15 @@ "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", "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" + } + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -488,7 +592,7 @@ "dev": true, "optional": true, "requires": { - "debug": "2.6.9" + "debug": "^2.2.0" } } } @@ -499,9 +603,9 @@ "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "core-js": "2.5.5", - "regenerator-runtime": "0.10.5" + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "regenerator-runtime": "^0.10.5" }, "dependencies": { "core-js": { @@ -518,8 +622,8 @@ "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { - "core-js": "2.5.5", - "regenerator-runtime": "0.11.1" + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" }, "dependencies": { "core-js": { @@ -536,6 +640,23 @@ } } }, + "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" + } + }, "backo2": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", @@ -548,7 +669,7 @@ "integrity": "sha512-sENfpossNAbVKZjTzBU6bkbR1vIb7t6brjqH9ZMEIYh/RyCIGFM3BSgERzh+tdwpAVXHSbIV1gQRrtzBYzUrjw==", "dev": true, "requires": { - "react": "15.6.2" + "react": "^15.6.2" } }, "backstopjs": { @@ -557,35 +678,35 @@ "integrity": "sha512-VLpW9z8T3AbKsFIh3RcvV4Fuo0zFWTRzOpiincO9zheqlI6tXskZeHwotTc3dsBYbI1YSxMPyn8Ytam7eN07Dg==", "dev": true, "requires": { - "backstop-twentytwenty": "1.0.4", - "casperjs": "1.1.4", - "chalk": "1.1.3", + "backstop-twentytwenty": "^1.0.4", + "casperjs": "^1.1.0-beta5", + "chalk": "^1.1.3", "chromy": "0.5.11", - "fs-extra": "0.30.0", - "jump.js": "1.0.2", - "junitwriter": "0.3.1", - "lodash": "4.17.10", - "minimist": "1.2.0", - "node-resemble-js": "0.2.0", + "fs-extra": "^0.30.0", + "jump.js": "^1.0.2", + "junitwriter": "~0.3.1", + "lodash": "^4.17.4", + "minimist": "^1.2.0", + "node-resemble-js": "^0.2.0", "object-hash": "1.1.5", "open": "0.0.5", - "os": "0.1.1", - "p-map": "1.2.0", - "path": "0.12.7", - "phantomjs-prebuilt": "2.1.16", - "puppeteer": "1.3.0", - "react": "15.6.2", - "react-dom": "15.6.2", - "react-modal": "3.4.4", - "react-redux": "5.0.7", - "react-sticky": "6.0.2", - "react-toggle-button": "2.2.0", - "redux": "3.7.2", - "sinon": "1.17.7", - "styled-components": "2.4.0", - "temp": "0.8.3", - "webpack": "3.11.0", - "webpack-dev-server": "2.11.2" + "os": "^0.1.1", + "p-map": "^1.1.1", + "path": "^0.12.7", + "phantomjs-prebuilt": "^2.1.7", + "puppeteer": "^1.2.0-next.1523485686787", + "react": "^15.6.1", + "react-dom": "^15.6.1", + "react-modal": "^3.0.3", + "react-redux": "^5.0.6", + "react-sticky": "^6.0.1", + "react-toggle-button": "^2.1.0", + "redux": "^3.7.2", + "sinon": "^1.17.7", + "styled-components": "^2.1.2", + "temp": "^0.8.3", + "webpack": "^3.5.6", + "webpack-dev-server": "^2.7.1" } }, "balanced-match": { @@ -600,13 +721,13 @@ "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { - "cache-base": "1.0.1", - "class-utils": "0.3.6", - "component-emitter": "1.2.1", - "define-property": "1.0.0", - "isobject": "3.0.1", - "mixin-deep": "1.3.0", - "pascalcase": "0.1.1" + "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" } }, "base64-arraybuffer": { @@ -640,15 +761,9 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, - "beeper": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", - "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", - "dev": true - }, "better-assert": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", @@ -677,9 +792,9 @@ "dev": true }, "binaryextensions": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-1.0.1.tgz", - "integrity": "sha1-HmN0iLNbWL2l9HdL+WpSEqjJB1U=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.1.1.tgz", + "integrity": "sha512-XBaoWE9RW8pPdPQNibZsW2zh8TW6gcarXp1FZPwT8Uop8ScSNldJEWf2k9l3HeTqdrEwsOsFcq74RiJECW34yA==", "dev": true }, "bitsyntax": { @@ -699,7 +814,7 @@ "dev": true, "optional": true, "requires": { - "readable-stream": "2.0.6" + "readable-stream": "~2.0.5" }, "dependencies": { "readable-stream": { @@ -709,12 +824,12 @@ "dev": true, "optional": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "0.10.31", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -738,7 +853,7 @@ "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "bluebird": { @@ -766,15 +881,15 @@ "dev": true, "requires": { "bytes": "3.0.0", - "content-type": "1.0.4", + "content-type": "~1.0.4", "debug": "2.6.9", - "depd": "1.1.2", - "http-errors": "1.6.3", + "depd": "~1.1.1", + "http-errors": "~1.6.2", "iconv-lite": "0.4.19", - "on-finished": "2.3.0", + "on-finished": "~2.3.0", "qs": "6.5.1", "raw-body": "2.3.2", - "type-is": "1.6.16" + "type-is": "~1.6.15" }, "dependencies": { "iconv-lite": { @@ -791,12 +906,12 @@ "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", "dev": true, "requires": { - "array-flatten": "2.1.1", - "deep-equal": "1.0.1", - "dns-equal": "1.0.0", - "dns-txt": "2.0.2", - "multicast-dns": "6.2.3", - "multicast-dns-service-types": "1.1.0" + "array-flatten": "^2.1.0", + "deep-equal": "^1.0.1", + "dns-equal": "^1.0.0", + "dns-txt": "^2.0.2", + "multicast-dns": "^6.0.1", + "multicast-dns-service-types": "^1.1.0" } }, "boom": { @@ -805,7 +920,7 @@ "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "dev": true, "requires": { - "hoek": "4.2.1" + "hoek": "4.x.x" } }, "brace-expansion": { @@ -814,7 +929,7 @@ "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -824,17 +939,17 @@ "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.1.1", - "split-string": "3.1.0", - "to-regex": "3.0.1" + "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" } }, "brorand": { @@ -849,12 +964,12 @@ "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { - "buffer-xor": "1.0.3", - "cipher-base": "1.0.4", - "create-hash": "1.2.0", - "evp_bytestokey": "1.0.3", - "inherits": "2.0.3", - "safe-buffer": "5.1.1" + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "browserify-cipher": { @@ -863,9 +978,9 @@ "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", "dev": true, "requires": { - "browserify-aes": "1.2.0", - "browserify-des": "1.0.1", - "evp_bytestokey": "1.0.3" + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" } }, "browserify-des": { @@ -874,9 +989,9 @@ "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", "dev": true, "requires": { - "cipher-base": "1.0.4", - "des.js": "1.0.0", - "inherits": "2.0.3" + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1" } }, "browserify-rsa": { @@ -885,8 +1000,8 @@ "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { - "bn.js": "4.11.8", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" } }, "browserify-sign": { @@ -895,13 +1010,13 @@ "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", "dev": true, "requires": { - "bn.js": "4.11.8", - "browserify-rsa": "4.0.1", - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "elliptic": "6.4.0", - "inherits": "2.0.3", - "parse-asn1": "5.1.1" + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" } }, "browserify-zlib": { @@ -910,7 +1025,7 @@ "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", "dev": true, "requires": { - "pako": "1.0.6" + "pako": "~1.0.5" } }, "buffer": { @@ -919,8 +1034,8 @@ "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==", "dev": true, "requires": { - "base64-js": "1.3.0", - "ieee754": "1.1.11" + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" } }, "buffer-equal": { @@ -987,15 +1102,15 @@ "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" + "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" } }, "callsite": { @@ -1016,9 +1131,9 @@ "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", "dev": true, "requires": { - "camelcase": "4.1.0", - "map-obj": "2.0.0", - "quick-lru": "1.1.0" + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" } }, "caseless": { @@ -1039,8 +1154,8 @@ "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", "dev": true, "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" }, "dependencies": { "lazy-cache": { @@ -1057,11 +1172,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "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" } }, "child-process-promise": { @@ -1070,9 +1185,9 @@ "integrity": "sha1-RzChHvYQ+tRQuPIjx50x172tgHQ=", "dev": true, "requires": { - "cross-spawn": "4.0.2", - "node-version": "1.1.3", - "promise-polyfill": "6.1.0" + "cross-spawn": "^4.0.2", + "node-version": "^1.0.0", + "promise-polyfill": "^6.0.1" } }, "chokidar": { @@ -1081,18 +1196,18 @@ "integrity": "sha512-zW8iXYZtXMx4kux/nuZVXjkLP+CyIK5Al5FHnj1OgTKGZfp4Oy6/ymtMSKFv3GD8DviEmUPmJg9eFdJ/JzudMg==", "dev": true, "requires": { - "anymatch": "2.0.0", - "async-each": "1.0.1", - "braces": "2.3.0", - "fsevents": "1.2.2", - "glob-parent": "3.1.0", - "inherits": "2.0.3", - "is-binary-path": "1.0.1", - "is-glob": "4.0.0", - "normalize-path": "2.1.1", - "path-is-absolute": "1.0.1", - "readdirp": "2.1.0", - "upath": "1.0.4" + "anymatch": "^2.0.0", + "async-each": "^1.0.0", + "braces": "^2.3.0", + "fsevents": "^1.1.2", + "glob-parent": "^3.1.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^2.1.1", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0", + "upath": "^1.0.0" }, "dependencies": { "is-glob": { @@ -1101,7 +1216,7 @@ "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", "dev": true, "requires": { - "is-extglob": "2.1.1" + "is-extglob": "^2.1.1" } } } @@ -1112,14 +1227,14 @@ "integrity": "sha512-E+kTHlGgtitPPu8Rci0E4XBasirKtTn6DjqFn8tTLp/7xCUzqb6lig9Il+HLkcudzKvT/aLxJbzbyNCe03w1AA==", "dev": true, "requires": { - "@types/core-js": "0.9.46", - "@types/mkdirp": "0.3.29", - "@types/node": "9.6.7", - "@types/rimraf": "0.0.28", - "is-wsl": "1.1.0", - "lighthouse-logger": "1.0.1", + "@types/core-js": "^0.9.41", + "@types/mkdirp": "^0.3.29", + "@types/node": "^9.3.0", + "@types/rimraf": "^0.0.28", + "is-wsl": "^1.1.0", + "lighthouse-logger": "^1.0.0", "mkdirp": "0.5.1", - "rimraf": "2.6.2" + "rimraf": "^2.6.1" } }, "chrome-remote-interface": { @@ -1128,8 +1243,8 @@ "integrity": "sha512-JACehSDwNwanDgWIO1Nvji9Td4KyCUUbQze10dNb8DAG72LmqH3uz7vdgujFKjmax8Q6yu1Xwapb8GODZykTDQ==", "dev": true, "requires": { - "commander": "2.11.0", - "ws": "3.3.3" + "commander": "2.11.x", + "ws": "3.3.x" } }, "chromy": { @@ -1138,12 +1253,12 @@ "integrity": "sha512-SBz5/xPYgeQiwFGMixPNQcbgnzsRHGCJnZKNJ5S0SmauSUY77/mqA8NjotQa12SZ3tZy0NX2gyGP41BAUWI6Rg==", "dev": true, "requires": { - "async-chain-proxy": "0.1.5", - "babel-runtime": "6.26.0", - "chrome-launcher": "0.10.2", - "chrome-remote-interface": "0.25.5", - "jimp": "0.2.28", - "uuid": "3.2.1" + "async-chain-proxy": "^0.1.5", + "babel-runtime": "^6.26.0", + "chrome-launcher": "^0.10.2", + "chrome-remote-interface": "^0.25.5", + "jimp": "^0.2.28", + "uuid": "^3.2.1" } }, "cipher-base": { @@ -1152,8 +1267,8 @@ "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", "dev": true, "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.1" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "circular-json": { @@ -1168,14 +1283,15 @@ "integrity": "sha1-prn+pVahci1Km3ChHGSHVXGmNKg=", "dev": true, "requires": { - "child-process-promise": "2.2.1" + "child-process-promise": "^2.1.3" } }, "civicrm-scssroot": { "version": "git://github.com/totten/civicrm-scssroot.git#3fc126e91ea503420daedc82425e9b85085707f6", + "from": "git://github.com/totten/civicrm-scssroot.git#v0.1.1", "dev": true, "requires": { - "civicrm-cv": "0.1.2" + "civicrm-cv": "^0.1.2" } }, "class-utils": { @@ -1184,10 +1300,10 @@ "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { - "arr-union": "3.1.0", - "define-property": "0.2.5", - "isobject": "3.0.1", - "static-extend": "0.1.2" + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" }, "dependencies": { "define-property": { @@ -1196,7 +1312,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "is-accessor-descriptor": { @@ -1205,7 +1321,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -1214,7 +1330,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -1225,7 +1341,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -1234,7 +1350,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -1245,9 +1361,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" } }, "kind-of": { @@ -1264,15 +1380,15 @@ "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", + "center-align": "^0.1.1", + "right-align": "^0.1.1", "wordwrap": "0.0.2" } }, "clone": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.3.tgz", - "integrity": "sha1-KY1+IjFmD0DAA8LtMUDezz9TCF8=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", + "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", "dev": true }, "clone-buffer": { @@ -1282,20 +1398,52 @@ "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=", + "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 }, "cloneable-readable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.0.0.tgz", - "integrity": "sha1-pikNQT8hemEjL5XkWP84QYz7ARc=", + "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.3", - "process-nextick-args": "1.0.7", - "through2": "2.0.3" + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" + }, + "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 + }, + "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" + } + } } }, "co": { @@ -1310,16 +1458,42 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "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", "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.1" + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "dev": true, + "requires": { + "color-name": "1.1.1" } }, + "color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=", + "dev": true + }, "color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", @@ -1338,7 +1512,7 @@ "integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=", "dev": true, "requires": { - "lodash": "4.17.10" + "lodash": "^4.5.0" } }, "combined-stream": { @@ -1347,7 +1521,7 @@ "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "commander": { @@ -1380,7 +1554,7 @@ "integrity": "sha1-DRAgq5JLL9tNYnmHXH1tq6a6p6k=", "dev": true, "requires": { - "mime-db": "1.33.0" + "mime-db": ">= 1.33.0 < 2" } }, "compression": { @@ -1389,13 +1563,13 @@ "integrity": "sha1-qv+81qr4VLROuygDU9WtFlH1mmk=", "dev": true, "requires": { - "accepts": "1.3.5", + "accepts": "~1.3.4", "bytes": "3.0.0", - "compressible": "2.0.13", + "compressible": "~2.0.13", "debug": "2.6.9", - "on-headers": "1.0.1", + "on-headers": "~1.0.1", "safe-buffer": "5.1.1", - "vary": "1.1.2" + "vary": "~1.1.2" } }, "concat-map": { @@ -1410,9 +1584,9 @@ "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" } }, "connect": { @@ -1423,7 +1597,7 @@ "requires": { "debug": "2.6.9", "finalhandler": "1.1.0", - "parseurl": "1.3.2", + "parseurl": "~1.3.2", "utils-merge": "1.0.1" }, "dependencies": { @@ -1434,12 +1608,12 @@ "dev": true, "requires": { "debug": "2.6.9", - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" } }, "statuses": { @@ -1462,7 +1636,7 @@ "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", "dev": true, "requires": { - "date-now": "0.1.4" + "date-now": "^0.1.4" } }, "console-control-strings": { @@ -1489,6 +1663,12 @@ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "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 + }, "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", @@ -1507,6 +1687,16 @@ "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-js": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", @@ -1525,8 +1715,8 @@ "integrity": "sha512-iZvCCg8XqHQZ1ioNBTzXS/cQSkqkqcPs8xSX4upNB+DAk9Ht3uzQf2J32uAHNCne8LDmKr29AgZrEs4oIrwLuQ==", "dev": true, "requires": { - "bn.js": "4.11.8", - "elliptic": "6.4.0" + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" } }, "create-hash": { @@ -1535,11 +1725,11 @@ "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { - "cipher-base": "1.0.4", - "inherits": "2.0.3", - "md5.js": "1.3.4", - "ripemd160": "2.0.2", - "sha.js": "2.4.11" + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" } }, "create-hmac": { @@ -1548,12 +1738,12 @@ "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { - "cipher-base": "1.0.4", - "create-hash": "1.2.0", - "inherits": "2.0.3", - "ripemd160": "2.0.2", - "safe-buffer": "5.1.1", - "sha.js": "2.4.11" + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" } }, "create-react-class": { @@ -1562,9 +1752,9 @@ "integrity": "sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg==", "dev": true, "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1" + "fbjs": "^0.8.9", + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" }, "dependencies": { "object-assign": { @@ -1581,8 +1771,8 @@ "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", "dev": true, "requires": { - "lru-cache": "4.1.2", - "which": "1.3.0" + "lru-cache": "^4.0.1", + "which": "^1.2.9" } }, "cryptiles": { @@ -1591,7 +1781,7 @@ "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", "dev": true, "requires": { - "boom": "5.2.0" + "boom": "5.x.x" }, "dependencies": { "boom": { @@ -1600,7 +1790,7 @@ "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", "dev": true, "requires": { - "hoek": "4.2.1" + "hoek": "4.x.x" } } } @@ -1611,17 +1801,17 @@ "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", "dev": true, "requires": { - "browserify-cipher": "1.0.1", - "browserify-sign": "4.0.4", - "create-ecdh": "4.0.1", - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "diffie-hellman": "5.0.3", - "inherits": "2.0.3", - "pbkdf2": "3.0.16", - "public-encrypt": "4.0.2", - "randombytes": "2.0.6", - "randomfill": "1.0.4" + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" } }, "css-color-keywords": { @@ -1636,9 +1826,9 @@ "integrity": "sha512-akxvxNPNm+Qb7kGswgWhD8rLENM8857NVIn1lX0Dr9BQuju8vx6ypet7KvwvqBC01FUEne5V/jvt7FJXWJPtgw==", "dev": true, "requires": { - "css-color-keywords": "1.0.0", - "fbjs": "0.8.16", - "postcss-value-parser": "3.3.0" + "css-color-keywords": "^1.0.0", + "fbjs": "^0.8.5", + "postcss-value-parser": "^3.3.0" } }, "currently-unhandled": { @@ -1647,7 +1837,7 @@ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "array-find-index": "1.0.2" + "array-find-index": "^1.0.1" } }, "custom-event": { @@ -1662,7 +1852,7 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "0.10.42" + "es5-ext": "^0.10.9" } }, "dashdash": { @@ -1671,7 +1861,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "data-uri-to-buffer": { @@ -1699,8 +1889,8 @@ "integrity": "sha1-8ny+56ASu/uC6gUVYtOXf2CT27E=", "dev": true, "requires": { - "get-stdin": "6.0.0", - "meow": "5.0.0" + "get-stdin": "*", + "meow": "*" } }, "debug": { @@ -1724,8 +1914,8 @@ "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", "dev": true, "requires": { - "decamelize": "1.2.0", - "map-obj": "1.0.1" + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" }, "dependencies": { "map-obj": { @@ -1755,13 +1945,44 @@ "dev": true, "optional": true }, + "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": { + "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 + } + } + }, + "default-resolution": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", + "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", + "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.3" + "clone": "^1.0.2" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + } } }, "define-properties": { @@ -1770,8 +1991,8 @@ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", "dev": true, "requires": { - "foreach": "2.0.5", - "object-keys": "1.0.11" + "foreach": "^2.0.5", + "object-keys": "^1.0.8" }, "dependencies": { "object-keys": { @@ -1788,7 +2009,7 @@ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "is-descriptor": "1.0.2" + "is-descriptor": "^1.0.0" } }, "degenerator": { @@ -1798,9 +2019,9 @@ "dev": true, "optional": true, "requires": { - "ast-types": "0.11.3", - "escodegen": "1.9.1", - "esprima": "3.1.3" + "ast-types": "0.x.x", + "escodegen": "1.x.x", + "esprima": "3.x.x" } }, "del": { @@ -1809,12 +2030,12 @@ "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", "dev": true, "requires": { - "globby": "6.1.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.1", - "p-map": "1.2.0", - "pify": "3.0.0", - "rimraf": "2.6.2" + "globby": "^6.1.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "p-map": "^1.1.1", + "pify": "^3.0.0", + "rimraf": "^2.2.8" } }, "delayed-stream": { @@ -1835,20 +2056,14 @@ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "dev": true }, - "deprecated": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/deprecated/-/deprecated-0.0.1.tgz", - "integrity": "sha1-+cmvVGSvoeepcUWKi97yqpTVuxk=", - "dev": true - }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", "dev": true, "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" } }, "destroy": { @@ -1869,7 +2084,7 @@ "integrity": "sha1-oIUEZefD68/5eda2U1rTRLgN18U=", "dev": true, "requires": { - "get-installed-path": "2.1.1" + "get-installed-path": "^2.0.3" } }, "detect-node": { @@ -1890,9 +2105,9 @@ "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { - "bn.js": "4.11.8", - "miller-rabin": "4.0.1", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" } }, "dns-equal": { @@ -1907,8 +2122,8 @@ "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", "dev": true, "requires": { - "ip": "1.1.5", - "safe-buffer": "5.1.1" + "ip": "^1.1.0", + "safe-buffer": "^5.0.1" } }, "dns-txt": { @@ -1917,7 +2132,7 @@ "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", "dev": true, "requires": { - "buffer-indexof": "1.1.1" + "buffer-indexof": "^1.0.0" } }, "dom-serialize": { @@ -1926,10 +2141,10 @@ "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", "dev": true, "requires": { - "custom-event": "1.0.1", - "ent": "2.2.0", - "extend": "3.0.1", - "void-elements": "2.0.1" + "custom-event": "~1.0.0", + "ent": "~2.2.0", + "extend": "^3.0.0", + "void-elements": "^2.0.0" } }, "dom-walk": { @@ -1951,39 +2166,26 @@ "dev": true, "optional": true }, - "duplexer2": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", - "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", + "duplexify": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", + "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", "dev": true, "requires": { - "readable-stream": "1.1.14" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "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.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "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 - } + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.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" } }, "ecc-jsbn": { @@ -1993,9 +2195,15 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, + "editions": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz", + "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==", + "dev": true + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -2008,13 +2216,13 @@ "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "dev": true, "requires": { - "bn.js": "4.11.8", - "brorand": "1.1.0", - "hash.js": "1.1.3", - "hmac-drbg": "1.0.1", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1", - "minimalistic-crypto-utils": "1.0.1" + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" } }, "emojis-list": { @@ -2035,27 +2243,16 @@ "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", "dev": true, "requires": { - "iconv-lite": "0.4.21" + "iconv-lite": "~0.4.13" } }, "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.3" - }, - "dependencies": { - "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.0.2" - } - } + "once": "^1.4.0" } }, "engine.io": { @@ -2064,13 +2261,13 @@ "integrity": "sha512-D06ivJkYxyRrcEe0bTpNnBQNgP9d3xog+qZlLbui8EsMr/DouQpf5o9FzJnWYHEYE0YsFHllUv2R1dkgYZXHcA==", "dev": true, "requires": { - "accepts": "1.3.5", + "accepts": "~1.3.4", "base64id": "1.0.0", "cookie": "0.3.1", - "debug": "3.1.0", - "engine.io-parser": "2.1.2", - "uws": "9.14.0", - "ws": "3.3.3" + "debug": "~3.1.0", + "engine.io-parser": "~2.1.0", + "uws": "~9.14.0", + "ws": "~3.3.1" }, "dependencies": { "debug": { @@ -2092,14 +2289,14 @@ "requires": { "component-emitter": "1.2.1", "component-inherit": "0.0.3", - "debug": "3.1.0", - "engine.io-parser": "2.1.2", + "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.3", - "xmlhttprequest-ssl": "1.5.5", + "ws": "~3.3.1", + "xmlhttprequest-ssl": "~1.5.4", "yeast": "0.1.2" }, "dependencies": { @@ -2121,10 +2318,10 @@ "dev": true, "requires": { "after": "0.8.2", - "arraybuffer.slice": "0.0.7", + "arraybuffer.slice": "~0.0.7", "base64-arraybuffer": "0.1.5", "blob": "0.0.4", - "has-binary2": "1.0.2" + "has-binary2": "~1.0.2" } }, "enhanced-resolve": { @@ -2133,10 +2330,10 @@ "integrity": "sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "memory-fs": "0.4.1", - "object-assign": "4.1.1", - "tapable": "0.2.8" + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "object-assign": "^4.0.1", + "tapable": "^0.2.7" }, "dependencies": { "object-assign": { @@ -2159,7 +2356,7 @@ "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", "dev": true, "requires": { - "prr": "1.0.1" + "prr": "~1.0.1" } }, "error-ex": { @@ -2168,7 +2365,7 @@ "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true, "requires": { - "is-arrayish": "0.2.1" + "is-arrayish": "^0.2.1" } }, "es-abstract": { @@ -2177,11 +2374,11 @@ "integrity": "sha512-ZnQrE/lXTTQ39ulXZ+J1DTFazV9qBy61x2bY071B+qGco8Z8q1QddsLdt/EF8Ai9hcWH72dWS0kFqXLxOxqslA==", "dev": true, "requires": { - "es-to-primitive": "1.1.1", - "function-bind": "1.1.1", - "has": "1.0.1", - "is-callable": "1.1.3", - "is-regex": "1.0.4" + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" } }, "es-to-primitive": { @@ -2190,9 +2387,9 @@ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", "dev": true, "requires": { - "is-callable": "1.1.3", - "is-date-object": "1.0.1", - "is-symbol": "1.0.1" + "is-callable": "^1.1.1", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.1" } }, "es5-ext": { @@ -2201,9 +2398,9 @@ "integrity": "sha512-AJxO1rmPe1bDEfSR6TJ/FgMFYuTBhR5R57KW58iCkYACMyFbrkqVyzXSurYoScDGvgyMpk7uRF/lPUPPTmsRSA==", "dev": true, "requires": { - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1", - "next-tick": "1.0.0" + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "1" } }, "es6-iterator": { @@ -2212,9 +2409,9 @@ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42", - "es6-symbol": "3.1.1" + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" } }, "es6-map": { @@ -2223,12 +2420,12 @@ "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42", - "es6-iterator": "2.0.3", - "es6-set": "0.1.5", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", + "es6-set": "~0.1.5", + "es6-symbol": "~3.1.1", + "event-emitter": "~0.3.5" } }, "es6-promise": { @@ -2243,7 +2440,7 @@ "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "dev": true, "requires": { - "es6-promise": "4.2.4" + "es6-promise": "^4.0.3" } }, "es6-set": { @@ -2252,11 +2449,11 @@ "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42", - "es6-iterator": "2.0.3", + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" + "event-emitter": "~0.3.5" } }, "es6-symbol": { @@ -2265,8 +2462,8 @@ "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42" + "d": "1", + "es5-ext": "~0.10.14" } }, "es6-weak-map": { @@ -2275,10 +2472,10 @@ "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42", - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" + "d": "1", + "es5-ext": "^0.10.14", + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" } }, "escape-html": { @@ -2300,11 +2497,11 @@ "dev": true, "optional": true, "requires": { - "esprima": "3.1.3", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.6.1" + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" }, "dependencies": { "source-map": { @@ -2322,10 +2519,10 @@ "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", "dev": true, "requires": { - "es6-map": "0.1.5", - "es6-weak-map": "2.0.2", - "esrecurse": "4.2.1", - "estraverse": "4.2.0" + "es6-map": "^0.1.3", + "es6-weak-map": "^2.0.1", + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" } }, "esprima": { @@ -2340,7 +2537,7 @@ "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", "dev": true, "requires": { - "estraverse": "4.2.0" + "estraverse": "^4.1.0" } }, "estraverse": { @@ -2368,8 +2565,8 @@ "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42" + "d": "1", + "es5-ext": "~0.10.14" } }, "eventemitter3": { @@ -2390,7 +2587,7 @@ "integrity": "sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI=", "dev": true, "requires": { - "original": "1.0.0" + "original": ">=0.0.5" } }, "evp_bytestokey": { @@ -2399,8 +2596,8 @@ "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "dev": true, "requires": { - "md5.js": "1.3.4", - "safe-buffer": "5.1.1" + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" } }, "execa": { @@ -2409,13 +2606,13 @@ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" }, "dependencies": { "cross-spawn": { @@ -2424,9 +2621,9 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { - "lru-cache": "4.1.2", - "shebang-command": "1.2.0", - "which": "1.3.0" + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" } } } @@ -2449,9 +2646,9 @@ "integrity": "sha1-SIsdHSRRyz06axks/AMPRMWFX+o=", "dev": true, "requires": { - "array-slice": "0.2.3", - "array-unique": "0.2.1", - "braces": "0.1.5" + "array-slice": "^0.2.3", + "array-unique": "^0.2.1", + "braces": "^0.1.2" }, "dependencies": { "array-slice": { @@ -2472,7 +2669,7 @@ "integrity": "sha1-wIVxEIUpHYt1/ddOqw+FlygHEeY=", "dev": true, "requires": { - "expand-range": "0.1.1" + "expand-range": "^0.1.0" } }, "expand-range": { @@ -2481,8 +2678,8 @@ "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", "dev": true, "requires": { - "is-number": "0.1.1", - "repeat-string": "0.2.2" + "is-number": "^0.1.1", + "repeat-string": "^0.2.2" } }, "is-number": { @@ -2505,13 +2702,13 @@ "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", "dev": true, "requires": { - "debug": "2.6.9", - "define-property": "0.2.5", - "extend-shallow": "2.0.1", - "posix-character-classes": "0.1.1", - "regex-not": "1.0.0", - "snapdragon": "0.8.1", - "to-regex": "3.0.1" + "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": { @@ -2520,7 +2717,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "is-accessor-descriptor": { @@ -2529,7 +2726,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -2538,7 +2735,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -2549,7 +2746,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -2558,7 +2755,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -2569,9 +2766,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" } }, "kind-of": { @@ -2588,7 +2785,7 @@ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "fill-range": "2.2.3" + "fill-range": "^2.1.0" }, "dependencies": { "fill-range": { @@ -2597,11 +2794,11 @@ "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true, "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^1.1.3", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" } }, "is-number": { @@ -2610,7 +2807,7 @@ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" } }, "isobject": { @@ -2628,7 +2825,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -2639,7 +2836,7 @@ "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", "dev": true, "requires": { - "homedir-polyfill": "1.0.1" + "homedir-polyfill": "^1.0.1" } }, "express": { @@ -2648,36 +2845,36 @@ "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", "dev": true, "requires": { - "accepts": "1.3.5", + "accepts": "~1.3.5", "array-flatten": "1.1.1", "body-parser": "1.18.2", "content-disposition": "0.5.2", - "content-type": "1.0.4", + "content-type": "~1.0.4", "cookie": "0.3.1", "cookie-signature": "1.0.6", "debug": "2.6.9", - "depd": "1.1.2", - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "etag": "1.8.1", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", "finalhandler": "1.1.1", "fresh": "0.5.2", "merge-descriptors": "1.0.1", - "methods": "1.1.2", - "on-finished": "2.3.0", - "parseurl": "1.3.2", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", "path-to-regexp": "0.1.7", - "proxy-addr": "2.0.3", + "proxy-addr": "~2.0.3", "qs": "6.5.1", - "range-parser": "1.2.0", + "range-parser": "~1.2.0", "safe-buffer": "5.1.1", "send": "0.16.2", "serve-static": "1.13.2", "setprototypeof": "1.1.0", - "statuses": "1.4.0", - "type-is": "1.6.16", + "statuses": "~1.4.0", + "type-is": "~1.6.16", "utils-merge": "1.0.1", - "vary": "1.1.2" + "vary": "~1.1.2" }, "dependencies": { "array-flatten": { @@ -2700,7 +2897,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } }, "extglob": { @@ -2709,14 +2906,14 @@ "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" + "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" } }, "extract-zip": { @@ -2760,9 +2957,9 @@ "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", "dev": true, "requires": { - "ansi-gray": "0.1.1", - "color-support": "1.1.3", - "time-stamp": "1.1.0" + "ansi-gray": "^0.1.1", + "color-support": "^1.1.3", + "time-stamp": "^1.0.0" } }, "fast-deep-equal": { @@ -2790,7 +2987,7 @@ "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", "dev": true, "requires": { - "websocket-driver": "0.7.0" + "websocket-driver": ">=0.5.1" } }, "fbjs": { @@ -2799,13 +2996,13 @@ "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", "dev": true, "requires": { - "core-js": "1.2.7", - "isomorphic-fetch": "2.2.1", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "promise": "7.3.1", - "setimmediate": "1.0.5", - "ua-parser-js": "0.7.17" + "core-js": "^1.0.0", + "isomorphic-fetch": "^2.1.1", + "loose-envify": "^1.0.0", + "object-assign": "^4.1.0", + "promise": "^7.1.1", + "setimmediate": "^1.0.5", + "ua-parser-js": "^0.7.9" }, "dependencies": { "object-assign": { @@ -2822,7 +3019,7 @@ "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", "dev": true, "requires": { - "pend": "1.2.0" + "pend": "~1.2.0" } }, "file-type": { @@ -2850,10 +3047,10 @@ "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.1" + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" } }, "finalhandler": { @@ -2863,12 +3060,12 @@ "dev": true, "requires": { "debug": "2.6.9", - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.4.0", - "unpipe": "1.0.0" + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" } }, "find": { @@ -2877,7 +3074,7 @@ "integrity": "sha1-S3Px/55WrZG3bnFkB/5f/mVUu4w=", "dev": true, "requires": { - "traverse-chain": "0.1.0" + "traverse-chain": "~0.1.0" } }, "find-index": { @@ -2892,7 +3089,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "2.0.0" + "locate-path": "^2.0.0" } }, "findup-sync": { @@ -2901,10 +3098,10 @@ "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", "dev": true, "requires": { - "detect-file": "1.0.0", - "is-glob": "3.1.0", - "micromatch": "3.1.5", - "resolve-dir": "1.0.1" + "detect-file": "^1.0.0", + "is-glob": "^3.1.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" } }, "fined": { @@ -2913,11 +3110,11 @@ "integrity": "sha1-s33IRLdqL15wgeiE98CuNE8VNHY=", "dev": true, "requires": { - "expand-tilde": "2.0.2", - "is-plain-object": "2.0.4", - "object.defaults": "1.1.0", - "object.pick": "1.3.0", - "parse-filepath": "1.0.2" + "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": { @@ -2932,13 +3129,23 @@ "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" + } + }, "follow-redirects": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz", "integrity": "sha512-uxYePVPogtya1ktGnAAXOacnbIuRMB4dkvqeNz2qTtTQsuzSfbDolV+wMMKxAmCx0bLgAKLbBOkjItMbbkR1vg==", "dev": true, "requires": { - "debug": "3.1.0" + "debug": "^3.1.0" }, "dependencies": { "debug": { @@ -2958,7 +3165,7 @@ "integrity": "sha1-LEBFC5NI6X8oEyJZO6lnBLmr1NQ=", "dev": true, "requires": { - "is-function": "1.0.1" + "is-function": "~1.0.0" } }, "for-in": { @@ -2973,7 +3180,7 @@ "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", "dev": true, "requires": { - "for-in": "1.0.2" + "for-in": "^1.0.1" } }, "foreach": { @@ -2994,9 +3201,9 @@ "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "dev": true, "requires": { - "asynckit": "0.4.0", + "asynckit": "^0.4.0", "combined-stream": "1.0.6", - "mime-types": "2.1.18" + "mime-types": "^2.1.12" } }, "formatio": { @@ -3005,7 +3212,7 @@ "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", "dev": true, "requires": { - "samsam": "1.1.2" + "samsam": "~1.1" } }, "forwarded": { @@ -3020,7 +3227,7 @@ "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", "dev": true, "requires": { - "map-cache": "0.2.2" + "map-cache": "^0.2.2" } }, "fresh": { @@ -3035,7 +3242,7 @@ "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", "dev": true, "requires": { - "null-check": "1.0.0" + "null-check": "^1.0.0" } }, "fs-extra": { @@ -3044,11 +3251,21 @@ "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "2.4.0", - "klaw": "1.3.1", - "path-is-absolute": "1.0.1", - "rimraf": "2.6.2" + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0", + "path-is-absolute": "^1.0.0", + "rimraf": "^2.2.8" + } + }, + "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": { @@ -3064,8 +3281,8 @@ "dev": true, "optional": true, "requires": { - "nan": "2.10.0", - "node-pre-gyp": "0.9.1" + "nan": "^2.9.2", + "node-pre-gyp": "^0.9.0" }, "dependencies": { "abbrev": { @@ -3095,8 +3312,8 @@ "dev": true, "optional": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.6" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, "balanced-match": { @@ -3111,7 +3328,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -3185,7 +3402,7 @@ "dev": true, "optional": true, "requires": { - "minipass": "2.2.4" + "minipass": "^2.2.1" } }, "fs.realpath": { @@ -3202,14 +3419,14 @@ "dev": true, "optional": true, "requires": { - "aproba": "1.2.0", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "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": { @@ -3219,12 +3436,12 @@ "dev": true, "optional": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "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": { @@ -3241,7 +3458,7 @@ "dev": true, "optional": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "^2.1.0" } }, "ignore-walk": { @@ -3251,7 +3468,7 @@ "dev": true, "optional": true, "requires": { - "minimatch": "3.0.4" + "minimatch": "^3.0.4" } }, "inflight": { @@ -3261,8 +3478,8 @@ "dev": true, "optional": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -3284,7 +3501,7 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "isarray": { @@ -3300,7 +3517,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -3315,8 +3532,8 @@ "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "dev": true, "requires": { - "safe-buffer": "5.1.1", - "yallist": "3.0.2" + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" } }, "minizlib": { @@ -3326,7 +3543,7 @@ "dev": true, "optional": true, "requires": { - "minipass": "2.2.4" + "minipass": "^2.2.1" } }, "mkdirp": { @@ -3352,9 +3569,9 @@ "dev": true, "optional": true, "requires": { - "debug": "2.6.9", - "iconv-lite": "0.4.21", - "sax": "1.2.4" + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" } }, "node-pre-gyp": { @@ -3364,16 +3581,16 @@ "dev": true, "optional": true, "requires": { - "detect-libc": "1.0.3", - "mkdirp": "0.5.1", - "needle": "2.2.0", - "nopt": "4.0.1", - "npm-packlist": "1.1.10", - "npmlog": "4.1.2", - "rc": "1.2.6", - "rimraf": "2.6.2", - "semver": "5.5.0", - "tar": "4.4.1" + "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": { @@ -3383,8 +3600,8 @@ "dev": true, "optional": true, "requires": { - "abbrev": "1.1.1", - "osenv": "0.1.5" + "abbrev": "1", + "osenv": "^0.1.4" } }, "npm-bundled": { @@ -3401,8 +3618,8 @@ "dev": true, "optional": true, "requires": { - "ignore-walk": "3.0.1", - "npm-bundled": "1.0.3" + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" } }, "npmlog": { @@ -3412,10 +3629,10 @@ "dev": true, "optional": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "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": { @@ -3437,7 +3654,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-homedir": { @@ -3461,8 +3678,8 @@ "dev": true, "optional": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "path-is-absolute": { @@ -3486,10 +3703,10 @@ "dev": true, "optional": true, "requires": { - "deep-extend": "0.4.2", - "ini": "1.3.5", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" }, "dependencies": { "minimist": { @@ -3508,13 +3725,13 @@ "dev": true, "optional": true, "requires": { - "core-util-is": "1.0.2", - "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.2" + "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": { @@ -3524,7 +3741,7 @@ "dev": true, "optional": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "safe-buffer": { @@ -3574,9 +3791,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string_decoder": { @@ -3586,7 +3803,7 @@ "dev": true, "optional": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "strip-ansi": { @@ -3595,7 +3812,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-json-comments": { @@ -3612,13 +3829,13 @@ "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.1", - "safe-buffer": "5.1.1", - "yallist": "3.0.2" + "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": { @@ -3635,7 +3852,7 @@ "dev": true, "optional": true, "requires": { - "string-width": "1.0.2" + "string-width": "^1.0.2" } }, "wrappy": { @@ -3658,10 +3875,10 @@ "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.2" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" } }, "ftp": { @@ -3671,7 +3888,7 @@ "dev": true, "optional": true, "requires": { - "readable-stream": "1.1.14", + "readable-stream": "1.1.x", "xregexp": "2.0.0" }, "dependencies": { @@ -3689,10 +3906,10 @@ "dev": true, "optional": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -3716,57 +3933,53 @@ "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "requires": { - "aproba": "1.2.0", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "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" }, "dependencies": { - "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 - }, "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.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } } } }, "gaze": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", - "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", "dev": true, "requires": { - "globule": "0.1.0" + "globule": "^1.0.0" } }, "generate-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", - "dev": true + "dev": true, + "optional": true }, "generate-object-property": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", "dev": true, + "optional": true, "requires": { - "is-property": "1.0.2" + "is-property": "^1.0.0" } }, "get-caller-file": { @@ -3803,12 +4016,12 @@ "dev": true, "optional": true, "requires": { - "data-uri-to-buffer": "1.2.0", - "debug": "2.6.9", - "extend": "3.0.1", - "file-uri-to-path": "1.0.0", - "ftp": "0.3.10", - "readable-stream": "2.3.3" + "data-uri-to-buffer": "1", + "debug": "2", + "extend": "3", + "file-uri-to-path": "1", + "ftp": "~0.3.10", + "readable-stream": "2" } }, "get-value": { @@ -3823,7 +4036,7 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "glob": { @@ -3832,12 +4045,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "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" } }, "glob-base": { @@ -3846,8 +4059,8 @@ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" }, "dependencies": { "glob-parent": { @@ -3856,7 +4069,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "2.0.1" + "is-glob": "^2.0.0" } }, "is-extglob": { @@ -3871,7 +4084,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } } } @@ -3882,88 +4095,38 @@ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, "requires": { - "is-glob": "3.1.0", - "path-dirname": "1.0.2" + "is-glob": "^3.1.0", + "path-dirname": "^1.0.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.5.3", - "glob2base": "0.0.12", - "minimatch": "2.0.10", - "ordered-read-streams": "0.1.0", - "through2": "0.6.5", - "unique-stream": "1.0.0" - }, - "dependencies": { - "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.6", - "inherits": "2.0.3", - "minimatch": "2.0.10", - "once": "1.4.0" - } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "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.1.8" - } - }, - "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.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "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 - }, - "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.34", - "xtend": "4.0.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" } }, "glob-watcher": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", - "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.1.tgz", + "integrity": "sha512-fK92r2COMC199WCyGUblrZKhjra3cyVMDiypDdqg1vsSDmexnbYivK1kNR4QItiNXLKmGlqan469ks67RtNa2g==", "dev": true, "requires": { - "gaze": "0.5.2" + "async-done": "^1.2.0", + "chokidar": "^2.0.0", + "just-debounce": "^1.0.0", + "object.defaults": "^1.1.0" } }, "glob2base": { @@ -3972,7 +4135,7 @@ "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", "dev": true, "requires": { - "find-index": "0.1.1" + "find-index": "^0.1.1" } }, "global": { @@ -3981,8 +4144,8 @@ "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", "dev": true, "requires": { - "min-document": "2.19.0", - "process": "0.5.2" + "min-document": "^2.19.0", + "process": "~0.5.1" } }, "global-modules": { @@ -3991,9 +4154,9 @@ "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { - "global-prefix": "1.0.2", - "is-windows": "1.0.1", - "resolve-dir": "1.0.1" + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" } }, "global-prefix": { @@ -4002,11 +4165,11 @@ "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", "dev": true, "requires": { - "expand-tilde": "2.0.2", - "homedir-polyfill": "1.0.1", - "ini": "1.3.5", - "is-windows": "1.0.1", - "which": "1.3.0" + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" } }, "globby": { @@ -4015,11 +4178,11 @@ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { - "array-union": "1.0.2", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" }, "dependencies": { "object-assign": { @@ -4037,70 +4200,23 @@ } }, "globule": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", - "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", + "integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==", "dev": true, "requires": { - "glob": "3.1.21", - "lodash": "1.0.2", - "minimatch": "0.2.14" - }, - "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.3", - "inherits": "1.0.2", - "minimatch": "0.2.14" - } - }, - "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 - }, - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", - "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.7.3", - "sigmund": "1.0.1" - } - } + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" } }, "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" + "sparkles": "^1.0.0" } }, "graceful-fs": { @@ -4116,31 +4232,42 @@ "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.1.3", - "deprecated": "0.0.1", - "gulp-util": "3.0.8", - "interpret": "1.1.0", - "liftoff": "2.5.0", - "minimist": "1.2.0", - "orchestrator": "0.3.8", - "pretty-hrtime": "1.0.3", - "semver": "4.3.6", - "tildify": "1.2.0", - "v8flags": "2.1.1", - "vinyl-fs": "0.3.14" + "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": { - "semver": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", - "dev": true + "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" + } } } }, @@ -4150,11 +4277,11 @@ "integrity": "sha512-DARK8rNMo4lHOFLGTiHEJdf19GuoBDHqGUaypz+fOhrvOs3iFO7ntdYtdpNxv+AzSJBx/JfypF0yEj9ks1IStQ==", "dev": true, "requires": { - "fancy-log": "1.3.2", - "plugin-error": "0.1.2", - "rimraf": "2.6.2", - "through2": "2.0.3", - "vinyl": "2.1.0" + "fancy-log": "^1.3.2", + "plugin-error": "^0.1.2", + "rimraf": "^2.6.2", + "through2": "^2.0.3", + "vinyl": "^2.1.0" }, "dependencies": { "arr-diff": { @@ -4163,8 +4290,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "1.1.0", - "array-slice": "0.2.3" + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" } }, "arr-union": { @@ -4179,25 +4306,13 @@ "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", "dev": true }, - "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 - }, "extend-shallow": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz", "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "1.1.0" + "kind-of": "^1.1.0" } }, "kind-of": { @@ -4212,39 +4327,19 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "0.1.1", - "ansi-red": "0.1.1", - "arr-diff": "1.1.0", - "arr-union": "2.1.0", - "extend-shallow": "1.1.4" - } - }, - "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.1.0", - "replace-ext": "1.0.0" + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" } } } }, "gulp-color": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/gulp-color/-/gulp-color-0.0.1.tgz", - "integrity": "sha1-A+O/mxkgep3Gh7EHNORyzX6JX4U=", + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/gulp-color/-/gulp-color-0.0.2.tgz", + "integrity": "sha512-xT1RrFyQn4Wqp8NYEZjoE3JBPMs4fsxo1RRV+CHsnx0QkCt3ZYfPhSaZRIff5FXSD8IrN9yRY/1WNM6oOAGI4g==", "dev": true }, "gulp-file": { @@ -4253,46 +4348,34 @@ "integrity": "sha1-RRNWoqxQicbbkaBEQlKgVDZXAGs=", "dev": true, "requires": { - "through2": "0.4.2", - "vinyl": "2.1.0" + "through2": "^0.4.1", + "vinyl": "^2.1.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 - }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, + "object-keys": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", + "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=", + "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.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", - "dev": true - }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", @@ -4305,22 +4388,8 @@ "integrity": "sha1-2/WGYDEVHsg1K7bE22SiKSqEC5s=", "dev": true, "requires": { - "readable-stream": "1.0.34", - "xtend": "2.1.2" - } - }, - "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.1.0", - "replace-ext": "1.0.0" + "readable-stream": "~1.0.17", + "xtend": "~2.1.1" } }, "xtend": { @@ -4329,7 +4398,7 @@ "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", "dev": true, "requires": { - "object-keys": "0.4.0" + "object-keys": "~0.4.0" } } } @@ -4340,13 +4409,13 @@ "integrity": "sha512-qEocs1UVoDKKUjfsxJNMNwkRla0PbsyJwsqNNXpzYWsLQ29LhxRMY3wnTGZcc4hMHtalnvah/Dwlwb4NijH/0A==", "dev": true, "requires": { - "ansi-colors": "1.1.0", - "fancy-log": "1.3.2", - "lodash.template": "4.4.0", - "node-notifier": "5.2.1", - "node.extend": "2.0.0", - "plugin-error": "0.1.2", - "through2": "2.0.3" + "ansi-colors": "^1.0.1", + "fancy-log": "^1.3.2", + "lodash.template": "^4.4.0", + "node-notifier": "^5.2.1", + "node.extend": "^2.0.0", + "plugin-error": "^0.1.2", + "through2": "^2.0.3" }, "dependencies": { "arr-diff": { @@ -4355,8 +4424,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "1.1.0", - "array-slice": "0.2.3" + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" } }, "arr-union": { @@ -4377,7 +4446,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "1.1.0" + "kind-of": "^1.1.0" } }, "kind-of": { @@ -4386,68 +4455,104 @@ "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, - "lodash.template": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", - "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", - "dev": true, - "requires": { - "lodash._reinterpolate": "3.0.0", - "lodash.templatesettings": "4.1.0" - } - }, - "lodash.templatesettings": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", - "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", - "dev": true, - "requires": { - "lodash._reinterpolate": "3.0.0" - } - }, "plugin-error": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "0.1.1", - "ansi-red": "0.1.1", - "arr-diff": "1.1.0", - "arr-union": "2.1.0", - "extend-shallow": "1.1.4" + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" } } } }, "gulp-rename": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.2.2.tgz", - "integrity": "sha1-OtRCh2PwXidk3sHGfYaNsnVoeBc=", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.4.0.tgz", + "integrity": "sha512-swzbIGb/arEoFK89tPY58vg3Ok1bw+d35PfUNwWqdo7KM4jkmuGA78JiDNqR+JeZFaeeHnRg9N7aihX3YPmsyg==", "dev": true }, "gulp-replace": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-0.6.1.tgz", - "integrity": "sha1-Eb+Mj85TPjPi9qjy9DC5VboL4GY=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.0.0.tgz", + "integrity": "sha512-lgdmrFSI1SdhNMXZQbrC75MOl1UjYWlOWNbNRnz+F/KHmgxt3l6XstBoAYIdadwETFyG/6i+vWUSCawdC3pqOw==", "dev": true, "requires": { - "istextorbinary": "1.0.2", - "readable-stream": "2.3.3", - "replacestream": "4.0.3" + "istextorbinary": "2.2.1", + "readable-stream": "^2.0.1", + "replacestream": "^4.0.0" } }, "gulp-sass": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-3.2.1.tgz", - "integrity": "sha512-UATbRpSDsyXCnpYSPBUEvdvtSEzksJs7/oQ0CujIpzKqKrO6vlnYwhX2UTsGrf4rNLwqlSSaM271It0uHYvJ3Q==", - "dev": true, - "requires": { - "gulp-util": "3.0.8", - "lodash.clonedeep": "4.5.0", - "node-sass": "4.9.0", - "through2": "2.0.3", - "vinyl-sourcemaps-apply": "0.2.1" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-4.0.1.tgz", + "integrity": "sha512-OMQEgWNggpog8Tc5v1MuI6eo+5iiPkVeLL76iBhDoEEScLUPfZlpvzmgTnLkpcqdrNodZxpz5qcv6mS2rulk3g==", + "dev": true, + "requires": { + "chalk": "^2.3.0", + "lodash.clonedeep": "^4.3.2", + "node-sass": "^4.8.3", + "plugin-error": "^1.0.1", + "replace-ext": "^1.0.0", + "strip-ansi": "^4.0.0", + "through2": "^2.0.0", + "vinyl-sourcemaps-apply": "^0.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "gulp-sass-bulk-import": { @@ -4456,21 +4561,120 @@ "integrity": "sha1-AvHW0xDgGOae/iUlgRpOc4E5ZCM=", "dev": true, "requires": { - "glob": "4.5.3", - "through2": "0.6.5", - "vinyl-fs": "0.3.14" + "glob": "^4.0.6", + "through2": "^0.6.3", + "vinyl-fs": "^0.3.9" }, "dependencies": { + "clone": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", + "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", + "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 + }, + "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" + } + }, "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.6", - "inherits": "2.0.3", - "minimatch": "2.0.10", - "once": "1.4.0" + "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" + } + }, + "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" + } + }, + "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" + } + } + } + }, + "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" } }, "isarray": { @@ -4479,25 +4683,43 @@ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, + "lodash": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", + "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", + "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": "2.0.10", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", "dev": true, "requires": { - "brace-expansion": "1.1.8" + "brace-expansion": "^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 + }, "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.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -4506,36 +4728,69 @@ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, + "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" + } + }, "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.34", - "xtend": "4.0.1" + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-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 + }, + "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-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" } } } }, - "gulp-sequence": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gulp-sequence/-/gulp-sequence-1.0.0.tgz", - "integrity": "sha512-c+p+EcyBl1UCpbfFA/vUD6MuC7uxoY6Y4g2lq9lLtzOHh9o1wijAQ4o0TIRQ14C7cG6zR6Zi+bpA0cW78CFt6g==", - "dev": true, - "requires": { - "thunks": "4.9.0" - } - }, "gulp-strip-css-comments": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/gulp-strip-css-comments/-/gulp-strip-css-comments-2.0.0.tgz", "integrity": "sha512-K6QMBcuGHTwY1gjerGQ3uXo1VQfN1KM7I5wvjJYvggJ+bmXSWJHmEdBwK2NO524e2cu0AXHHRs0QrwjnvrrZtA==", "dev": true, "requires": { - "plugin-error": "0.1.2", - "strip-css-comments": "3.0.0", - "through2": "2.0.3" + "plugin-error": "^0.1.2", + "strip-css-comments": "^3.0.0", + "through2": "^2.0.0" }, "dependencies": { "arr-diff": { @@ -4544,8 +4799,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "1.1.0", - "array-slice": "0.2.3" + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" } }, "arr-union": { @@ -4566,7 +4821,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "1.1.0" + "kind-of": "^1.1.0" } }, "kind-of": { @@ -4581,56 +4836,22 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "0.1.1", - "ansi-red": "0.1.1", - "arr-diff": "1.1.0", - "arr-union": "2.1.0", - "extend-shallow": "1.1.4" + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" } } } }, - "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.3", - "beeper": "1.1.1", - "chalk": "1.1.3", - "dateformat": "2.2.0", - "fancy-log": "1.3.2", - "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.6.2", - "minimist": "1.2.0", - "multipipe": "0.1.2", - "object-assign": "3.0.0", - "replace-ext": "0.0.1", - "through2": "2.0.3", - "vinyl": "0.5.3" - }, - "dependencies": { - "dateformat": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", - "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=", - "dev": true - } - } - }, "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" + "glogg": "^1.0.0" } }, "handle-thing": { @@ -4651,8 +4872,8 @@ "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "dev": true, "requires": { - "ajv": "5.5.2", - "har-schema": "2.0.0" + "ajv": "^5.1.0", + "har-schema": "^2.0.0" } }, "has": { @@ -4661,7 +4882,7 @@ "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", "dev": true, "requires": { - "function-bind": "1.1.1" + "function-bind": "^1.0.2" } }, "has-ansi": { @@ -4670,7 +4891,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "has-binary2": { @@ -4702,14 +4923,11 @@ "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "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-unicode": { "version": "2.0.1", @@ -4723,9 +4941,9 @@ "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", "dev": true, "requires": { - "get-value": "2.0.6", - "has-values": "1.0.0", - "isobject": "3.0.1" + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" } }, "has-values": { @@ -4734,8 +4952,8 @@ "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true, "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" + "is-number": "^3.0.0", + "kind-of": "^4.0.0" }, "dependencies": { "kind-of": { @@ -4744,7 +4962,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -4755,8 +4973,8 @@ "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "dev": true, "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.1" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "hash.js": { @@ -4765,8 +4983,8 @@ "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", "dev": true, "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" } }, "hasha": { @@ -4775,8 +4993,8 @@ "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", "dev": true, "requires": { - "is-stream": "1.1.0", - "pinkie-promise": "2.0.1" + "is-stream": "^1.0.1", + "pinkie-promise": "^2.0.0" } }, "hawk": { @@ -4785,10 +5003,10 @@ "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "dev": true, "requires": { - "boom": "4.3.1", - "cryptiles": "3.1.2", - "hoek": "4.2.1", - "sntp": "2.1.0" + "boom": "4.x.x", + "cryptiles": "3.x.x", + "hoek": "4.x.x", + "sntp": "2.x.x" } }, "hipchat-notifier": { @@ -4798,8 +5016,8 @@ "dev": true, "optional": true, "requires": { - "lodash": "4.17.10", - "request": "2.85.0" + "lodash": "^4.0.0", + "request": "^2.0.0" } }, "hmac-drbg": { @@ -4808,9 +5026,9 @@ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "dev": true, "requires": { - "hash.js": "1.1.3", - "minimalistic-assert": "1.0.1", - "minimalistic-crypto-utils": "1.0.1" + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, "hoek": { @@ -4831,7 +5049,7 @@ "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", "dev": true, "requires": { - "parse-passwd": "1.0.0" + "parse-passwd": "^1.0.0" } }, "hosted-git-info": { @@ -4846,10 +5064,10 @@ "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", "dev": true, "requires": { - "inherits": "2.0.3", - "obuf": "1.1.2", - "readable-stream": "2.3.3", - "wbuf": "1.7.3" + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" } }, "html-entities": { @@ -4870,10 +5088,10 @@ "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "dev": true, "requires": { - "depd": "1.1.2", + "depd": "~1.1.2", "inherits": "2.0.3", "setprototypeof": "1.1.0", - "statuses": "1.4.0" + "statuses": ">= 1.4.0 < 2" } }, "http-parser-js": { @@ -4888,9 +5106,9 @@ "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", "dev": true, "requires": { - "eventemitter3": "3.1.0", - "follow-redirects": "1.4.1", - "requires-port": "1.0.0" + "eventemitter3": "^3.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" } }, "http-proxy-agent": { @@ -4899,9 +5117,9 @@ "integrity": "sha1-zBzjjkU7+YSg93AtLdWcc9CBKEo=", "dev": true, "requires": { - "agent-base": "2.1.1", - "debug": "2.6.9", - "extend": "3.0.1" + "agent-base": "2", + "debug": "2", + "extend": "3" }, "dependencies": { "agent-base": { @@ -4910,8 +5128,8 @@ "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "dev": true, "requires": { - "extend": "3.0.1", - "semver": "5.0.3" + "extend": "~3.0.0", + "semver": "~5.0.1" } }, "semver": { @@ -4928,10 +5146,10 @@ "integrity": "sha1-ZC6ISIUdZvCdTxJJEoRtuutBuDM=", "dev": true, "requires": { - "http-proxy": "1.17.0", - "is-glob": "3.1.0", - "lodash": "4.17.10", - "micromatch": "2.3.11" + "http-proxy": "^1.16.2", + "is-glob": "^3.1.0", + "lodash": "^4.17.2", + "micromatch": "^2.3.11" }, "dependencies": { "arr-diff": { @@ -4940,7 +5158,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "1.1.0" + "arr-flatten": "^1.0.1" } }, "array-unique": { @@ -4955,9 +5173,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" } }, "expand-brackets": { @@ -4966,7 +5184,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "0.1.1" + "is-posix-bracket": "^0.1.0" } }, "extglob": { @@ -4975,7 +5193,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } }, "is-extglob": { @@ -4990,7 +5208,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } }, "micromatch": { @@ -4999,19 +5217,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" }, "dependencies": { "is-glob": { @@ -5020,7 +5238,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } } } @@ -5033,9 +5251,9 @@ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.14.1" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "httpntlm": { @@ -5044,8 +5262,8 @@ "integrity": "sha1-rQFScUOi6Hc8+uapb1hla7UqNLI=", "dev": true, "requires": { - "httpreq": "0.4.24", - "underscore": "1.7.0" + "httpreq": ">=0.4.22", + "underscore": "~1.7.0" } }, "httpreq": { @@ -5066,8 +5284,8 @@ "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", "dev": true, "requires": { - "agent-base": "4.2.0", - "debug": "3.1.0" + "agent-base": "^4.1.0", + "debug": "^3.1.0" }, "dependencies": { "debug": { @@ -5087,7 +5305,7 @@ "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", "dev": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "^2.1.0" } }, "ieee754": { @@ -5102,8 +5320,8 @@ "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", "dev": true, "requires": { - "pkg-dir": "2.0.0", - "resolve-cwd": "2.0.0" + "pkg-dir": "^2.0.0", + "resolve-cwd": "^2.0.0" } }, "in-publish": { @@ -5137,8 +5355,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -5159,7 +5377,7 @@ "integrity": "sha1-rp+/k7mEh4eF1QqN4bNWlWBYz1w=", "dev": true, "requires": { - "meow": "3.7.0" + "meow": "^3.3.0" }, "dependencies": { "camelcase": { @@ -5174,8 +5392,8 @@ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { - "camelcase": "2.1.1", - "map-obj": "1.0.1" + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" } }, "find-up": { @@ -5184,8 +5402,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "get-stdin": { @@ -5200,7 +5418,7 @@ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, "requires": { - "repeating": "2.0.1" + "repeating": "^2.0.0" } }, "load-json-file": { @@ -5209,11 +5427,11 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.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" } }, "map-obj": { @@ -5228,16 +5446,16 @@ "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { - "camelcase-keys": "2.1.0", - "decamelize": "1.2.0", - "loud-rejection": "1.6.0", - "map-obj": "1.0.1", - "minimist": "1.2.0", - "normalize-package-data": "2.4.0", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "redent": "1.0.0", - "trim-newlines": "1.0.0" + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" } }, "object-assign": { @@ -5252,7 +5470,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "^1.2.0" } }, "path-exists": { @@ -5261,7 +5479,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "2.0.1" + "pinkie-promise": "^2.0.0" } }, "path-type": { @@ -5270,9 +5488,9 @@ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "pify": { @@ -5287,9 +5505,9 @@ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.0" + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" } }, "read-pkg-up": { @@ -5298,8 +5516,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" } }, "redent": { @@ -5308,8 +5526,8 @@ "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", "dev": true, "requires": { - "indent-string": "2.1.0", - "strip-indent": "1.0.1" + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" } }, "strip-bom": { @@ -5318,7 +5536,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "0.2.1" + "is-utf8": "^0.2.0" } }, "strip-indent": { @@ -5327,7 +5545,7 @@ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", "dev": true, "requires": { - "get-stdin": "4.0.1" + "get-stdin": "^4.0.1" } }, "trim-newlines": { @@ -5350,7 +5568,7 @@ "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", "dev": true, "requires": { - "loose-envify": "1.3.1" + "loose-envify": "^1.0.0" } }, "invert-kv": { @@ -5389,8 +5607,8 @@ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { - "is-relative": "1.0.0", - "is-windows": "1.0.1" + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" } }, "is-accessor-descriptor": { @@ -5399,7 +5617,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-arrayish": { @@ -5414,7 +5632,7 @@ "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", "dev": true, "requires": { - "binary-extensions": "1.11.0" + "binary-extensions": "^1.0.0" } }, "is-buffer": { @@ -5429,7 +5647,7 @@ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { - "builtin-modules": "1.1.1" + "builtin-modules": "^1.0.0" } }, "is-callable": { @@ -5444,7 +5662,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-date-object": { @@ -5459,9 +5677,9 @@ "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-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" } }, "is-dotfile": { @@ -5476,7 +5694,7 @@ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { - "is-primitive": "2.0.0" + "is-primitive": "^2.0.0" } }, "is-extendable": { @@ -5497,7 +5715,7 @@ "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-fullwidth-code-point": { @@ -5506,7 +5724,7 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-function": { @@ -5521,35 +5739,43 @@ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { - "is-extglob": "2.1.1" + "is-extglob": "^2.1.0" } }, "is-my-ip-valid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", - "dev": true + "dev": true, + "optional": true }, "is-my-json-valid": { "version": "2.17.2", "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", "dev": true, + "optional": true, "requires": { - "generate-function": "2.0.0", - "generate-object-property": "1.2.0", - "is-my-ip-valid": "1.0.0", - "jsonpointer": "4.0.1", - "xtend": "4.0.1" + "generate-function": "^2.0.0", + "generate-object-property": "^1.1.0", + "is-my-ip-valid": "^1.0.0", + "jsonpointer": "^4.0.0", + "xtend": "^4.0.0" } }, + "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", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -5558,7 +5784,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -5569,7 +5795,7 @@ "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", "dev": true, "requires": { - "is-number": "3.0.0" + "is-number": "^3.0.0" } }, "is-path-cwd": { @@ -5584,7 +5810,7 @@ "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", "dev": true, "requires": { - "is-path-inside": "1.0.1" + "is-path-inside": "^1.0.0" } }, "is-path-inside": { @@ -5593,7 +5819,7 @@ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { - "path-is-inside": "1.0.2" + "path-is-inside": "^1.0.1" } }, "is-plain-obj": { @@ -5608,7 +5834,7 @@ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { - "isobject": "3.0.1" + "isobject": "^3.0.1" } }, "is-posix-bracket": { @@ -5627,7 +5853,8 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true + "dev": true, + "optional": true }, "is-regex": { "version": "1.0.4", @@ -5635,7 +5862,7 @@ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { - "has": "1.0.1" + "has": "^1.0.1" } }, "is-regexp": { @@ -5650,7 +5877,7 @@ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { - "is-unc-path": "1.0.0" + "is-unc-path": "^1.0.0" } }, "is-stream": { @@ -5677,7 +5904,7 @@ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { - "unc-path-regex": "0.1.2" + "unc-path-regex": "^0.1.2" } }, "is-utf8": { @@ -5686,6 +5913,12 @@ "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", @@ -5728,8 +5961,8 @@ "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", "dev": true, "requires": { - "node-fetch": "1.7.3", - "whatwg-fetch": "2.0.4" + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" } }, "isstream": { @@ -5739,13 +5972,14 @@ "dev": true }, "istextorbinary": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-1.0.2.tgz", - "integrity": "sha1-rOGTVNGpoBc+/rEITOD4ewrX3s8=", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-2.2.1.tgz", + "integrity": "sha512-TS+hoFl8Z5FAFMK38nhBkdLt44CclNRgDHWeMgsV8ko3nDlr/9UI2Sf839sW7enijf8oKsZYXRvM8g0it9Zmcw==", "dev": true, "requires": { - "binaryextensions": "1.0.1", - "textextensions": "1.0.2" + "binaryextensions": "2", + "editions": "^1.3.3", + "textextensions": "2" } }, "jasmine-core": { @@ -5760,22 +5994,22 @@ "integrity": "sha1-3VKak3GQ9ClXp5N9Gsw6d2KZbqI=", "dev": true, "requires": { - "bignumber.js": "2.4.0", + "bignumber.js": "^2.1.0", "bmp-js": "0.0.3", - "es6-promise": "3.3.1", - "exif-parser": "0.1.12", - "file-type": "3.9.0", - "jpeg-js": "0.2.0", - "load-bmfont": "1.3.0", - "mime": "1.6.0", + "es6-promise": "^3.0.2", + "exif-parser": "^0.1.9", + "file-type": "^3.1.0", + "jpeg-js": "^0.2.0", + "load-bmfont": "^1.2.3", + "mime": "^1.3.4", "mkdirp": "0.5.1", - "pixelmatch": "4.0.2", - "pngjs": "3.3.3", - "read-chunk": "1.0.1", - "request": "2.85.0", - "stream-to-buffer": "0.1.0", - "tinycolor2": "1.4.1", - "url-regex": "3.2.0" + "pixelmatch": "^4.0.0", + "pngjs": "^3.0.0", + "read-chunk": "^1.0.1", + "request": "^2.65.0", + "stream-to-buffer": "^0.1.0", + "tinycolor2": "^1.1.2", + "url-regex": "^3.0.0" }, "dependencies": { "es6-promise": { @@ -5793,9 +6027,9 @@ "dev": true }, "js-base64": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.3.tgz", - "integrity": "sha512-H7ErYLM34CvDMto3GbD6xD0JLUGYXR3QTcH6B/tr4Hi/QpSThnCsIp+Sy5FRTw3B0d6py4HcNkW7nO/wdtGWEw==", + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.8.tgz", + "integrity": "sha512-hm2nYpDrwoO/OzBhdcqs/XGT6XjSuSSCVEpia+Kl2J6x4CYt5hISlVL/AYU1khoDXv0AQVgxtdJySb9gjAn56Q==", "dev": true }, "js-tokens": { @@ -5835,6 +6069,15 @@ "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", "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" + } + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -5859,14 +6102,21 @@ "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { - "graceful-fs": "4.1.11" + "graceful-fs": "^4.1.6" } }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, "jsonpointer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", - "dev": true + "dev": true, + "optional": true }, "jsprim": { "version": "1.4.1", @@ -5925,42 +6175,48 @@ "integrity": "sha1-+Rb20Q1F3BcbG+Lm5nP7bgzDXQo=", "dev": true, "requires": { - "lodash": "3.5.0" + "lodash": "~3.5.0" } } } }, + "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 + }, "karma": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/karma/-/karma-2.0.2.tgz", "integrity": "sha1-TS25QChQpmVR+nhLAWT7CCTtjEs=", "dev": true, "requires": { - "bluebird": "3.5.1", - "body-parser": "1.18.2", - "chokidar": "1.7.0", - "colors": "1.2.1", - "combine-lists": "1.0.1", - "connect": "3.6.6", - "core-js": "2.5.5", - "di": "0.0.1", - "dom-serialize": "2.2.1", - "expand-braces": "0.1.2", - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "http-proxy": "1.17.0", - "isbinaryfile": "3.0.2", - "lodash": "4.17.10", - "log4js": "2.5.3", - "mime": "1.6.0", - "minimatch": "3.0.4", - "optimist": "0.6.1", - "qjobs": "1.2.0", - "range-parser": "1.2.0", - "rimraf": "2.6.2", - "safe-buffer": "5.1.1", + "bluebird": "^3.3.0", + "body-parser": "^1.16.1", + "chokidar": "^1.4.1", + "colors": "^1.1.0", + "combine-lists": "^1.0.0", + "connect": "^3.6.0", + "core-js": "^2.2.0", + "di": "^0.0.1", + "dom-serialize": "^2.2.0", + "expand-braces": "^0.1.1", + "glob": "^7.1.1", + "graceful-fs": "^4.1.2", + "http-proxy": "^1.13.0", + "isbinaryfile": "^3.0.0", + "lodash": "^4.17.4", + "log4js": "^2.3.9", + "mime": "^1.3.4", + "minimatch": "^3.0.2", + "optimist": "^0.6.1", + "qjobs": "^1.1.4", + "range-parser": "^1.2.0", + "rimraf": "^2.6.0", + "safe-buffer": "^5.0.1", "socket.io": "2.0.4", - "source-map": "0.6.1", + "source-map": "^0.6.1", "tmp": "0.0.33", "useragent": "2.2.1" }, @@ -5971,8 +6227,8 @@ "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", "dev": true, "requires": { - "micromatch": "2.3.11", - "normalize-path": "2.1.1" + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" } }, "arr-diff": { @@ -5981,7 +6237,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "1.1.0" + "arr-flatten": "^1.0.1" } }, "array-unique": { @@ -5996,9 +6252,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" } }, "chokidar": { @@ -6007,15 +6263,15 @@ "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", "dev": true, "requires": { - "anymatch": "1.3.2", - "async-each": "1.0.1", - "fsevents": "1.2.2", - "glob-parent": "2.0.0", - "inherits": "2.0.3", - "is-binary-path": "1.0.1", - "is-glob": "2.0.1", - "path-is-absolute": "1.0.1", - "readdirp": "2.1.0" + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" } }, "core-js": { @@ -6030,7 +6286,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "0.1.1" + "is-posix-bracket": "^0.1.0" } }, "extglob": { @@ -6039,7 +6295,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } }, "glob-parent": { @@ -6048,7 +6304,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "2.0.1" + "is-glob": "^2.0.0" } }, "is-extglob": { @@ -6063,7 +6319,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } }, "kind-of": { @@ -6072,7 +6328,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } }, "micromatch": { @@ -6081,19 +6337,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" } }, "source-map": { @@ -6110,8 +6366,8 @@ "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", "dev": true, "requires": { - "fs-access": "1.0.1", - "which": "1.3.0" + "fs-access": "^1.0.0", + "which": "^1.2.1" } }, "karma-jasmine": { @@ -6126,7 +6382,7 @@ "integrity": "sha1-T5xAzt+xo5X4rvh2q/lhiZF8Y5Y=", "dev": true, "requires": { - "path-is-absolute": "1.0.1", + "path-is-absolute": "^1.0.0", "xmlbuilder": "8.2.2" }, "dependencies": { @@ -6156,7 +6412,7 @@ "integrity": "sha1-LpxyB+pyZ3EmAln4K+y1QyCeRAo=", "dev": true, "requires": { - "colors": "1.2.1" + "colors": "^1.1.2" } }, "kew": { @@ -6183,7 +6439,17 @@ "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", "dev": true, "requires": { - "graceful-fs": "4.1.11" + "graceful-fs": "^4.1.9" + } + }, + "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" } }, "lazy-cache": { @@ -6192,16 +6458,34 @@ "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", "dev": true, "requires": { - "set-getter": "0.1.0" + "set-getter": "^0.1.0" + } + }, + "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" } }, - "lcid": { + "lead": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", + "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", "dev": true, "requires": { - "invert-kv": "1.0.0" + "flush-write-stream": "^1.0.2" } }, "levn": { @@ -6211,8 +6495,8 @@ "dev": true, "optional": true, "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" } }, "libbase64": { @@ -6252,14 +6536,14 @@ "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", "dev": true, "requires": { - "extend": "3.0.1", - "findup-sync": "2.0.0", - "fined": "1.1.0", - "flagged-respawn": "1.0.0", - "is-plain-object": "2.0.4", - "object.map": "1.0.1", - "rechoir": "0.6.2", - "resolve": "1.5.0" + "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" } }, "lighthouse-logger": { @@ -6268,7 +6552,7 @@ "integrity": "sha1-8HPYP3rLyWcpvxAKEhyPAGmRrmE=", "dev": true, "requires": { - "debug": "2.6.9" + "debug": "^2.6.8" } }, "load-bmfont": { @@ -6278,12 +6562,12 @@ "dev": true, "requires": { "buffer-equal": "0.0.1", - "mime": "1.6.0", - "parse-bmfont-ascii": "1.0.6", - "parse-bmfont-binary": "1.0.6", - "parse-bmfont-xml": "1.1.3", - "xhr": "2.4.1", - "xtend": "4.0.1" + "mime": "^1.3.4", + "parse-bmfont-ascii": "^1.0.3", + "parse-bmfont-binary": "^1.0.5", + "parse-bmfont-xml": "^1.1.0", + "xhr": "^2.0.1", + "xtend": "^4.0.0" } }, "load-json-file": { @@ -6292,10 +6576,10 @@ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "4.0.0", - "pify": "3.0.0", - "strip-bom": "3.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" } }, "loader-runner": { @@ -6310,9 +6594,9 @@ "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", "dev": true, "requires": { - "big.js": "3.2.0", - "emojis-list": "2.1.0", - "json5": "0.5.1" + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0" } }, "locate-path": { @@ -6321,8 +6605,8 @@ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { - "p-locate": "2.0.0", - "path-exists": "3.0.0" + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" } }, "lodash": { @@ -6337,60 +6621,12 @@ "integrity": "sha512-iesFYPmxYYGTcmQK0sL8bX3TGHyM6b2qREaB4kamHfQyfPJP0xgoGxp19nsH16nsfquLdiyKyX3mQkfiSGV8Rg==", "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.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", @@ -6403,75 +6639,29 @@ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "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.1" - } - }, - "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.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" - } - }, "lodash.mergewith": { "version": "4.6.1", "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", "dev": true }, - "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=", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", + "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", "dev": true, "requires": { - "lodash._basecopy": "3.0.1", - "lodash._basetostring": "3.0.1", - "lodash._basevalues": "3.0.0", - "lodash._isiterateecall": "3.0.9", - "lodash._reinterpolate": "3.0.0", - "lodash.escape": "3.2.0", - "lodash.keys": "3.1.2", - "lodash.restparam": "3.6.1", - "lodash.templatesettings": "3.1.1" + "lodash._reinterpolate": "~3.0.0", + "lodash.templatesettings": "^4.0.0" } }, "lodash.templatesettings": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", - "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", + "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", "dev": true, "requires": { - "lodash._reinterpolate": "3.0.0", - "lodash.escape": "3.2.0" + "lodash._reinterpolate": "~3.0.0" } }, "log4js": { @@ -6480,19 +6670,19 @@ "integrity": "sha512-YL/qpTxYtK0iWWbuKCrevDZz5lh+OjyHHD+mICqpjnYGKdNRBvPeh/1uYjkKUemT1CSO4wwLOwphWMpKAnD9kw==", "dev": true, "requires": { - "amqplib": "0.5.2", - "axios": "0.15.3", - "circular-json": "0.5.3", - "date-format": "1.2.0", - "debug": "3.1.0", - "hipchat-notifier": "1.1.0", - "loggly": "1.1.1", - "mailgun-js": "0.7.15", - "nodemailer": "2.7.2", - "redis": "2.8.0", - "semver": "5.5.0", - "slack-node": "0.2.0", - "streamroller": "0.7.0" + "amqplib": "^0.5.2", + "axios": "^0.15.3", + "circular-json": "^0.5.1", + "date-format": "^1.2.0", + "debug": "^3.1.0", + "hipchat-notifier": "^1.1.0", + "loggly": "^1.1.0", + "mailgun-js": "^0.7.0", + "nodemailer": "^2.5.0", + "redis": "^2.7.1", + "semver": "^5.3.0", + "slack-node": "~0.2.0", + "streamroller": "^0.7.0" }, "dependencies": { "debug": { @@ -6513,9 +6703,9 @@ "dev": true, "optional": true, "requires": { - "json-stringify-safe": "5.0.1", - "request": "2.75.0", - "timespan": "2.3.0" + "json-stringify-safe": "5.0.x", + "request": "2.75.x", + "timespan": "2.3.x" }, "dependencies": { "assert-plus": { @@ -6538,7 +6728,7 @@ "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "dev": true, "requires": { - "hoek": "2.16.3" + "hoek": "2.x.x" } }, "caseless": { @@ -6555,7 +6745,7 @@ "dev": true, "optional": true, "requires": { - "boom": "2.10.1" + "boom": "2.x.x" } }, "form-data": { @@ -6565,9 +6755,9 @@ "dev": true, "optional": true, "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.6", - "mime-types": "2.1.18" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.11" } }, "har-validator": { @@ -6577,10 +6767,10 @@ "dev": true, "optional": true, "requires": { - "chalk": "1.1.3", - "commander": "2.11.0", - "is-my-json-valid": "2.17.2", - "pinkie-promise": "2.0.1" + "chalk": "^1.1.1", + "commander": "^2.9.0", + "is-my-json-valid": "^2.12.4", + "pinkie-promise": "^2.0.0" } }, "hawk": { @@ -6590,10 +6780,10 @@ "dev": true, "optional": true, "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" } }, "hoek": { @@ -6609,9 +6799,9 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.1", - "sshpk": "1.14.1" + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "node-uuid": { @@ -6635,27 +6825,27 @@ "dev": true, "optional": true, "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.7.0", - "bl": "1.1.2", - "caseless": "0.11.0", - "combined-stream": "1.0.6", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.0.0", - "har-validator": "2.0.6", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.18", - "node-uuid": "1.4.8", - "oauth-sign": "0.8.2", - "qs": "6.2.3", - "stringstream": "0.0.5", - "tough-cookie": "2.3.4", - "tunnel-agent": "0.4.3" + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "bl": "~1.1.2", + "caseless": "~0.11.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.0.0", + "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", + "node-uuid": "~1.4.7", + "oauth-sign": "~0.8.1", + "qs": "~6.2.0", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "~0.4.1" } }, "sntp": { @@ -6665,7 +6855,7 @@ "dev": true, "optional": true, "requires": { - "hoek": "2.16.3" + "hoek": "2.x.x" } }, "tunnel-agent": { @@ -6701,7 +6891,7 @@ "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", "dev": true, "requires": { - "js-tokens": "3.0.2" + "js-tokens": "^3.0.0" } }, "loud-rejection": { @@ -6710,8 +6900,8 @@ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", "dev": true, "requires": { - "currently-unhandled": "0.4.1", - "signal-exit": "3.0.2" + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" } }, "lru-cache": { @@ -6720,8 +6910,8 @@ "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", "dev": true, "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" } }, "mailcomposer": { @@ -6742,15 +6932,15 @@ "dev": true, "optional": true, "requires": { - "async": "2.1.5", - "debug": "2.2.0", - "form-data": "2.1.4", - "inflection": "1.10.0", - "is-stream": "1.1.0", - "path-proxy": "1.0.0", - "proxy-agent": "2.0.0", - "q": "1.4.1", - "tsscmp": "1.0.5" + "async": "~2.1.2", + "debug": "~2.2.0", + "form-data": "~2.1.1", + "inflection": "~1.10.0", + "is-stream": "^1.1.0", + "path-proxy": "~1.0.0", + "proxy-agent": "~2.0.0", + "q": "~1.4.0", + "tsscmp": "~1.0.0" }, "dependencies": { "async": { @@ -6760,7 +6950,7 @@ "dev": true, "optional": true, "requires": { - "lodash": "4.17.10" + "lodash": "^4.14.0" } }, "debug": { @@ -6780,9 +6970,9 @@ "dev": true, "optional": true, "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.6", - "mime-types": "2.1.18" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" } }, "ms": { @@ -6795,23 +6985,12 @@ } }, "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.2.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.6" - } - } + "kind-of": "^6.0.2" } }, "map-cache": { @@ -6832,7 +7011,19 @@ "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true, "requires": { - "object-visit": "1.0.1" + "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" } }, "md5.js": { @@ -6841,8 +7032,8 @@ "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "dev": true, "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3" + "hash-base": "^3.0.0", + "inherits": "^2.0.1" } }, "media-typer": { @@ -6857,7 +7048,7 @@ "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { - "mimic-fn": "1.2.0" + "mimic-fn": "^1.0.0" } }, "memory-fs": { @@ -6866,8 +7057,8 @@ "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", "dev": true, "requires": { - "errno": "0.1.7", - "readable-stream": "2.3.3" + "errno": "^0.1.3", + "readable-stream": "^2.0.1" } }, "meow": { @@ -6876,15 +7067,15 @@ "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", "dev": true, "requires": { - "camelcase-keys": "4.2.0", - "decamelize-keys": "1.1.0", - "loud-rejection": "1.6.0", - "minimist-options": "3.0.2", - "normalize-package-data": "2.4.0", - "read-pkg-up": "3.0.0", - "redent": "2.0.0", - "trim-newlines": "2.0.0", - "yargs-parser": "10.0.0" + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0", + "yargs-parser": "^10.0.0" } }, "merge": { @@ -6911,19 +7102,19 @@ "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.4", - "fragment-cache": "0.2.1", - "kind-of": "6.0.2", - "nanomatch": "1.2.7", - "object.pick": "1.3.0", - "regex-not": "1.0.0", - "snapdragon": "0.8.1", - "to-regex": "3.0.1" + "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" } }, "miller-rabin": { @@ -6932,8 +7123,8 @@ "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", "dev": true, "requires": { - "bn.js": "4.11.8", - "brorand": "1.1.0" + "bn.js": "^4.0.0", + "brorand": "^1.0.1" } }, "mime": { @@ -6954,7 +7145,7 @@ "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "dev": true, "requires": { - "mime-db": "1.33.0" + "mime-db": "~1.33.0" } }, "mimic-fn": { @@ -6969,7 +7160,7 @@ "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", "dev": true, "requires": { - "dom-walk": "0.1.1" + "dom-walk": "^0.1.0" } }, "minimalistic-assert": { @@ -6990,7 +7181,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.8" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -7005,8 +7196,8 @@ "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { - "arrify": "1.0.1", - "is-plain-obj": "1.1.0" + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" } }, "mixin-deep": { @@ -7015,8 +7206,8 @@ "integrity": "sha512-dgaCvoh6i1nosAUBKb0l0pfJ78K8+S9fluyIR2YvAeUD/QuMahnFnF3xYty5eYXMjhGSsB0DsW6A0uAZyetoAg==", "dev": true, "requires": { - "for-in": "1.0.2", - "is-extendable": "1.0.1" + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" }, "dependencies": { "is-extendable": { @@ -7025,7 +7216,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "2.0.4" + "is-plain-object": "^2.0.4" } } } @@ -7059,8 +7250,8 @@ "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", "dev": true, "requires": { - "dns-packet": "1.3.1", - "thunky": "1.0.2" + "dns-packet": "^1.3.1", + "thunky": "^1.0.2" } }, "multicast-dns-service-types": { @@ -7069,14 +7260,11 @@ "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", "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" - } + "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", @@ -7090,17 +7278,17 @@ "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.1.0", - "object.pick": "1.3.0", - "regex-not": "1.0.0", - "snapdragon": "0.8.1", - "to-regex": "3.0.1" + "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": { @@ -7112,9 +7300,9 @@ } }, "natives": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz", - "integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.4.tgz", + "integrity": "sha512-Q29yeg9aFKwhLVdkTAejM/HvYG0Y1Am1+HUkFQGn5k2j8GS+v60TVmZh6nujpEAj/qql+wGUrlryO8bF+b1jEg==", "dev": true }, "negotiator": { @@ -7148,8 +7336,8 @@ "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", "dev": true, "requires": { - "encoding": "0.1.12", - "is-stream": "1.1.0" + "encoding": "^0.1.11", + "is-stream": "^1.0.1" } }, "node-forge": { @@ -7159,31 +7347,177 @@ "dev": true }, "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.11", - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "nopt": "3.0.6", - "npmlog": "4.1.2", - "osenv": "0.1.5", - "request": "2.85.0", - "rimraf": "2.6.2", - "semver": "5.3.0", - "tar": "2.2.1", - "which": "1.3.0" + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.7.0.tgz", + "integrity": "sha512-qDQE/Ft9xXP6zphwx4sD0t+VhwV7yFaloMpfbL2QnnDZcyaiakWlLdtFGGQfTAwpFHdpbRhRxVhIHN1OKAjgbg==", + "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.9.0 <2.82.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" }, "dependencies": { + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "dev": true, + "requires": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + } + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "dev": true + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "requires": { + "boom": "2.x.x" + } + }, + "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" + } + }, + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "dev": true + }, + "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" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "dev": true + }, + "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" + } + }, "semver": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "requires": { + "hoek": "2.x.x" + } } } }, @@ -7193,28 +7527,28 @@ "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", "dev": true, "requires": { - "assert": "1.4.1", - "browserify-zlib": "0.2.0", - "buffer": "4.9.1", - "console-browserify": "1.1.0", - "constants-browserify": "1.0.0", - "crypto-browserify": "3.12.0", - "domain-browser": "1.2.0", - "events": "1.1.1", - "https-browserify": "1.0.0", - "os-browserify": "0.3.0", + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^1.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", "path-browserify": "0.0.0", - "process": "0.11.10", - "punycode": "1.4.1", - "querystring-es3": "0.2.1", - "readable-stream": "2.3.3", - "stream-browserify": "2.0.1", - "stream-http": "2.8.1", - "string_decoder": "1.0.3", - "timers-browserify": "2.0.10", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", "tty-browserify": "0.0.0", - "url": "0.11.0", - "util": "0.10.3", + "url": "^0.11.0", + "util": "^0.10.3", "vm-browserify": "0.0.4" }, "dependencies": { @@ -7224,9 +7558,9 @@ "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { - "base64-js": "1.3.0", - "ieee754": "1.1.11", - "isarray": "1.0.0" + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" } }, "process": { @@ -7243,10 +7577,10 @@ "integrity": "sha512-MIBs+AAd6dJ2SklbbE8RUDRlIVhU8MaNLh1A9SUZDUHPiZkWLFde6UNwG41yQHZEToHgJMXqyVZ9UcS/ReOVTg==", "dev": true, "requires": { - "growly": "1.3.0", - "semver": "5.5.0", - "shellwords": "0.1.1", - "which": "1.3.0" + "growly": "^1.3.0", + "semver": "^5.4.1", + "shellwords": "^0.1.1", + "which": "^1.3.0" } }, "node-resemble-js": { @@ -7256,7 +7590,7 @@ "dev": true, "requires": { "jpeg-js": "0.2.0", - "pngjs": "2.2.0" + "pngjs": "~2.2.0" }, "dependencies": { "pngjs": { @@ -7268,53 +7602,32 @@ } }, "node-sass": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.9.0.tgz", - "integrity": "sha512-QFHfrZl6lqRU3csypwviz2XLgGNOoWQbo2GOvtsfQqOfL4cy1BtWnhx/XUeAO9LT3ahBzSRXcEO6DdvAH9DzSg==", - "dev": true, - "requires": { - "async-foreach": "0.1.3", - "chalk": "1.1.3", - "cross-spawn": "3.0.1", - "gaze": "1.1.2", - "get-stdin": "4.0.1", - "glob": "7.1.2", - "in-publish": "2.0.0", - "lodash.assign": "4.2.0", - "lodash.clonedeep": "4.5.0", - "lodash.mergewith": "4.6.1", - "meow": "3.7.0", - "mkdirp": "0.5.1", - "nan": "2.10.0", - "node-gyp": "3.6.2", - "npmlog": "4.1.2", - "request": "2.79.0", - "sass-graph": "2.2.4", - "stdout-stream": "1.4.0", - "true-case-path": "1.0.2" + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.9.2.tgz", + "integrity": "sha512-LdxoJLZutx0aQXHtWIYwJKMj+9pTjneTcLWJgzf2XbGu0q5pRNqW5QvFCEdm3mc5rJOdru/mzln5d0EZLacf6g==", + "dev": true, + "requires": { + "async-foreach": "^0.1.3", + "chalk": "^1.1.1", + "cross-spawn": "^3.0.0", + "gaze": "^1.0.0", + "get-stdin": "^4.0.1", + "glob": "^7.0.3", + "in-publish": "^2.0.0", + "lodash.assign": "^4.2.0", + "lodash.clonedeep": "^4.3.2", + "lodash.mergewith": "^4.6.0", + "meow": "^3.7.0", + "mkdirp": "^0.5.1", + "nan": "^2.10.0", + "node-gyp": "^3.3.1", + "npmlog": "^4.0.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": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", - "dev": true - }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "dev": true - }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "dev": true, - "requires": { - "hoek": "2.16.3" - } - }, "camelcase": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", @@ -7327,33 +7640,18 @@ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { - "camelcase": "2.1.1", - "map-obj": "1.0.1" + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" } }, - "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", - "dev": true - }, "cross-spawn": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", "dev": true, "requires": { - "lru-cache": "4.1.2", - "which": "1.3.0" - } - }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "dev": true, - "requires": { - "boom": "2.10.1" + "lru-cache": "^4.0.1", + "which": "^1.2.9" } }, "find-up": { @@ -7362,87 +7660,15 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" - } - }, - "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.6", - "mime-types": "2.1.18" - } - }, - "gaze": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.2.tgz", - "integrity": "sha1-hHIkZ3rbiHDWeSV+0ziP22HkAQU=", - "dev": true, - "requires": { - "globule": "1.2.0" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, - "globule": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.0.tgz", - "integrity": "sha1-HcScaCLdnoovoAuiopUAboZkvQk=", - "dev": true, - "requires": { - "glob": "7.1.2", - "lodash": "4.17.10", - "minimatch": "3.0.4" - } - }, - "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "commander": "2.11.0", - "is-my-json-valid": "2.17.2", - "pinkie-promise": "2.0.1" - } - }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "dev": true, - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "dev": true, - "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.1", - "sshpk": "1.14.1" - } + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true }, "indent-string": { "version": "2.1.0", @@ -7450,7 +7676,7 @@ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, "requires": { - "repeating": "2.0.1" + "repeating": "^2.0.0" } }, "load-json-file": { @@ -7459,11 +7685,11 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.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" } }, "map-obj": { @@ -7478,31 +7704,25 @@ "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { - "camelcase-keys": "2.1.0", - "decamelize": "1.2.0", - "loud-rejection": "1.6.0", - "map-obj": "1.0.1", - "minimist": "1.2.0", - "normalize-package-data": "2.4.0", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "redent": "1.0.0", - "trim-newlines": "1.0.0" + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" } }, - "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 - }, "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.3.1" + "error-ex": "^1.2.0" } }, "path-exists": { @@ -7511,7 +7731,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "2.0.1" + "pinkie-promise": "^2.0.0" } }, "path-type": { @@ -7520,9 +7740,9 @@ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "pify": { @@ -7531,21 +7751,15 @@ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, - "qs": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", - "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", - "dev": true - }, "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.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.0" + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" } }, "read-pkg-up": { @@ -7554,8 +7768,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" } }, "redent": { @@ -7564,45 +7778,36 @@ "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", "dev": true, "requires": { - "indent-string": "2.1.0", - "strip-indent": "1.0.1" + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" } }, "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.7.0", - "caseless": "0.11.0", - "combined-stream": "1.0.6", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "2.0.6", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.18", - "oauth-sign": "0.8.2", - "qs": "6.3.2", - "stringstream": "0.0.5", - "tough-cookie": "2.3.4", - "tunnel-agent": "0.4.3", - "uuid": "3.2.1" - } - }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "dev": true, - "requires": { - "hoek": "2.16.3" + "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" } }, "strip-bom": { @@ -7611,7 +7816,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "0.2.1" + "is-utf8": "^0.2.0" } }, "strip-indent": { @@ -7620,7 +7825,7 @@ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", "dev": true, "requires": { - "get-stdin": "4.0.1" + "get-stdin": "^4.0.1" } }, "trim-newlines": { @@ -7628,12 +7833,6 @@ "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", "dev": true - }, - "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "dev": true } } }, @@ -7649,7 +7848,7 @@ "integrity": "sha1-dSWih1Z36lNHhKXhCseJVhOWFN8=", "dev": true, "requires": { - "is": "3.2.1" + "is": "^3.2.1" } }, "nodemailer": { @@ -7675,8 +7874,8 @@ "dev": true, "optional": true, "requires": { - "ip": "1.1.5", - "smart-buffer": "1.1.15" + "ip": "^1.1.2", + "smart-buffer": "^1.0.4" } } } @@ -7743,7 +7942,7 @@ "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", "dev": true, "requires": { - "abbrev": "1.1.1" + "abbrev": "1" } }, "normalize-package-data": { @@ -7752,10 +7951,10 @@ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true, "requires": { - "hosted-git-info": "2.6.0", - "is-builtin-module": "1.0.0", - "semver": "5.5.0", - "validate-npm-package-license": "3.0.3" + "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": { @@ -7764,7 +7963,16 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "1.1.0" + "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" } }, "npm-run-path": { @@ -7773,7 +7981,7 @@ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { - "path-key": "2.0.1" + "path-key": "^2.0.0" } }, "npmlog": { @@ -7782,10 +7990,10 @@ "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, "null-check": { @@ -7807,9 +8015,9 @@ "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=", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, "object-component": { @@ -7824,9 +8032,9 @@ "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", "dev": true, "requires": { - "copy-descriptor": "0.1.1", - "define-property": "0.2.5", - "kind-of": "3.2.2" + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" }, "dependencies": { "define-property": { @@ -7835,7 +8043,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "is-accessor-descriptor": { @@ -7844,7 +8052,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" } }, "is-data-descriptor": { @@ -7853,7 +8061,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" } }, "is-descriptor": { @@ -7862,9 +8070,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" }, "dependencies": { "kind-of": { @@ -7881,7 +8089,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -7893,9 +8101,9 @@ "dev": true }, "object-keys": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", - "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=", + "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": { @@ -7904,7 +8112,19 @@ "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", "dev": true, "requires": { - "isobject": "3.0.1" + "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": { @@ -7913,10 +8133,10 @@ "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", "dev": true, "requires": { - "array-each": "1.0.1", - "array-slice": "1.1.0", - "for-own": "1.0.0", - "isobject": "3.0.1" + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" } }, "object.map": { @@ -7925,8 +8145,8 @@ "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", "dev": true, "requires": { - "for-own": "1.0.0", - "make-iterator": "1.0.0" + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" } }, "object.omit": { @@ -7935,8 +8155,8 @@ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" }, "dependencies": { "for-own": { @@ -7945,7 +8165,7 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { - "for-in": "1.0.2" + "for-in": "^1.0.1" } } } @@ -7956,7 +8176,17 @@ "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "dev": true, "requires": { - "isobject": "3.0.1" + "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" } }, "obuf": { @@ -7986,7 +8216,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "open": { @@ -8001,7 +8231,7 @@ "integrity": "sha512-bYJHo/LOmoTd+pfiYhfZDnf9zekVJrY+cnS2a5F2x+w5ppvTqObojTP7WiFG+kVZs9Inw+qQ/lw7TroWwhdd2g==", "dev": true, "requires": { - "is-wsl": "1.1.0" + "is-wsl": "^1.1.0" } }, "optimist": { @@ -8010,8 +8240,8 @@ "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { - "minimist": "0.0.10", - "wordwrap": "0.0.2" + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" }, "dependencies": { "minimist": { @@ -8029,12 +8259,12 @@ "dev": true, "optional": true, "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" }, "dependencies": { "wordwrap": { @@ -8046,30 +8276,22 @@ } } }, - "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" } }, - "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 - }, "original": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/original/-/original-1.0.0.tgz", "integrity": "sha1-kUf5P6FpbQS+YeAb1QuurKZWvTs=", "dev": true, "requires": { - "url-parse": "1.0.5" + "url-parse": "1.0.x" }, "dependencies": { "url-parse": { @@ -8078,8 +8300,8 @@ "integrity": "sha1-CFSGBCKv3P7+tsllxmLUgAFpkns=", "dev": true, "requires": { - "querystringify": "0.0.4", - "requires-port": "1.0.0" + "querystringify": "0.0.x", + "requires-port": "1.0.x" } } } @@ -8108,9 +8330,9 @@ "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { - "execa": "0.7.0", - "lcid": "1.0.0", - "mem": "1.1.0" + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" } }, "os-tmpdir": { @@ -8125,8 +8347,8 @@ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "p-finally": { @@ -8141,7 +8363,7 @@ "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", "dev": true, "requires": { - "p-try": "1.0.0" + "p-try": "^1.0.0" } }, "p-locate": { @@ -8150,7 +8372,7 @@ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { - "p-limit": "1.2.0" + "p-limit": "^1.1.0" } }, "p-map": { @@ -8172,15 +8394,15 @@ "dev": true, "optional": true, "requires": { - "agent-base": "2.1.1", - "debug": "2.6.9", - "extend": "3.0.1", - "get-uri": "2.0.1", - "http-proxy-agent": "1.0.0", - "https-proxy-agent": "1.0.0", - "pac-resolver": "2.0.0", - "raw-body": "2.3.2", - "socks-proxy-agent": "2.1.1" + "agent-base": "2", + "debug": "2", + "extend": "3", + "get-uri": "2", + "http-proxy-agent": "1", + "https-proxy-agent": "1", + "pac-resolver": "~2.0.0", + "raw-body": "2", + "socks-proxy-agent": "2" }, "dependencies": { "agent-base": { @@ -8189,8 +8411,8 @@ "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "dev": true, "requires": { - "extend": "3.0.1", - "semver": "5.0.3" + "extend": "~3.0.0", + "semver": "~5.0.1" } }, "https-proxy-agent": { @@ -8200,9 +8422,9 @@ "dev": true, "optional": true, "requires": { - "agent-base": "2.1.1", - "debug": "2.6.9", - "extend": "3.0.1" + "agent-base": "2", + "debug": "2", + "extend": "3" } }, "semver": { @@ -8220,11 +8442,11 @@ "dev": true, "optional": true, "requires": { - "co": "3.0.6", - "degenerator": "1.0.4", + "co": "~3.0.6", + "degenerator": "~1.0.2", "ip": "1.0.1", - "netmask": "1.0.6", - "thunkify": "2.1.2" + "netmask": "~1.0.4", + "thunkify": "~2.1.1" }, "dependencies": { "co": { @@ -8255,11 +8477,11 @@ "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "dev": true, "requires": { - "asn1.js": "4.10.1", - "browserify-aes": "1.2.0", - "create-hash": "1.2.0", - "evp_bytestokey": "1.0.3", - "pbkdf2": "3.0.16" + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" } }, "parse-bmfont-ascii": { @@ -8280,8 +8502,8 @@ "integrity": "sha1-1rZqNxr9OcUAfZ8O6yYqTyzOe3w=", "dev": true, "requires": { - "xml-parse-from-string": "1.0.1", - "xml2js": "0.4.19" + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.4.5" } }, "parse-filepath": { @@ -8290,9 +8512,9 @@ "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", "dev": true, "requires": { - "is-absolute": "1.0.0", - "map-cache": "0.2.2", - "path-root": "0.1.1" + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" } }, "parse-glob": { @@ -8301,10 +8523,10 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" }, "dependencies": { "is-extglob": { @@ -8319,7 +8541,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } } } @@ -8330,7 +8552,7 @@ "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", "dev": true, "requires": { - "for-each": "0.3.2", + "for-each": "^0.3.2", "trim": "0.0.1" } }, @@ -8340,8 +8562,8 @@ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "1.3.1", - "json-parse-better-errors": "1.0.2" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" } }, "parse-passwd": { @@ -8356,7 +8578,7 @@ "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", "dev": true, "requires": { - "better-assert": "1.0.2" + "better-assert": "~1.0.0" } }, "parseuri": { @@ -8365,7 +8587,7 @@ "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", "dev": true, "requires": { - "better-assert": "1.0.2" + "better-assert": "~1.0.0" } }, "parseurl": { @@ -8386,8 +8608,8 @@ "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", "dev": true, "requires": { - "process": "0.11.10", - "util": "0.10.3" + "process": "^0.11.1", + "util": "^0.10.3" }, "dependencies": { "process": { @@ -8447,7 +8669,7 @@ "dev": true, "optional": true, "requires": { - "inflection": "1.3.8" + "inflection": "~1.3.0" }, "dependencies": { "inflection": { @@ -8465,7 +8687,7 @@ "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", "dev": true, "requires": { - "path-root-regex": "0.1.2" + "path-root-regex": "^0.1.0" } }, "path-root-regex": { @@ -8486,7 +8708,7 @@ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "3.0.0" + "pify": "^3.0.0" } }, "pbkdf2": { @@ -8495,11 +8717,11 @@ "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", "dev": true, "requires": { - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "ripemd160": "2.0.2", - "safe-buffer": "5.1.1", - "sha.js": "2.4.11" + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" } }, "pend": { @@ -8520,15 +8742,15 @@ "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=", "dev": true, "requires": { - "es6-promise": "4.2.4", - "extract-zip": "1.6.6", - "fs-extra": "1.0.0", - "hasha": "2.2.0", - "kew": "0.7.0", - "progress": "1.1.8", - "request": "2.85.0", - "request-progress": "2.0.1", - "which": "1.3.0" + "es6-promise": "^4.0.3", + "extract-zip": "^1.6.5", + "fs-extra": "^1.0.0", + "hasha": "^2.2.0", + "kew": "^0.7.0", + "progress": "^1.1.8", + "request": "^2.81.0", + "request-progress": "^2.0.1", + "which": "^1.2.10" }, "dependencies": { "fs-extra": { @@ -8537,9 +8759,9 @@ "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "2.4.0", - "klaw": "1.3.1" + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0" } } } @@ -8562,7 +8784,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" } }, "pixelmatch": { @@ -8571,7 +8793,7 @@ "integrity": "sha1-j0fc7FARtHe2fbA8JDvB8wheiFQ=", "dev": true, "requires": { - "pngjs": "3.3.3" + "pngjs": "^3.0.0" } }, "pkg-dir": { @@ -8580,7 +8802,7 @@ "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", "dev": true, "requires": { - "find-up": "2.1.0" + "find-up": "^2.1.0" } }, "plugin-error": { @@ -8589,10 +8811,10 @@ "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==", "dev": true, "requires": { - "ansi-colors": "1.1.0", - "arr-diff": "4.0.0", - "arr-union": "3.1.0", - "extend-shallow": "3.0.2" + "ansi-colors": "^1.0.1", + "arr-diff": "^4.0.0", + "arr-union": "^3.1.0", + "extend-shallow": "^3.0.2" }, "dependencies": { "extend-shallow": { @@ -8601,8 +8823,8 @@ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, "requires": { - "assign-symbols": "1.0.0", - "is-extendable": "1.0.1" + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" } }, "is-extendable": { @@ -8611,7 +8833,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "2.0.4" + "is-plain-object": "^2.0.4" } } } @@ -8628,9 +8850,9 @@ "integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=", "dev": true, "requires": { - "async": "1.5.2", - "debug": "2.6.9", - "mkdirp": "0.5.1" + "async": "^1.5.2", + "debug": "^2.2.0", + "mkdirp": "0.5.x" }, "dependencies": { "async": { @@ -8695,7 +8917,7 @@ "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "dev": true, "requires": { - "asap": "2.0.6" + "asap": "~2.0.3" } }, "promise-polyfill": { @@ -8710,9 +8932,9 @@ "integrity": "sha512-4ec7bY1Y66LymSUOH/zARVYObB23AT2h8cf6e/O6ZALB/N0sqZFEx7rq6EYPX2MkOdKORuooI/H5k9TlR4q7kQ==", "dev": true, "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1" + "fbjs": "^0.8.16", + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" }, "dependencies": { "object-assign": { @@ -8729,7 +8951,7 @@ "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", "dev": true, "requires": { - "forwarded": "0.1.2", + "forwarded": "~0.1.2", "ipaddr.js": "1.6.0" } }, @@ -8740,14 +8962,14 @@ "dev": true, "optional": true, "requires": { - "agent-base": "2.1.1", - "debug": "2.6.9", - "extend": "3.0.1", - "http-proxy-agent": "1.0.0", - "https-proxy-agent": "1.0.0", - "lru-cache": "2.6.5", - "pac-proxy-agent": "1.1.0", - "socks-proxy-agent": "2.1.1" + "agent-base": "2", + "debug": "2", + "extend": "3", + "http-proxy-agent": "1", + "https-proxy-agent": "1", + "lru-cache": "~2.6.5", + "pac-proxy-agent": "1", + "socks-proxy-agent": "2" }, "dependencies": { "agent-base": { @@ -8756,8 +8978,8 @@ "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "dev": true, "requires": { - "extend": "3.0.1", - "semver": "5.0.3" + "extend": "~3.0.0", + "semver": "~5.0.1" } }, "https-proxy-agent": { @@ -8767,9 +8989,9 @@ "dev": true, "optional": true, "requires": { - "agent-base": "2.1.1", - "debug": "2.6.9", - "extend": "3.0.1" + "agent-base": "2", + "debug": "2", + "extend": "3" } }, "lru-cache": { @@ -8811,11 +9033,32 @@ "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", "dev": true, "requires": { - "bn.js": "4.11.8", - "browserify-rsa": "4.0.1", - "create-hash": "1.2.0", - "parse-asn1": "5.1.1", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "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" } }, "punycode": { @@ -8830,14 +9073,14 @@ "integrity": "sha512-wx10aPQPpGJVxdB6yoDSLm9p4rCwARUSLMVV0bx++owuqkvviXKyiFM3EWsywaFmjOKNPXacIjplF7xhHiFP3w==", "dev": true, "requires": { - "debug": "2.6.9", - "extract-zip": "1.6.6", - "https-proxy-agent": "2.2.1", - "mime": "1.6.0", - "progress": "2.0.0", - "proxy-from-env": "1.0.0", - "rimraf": "2.6.2", - "ws": "3.3.3" + "debug": "^2.6.8", + "extract-zip": "^1.6.5", + "https-proxy-agent": "^2.1.0", + "mime": "^1.3.4", + "progress": "^2.0.0", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^3.0.0" }, "dependencies": { "progress": { @@ -8897,7 +9140,7 @@ "integrity": "sha512-pDP/NMRAXoTfrhCfyfSEwJAKLaxBU9eApMeBPB1TkDouZmvPerIClV8lTAd+uF8ZiTaVl69e1FCxQrAd/VTjGw==", "dev": true, "requires": { - "performance-now": "2.1.0" + "performance-now": "^2.1.0" } }, "randomatic": { @@ -8906,8 +9149,8 @@ "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", "dev": true, "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" + "is-number": "^3.0.0", + "kind-of": "^4.0.0" }, "dependencies": { "kind-of": { @@ -8916,7 +9159,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -8927,7 +9170,7 @@ "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "^5.1.0" } }, "randomfill": { @@ -8936,8 +9179,8 @@ "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", "dev": true, "requires": { - "randombytes": "2.0.6", - "safe-buffer": "5.1.1" + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" } }, "range-parser": { @@ -8973,7 +9216,7 @@ "depd": "1.1.1", "inherits": "2.0.3", "setprototypeof": "1.0.3", - "statuses": "1.4.0" + "statuses": ">= 1.3.1 < 2" } }, "iconv-lite": { @@ -8996,11 +9239,11 @@ "integrity": "sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=", "dev": true, "requires": { - "create-react-class": "15.6.3", - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "prop-types": "15.6.1" + "create-react-class": "^15.6.0", + "fbjs": "^0.8.9", + "loose-envify": "^1.1.0", + "object-assign": "^4.1.0", + "prop-types": "^15.5.10" }, "dependencies": { "object-assign": { @@ -9017,10 +9260,10 @@ "integrity": "sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=", "dev": true, "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "prop-types": "15.6.1" + "fbjs": "^0.8.9", + "loose-envify": "^1.1.0", + "object-assign": "^4.1.0", + "prop-types": "^15.5.10" }, "dependencies": { "object-assign": { @@ -9043,10 +9286,10 @@ "integrity": "sha512-5VYNvy301Z0xxGBQhPmDdzOcyEkUG8sU7bpRsAPI4OHgEUkbBFrpjzs/ocNI0m824/lOqTxddXzwgmDJXx3s3Q==", "dev": true, "requires": { - "exenv": "1.2.2", - "prop-types": "15.6.1", - "react-lifecycles-compat": "3.0.2", - "warning": "3.0.0" + "exenv": "^1.2.0", + "prop-types": "^15.5.10", + "react-lifecycles-compat": "^3.0.0", + "warning": "^3.0.0" } }, "react-motion": { @@ -9055,9 +9298,9 @@ "integrity": "sha512-9q3YAvHoUiWlP3cK0v+w1N5Z23HXMj4IF4YuvjvWegWqNPfLXsOBE/V7UvQGpXxHFKRQQcNcVQE31g9SB/6qgQ==", "dev": true, "requires": { - "performance-now": "0.2.0", - "prop-types": "15.6.1", - "raf": "3.4.0" + "performance-now": "^0.2.0", + "prop-types": "^15.5.8", + "raf": "^3.1.0" }, "dependencies": { "performance-now": { @@ -9074,12 +9317,12 @@ "integrity": "sha512-5VI8EV5hdgNgyjfmWzBbdrqUkrVRKlyTKk1sGH3jzM2M2Mhj/seQgPXaz6gVAj2lz/nz688AdTqMO18Lr24Zhg==", "dev": true, "requires": { - "hoist-non-react-statics": "2.5.0", - "invariant": "2.2.4", - "lodash": "4.17.10", - "lodash-es": "4.17.10", - "loose-envify": "1.3.1", - "prop-types": "15.6.1" + "hoist-non-react-statics": "^2.5.0", + "invariant": "^2.0.0", + "lodash": "^4.17.5", + "lodash-es": "^4.17.5", + "loose-envify": "^1.1.0", + "prop-types": "^15.6.0" } }, "react-sticky": { @@ -9088,8 +9331,8 @@ "integrity": "sha512-eXsij6ifE2k1d6eCwQzil0JRS3VLP6BYfiF7qEbVPL3GLqciedGJfbavpXx5T95x5HvhuAA4FChYEDv83r1NyQ==", "dev": true, "requires": { - "prop-types": "15.6.1", - "raf": "3.4.0" + "prop-types": "^15.5.8", + "raf": "^3.3.0" } }, "react-toggle-button": { @@ -9098,8 +9341,8 @@ "integrity": "sha1-obkhQ6oN9BRkL8sUHwh59UW8Wok=", "dev": true, "requires": { - "prop-types": "15.6.1", - "react-motion": "0.5.2" + "prop-types": "^15.6.0", + "react-motion": "^0.5.2" } }, "read-chunk": { @@ -9114,9 +9357,9 @@ "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { - "load-json-file": "4.0.0", - "normalize-package-data": "2.4.0", - "path-type": "3.0.0" + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" } }, "read-pkg-up": { @@ -9125,8 +9368,8 @@ "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { - "find-up": "2.1.0", - "read-pkg": "3.0.0" + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" } }, "readable-stream": { @@ -9135,13 +9378,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "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" } }, "readdirp": { @@ -9150,10 +9393,10 @@ "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "minimatch": "3.0.4", - "readable-stream": "2.3.3", - "set-immediate-shim": "1.0.1" + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" } }, "rechoir": { @@ -9162,7 +9405,7 @@ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { - "resolve": "1.5.0" + "resolve": "^1.1.6" } }, "redent": { @@ -9171,8 +9414,8 @@ "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", "dev": true, "requires": { - "indent-string": "3.2.0", - "strip-indent": "2.0.0" + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" } }, "redis": { @@ -9182,9 +9425,9 @@ "dev": true, "optional": true, "requires": { - "double-ended-queue": "2.1.0-0", - "redis-commands": "1.3.5", - "redis-parser": "2.6.0" + "double-ended-queue": "^2.1.0-0", + "redis-commands": "^1.2.0", + "redis-parser": "^2.6.0" } }, "redis-commands": { @@ -9207,10 +9450,10 @@ "integrity": "sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==", "dev": true, "requires": { - "lodash": "4.17.10", - "lodash-es": "4.17.10", - "loose-envify": "1.3.1", - "symbol-observable": "1.2.0" + "lodash": "^4.2.1", + "lodash-es": "^4.2.1", + "loose-envify": "^1.1.0", + "symbol-observable": "^1.0.3" } }, "regenerator-runtime": { @@ -9225,7 +9468,7 @@ "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { - "is-equal-shallow": "0.1.3" + "is-equal-shallow": "^0.1.3" } }, "regex-not": { @@ -9234,7 +9477,28 @@ "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", "dev": true, "requires": { - "extend-shallow": "2.0.1" + "extend-shallow": "^2.0.1" + } + }, + "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": { + "remove-bom-buffer": "^3.0.0", + "safe-buffer": "^5.1.0", + "through2": "^2.0.3" } }, "remove-trailing-separator": { @@ -9261,32 +9525,35 @@ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { - "is-finite": "1.0.2" + "is-finite": "^1.0.0" } }, "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" + } + }, "replacestream": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz", "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==", "dev": true, "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1", - "readable-stream": "2.3.3" - }, - "dependencies": { - "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 - } + "escape-string-regexp": "^1.0.3", + "object-assign": "^4.0.1", + "readable-stream": "^2.0.2" } }, "request": { @@ -9295,28 +9562,28 @@ "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "dev": true, "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.7.0", - "caseless": "0.12.0", - "combined-stream": "1.0.6", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.3.2", - "har-validator": "5.0.3", - "hawk": "6.0.2", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.18", - "oauth-sign": "0.8.2", - "performance-now": "2.1.0", - "qs": "6.5.1", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.4", - "tunnel-agent": "0.6.0", - "uuid": "3.2.1" + "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", + "hawk": "~6.0.2", + "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", + "stringstream": "~0.0.5", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" } }, "request-progress": { @@ -9325,7 +9592,7 @@ "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", "dev": true, "requires": { - "throttleit": "1.0.0" + "throttleit": "^1.0.0" } }, "requestretry": { @@ -9335,10 +9602,10 @@ "dev": true, "optional": true, "requires": { - "extend": "3.0.1", - "lodash": "4.17.10", - "request": "2.85.0", - "when": "3.7.8" + "extend": "^3.0.0", + "lodash": "^4.15.0", + "request": "^2.74.0", + "when": "^3.7.7" } }, "require-directory": { @@ -9366,12 +9633,12 @@ "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" + "path-parse": "^1.0.5" } }, "resolve-cwd": { @@ -9380,7 +9647,7 @@ "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", "dev": true, "requires": { - "resolve-from": "3.0.0" + "resolve-from": "^3.0.0" } }, "resolve-dir": { @@ -9389,8 +9656,8 @@ "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", "dev": true, "requires": { - "expand-tilde": "2.0.2", - "global-modules": "1.0.0" + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" } }, "resolve-from": { @@ -9399,6 +9666,15 @@ "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", "dev": true }, + "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", @@ -9411,7 +9687,7 @@ "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, "requires": { - "align-text": "0.1.4" + "align-text": "^0.1.1" } }, "rimraf": { @@ -9420,7 +9696,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "ripemd160": { @@ -9429,8 +9705,8 @@ "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", "dev": true, "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3" + "hash-base": "^3.0.0", + "inherits": "^2.0.1" } }, "safe-buffer": { @@ -9457,173 +9733,10 @@ "integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=", "dev": true, "requires": { - "glob": "7.1.2", - "lodash": "4.17.10", - "scss-tokenizer": "0.2.3", - "yargs": "7.1.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 - }, - "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.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" - } - }, - "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": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.0.0" - } - }, - "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-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.3.1" - } - }, - "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.1" - } - }, - "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.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "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.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.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.1.2", - "read-pkg": "1.1.0" - } - }, - "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.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "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.1" - } - }, - "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 - }, - "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.2.0", - "get-caller-file": "1.0.2", - "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" - } - } + "glob": "^7.0.0", + "lodash": "^4.0.0", + "scss-tokenizer": "^0.2.3", + "yargs": "^7.0.0" } }, "sax": { @@ -9638,8 +9751,8 @@ "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", "dev": true, "requires": { - "js-base64": "2.4.3", - "source-map": "0.4.4" + "js-base64": "^2.1.8", + "source-map": "^0.4.2" }, "dependencies": { "source-map": { @@ -9648,7 +9761,7 @@ "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } } } @@ -9674,6 +9787,15 @@ "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true }, + "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": { + "sver-compat": "^1.5.0" + } + }, "send": { "version": "0.16.2", "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", @@ -9681,18 +9803,18 @@ "dev": true, "requires": { "debug": "2.6.9", - "depd": "1.1.2", - "destroy": "1.0.4", - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "etag": "1.8.1", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "1.6.3", + "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.4.0" + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" }, "dependencies": { "mime": { @@ -9703,25 +9825,19 @@ } } }, - "sequencify": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", - "integrity": "sha1-kM/xnQLgcCf9dn9erT57ldHnOAw=", - "dev": true - }, "serve-index": { "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.5", + "accepts": "~1.3.4", "batch": "0.6.1", "debug": "2.6.9", - "escape-html": "1.0.3", - "http-errors": "1.6.3", - "mime-types": "2.1.18", - "parseurl": "1.3.2" + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" } }, "serve-static": { @@ -9730,9 +9846,9 @@ "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", "dev": true, "requires": { - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "parseurl": "1.3.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", "send": "0.16.2" } }, @@ -9748,7 +9864,7 @@ "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", "dev": true, "requires": { - "to-object-path": "0.3.0" + "to-object-path": "^0.3.0" } }, "set-immediate-shim": { @@ -9763,10 +9879,10 @@ "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "dev": true, "requires": { - "extend-shallow": "2.0.1", - "is-extendable": "0.1.1", - "is-plain-object": "2.0.4", - "split-string": "3.1.0" + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" } }, "setimmediate": { @@ -9787,8 +9903,8 @@ "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.1" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "shebang-command": { @@ -9797,7 +9913,7 @@ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { - "shebang-regex": "1.0.0" + "shebang-regex": "^1.0.0" } }, "shebang-regex": { @@ -9833,7 +9949,7 @@ "formatio": "1.1.1", "lolex": "1.3.2", "samsam": "1.1.2", - "util": "0.10.3" + "util": ">=0.10.3 <1" } }, "slack-node": { @@ -9843,7 +9959,7 @@ "dev": true, "optional": true, "requires": { - "requestretry": "1.13.0" + "requestretry": "^1.2.2" } }, "smart-buffer": { @@ -9868,14 +9984,14 @@ "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", "dev": true, "requires": { - "base": "0.11.2", - "debug": "2.6.9", - "define-property": "0.2.5", - "extend-shallow": "2.0.1", - "map-cache": "0.2.2", - "source-map": "0.5.7", - "source-map-resolve": "0.5.1", - "use": "2.0.2" + "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": { @@ -9884,7 +10000,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "is-accessor-descriptor": { @@ -9893,7 +10009,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -9902,7 +10018,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -9913,7 +10029,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -9922,7 +10038,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -9933,9 +10049,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" } }, "kind-of": { @@ -9952,9 +10068,9 @@ "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { - "define-property": "1.0.0", - "isobject": "3.0.1", - "snapdragon-util": "3.0.1" + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" } }, "snapdragon-util": { @@ -9963,7 +10079,7 @@ "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.2.0" }, "dependencies": { "kind-of": { @@ -9972,7 +10088,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -9983,7 +10099,7 @@ "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "dev": true, "requires": { - "hoek": "4.2.1" + "hoek": "4.x.x" } }, "socket.io": { @@ -9992,11 +10108,11 @@ "integrity": "sha1-waRZDO/4fs8TxyZS8Eb3FrKeYBQ=", "dev": true, "requires": { - "debug": "2.6.9", - "engine.io": "3.1.5", - "socket.io-adapter": "1.1.1", + "debug": "~2.6.6", + "engine.io": "~3.1.0", + "socket.io-adapter": "~1.1.0", "socket.io-client": "2.0.4", - "socket.io-parser": "3.1.3" + "socket.io-parser": "~3.1.1" } }, "socket.io-adapter": { @@ -10015,14 +10131,14 @@ "base64-arraybuffer": "0.1.5", "component-bind": "1.0.0", "component-emitter": "1.2.1", - "debug": "2.6.9", - "engine.io-client": "3.1.6", + "debug": "~2.6.4", + "engine.io-client": "~3.1.0", "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.1.3", + "socket.io-parser": "~3.1.1", "to-array": "0.1.4" } }, @@ -10033,8 +10149,8 @@ "dev": true, "requires": { "component-emitter": "1.2.1", - "debug": "3.1.0", - "has-binary2": "1.0.2", + "debug": "~3.1.0", + "has-binary2": "~1.0.2", "isarray": "2.0.1" }, "dependencies": { @@ -10061,8 +10177,8 @@ "integrity": "sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw==", "dev": true, "requires": { - "faye-websocket": "0.10.0", - "uuid": "3.2.1" + "faye-websocket": "^0.10.0", + "uuid": "^3.0.1" } }, "sockjs-client": { @@ -10071,12 +10187,12 @@ "integrity": "sha1-W6vjhrd15M8U51IJEUUmVAFsixI=", "dev": true, "requires": { - "debug": "2.6.9", + "debug": "^2.6.6", "eventsource": "0.1.6", - "faye-websocket": "0.11.1", - "inherits": "2.0.3", - "json3": "3.3.2", - "url-parse": "1.4.0" + "faye-websocket": "~0.11.0", + "inherits": "^2.0.1", + "json3": "^3.3.2", + "url-parse": "^1.1.8" }, "dependencies": { "faye-websocket": { @@ -10085,7 +10201,7 @@ "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", "dev": true, "requires": { - "websocket-driver": "0.7.0" + "websocket-driver": ">=0.5.1" } } } @@ -10096,8 +10212,8 @@ "integrity": "sha1-W4t/x8jzQcU+0FbpKbe/Tei6e1o=", "dev": true, "requires": { - "ip": "1.1.5", - "smart-buffer": "1.1.15" + "ip": "^1.1.4", + "smart-buffer": "^1.0.13" } }, "socks-proxy-agent": { @@ -10106,9 +10222,9 @@ "integrity": "sha512-sFtmYqdUK5dAMh85H0LEVFUCO7OhJJe1/z2x/Z6mxp3s7/QPf1RkZmpZy+BpuU0bEjcV9npqKjq9Y3kwFUjnxw==", "dev": true, "requires": { - "agent-base": "2.1.1", - "extend": "3.0.1", - "socks": "1.1.10" + "agent-base": "2", + "extend": "3", + "socks": "~1.1.5" }, "dependencies": { "agent-base": { @@ -10117,8 +10233,8 @@ "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", "dev": true, "requires": { - "extend": "3.0.1", - "semver": "5.0.3" + "extend": "~3.0.0", + "semver": "~5.0.1" } }, "semver": { @@ -10147,11 +10263,11 @@ "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", "dev": true, "requires": { - "atob": "2.0.3", - "decode-uri-component": "0.2.0", - "resolve-url": "0.2.1", - "source-map-url": "0.4.0", - "urix": "0.1.0" + "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": { @@ -10161,9 +10277,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": { @@ -10172,8 +10288,8 @@ "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", "dev": true, "requires": { - "spdx-expression-parse": "3.0.0", - "spdx-license-ids": "3.0.0" + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" } }, "spdx-exceptions": { @@ -10188,8 +10304,8 @@ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { - "spdx-exceptions": "2.1.0", - "spdx-license-ids": "3.0.0" + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" } }, "spdx-license-ids": { @@ -10204,12 +10320,12 @@ "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=", "dev": true, "requires": { - "debug": "2.6.9", - "handle-thing": "1.2.5", - "http-deceiver": "1.2.7", - "safe-buffer": "5.1.1", - "select-hose": "2.0.0", - "spdy-transport": "2.1.0" + "debug": "^2.6.8", + "handle-thing": "^1.2.5", + "http-deceiver": "^1.2.7", + "safe-buffer": "^5.0.1", + "select-hose": "^2.0.0", + "spdy-transport": "^2.0.18" } }, "spdy-transport": { @@ -10218,13 +10334,13 @@ "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==", "dev": true, "requires": { - "debug": "2.6.9", - "detect-node": "2.0.3", - "hpack.js": "2.1.6", - "obuf": "1.1.2", - "readable-stream": "2.3.3", - "safe-buffer": "5.1.1", - "wbuf": "1.7.3" + "debug": "^2.6.8", + "detect-node": "^2.0.3", + "hpack.js": "^2.1.6", + "obuf": "^1.1.1", + "readable-stream": "^2.2.9", + "safe-buffer": "^5.0.1", + "wbuf": "^1.7.2" } }, "split-string": { @@ -10233,7 +10349,7 @@ "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { - "extend-shallow": "3.0.2" + "extend-shallow": "^3.0.0" }, "dependencies": { "extend-shallow": { @@ -10242,8 +10358,8 @@ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, "requires": { - "assign-symbols": "1.0.0", - "is-extendable": "1.0.1" + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" } }, "is-extendable": { @@ -10252,7 +10368,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "2.0.4" + "is-plain-object": "^2.0.4" } } } @@ -10263,24 +10379,30 @@ "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", "dev": true, "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" + "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", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.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" + "define-property": "^0.2.5", + "object-copy": "^0.1.0" }, "dependencies": { "define-property": { @@ -10289,7 +10411,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "is-accessor-descriptor": { @@ -10298,7 +10420,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -10307,7 +10429,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -10318,7 +10440,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -10327,7 +10449,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -10338,9 +10460,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" } }, "kind-of": { @@ -10363,7 +10485,7 @@ "integrity": "sha1-osfIWH5U2UJ+qe2zrD8s1SLfN4s=", "dev": true, "requires": { - "readable-stream": "2.3.3" + "readable-stream": "^2.0.1" } }, "stream-browserify": { @@ -10372,14 +10494,14 @@ "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3" + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" } }, - "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-http": { @@ -10388,13 +10510,19 @@ "integrity": "sha512-cQ0jo17BLca2r0GfRdZKYAGLU6JRoIWxqSOakUMuKOT6MOK7AAlE856L33QuDmAy/eeOrhLee3dZKX0Uadu93A==", "dev": true, "requires": { - "builtin-status-codes": "3.0.0", - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "to-arraybuffer": "1.0.1", - "xtend": "4.0.1" + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.3", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" } }, + "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 + }, "stream-to": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stream-to/-/stream-to-0.2.2.tgz", @@ -10407,7 +10535,7 @@ "integrity": "sha1-JnmdkDqyAlyb1VCsRxcbAPjdgKk=", "dev": true, "requires": { - "stream-to": "0.2.2" + "stream-to": "~0.2.0" } }, "streamroller": { @@ -10416,10 +10544,10 @@ "integrity": "sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ==", "dev": true, "requires": { - "date-format": "1.2.0", - "debug": "3.1.0", - "mkdirp": "0.5.1", - "readable-stream": "2.3.3" + "date-format": "^1.2.0", + "debug": "^3.1.0", + "mkdirp": "^0.5.1", + "readable-stream": "^2.3.0" }, "dependencies": { "debug": { @@ -10439,8 +10567,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" }, "dependencies": { "ansi-regex": { @@ -10461,7 +10589,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } } } @@ -10472,7 +10600,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "stringstream": { @@ -10487,7 +10615,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-bom": { @@ -10502,7 +10630,7 @@ "integrity": "sha1-elYl7/iisibPiUehElTaluE9rok=", "dev": true, "requires": { - "is-regexp": "1.0.0" + "is-regexp": "^1.0.0" } }, "strip-eof": { @@ -10523,14 +10651,14 @@ "integrity": "sha512-bLW0/lQxTgJ0y+TEllctly+/B0Hz2N82e5AhubP+FIVPSisyOzyFnZzWdqRml7RDwRCsT+EGNN8YYa0VFutT+w==", "dev": true, "requires": { - "buffer": "5.1.0", - "css-to-react-native": "2.1.2", - "fbjs": "0.8.16", - "hoist-non-react-statics": "1.2.0", - "is-plain-object": "2.0.4", - "prop-types": "15.6.1", - "stylis": "3.5.0", - "supports-color": "3.2.3" + "buffer": "^5.0.3", + "css-to-react-native": "^2.0.3", + "fbjs": "^0.8.9", + "hoist-non-react-statics": "^1.2.0", + "is-plain-object": "^2.0.1", + "prop-types": "^15.5.4", + "stylis": "^3.4.0", + "supports-color": "^3.2.3" }, "dependencies": { "hoist-non-react-statics": { @@ -10545,7 +10673,7 @@ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" } } } @@ -10562,6 +10690,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" + } + }, "symbol-observable": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", @@ -10580,9 +10718,9 @@ "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" } }, "temp": { @@ -10591,8 +10729,8 @@ "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", "dev": true, "requires": { - "os-tmpdir": "1.0.2", - "rimraf": "2.2.8" + "os-tmpdir": "^1.0.0", + "rimraf": "~2.2.6" }, "dependencies": { "rimraf": { @@ -10604,9 +10742,9 @@ } }, "textextensions": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-1.0.2.tgz", - "integrity": "sha1-ZUhjk+4fK7A5pgy7oFsLaL2VAdI=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-2.2.0.tgz", + "integrity": "sha512-j5EMxnryTvKxwH2Cq+Pb43tsf6sdEgw6Pdwxk83mPaq0ToeFJt6WE4J3s5BqY7vmjlLgkgXvhtXUxo80FyBhCA==", "dev": true }, "throttleit": { @@ -10621,8 +10759,18 @@ "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", "dev": true, "requires": { - "readable-stream": "2.3.3", - "xtend": "4.0.1" + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" + } + }, + "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": { + "through2": "~2.0.0", + "xtend": "~4.0.0" } }, "thunkify": { @@ -10632,27 +10780,12 @@ "dev": true, "optional": true }, - "thunks": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/thunks/-/thunks-4.9.0.tgz", - "integrity": "sha512-Bp4sGtcf8/SAgX2XBXYH2Crc7ESL7xuTuQ5kx84Tvz7VSkLFg6bfjFBpRmX2DLAWaLeK6q32ogqAnXcr5NAQtw==", - "dev": true - }, "thunky": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.0.2.tgz", "integrity": "sha1-qGLgGOP7HqLsP85dVWBc9X8kc3E=", "dev": true }, - "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.2" - } - }, "time-stamp": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", @@ -10665,7 +10798,7 @@ "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", "dev": true, "requires": { - "setimmediate": "1.0.5" + "setimmediate": "^1.0.4" } }, "timespan": { @@ -10687,7 +10820,17 @@ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { - "os-tmpdir": "1.0.2" + "os-tmpdir": "~1.0.2" + } + }, + "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-array": { @@ -10708,7 +10851,7 @@ "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -10717,7 +10860,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -10728,9 +10871,9 @@ "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", "dev": true, "requires": { - "define-property": "0.2.5", - "extend-shallow": "2.0.1", - "regex-not": "1.0.0" + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "regex-not": "^1.0.0" }, "dependencies": { "define-property": { @@ -10739,7 +10882,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "is-accessor-descriptor": { @@ -10748,7 +10891,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -10757,7 +10900,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -10768,7 +10911,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -10777,7 +10920,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -10788,9 +10931,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" } }, "kind-of": { @@ -10807,8 +10950,17 @@ "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", "dev": true, "requires": { - "is-number": "3.0.0", - "repeat-string": "1.6.1" + "is-number": "^3.0.0", + "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" } }, "tough-cookie": { @@ -10817,7 +10969,7 @@ "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "dev": true, "requires": { - "punycode": "1.4.1" + "punycode": "^1.4.1" } }, "traverse-chain": { @@ -10844,7 +10996,7 @@ "integrity": "sha1-fskRMJJHZsf1c74wIMNPj9/QDWI=", "dev": true, "requires": { - "glob": "6.0.4" + "glob": "^6.0.4" }, "dependencies": { "glob": { @@ -10853,11 +11005,11 @@ "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", "dev": true, "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } @@ -10881,7 +11033,7 @@ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -10897,7 +11049,7 @@ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "prelude-ls": "1.1.2" + "prelude-ls": "~1.1.2" } }, "type-is": { @@ -10907,7 +11059,7 @@ "dev": true, "requires": { "media-typer": "0.3.0", - "mime-types": "2.1.18" + "mime-types": "~2.1.18" } }, "typedarray": { @@ -10928,9 +11080,9 @@ "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", "dev": true, "requires": { - "source-map": "0.5.7", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" }, "dependencies": { "camelcase": { @@ -10945,9 +11097,9 @@ "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", "window-size": "0.1.0" } } @@ -10966,9 +11118,9 @@ "integrity": "sha1-uVH0q7a9YX5m9j64kUmOORdj4wk=", "dev": true, "requires": { - "source-map": "0.5.7", - "uglify-js": "2.8.29", - "webpack-sources": "1.1.0" + "source-map": "^0.5.6", + "uglify-js": "^2.8.29", + "webpack-sources": "^1.0.1" } }, "ultron": { @@ -10989,16 +11141,39 @@ "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=", "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", "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" + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" }, "dependencies": { "set-value": { @@ -11007,19 +11182,23 @@ "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", "dev": true, "requires": { - "extend-shallow": "2.0.1", - "is-extendable": "0.1.1", - "is-plain-object": "2.0.4", - "to-object-path": "0.3.0" + "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 + "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" + } }, "unpipe": { "version": "1.0.0", @@ -11033,8 +11212,8 @@ "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", "dev": true, "requires": { - "has-value": "0.3.1", - "isobject": "3.0.1" + "has-value": "^0.3.1", + "isobject": "^3.0.0" }, "dependencies": { "has-value": { @@ -11043,9 +11222,9 @@ "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", "dev": true, "requires": { - "get-value": "2.0.6", - "has-values": "0.1.4", - "isobject": "2.1.0" + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" }, "dependencies": { "isobject": { @@ -11079,7 +11258,7 @@ "integrity": "sha1-+QuFhQf4HepNz7s8TD2/orVX+qo=", "dev": true, "requires": { - "punycode": "2.1.0" + "punycode": "^2.1.0" }, "dependencies": { "punycode": { @@ -11120,8 +11299,8 @@ "integrity": "sha512-ERuGxDiQ6Xw/agN4tuoCRbmwRuZP0cJ1lJxJubXr5Q/5cDa78+Dc4wfvtxzhzhkm5VvmW6Mf8EVj9SPGN4l8Lg==", "dev": true, "requires": { - "querystringify": "2.0.0", - "requires-port": "1.0.0" + "querystringify": "^2.0.0", + "requires-port": "^1.0.0" }, "dependencies": { "querystringify": { @@ -11138,7 +11317,7 @@ "integrity": "sha1-260eDJ4p4QXdCx8J9oYvf9tIJyQ=", "dev": true, "requires": { - "ip-regex": "1.0.3" + "ip-regex": "^1.0.1" } }, "use": { @@ -11147,9 +11326,9 @@ "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", "dev": true, "requires": { - "define-property": "0.2.5", - "isobject": "3.0.1", - "lazy-cache": "2.0.2" + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "lazy-cache": "^2.0.2" }, "dependencies": { "define-property": { @@ -11158,7 +11337,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "is-accessor-descriptor": { @@ -11167,7 +11346,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -11176,7 +11355,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -11187,7 +11366,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -11196,7 +11375,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -11207,9 +11386,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" } }, "kind-of": { @@ -11220,20 +11399,14 @@ } } }, - "user-home": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", - "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", - "dev": true - }, "useragent": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.2.1.tgz", "integrity": "sha1-z1k+9PLRdYdei7ZY6pLhik/QbY4=", "dev": true, "requires": { - "lru-cache": "2.2.4", - "tmp": "0.0.33" + "lru-cache": "2.2.x", + "tmp": "0.0.x" }, "dependencies": { "lru-cache": { @@ -11287,12 +11460,12 @@ "optional": 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": { @@ -11301,10 +11474,16 @@ "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", "dev": true, "requires": { - "spdx-correct": "3.0.0", - "spdx-expression-parse": "3.0.0" + "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 + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -11317,107 +11496,63 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" + "extsprintf": "^1.2.0" } }, "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.3", - "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=", + "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": { - "defaults": "1.0.3", - "glob-stream": "3.1.18", - "glob-watcher": "0.0.6", - "graceful-fs": "3.0.11", - "mkdirp": "0.5.1", - "strip-bom": "1.0.0", - "through2": "0.6.5", - "vinyl": "0.4.6" - }, - "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", - "dev": true - }, - "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.1" - } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "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.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "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-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.1" - } - }, - "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.34", - "xtend": "4.0.1" - } - }, - "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" - } - } + "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": { @@ -11426,7 +11561,7 @@ "integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=", "dev": true, "requires": { - "source-map": "0.5.7" + "source-map": "^0.5.1" } }, "vm-browserify": { @@ -11450,7 +11585,7 @@ "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=", "dev": true, "requires": { - "loose-envify": "1.3.1" + "loose-envify": "^1.0.0" } }, "watchpack": { @@ -11459,9 +11594,9 @@ "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", "dev": true, "requires": { - "chokidar": "2.0.3", - "graceful-fs": "4.1.11", - "neo-async": "2.5.1" + "chokidar": "^2.0.2", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0" } }, "wbuf": { @@ -11470,7 +11605,7 @@ "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", "dev": true, "requires": { - "minimalistic-assert": "1.0.1" + "minimalistic-assert": "^1.0.0" } }, "webpack": { @@ -11479,28 +11614,28 @@ "integrity": "sha512-3kOFejWqj5ISpJk4Qj/V7w98h9Vl52wak3CLiw/cDOfbVTq7FeoZ0SdoHHY9PYlHr50ZS42OfvzE2vB4nncKQg==", "dev": true, "requires": { - "acorn": "5.5.3", - "acorn-dynamic-import": "2.0.2", - "ajv": "6.4.0", - "ajv-keywords": "3.1.0", - "async": "2.6.0", - "enhanced-resolve": "3.4.1", - "escope": "3.6.0", - "interpret": "1.1.0", - "json-loader": "0.5.7", - "json5": "0.5.1", - "loader-runner": "2.3.0", - "loader-utils": "1.1.0", - "memory-fs": "0.4.1", - "mkdirp": "0.5.1", - "node-libs-browser": "2.1.0", - "source-map": "0.5.7", - "supports-color": "4.5.0", - "tapable": "0.2.8", - "uglifyjs-webpack-plugin": "0.4.6", - "watchpack": "1.6.0", - "webpack-sources": "1.1.0", - "yargs": "8.0.2" + "acorn": "^5.0.0", + "acorn-dynamic-import": "^2.0.0", + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0", + "async": "^2.1.2", + "enhanced-resolve": "^3.4.0", + "escope": "^3.6.0", + "interpret": "^1.0.0", + "json-loader": "^0.5.4", + "json5": "^0.5.1", + "loader-runner": "^2.3.0", + "loader-utils": "^1.1.0", + "memory-fs": "~0.4.1", + "mkdirp": "~0.5.0", + "node-libs-browser": "^2.0.0", + "source-map": "^0.5.3", + "supports-color": "^4.2.1", + "tapable": "^0.2.7", + "uglifyjs-webpack-plugin": "^0.4.6", + "watchpack": "^1.4.0", + "webpack-sources": "^1.0.1", + "yargs": "^8.0.2" }, "dependencies": { "ajv": { @@ -11509,10 +11644,10 @@ "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=", "dev": true, "requires": { - "fast-deep-equal": "1.1.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1", - "uri-js": "3.0.2" + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0", + "uri-js": "^3.0.2" } }, "cliui": { @@ -11521,9 +11656,9 @@ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" }, "dependencies": { "string-width": { @@ -11532,9 +11667,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } } } @@ -11551,10 +11686,10 @@ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "strip-bom": "3.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" } }, "parse-json": { @@ -11563,7 +11698,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "^1.2.0" } }, "path-type": { @@ -11572,7 +11707,7 @@ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", "dev": true, "requires": { - "pify": "2.3.0" + "pify": "^2.0.0" } }, "pify": { @@ -11587,9 +11722,9 @@ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", "dev": true, "requires": { - "load-json-file": "2.0.0", - "normalize-package-data": "2.4.0", - "path-type": "2.0.0" + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" } }, "read-pkg-up": { @@ -11598,8 +11733,8 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true, "requires": { - "find-up": "2.1.0", - "read-pkg": "2.0.0" + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" } }, "supports-color": { @@ -11608,7 +11743,7 @@ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "^2.0.0" } }, "yargs": { @@ -11617,19 +11752,19 @@ "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", "dev": true, "requires": { - "camelcase": "4.1.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "read-pkg-up": "2.0.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "3.2.1", - "yargs-parser": "7.0.0" + "camelcase": "^4.1.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "read-pkg-up": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^7.0.0" } }, "yargs-parser": { @@ -11638,7 +11773,7 @@ "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", "dev": true, "requires": { - "camelcase": "4.1.0" + "camelcase": "^4.1.0" } } } @@ -11649,11 +11784,11 @@ "integrity": "sha512-FCrqPy1yy/sN6U/SaEZcHKRXGlqU0DUaEBL45jkUYoB8foVb6wCnbIJ1HKIx+qUFTW+3JpVcCJCxZ8VATL4e+A==", "dev": true, "requires": { - "memory-fs": "0.4.1", - "mime": "1.6.0", - "path-is-absolute": "1.0.1", - "range-parser": "1.2.0", - "time-stamp": "2.0.0" + "memory-fs": "~0.4.1", + "mime": "^1.5.0", + "path-is-absolute": "^1.0.0", + "range-parser": "^1.0.3", + "time-stamp": "^2.0.0" }, "dependencies": { "time-stamp": { @@ -11671,30 +11806,30 @@ "dev": true, "requires": { "ansi-html": "0.0.7", - "array-includes": "3.0.3", - "bonjour": "3.5.0", - "chokidar": "2.0.3", - "compression": "1.7.2", - "connect-history-api-fallback": "1.5.0", - "debug": "3.1.0", - "del": "3.0.0", - "express": "4.16.3", - "html-entities": "1.2.1", - "http-proxy-middleware": "0.17.4", - "import-local": "1.0.0", + "array-includes": "^3.0.3", + "bonjour": "^3.5.0", + "chokidar": "^2.0.0", + "compression": "^1.5.2", + "connect-history-api-fallback": "^1.3.0", + "debug": "^3.1.0", + "del": "^3.0.0", + "express": "^4.16.2", + "html-entities": "^1.2.0", + "http-proxy-middleware": "~0.17.4", + "import-local": "^1.0.0", "internal-ip": "1.2.0", - "ip": "1.1.5", - "killable": "1.0.0", - "loglevel": "1.6.1", - "opn": "5.3.0", - "portfinder": "1.0.13", - "selfsigned": "1.10.2", - "serve-index": "1.9.1", + "ip": "^1.1.5", + "killable": "^1.0.0", + "loglevel": "^1.4.1", + "opn": "^5.1.0", + "portfinder": "^1.0.9", + "selfsigned": "^1.9.1", + "serve-index": "^1.7.2", "sockjs": "0.3.19", "sockjs-client": "1.1.4", - "spdy": "3.4.7", - "strip-ansi": "3.0.1", - "supports-color": "5.4.0", + "spdy": "^3.4.1", + "strip-ansi": "^3.0.0", + "supports-color": "^5.1.0", "webpack-dev-middleware": "1.12.2", "yargs": "6.6.0" }, @@ -11711,9 +11846,9 @@ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" } }, "debug": { @@ -11731,8 +11866,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "has-flag": { @@ -11747,11 +11882,11 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.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" } }, "os-locale": { @@ -11760,7 +11895,7 @@ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { - "lcid": "1.0.0" + "lcid": "^1.0.0" } }, "parse-json": { @@ -11769,7 +11904,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "^1.2.0" } }, "path-exists": { @@ -11778,7 +11913,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "2.0.1" + "pinkie-promise": "^2.0.0" } }, "path-type": { @@ -11787,9 +11922,9 @@ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "pify": { @@ -11804,9 +11939,9 @@ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.0" + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" } }, "read-pkg-up": { @@ -11815,8 +11950,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" } }, "string-width": { @@ -11825,9 +11960,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "strip-bom": { @@ -11836,7 +11971,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "0.2.1" + "is-utf8": "^0.2.0" } }, "supports-color": { @@ -11845,7 +11980,7 @@ "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "dev": true, "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } }, "which-module": { @@ -11860,19 +11995,19 @@ "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", "dev": true, "requires": { - "camelcase": "3.0.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "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.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-parser": { @@ -11881,7 +12016,7 @@ "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", "dev": true, "requires": { - "camelcase": "3.0.0" + "camelcase": "^3.0.0" } } } @@ -11892,8 +12027,8 @@ "integrity": "sha512-aqYp18kPphgoO5c/+NaUvEeACtZjMESmDChuD3NBciVpah3XpMEU9VAAtIaB1BsfJWWTSdv8Vv1m3T0aRk2dUw==", "dev": true, "requires": { - "source-list-map": "2.0.0", - "source-map": "0.6.1" + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" }, "dependencies": { "source-map": { @@ -11910,8 +12045,8 @@ "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", "dev": true, "requires": { - "http-parser-js": "0.4.12", - "websocket-extensions": "0.1.3" + "http-parser-js": ">=0.4.0", + "websocket-extensions": ">=0.1.1" } }, "websocket-extensions": { @@ -11939,7 +12074,7 @@ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" } }, "which-module": { @@ -11949,25 +12084,12 @@ "dev": true }, "wide-align": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, "requires": { - "string-width": "1.0.2" - }, - "dependencies": { - "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.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } + "string-width": "^1.0.2 || 2" } }, "window-size": { @@ -11988,8 +12110,8 @@ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" }, "dependencies": { "string-width": { @@ -11998,9 +12120,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } } } @@ -12017,9 +12139,9 @@ "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", "dev": true, "requires": { - "async-limiter": "1.0.0", - "safe-buffer": "5.1.1", - "ultron": "1.1.1" + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" } }, "xhr": { @@ -12028,10 +12150,10 @@ "integrity": "sha512-pAIU5vBr9Hiy5cpFIbPnwf0C18ZF86DBsZKrlsf87N5De/JbA6RJ83UP/cv+aljl4S40iRVMqP4pr4sF9Dnj0A==", "dev": true, "requires": { - "global": "4.3.2", - "is-function": "1.0.1", - "parse-headers": "2.0.1", - "xtend": "4.0.1" + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" } }, "xml-parse": { @@ -12052,8 +12174,8 @@ "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", "dev": true, "requires": { - "sax": "1.2.4", - "xmlbuilder": "9.0.7" + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" } }, "xmlbuilder": { @@ -12093,13 +12215,176 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "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 + }, + "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" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "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": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "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-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" + } + }, + "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-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 + }, + "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" + } + }, + "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" + } + }, + "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" + } + }, + "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 + }, + "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" + } + } + } + }, "yargs-parser": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.0.0.tgz", "integrity": "sha512-+DHejWujTVYeMHLff8U96rLc4uE4Emncoftvn5AjhB1Jw1pWxLzgBUT/WYbPrHmy6YPEBTZQx5myHhVcuuu64g==", "dev": true, "requires": { - "camelcase": "4.1.0" + "camelcase": "^4.1.0" } }, "yauzl": { @@ -12108,7 +12393,7 @@ "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", "dev": true, "requires": { - "fd-slicer": "1.0.1" + "fd-slicer": "~1.0.1" } }, "yeast": { diff --git a/uk.co.compucorp.civicrm.hrcore/package.json b/uk.co.compucorp.civicrm.hrcore/package.json index 26840a87814..f2d459b684a 100644 --- a/uk.co.compucorp.civicrm.hrcore/package.json +++ b/uk.co.compucorp.civicrm.hrcore/package.json @@ -11,16 +11,15 @@ "detect-installed": "^2.0.4", "es6-promise": "^4.2.4", "find": "^0.2.9", - "gulp": "^3.9.1", + "gulp": "^4.0.0", "gulp-clean": "^0.4.0", - "gulp-color": "0.0.1", + "gulp-color": "0.0.2", "gulp-file": "^0.4.0", "gulp-notify": "^3.2.0", - "gulp-rename": "^1.2.2", - "gulp-replace": "^0.6.1", - "gulp-sass": "^3.2.1", + "gulp-rename": "^1.4.0", + "gulp-replace": "^1.0.0", + "gulp-sass": "^4.0.1", "gulp-sass-bulk-import": "^1.0.1", - "gulp-sequence": "^1.0.0", "gulp-strip-css-comments": "^2.0.0", "jasmine-core": "^2.99.1", "karma": "^2.0.2", From 8bfd1963cf9c45aff96d8e702de631d7a3718113 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 31 Jul 2018 12:26:44 +0100 Subject: [PATCH 100/151] PCHR-4049: Fix watching --- uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js | 2 +- uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js index 8a9e77920cd..deb1f1e4fd9 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js @@ -27,7 +27,7 @@ module.exports = [ path.join(extPath, 'js/src/**/*.js') ], 'requirejs'); - gulp.watch(watchPatterns, ['requirejs']).on('change', function (file) { + gulp.watch(watchPatterns, gulp.parallel('requirejs')).on('change', function (file) { if (utils.canCurrentExtensionRun('test')) { try { test.for(file.path); diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js index ef9dc6b7974..007a9dbbfa2 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js @@ -37,7 +37,7 @@ module.exports = [ path.join(extPath, 'scss/**/*.scss') ], 'sass'); - gulp.watch(watchPatterns, ['sass']); + gulp.watch(watchPatterns, gulp.parallel('sass')); cb(); } else { console.log('Not eligible for this task, skipping...'); From 28bc2e029a63b517f79512c6bdd971318b0f5fe2 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 31 Jul 2018 14:15:45 +0100 Subject: [PATCH 101/151] PCHR-4049: Fix tasks promises execution --- uk.co.compucorp.civicrm.hrcore/gulpfile.js | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/gulpfile.js b/uk.co.compucorp.civicrm.hrcore/gulpfile.js index 4542adefda1..3eb534b9e59 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulpfile.js +++ b/uk.co.compucorp.civicrm.hrcore/gulpfile.js @@ -5,21 +5,29 @@ var gulp = require('gulp'); var utils = require('./gulp/utils'); var tasks = getMainTasks(); +var watcherPromises = buildTaskPromises(['sass:watch', 'requirejs:watch', 'test:watch']); +var builderPromises = buildTaskPromises(['sass', 'requirejs', 'test']); + _.each(tasks, function (fn, name) { gulp.task(name, fn); }); -gulp.task('watch', gulp.series( - utils.spawnTaskForExtension('sass:watch', tasks['sass:watch']), - utils.spawnTaskForExtension('requirejs:watch', tasks['requirejs:watch']), - utils.spawnTaskForExtension('test:watch', tasks['test:watch']) -)); +gulp.task('watch', gulp.series(watcherPromises)); +gulp.task('build', gulp.series(builderPromises)); -gulp.task('build', gulp.series( - utils.spawnTaskForExtension('sass', tasks['sass']), - utils.spawnTaskForExtension('requirejs', tasks['requirejs']), - utils.spawnTaskForExtension('test', tasks['test']) -)); +/** + * Builds extension tasks promises + * + * @param {Array} taskNames + * @return {Array} of task promises + */ +function buildTaskPromises (taskNames) { + return taskNames.map(function (taskName) { + return function () { + return utils.spawnTaskForExtension(taskName, tasks[taskName]); + }; + }); +} /** * Gets all the task listed in the files under the gulp/task folder From d56dfb097efafc5a81b5add898640311a574a7f9 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Tue, 31 Jul 2018 15:50:38 +0100 Subject: [PATCH 102/151] PCHR-4051: Add the canCancelForAbsenceType method in LeaveRequestRights Service. Add tests. --- .../Service/LeaveRequestRights.php | 31 +++++++++++ .../Service/LeaveRequestRightsTest.php | 55 +++++++++++++++++++ 2 files changed, 86 insertions(+) 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 648d8dabab0..6fe8db1752b 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php @@ -209,4 +209,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'); + + if ($absenceType->allow_request_cancelation != AbsenceType::REQUEST_CANCELATION_NO && + $leaveFromDate > $today + ) { + return TRUE; + } + + return FALSE; + } } 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 8d959f2a5ff..dd77e1f7662 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 @@ -323,6 +324,60 @@ 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); From f237c6d310f403830ca255a2c1491b7dba9917df Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 31 Jul 2018 15:51:12 +0100 Subject: [PATCH 103/151] PCHR-4049: Fix Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 3cf2fc4d4df8d1379633f84aef3eca3d323f15cc Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Tue, 31 Jul 2018 15:55:35 +0100 Subject: [PATCH 104/151] PCHR-4051: Use the canCancelForAbsenceType method in LeaveRequest Service. Add tests. Remove validation for absence type cancellation in Leave Request BAO. --- .../HRLeaveAndAbsences/BAO/LeaveRequest.php | 41 ------------------- .../Service/LeaveRequest.php | 27 +++++++++++- .../Service/LeaveRequestTest.php | 32 +++++++++++++++ 3 files changed, 58 insertions(+), 42 deletions(-) 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 20805846edf..c2cd51fe064 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 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 8a6c538aff3..99e010cbae0 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 @@ -499,6 +499,18 @@ 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'), @@ -1233,6 +1245,26 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenAbsenceTypeAllowsP $this->assertEquals($toilRequest->status_id, $leaveStatuses['cancelled']); } + 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'); From c22b77e56a8d52a3d3e7c0d3041853100c2b0851 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Tue, 31 Jul 2018 16:12:29 +0100 Subject: [PATCH 105/151] PCHR-4051: Remove obsolete tests. Fix broken tests. --- .../BAO/LeaveRequestTest.php | 66 --------------- .../Service/LeaveRequestTest.php | 7 +- .../tests/phpunit/api/v3/LeaveRequestTest.php | 80 ------------------- 3 files changed, 5 insertions(+), 148 deletions(-) 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/LeaveRequestTest.php b/uk.co.compucorp.civicrm.hrleaveandabsences/tests/phpunit/CRM/HRLeaveAndAbsences/Service/LeaveRequestTest.php index 99e010cbae0..2d3b2c70da7 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; @@ -1128,7 +1129,8 @@ public function testGetBreakdownIncludeOnlyTheLeaveBalanceChangesOfTheLeaveReque public function testToilRequestWithPastDatesCanNotBeCancelledWhenUserIsLeaveContactAndAbsenceTypeDoesNotAllowPastAccrual() { $absenceType = AbsenceTypeFabricator::fabricate([ 'allow_accruals_request' => true, - 'allow_accrue_in_the_past' => false + 'allow_accrue_in_the_past' => false, + 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_ALWAYS ]); $leaveStatuses = LeaveRequest::getStatuses(); @@ -1216,7 +1218,8 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenUserIsManagerAndAb public function testToilRequestWithPastDatesCanBeCancelledWhenAbsenceTypeAllowsPastAccrual() { $absenceType = AbsenceTypeFabricator::fabricate([ 'allow_accruals_request' => true, - 'allow_accrue_in_the_past' => true + 'allow_accrue_in_the_past' => true, + 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_ALWAYS ]); $leaveStatuses = LeaveRequest::getStatuses(); 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 d75026e6ee9..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'), From 618dec101359919760a439a767522b2d596f4563 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Tue, 31 Jul 2018 16:43:11 +0100 Subject: [PATCH 106/151] PCHR-4051: Code formatting fixes --- .../HRLeaveAndAbsences/Service/LeaveRequest.php | 2 +- .../Service/LeaveRequestRights.php | 6 +++--- .../Service/LeaveRequestRightsTest.php | 4 +++- .../Service/LeaveRequestTest.php | 16 +++++++++++++--- 4 files changed, 20 insertions(+), 8 deletions(-) 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 c2cd51fe064..b3a75707294 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequest.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequest.php @@ -118,7 +118,7 @@ protected function update($params) { $isCancelledStatus = $this->isCancelledStatus($params); if ($isCancelledStatus) { - if(!$this->canCancelForAbsenceType($params)) { + if (!$this->canCancelForAbsenceType($params)) { throw new RuntimeException( 'You cannot cancel leave requests for this Absence type' ); 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 6fe8db1752b..1e7d29c83ac 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php @@ -232,9 +232,9 @@ public function canCancelForAbsenceType($absenceTypeId, $contactId, DateTime $le $today = new DateTime('today'); - if ($absenceType->allow_request_cancelation != AbsenceType::REQUEST_CANCELATION_NO && - $leaveFromDate > $today - ) { + $absenceTypeRequestCancellationNotNo = + $absenceType->allow_request_cancelation != AbsenceType::REQUEST_CANCELATION_NO; + if ($absenceTypeRequestCancellationNotNo && $leaveFromDate > $today) { return TRUE; } 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 dd77e1f7662..5ad77f8fec1 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 @@ -343,7 +343,9 @@ public function testCanCancelForAbsenceTypeReturnsTrueWhenUserIsLeaveManager() { } public function testCanCancelForAbsenceTypeReturnsTrueWhenAbsenceTypeAllowsCancellationForStaff() { - $absenceType = AbsenceTypeFabricator::fabricate(['allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_ALWAYS]); + $absenceType = AbsenceTypeFabricator::fabricate([ + 'allow_request_cancelation' => AbsenceType::REQUEST_CANCELATION_ALWAYS + ]); $contactID = 2; $leaveDate = new DateTime(); $leaveRequestRightsService = $this->getLeaveRightsService(); 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 2d3b2c70da7..72a2f388d04 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 @@ -500,10 +500,17 @@ private function getLeaveRequestService($isAdmin = false, $isManager = false, $a ); } - private function getLeaveRequestServiceForWhenAbsenceTypeCannotBeCancelled($typeId, $contactID, $leaveFromDate) { + 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); + $leaveRightsService->canCancelForAbsenceType( + $typeId, + $contactID, + new DateTime($leaveFromDate))->willReturn(FALSE); return new LeaveRequestService( $this->leaveBalanceChangeService, @@ -1264,7 +1271,10 @@ public function testCreateThrowsAnExceptionWhenUserIsNotAllowedToCancelAbsenceTy $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'); + $this->setExpectedException( + RuntimeException::class, + 'You cannot cancel leave requests for this Absence type' + ); $leaveRequestService->create($params, false); } From bbd885613de9e0ca5557aab517bb2178a06478e2 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Tue, 31 Jul 2018 16:48:25 +0100 Subject: [PATCH 107/151] PCHR-4051: Fix boolean case in tests. --- .../Service/LeaveRequestTest.php | 152 +++++++++--------- 1 file changed, 76 insertions(+), 76 deletions(-) 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 72a2f388d04..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 @@ -50,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([ @@ -62,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 @@ -81,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]); @@ -94,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 @@ -113,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]); @@ -126,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); @@ -143,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]); @@ -156,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 @@ -176,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 = [ @@ -190,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 @@ -205,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) @@ -233,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); } @@ -249,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); } @@ -302,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); } /** @@ -310,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() { @@ -326,7 +326,7 @@ public function testCreateThrowsAnExceptionWhenTransitionStatusIsNotValidWhenUpd $params['id'] = $leaveRequest->id; $params['status_id'] = $leaveRequestStatuses['awaiting_approval']; - $this->getLeaveRequestServiceWhenStatusTransitionIsNotAllowed()->create($params, false); + $this->getLeaveRequestServiceWhenStatusTransitionIsNotAllowed()->create($params, FALSE); } /** @@ -342,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() { @@ -354,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); } @@ -374,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); } /** @@ -393,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); } /** @@ -414,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); } /** @@ -429,7 +429,7 @@ public function testCreateThrowsAnExceptionWhenLeaveApproverUpdatesAbsenceTypeFo $params['id'] = $leaveRequest->id; $params['type_id'] = 2; - $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create($params, FALSE); } /** @@ -444,7 +444,7 @@ public function testCreateThrowsAnExceptionWhenAdminUpdatesAbsenceTypeForLeaveRe $params['id'] = $leaveRequest->id; $params['type_id'] = 2; - $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, false); + $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create($params, FALSE); } /** @@ -477,13 +477,13 @@ public function testDeleteDoesNotThrowAnExceptionWhenLeaveContactWhoIsOwnLeaveAp //Check that the leave request is actually soft deleted. $leaveRequestRecord = new LeaveRequest(); $leaveRequestRecord->id = $leaveRequest->id; - $leaveRequestRecord->find(true); + $leaveRequestRecord->find(TRUE); $this->assertEquals(1, $leaveRequestRecord->is_deleted); $this->unregisterCurrentLoggedInContactFromSession(); } - private function getLeaveRequestService($isAdmin = false, $isManager = false, $allowStatusTransition = true, $mockBalanceChangeService = false) { + private function getLeaveRequestService($isAdmin = FALSE, $isManager = FALSE, $allowStatusTransition = TRUE, $mockBalanceChangeService = FALSE) { $leaveManagerService = $this->createLeaveManagerServiceMock($isAdmin, $isManager); $leaveRequestStatusMatrixService = $this->createLeaveRequestStatusMatrixServiceMock($allowStatusTransition); $leaveRequestRightsService = new LeaveRequestRightsService($leaveManagerService); @@ -526,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(); @@ -570,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 = [ @@ -579,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); @@ -614,7 +614,7 @@ public function testBalanceChangeIsUpdatedForAnExistingLeaveRequestWhenChangeBal $leaveRequest = $this->getleaveRequestService()->create( $params, - false + FALSE ); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); @@ -632,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 = [ @@ -641,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); @@ -676,7 +676,7 @@ public function testBalanceChangeIsNotUpdatedForAnExistingLeaveRequestWhenChange $leaveRequest = $this->getleaveRequestService()->create( $params, - false + FALSE ); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($leaveRequest); @@ -694,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 = [ @@ -703,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); @@ -749,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 @@ -768,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 = [ @@ -777,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); @@ -823,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 @@ -843,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 = [ @@ -852,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); @@ -866,7 +866,7 @@ public function testBalanceIsUpdatedForExistingToilWhenChangeBalanceIsFalseAndTo $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //Balance change is updated for the TOIL @@ -885,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 = [ @@ -894,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); @@ -908,7 +908,7 @@ public function testBalanceIsUpdatedForExistingToilWhenChangeBalanceIsTrueAndToi $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //Balance change is updated for the TOIL @@ -927,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 = [ @@ -938,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); @@ -957,7 +957,7 @@ public function testBalanceRemainsSameButDatesAreUpdatedForToilWhenChangeBalance $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -978,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 = [ @@ -989,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); @@ -1008,7 +1008,7 @@ public function testBalanceRemainsSameButDatesAreUpdatedForToilWhenChangeBalance $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); $balance = LeaveBalanceChange::getTotalBalanceChangeForLeaveRequest($toilRequest); @@ -1029,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 = [ @@ -1040,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); @@ -1052,7 +1052,7 @@ public function testBalanceAndDatesNotUpdatedForExistingToilWhenChangeBalanceIsF $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //Both the dates and balance changes remain the same. @@ -1074,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 = [ @@ -1085,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); @@ -1097,7 +1097,7 @@ public function testBalanceAndDatesRemainsSameForExistingToilWhenChangeBalanceIs $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsAdmin()->create( $params, - false + FALSE ); //Both the dates and balance changes remain the same. @@ -1115,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); @@ -1135,8 +1135,8 @@ 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 ]); @@ -1158,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(); @@ -1184,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']); @@ -1192,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(); @@ -1215,7 +1215,7 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenUserIsManagerAndAb $toilRequest = $this->getLeaveRequestServiceWhenCurrentUserIsLeaveManager()->create( $params, - false + FALSE ); $this->assertNotNull($toilRequest->id); @@ -1224,8 +1224,8 @@ 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 ]); @@ -1248,7 +1248,7 @@ public function testToilRequestWithPastDatesCanBeCancelledWhenAbsenceTypeAllowsP $toilRequest = $this->getLeaveRequestService()->create( $params, - false + FALSE ); $this->assertNotNull($toilRequest->id); @@ -1275,10 +1275,10 @@ public function testCreateThrowsAnExceptionWhenUserIsNotAllowedToCancelAbsenceTy RuntimeException::class, 'You cannot cancel leave requests for this Absence type' ); - $leaveRequestService->create($params, false); + $leaveRequestService->create($params, FALSE); } - private function getExpectedBreakdownForLeaveRequest(LeaveRequest $leaveRequest, $amount = false) { + private function getExpectedBreakdownForLeaveRequest(LeaveRequest $leaveRequest, $amount = FALSE) { $leaveRequestDayTypes = LeaveRequest::buildOptions('from_date_type'); $dates = $leaveRequest->getDates(); From 38f18086e9896dfad87432e1a9d70f405af6e84d Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Tue, 31 Jul 2018 17:01:38 +0100 Subject: [PATCH 108/151] PCHR-4051: Refactor method for clarity. --- .../CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 1e7d29c83ac..c07ce43b3c9 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/CRM/HRLeaveAndAbsences/Service/LeaveRequestRights.php @@ -232,9 +232,9 @@ public function canCancelForAbsenceType($absenceTypeId, $contactId, DateTime $le $today = new DateTime('today'); - $absenceTypeRequestCancellationNotNo = - $absenceType->allow_request_cancelation != AbsenceType::REQUEST_CANCELATION_NO; - if ($absenceTypeRequestCancellationNotNo && $leaveFromDate > $today) { + $absenceTypeAllowsFutureCancellation = + $absenceType->allow_request_cancelation == AbsenceType::REQUEST_CANCELATION_IN_ADVANCE_OF_START_DATE; + if ($absenceTypeAllowsFutureCancellation && $leaveFromDate > $today) { return TRUE; } From 7061cc904eaf82b912fdda048e70e106560baaf7 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 31 Jul 2018 17:09:34 +0100 Subject: [PATCH 109/151] PCHR-4054: Fix role for self approving manager --- .../js/dist/absence-tab.min.js | 2 +- .../js/dist/admin-dashboard.min.js | 2 +- .../js/dist/manager-leave.min.js | 2 +- .../js/dist/my-leave.min.js | 2 +- .../shared/controllers/request.controller.js | 2 +- .../controllers/request.controller.spec.js | 20 +++++++++++++------ 6 files changed, 19 insertions(+), 11 deletions(-) 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 5a548193e48..e696b5eda7a 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(){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&&(n||a)}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=t.remove(e.list,function(e){return e.id!==Le.id})}):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"]}), +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=t.remove(e.list,function(e){return e.id!==Le.id})}):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 5116b1fad1f..23713ce42a9 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,5 +1,5 @@ !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&&(n||a)}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=t.remove(e.list,function(e){return e.id!==ke.id})}):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(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=t.remove(e.list,function(e){return e.id!==ke.id})}):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 45ff4dcad29..3fb8c654d79 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,5 +1,5 @@ !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&&(t||a)}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=n.remove(e.list,function(e){return e.id!==Me.id})}):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() +;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=n.remove(e.list,function(e){return e.id!==Me.id})}):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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index f92b0017ad6..5485d3bd042 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,5 +1,5 @@ !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&&(n||a)}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=t.remove(e.list,function(e){return e.id!==ke.id})}):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), +})),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=t.remove(e.list,function(e){return e.id!==ke.id})}):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/shared/controllers/request.controller.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js index 455df2994b6..4ee1ce96839 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 @@ -571,7 +571,7 @@ define([ 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; } /** diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js index 4290586aa97..b572eefca45 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js @@ -4,6 +4,7 @@ define([ 'common/lodash', 'common/moment', + 'common/mocks/data/contact.data', 'leave-absences/mocks/data/option-group.data', 'leave-absences/mocks/data/leave-request.data', 'leave-absences/manager-leave/app', @@ -16,7 +17,7 @@ 'leave-absences/mocks/apis/work-pattern-api-mock', 'leave-absences/shared/services/leave-request.service', 'leave-absences/manager-leave/app' - ], function (_, moment, optionGroupMock, mockData) { + ], function (_, moment, contactData, optionGroupMock, mockData) { 'use strict'; describe('LeaveRequestCtrl', function () { @@ -645,12 +646,19 @@ }); }); - describe('basic tests for when manager opens leave request popup in edit mode', function () { + describe('when manager opens someone else\'s leave request', function () { + var managedContact; + beforeEach(function () { var status = optionGroupMock.specificValue('hrleaveandabsences_leave_request_status', 'value', '3'); var leaveRequest = LeaveRequestInstance.init(mockData.findBy('status_id', status)); - leaveRequest.contact_id = CRM.vars.leaveAndAbsences.contactId.toString(); + // Anyone but the manager + managedContact = _.sample( + contactData.all.values.filter(function (contact) { + return contact.id !== CRM.vars.leaveAndAbsences.contactId; + })); + leaveRequest.contact_id = managedContact.id; initTestController({ leaveRequest: leaveRequest }); }); @@ -671,7 +679,7 @@ }); it('sets all leaverequest values', function () { - expect(controller.request.contact_id).toEqual('' + CRM.vars.leaveAndAbsences.contactId); + expect(controller.request.contact_id).toEqual(managedContact.id); expect(controller.request.type_id).toEqual(jasmine.any(String)); expect(controller.request.status_id).toEqual(waitingApprovalStatus.value); expect(controller.request.from_date).toEqual(jasmine.any(String)); @@ -1579,8 +1587,8 @@ initTestController({ leaveRequest: leaveRequest }); }); - it('sets is self record as false', function () { - expect(controller.isSelfRecord).toBe(false); + it('sets is self record as true', function () { + expect(controller.isSelfRecord).toBe(true); }); }); From 09373c27c627bcf649c9c89a8d8a52d0dbdab1e2 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Wed, 1 Aug 2018 10:06:58 +0100 Subject: [PATCH 110/151] PCHR-4054: PR Feedback --- .../js/test/shared/controllers/request.controller.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js index b572eefca45..d223c22c9a7 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js @@ -646,7 +646,7 @@ }); }); - describe('when manager opens someone else\'s leave request', function () { + describe('when manager opens a leave request of another contact', function () { var managedContact; beforeEach(function () { @@ -1478,7 +1478,7 @@ $rootScope.section = 'my-leave'; }); - describe('and the user is checking someone else\'s request', function () { + describe('and the user is checking a leave request of another contact', function () { beforeEach(function () { leaveRequest.id = _.uniqueId(); leaveRequest.contact_id = anotherContactId; @@ -1566,7 +1566,7 @@ $rootScope.section = 'manager-leave'; }); - describe('and the user is checking someone else\'s request', function () { + describe('and the user is checking a leave request of another contact', function () { beforeEach(function () { leaveRequest.id = _.uniqueId(); leaveRequest.contact_id = anotherContactId; From 230c2820776a9ae8e74d6adb658b16f9493be25f Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Wed, 1 Aug 2018 12:49:08 +0100 Subject: [PATCH 111/151] PCHR-4054: Refactored canChangeDatesFor method to allow own leave approver change leave dates. Add tests. --- .../Service/LeaveRequestRights.php | 19 +++++++++++---- .../Service/LeaveRequestRightsTest.php | 23 +++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) 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 c07ce43b3c9..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); } /** 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 5ad77f8fec1..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 @@ -180,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 */ From fc7f3b0cc4cb5842098899d6a8c58ab6f778a4e9 Mon Sep 17 00:00:00 2001 From: Swastik Pareek Date: Wed, 1 Aug 2018 18:59:01 +0530 Subject: [PATCH 112/151] SHOR-22: Remove extra PHP code for appending contact image - covered under shoreditch --- hrui/hrui.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hrui/hrui.php b/hrui/hrui.php index 35b0829daee..76f4a424ec1 100644 --- a/hrui/hrui.php +++ b/hrui/hrui.php @@ -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, )); From 01725f9fc0b4a27df8ae2c2d1e7341a077d89c14 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Wed, 1 Aug 2018 16:11:59 +0100 Subject: [PATCH 113/151] PCHR-4049: Fix tasks maps --- uk.co.compucorp.civicrm.hrcore/gulpfile.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/gulpfile.js b/uk.co.compucorp.civicrm.hrcore/gulpfile.js index 3eb534b9e59..4640976ae70 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulpfile.js +++ b/uk.co.compucorp.civicrm.hrcore/gulpfile.js @@ -23,9 +23,7 @@ gulp.task('build', gulp.series(builderPromises)); */ function buildTaskPromises (taskNames) { return taskNames.map(function (taskName) { - return function () { - return utils.spawnTaskForExtension(taskName, tasks[taskName]); - }; + return utils.spawnTaskForExtension(taskName, tasks[taskName]); }); } From d37f669943936b18da82fc5baa7988584fe53720 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Wed, 1 Aug 2018 16:43:54 +0100 Subject: [PATCH 114/151] PCHR-4049: Fix watchers --- .../gulp/tasks/requirejs.js | 17 +++++++++-------- .../gulp/tasks/test.js | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js index deb1f1e4fd9..9cb241e5679 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js @@ -27,15 +27,16 @@ module.exports = [ path.join(extPath, 'js/src/**/*.js') ], 'requirejs'); - gulp.watch(watchPatterns, gulp.parallel('requirejs')).on('change', function (file) { - if (utils.canCurrentExtensionRun('test')) { - try { - test.for(file.path); - } catch (ex) { - test.all(); + gulp.watch(watchPatterns, gulp.parallel('requirejs')) + .on('change', function (filePath) { + if (utils.canCurrentExtensionRun('test')) { + try { + test.for(filePath); + } catch (ex) { + test.all(); + } } - } - }); + }); cb(); } else { console.log('Not eligible for this task, skipping...'); diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js index d46a24069d7..e40f26f72bc 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js @@ -34,8 +34,8 @@ module.exports = [ '!' + path.join(testFolderPath, 'test/test-main.js') ], 'test'); - gulp.watch(watchPatterns).on('change', function (file) { - test.single(file.path); + gulp.watch(watchPatterns).on('change', function (filePath) { + test.single(filePath); }); cb(); } else { From fe86133f84d7f74a258622b7a7bf99aee6695d62 Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Wed, 1 Aug 2018 16:52:43 +0100 Subject: [PATCH 115/151] PCHR-4076: Fix filters on admin leave - leave requests and calendar tab --- .../CRM/Hrjobroles/API/Query/ContactHrJobRolesSelect.php | 7 ++++++- .../CRM/Hrjobroles/Test/Fabricator/HrJobRoles.php | 4 ++++ .../tests/phpunit/api/v3/ContactHRJobRoleTest.php | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) 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/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/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']; From ab37348c198d5aef505d89a6046c291c89c854bc Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Thu, 2 Aug 2018 10:51:50 +0100 Subject: [PATCH 116/151] PCHR-4094: Add admin to managees list --- .../js/dist/absence-tab.min.js | 2 +- .../js/dist/admin-dashboard.min.js | 4 ++-- .../js/dist/manager-leave.min.js | 8 ++++---- .../js/dist/my-leave.min.js | 2 +- .../shared/controllers/request.controller.js | 5 +---- .../js/test/shared/controllers/request.controller.spec.js | 6 +++--- 6 files changed, 12 insertions(+), 15 deletions(-) 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 e696b5eda7a..39da60dd7b6 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(){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=t.remove(e.list,function(e){return e.id!==Le.id})}):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"]}), +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){console.log(e.list),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 23713ce42a9..c478dc1ef8a 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,5 +1,5 @@ !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=t.remove(e.list,function(e){return e.id!==ke.id})}):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(){}); +},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){console.log(e.list),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 3fb8c654d79..873791b9030 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,5 +1,5 @@ -!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=n.remove(e.list,function(e){return e.id!==Me.id})}):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(){}); +!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(),g().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 g(){return n.all([p(),v(),h(),b(),C()]).catch(function(e){c.error("Error",e)})}function b(){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(b).then(g).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 g(){s.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){W.supportData.absenceTypesToFilterBy=t,$(!0)})}function b(){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:g(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)):g(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 g(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 b(){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 b().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 g(){C.comment.text.length&&C.addComment()}function b(){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&&b()})}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=g}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 g(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 b(){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=g,ne.dateTypeChangeHandler=b,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 g(t){return e.find(H.absenceTypes,{id:t})}function b(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=g,H.getArrayOfSize=b,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 g(){return o.resolve()}function b(){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=g,i.initDayTypesExtended=b,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 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=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(b).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,g[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,g={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,g,b,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(){be("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=b.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){console.log(e.list),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 ge(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 be(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=ge(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")?be("LeaveRequest::updatedByManager"):(Ne.isRole("staff")||Ne.isRole("admin"))&&be("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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index 5485d3bd042..6c1c264aba6 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,5 +1,5 @@ !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=t.remove(e.list,function(e){return e.id!==ke.id})}):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), +})),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){console.log(e.list),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/shared/controllers/request.controller.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js index 4ee1ce96839..b2bd6eaa76c 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 @@ -828,10 +828,7 @@ 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 !== loggedInContact.id; - }); + vm.managedContacts = contacts.list; }); } else { // In any other case (including managing) diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js index d223c22c9a7..a2437284e9e 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/controllers/request.controller.spec.js @@ -1132,7 +1132,7 @@ describe('admin opens leave request popup in create mode', function () { var leaveRequest; - var adminId = '206'; + var adminId = CRM.vars.leaveAndAbsences.contactId.toString(); beforeEach(function () { leaveRequest = LeaveRequestInstance.init(); @@ -1151,8 +1151,8 @@ expect(controller.isRole('admin')).toBeTruthy(); }); - it('does not contain admin in the list of managees', function () { - expect(_.find(controller.managedContacts, { 'id': adminId })).toBeUndefined(); + it('contains admin in the list of managees', function () { + expect(!!_.find(controller.managedContacts, { 'id': adminId })).toBe(true); }); }); }); From 0659b912f5b62d5e1e75b6333820e8ca4ceddf7d Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Thu, 2 Aug 2018 11:28:01 +0100 Subject: [PATCH 117/151] PCHR-4094: PR Feedback --- .../js/dist/absence-tab.min.js | 2 +- .../js/dist/admin-dashboard.min.js | 4 ++-- .../js/dist/manager-leave.min.js | 8 ++++---- .../js/dist/my-leave.min.js | 4 ++-- .../shared/controllers/request.controller.js | 3 +++ 5 files changed, 12 insertions(+), 9 deletions(-) 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 39da60dd7b6..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(){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){console.log(e.list),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"]}), +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 c478dc1ef8a..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,5 +1,5 @@ !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){console.log(e.list),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(){}); +},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 873791b9030..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,5 +1,5 @@ -!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(),g().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 g(){return n.all([p(),v(),h(),b(),C()]).catch(function(e){c.error("Error",e)})}function b(){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(b).then(g).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 g(){s.$on("LeaveCalendar::updateFiltersByAbsenceType",function(e,t){W.supportData.absenceTypesToFilterBy=t,$(!0)})}function b(){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:g(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)):g(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 g(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 b(){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 b().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 g(){C.comment.text.length&&C.addComment()}function b(){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&&b()})}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=g}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 g(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 b(){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=g,ne.dateTypeChangeHandler=b,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 g(t){return e.find(H.absenceTypes,{id:t})}function b(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=g,H.getArrayOfSize=b,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 g(){return o.resolve()}function b(){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=g,i.initDayTypesExtended=b,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 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=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(b).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,g[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,g={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,g,b,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(){be("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=b.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){console.log(e.list),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 ge(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 be(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=ge(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")?be("LeaveRequest::updatedByManager"):(Ne.isRole("staff")||Ne.isRole("admin"))&&be("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(){}); +!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/my-leave.min.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js index 6c1c264aba6..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,5 +1,5 @@ !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){console.log(e.list),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(){}); +})),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/shared/controllers/request.controller.js b/uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/controllers/request.controller.js index b2bd6eaa76c..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 @@ -814,6 +814,9 @@ define([ /** * 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} */ From 99553f304cd4323b0dbbf0bcf3830a959e24388d Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Fri, 3 Aug 2018 13:19:47 +0100 Subject: [PATCH 118/151] PCHR-4075: Fix filters on admin - advanced search - job role filters --- .../CRM/Hrjobroles/BAO/Query.php | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) 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; From 0871e793834ac6cd636333bc7578461617214e5c Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Thu, 2 Aug 2018 13:01:25 +0100 Subject: [PATCH 119/151] PCHR-4005: Fix JS for HRMed and HRCareer --- hrcareer/js/dist/hrcareer.min.js | 2 +- hrcareer/js/src/hrcareer/app.js | 32 +++++++++++++++++---------- hrmed/js/dist/hrmed.min.js | 2 +- hrmed/js/src/hrmed/app.js | 37 +++++++++++++++++++++----------- 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/hrcareer/js/dist/hrcareer.min.js b/hrcareer/js/dist/hrcareer.min.js index 19bd1b56d86..45f52ce8454 100644 --- a/hrcareer/js/dist/hrcareer.min.js +++ b/hrcareer/js/dist/hrcareer.min.js @@ -1,2 +1,2 @@ -define("hrcareer/app",[],function(){"use strict";CRM.$(function(e){e("body").on("crmFormLoad",function(a){if("hrcareer_tab"===a.profileName){var r=e('[data-crm-custom="Career:End_Date"]').attr("name");if(0===e("div#editrow-"+r+" a.helpicon").length){var n=e('
    ');e("div#editrow-"+r+" div label").append(n)}}})})}),function(e){e(["hrcareer/app"])}(require); +define(function(e){"use strict";e.$("body").on("crmFormLoad",function(){var r=e.$(".custom-group-Career");if(r.length){var n=r.find('[data-crm-custom="Career:End_Date"]').attr("name"),a="label[for="+n+"]";if(!r.find(a+" .helpicon").length){var t=e.$('');r.find(a).append(" ").append(t),t.on("click",function(){return e.help("",{id:"hrcareer-enddate",file:"CRM/HRCareer/Page/helptext"}),!1})}}})}(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/src/hrcareer/app.js b/hrcareer/js/src/hrcareer/app.js index bac78e27fad..7e365da1c43 100644 --- a/hrcareer/js/src/hrcareer/app.js +++ b/hrcareer/js/src/hrcareer/app.js @@ -1,18 +1,28 @@ /* eslint-env amd */ -define(function () { +define(function (CRM) { 'use strict'; - CRM.$(function ($) { - $('body').on('crmFormLoad', function (event) { - if (event.profileName === 'hrcareer_tab') { - var accessName = $('[data-crm-custom="Career:End_Date"]').attr('name'); + CRM.$('body').on('crmFormLoad', function () { + var form = CRM.$('.custom-group-Career'); - if ($('div#editrow-' + accessName + ' a.helpicon').length === 0) { - var helpIcon = $(""); - $('div#editrow-' + accessName + ' div label').append(helpIcon); - } + if (form.length) { + var accessName = form.find('[data-crm-custom="Career:End_Date"]').attr('name'); + var labelSelector = 'label[for=' + accessName + ']'; + + if (!form.find(labelSelector + ' .helpicon').length) { + var helpIcon = CRM.$(''); + + form.find(labelSelector).append(' ').append(helpIcon); + helpIcon.on('click', function () { + CRM.help('', { + id: 'hrcareer-enddate', + file: 'CRM/HRCareer/Page/helptext' + }); + + return false; + }); } - }); + } }); -}); +}(CRM)); diff --git a/hrmed/js/dist/hrmed.min.js b/hrmed/js/dist/hrmed.min.js index 6905d78844f..f1cd294a3d8 100644 --- a/hrmed/js/dist/hrmed.min.js +++ b/hrmed/js/dist/hrmed.min.js @@ -1,2 +1,2 @@ -!function(e,i){define("hrmed/app",[],function(){"use strict";e("body").on("crmFormLoad",function(i){if("hrmed_tab"===i.profileName){var n=e('[data-crm-custom="Medical_Disability:Condition"]').attr("name");if(0===e("div#editrow-"+n+" a.helpicon").length){var a=e('');e("div#editrow-"+n+" div label").append(a)}}})})}(CRM.$,CRM._),function(e){e(["hrmed/app"])}(require); +define(function(i){"use strict";i.$("body").on("crmFormLoad",function(){var e=i.$(".custom-group-Medical_Disability");if(e.length){var n=e.find('[data-crm-custom="Medical_Disability:Condition"]').attr("name"),t="label[for="+n+"]";if(!e.find(t+" .helpicon").length){var o=i.$('');e.find(t).append(o),o.on("click",function(){return i.help("",{id:"hrmed-med-condition",file:"CRM/HRMed/Page/helptext"}),!1})}}})}(CRM)),function(i){i(["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/src/hrmed/app.js b/hrmed/js/src/hrmed/app.js index 1f4232dce7b..4cb89839c27 100644 --- a/hrmed/js/src/hrmed/app.js +++ b/hrmed/js/src/hrmed/app.js @@ -1,17 +1,28 @@ /* eslint-env amd */ -(function ($, _) { - define(function () { - 'use strict'; - // 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); - } +define(function (CRM) { + 'use strict'; + + CRM.$('body').on('crmFormLoad', function () { + var form = CRM.$('.custom-group-Medical_Disability'); + + if (form.length) { + var accessName = form.find('[data-crm-custom="Medical_Disability:Condition"]').attr('name'); + var labelSelector = 'label[for=' + accessName + ']'; + + if (!form.find(labelSelector + ' .helpicon').length) { + var helpIcon = CRM.$(''); + + form.find(labelSelector).append(helpIcon); + helpIcon.on('click', function () { + CRM.help('', { + id: 'hrmed-med-condition', + file: 'CRM/HRMed/Page/helptext' + }); + + return false; + }); } - }); + } }); -}(CRM.$, CRM._)); +}(CRM)); From 6e89b0ec8a8bf3c68087eeb7b52b87347e6eb64d Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Thu, 2 Aug 2018 14:46:25 +0100 Subject: [PATCH 120/151] PCHR-4005: PR Feedback --- hrcareer/js/dist/hrcareer.min.js | 2 +- hrcareer/js/src/hrcareer/app.js | 61 +++++++++++++++++++++++--------- hrmed/js/dist/hrmed.min.js | 2 +- hrmed/js/src/hrmed/app.js | 61 +++++++++++++++++++++++--------- 4 files changed, 90 insertions(+), 36 deletions(-) diff --git a/hrcareer/js/dist/hrcareer.min.js b/hrcareer/js/dist/hrcareer.min.js index 45f52ce8454..a0f33e80e27 100644 --- a/hrcareer/js/dist/hrcareer.min.js +++ b/hrcareer/js/dist/hrcareer.min.js @@ -1,2 +1,2 @@ -define(function(e){"use strict";e.$("body").on("crmFormLoad",function(){var r=e.$(".custom-group-Career");if(r.length){var n=r.find('[data-crm-custom="Career:End_Date"]').attr("name"),a="label[for="+n+"]";if(!r.find(a+" .helpicon").length){var t=e.$('');r.find(a).append(" ").append(t),t.on("click",function(){return e.help("",{id:"hrcareer-enddate",file:"CRM/HRCareer/Page/helptext"}),!1})}}})}(CRM)),function(e){e(["hrcareer/app"])}(require); +define(function(e){"use strict";function n(n,r,a,t,i){var c,d=n.find('[data-crm-custom="'+r+'"]').attr("name"),o="label[for="+d+"]";n.find(o+" .helpicon").length||(c=e.$(''),n.find(o+" .crm-marker").length||n.find(o).append(" "),n.find(o).append(c),c.on("click",function(){return e.help("",{id:t,file:i}),!1}))}function r(){var r=e.$(".custom-group-Career");r.length&&n(r,"Career:End_Date","End Date Help","hrcareer-enddate","CRM/HRCareer/Page/helptext")}e.$("body").on("crmFormLoad",r)}(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/src/hrcareer/app.js b/hrcareer/js/src/hrcareer/app.js index 7e365da1c43..92420ebdca6 100644 --- a/hrcareer/js/src/hrcareer/app.js +++ b/hrcareer/js/src/hrcareer/app.js @@ -3,26 +3,53 @@ define(function (CRM) { 'use strict'; - CRM.$('body').on('crmFormLoad', function () { - var form = CRM.$('.custom-group-Career'); + CRM.$('body').on('crmFormLoad', injectHelpIcons); + + /** + * Injects a help icon to a form field + * + * @param {jQuery} $form + * @param {String} accessNameSelector - a selector to the field to populate to + * @param {String} title - the title of the help icon + * @param {String} helpId - the ID of the helper + * @param {String} helpFile - the path to the helper template + */ + function injectHelpIcon ($form, accessNameSelector, title, helpId, helpFile) { + var $helpIcon; + var accessName = $form.find('[data-crm-custom="' + accessNameSelector + '"]').attr('name'); + var labelSelector = 'label[for=' + accessName + ']'; + + if ($form.find(labelSelector + ' .helpicon').length) { + return; + } + + $helpIcon = CRM.$(''); - if (form.length) { - var accessName = form.find('[data-crm-custom="Career:End_Date"]').attr('name'); - var labelSelector = 'label[for=' + accessName + ']'; + // Populates a space before the icon if there are no other markers + if (!$form.find(labelSelector + ' .crm-marker').length) { + $form.find(labelSelector).append(' '); + } + + $form.find(labelSelector).append($helpIcon); - if (!form.find(labelSelector + ' .helpicon').length) { - var helpIcon = CRM.$(''); + $helpIcon.on('click', function () { + CRM.help('', { id: helpId, file: helpFile }); - form.find(labelSelector).append(' ').append(helpIcon); - helpIcon.on('click', function () { - CRM.help('', { - id: 'hrcareer-enddate', - file: 'CRM/HRCareer/Page/helptext' - }); + return false; + }); + } - return false; - }); - } + /** + * Injects help icons into the Career CiviCRM form + */ + function injectHelpIcons () { + var form = CRM.$('.custom-group-Career'); + + if (!form.length) { + return; } - }); + + injectHelpIcon(form, 'Career:End_Date', 'End Date Help', + 'hrcareer-enddate', 'CRM/HRCareer/Page/helptext'); + } }(CRM)); diff --git a/hrmed/js/dist/hrmed.min.js b/hrmed/js/dist/hrmed.min.js index f1cd294a3d8..054088618c4 100644 --- a/hrmed/js/dist/hrmed.min.js +++ b/hrmed/js/dist/hrmed.min.js @@ -1,2 +1,2 @@ -define(function(i){"use strict";i.$("body").on("crmFormLoad",function(){var e=i.$(".custom-group-Medical_Disability");if(e.length){var n=e.find('[data-crm-custom="Medical_Disability:Condition"]').attr("name"),t="label[for="+n+"]";if(!e.find(t+" .helpicon").length){var o=i.$('');e.find(t).append(o),o.on("click",function(){return i.help("",{id:"hrmed-med-condition",file:"CRM/HRMed/Page/helptext"}),!1})}}})}(CRM)),function(i){i(["hrmed/app"])}(require); +define(function(i){"use strict";function n(n,e,t,o,d){var a,c=n.find('[data-crm-custom="'+e+'"]').attr("name"),r="label[for="+c+"]";n.find(r+" .helpicon").length||(a=i.$(''),n.find(r+" .crm-marker").length||n.find(r).append(" "),n.find(r).append(a),a.on("click",function(){return i.help("",{id:o,file:d}),!1}))}function e(){var e=i.$(".custom-group-Medical_Disability");e.length&&n(e,"Medical_Disability:Condition","Condition Help","hrmed-med-condition","CRM/HRMed/Page/helptext")}i.$("body").on("crmFormLoad",e)}(CRM)),function(i){i(["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/src/hrmed/app.js b/hrmed/js/src/hrmed/app.js index 4cb89839c27..925d8e78811 100644 --- a/hrmed/js/src/hrmed/app.js +++ b/hrmed/js/src/hrmed/app.js @@ -3,26 +3,53 @@ define(function (CRM) { 'use strict'; - CRM.$('body').on('crmFormLoad', function () { - var form = CRM.$('.custom-group-Medical_Disability'); + CRM.$('body').on('crmFormLoad', injectHelpIcons); + + /** + * Injects a help icon to a form field + * + * @param {jQuery} $form + * @param {String} accessNameSelector - a selector to the field to populate to + * @param {String} title - the title of the help icon + * @param {String} helpId - the ID of the helper + * @param {String} helpFile - the path to the helper template + */ + function injectHelpIcon ($form, accessNameSelector, title, helpId, helpFile) { + var $helpIcon; + var accessName = $form.find('[data-crm-custom="' + accessNameSelector + '"]').attr('name'); + var labelSelector = 'label[for=' + accessName + ']'; + + if ($form.find(labelSelector + ' .helpicon').length) { + return; + } + + $helpIcon = CRM.$(''); - if (form.length) { - var accessName = form.find('[data-crm-custom="Medical_Disability:Condition"]').attr('name'); - var labelSelector = 'label[for=' + accessName + ']'; + // Populates a space before the icon if there are no other markers + if (!$form.find(labelSelector + ' .crm-marker').length) { + $form.find(labelSelector).append(' '); + } + + $form.find(labelSelector).append($helpIcon); - if (!form.find(labelSelector + ' .helpicon').length) { - var helpIcon = CRM.$(''); + $helpIcon.on('click', function () { + CRM.help('', { id: helpId, file: helpFile }); - form.find(labelSelector).append(helpIcon); - helpIcon.on('click', function () { - CRM.help('', { - id: 'hrmed-med-condition', - file: 'CRM/HRMed/Page/helptext' - }); + return false; + }); + } - return false; - }); - } + /** + * Injects help icons into the Career CiviCRM form + */ + function injectHelpIcons () { + var form = CRM.$('.custom-group-Medical_Disability'); + + if (!form.length) { + return; } - }); + + injectHelpIcon(form, 'Medical_Disability:Condition', 'Condition Help', + 'hrmed-med-condition', 'CRM/HRMed/Page/helptext'); + } }(CRM)); From 2aed98e749974867d7385509d07180f857b609e7 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Fri, 3 Aug 2018 12:02:02 +0100 Subject: [PATCH 121/151] PCHR-4005: Remove code duplication --- hrcareer/js/build.js | 5 +- hrcareer/js/dist/hrcareer.min.js | 2 +- hrcareer/js/src/hrcareer/app.js | 63 ++++--------------- hrmed/js/build.js | 5 +- hrmed/js/dist/hrmed.min.js | 2 +- hrmed/js/src/hrmed/app.js | 63 ++++--------------- uk.co.compucorp.civicrm.hrcore/hrcore.php | 2 +- .../js/dist/hrcore.min.js | 2 +- .../js/src/hrcore/analytics/page-tracker.js | 37 +++++++++++ .../js/src/hrcore/app.js | 41 ++---------- .../src/hrcore/helpers/help-icon-injector.js | 44 +++++++++++++ 11 files changed, 123 insertions(+), 143 deletions(-) create mode 100644 uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics/page-tracker.js create mode 100644 uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers/help-icon-injector.js diff --git a/hrcareer/js/build.js b/hrcareer/js/build.js index e525f473612..ea3d3bdc228 100644 --- a/hrcareer/js/build.js +++ b/hrcareer/js/build.js @@ -5,5 +5,8 @@ out: 'dist/hrcareer.min.js', name: 'hrcareer', skipModuleInsertion: true, - generateSourceMaps: true + generateSourceMaps: true, + paths: { + 'hrcore': 'empty:' + } }) diff --git a/hrcareer/js/dist/hrcareer.min.js b/hrcareer/js/dist/hrcareer.min.js index a0f33e80e27..e82d8a9ac03 100644 --- a/hrcareer/js/dist/hrcareer.min.js +++ b/hrcareer/js/dist/hrcareer.min.js @@ -1,2 +1,2 @@ -define(function(e){"use strict";function n(n,r,a,t,i){var c,d=n.find('[data-crm-custom="'+r+'"]').attr("name"),o="label[for="+d+"]";n.find(o+" .helpicon").length||(c=e.$(''),n.find(o+" .crm-marker").length||n.find(o).append(" "),n.find(o).append(c),c.on("click",function(){return e.help("",{id:t,file:i}),!1}))}function r(){var r=e.$(".custom-group-Career");r.length&&n(r,"Career:End_Date","End Date Help","hrcareer-enddate","CRM/HRCareer/Page/helptext")}e.$("body").on("crmFormLoad",r)}(CRM)),function(e){e(["hrcareer/app"])}(require); +!function(e){define("hrcareer/app",["hrcore/helpers/help-icon-injector"],function(r){"use strict";e.$("body").on("crmFormLoad",function(){r("custom-group-Career","Career:End_Date","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/src/hrcareer/app.js b/hrcareer/js/src/hrcareer/app.js index 92420ebdca6..d27ec24c067 100644 --- a/hrcareer/js/src/hrcareer/app.js +++ b/hrcareer/js/src/hrcareer/app.js @@ -1,55 +1,16 @@ /* eslint-env amd */ -define(function (CRM) { - 'use strict'; - - CRM.$('body').on('crmFormLoad', injectHelpIcons); - - /** - * Injects a help icon to a form field - * - * @param {jQuery} $form - * @param {String} accessNameSelector - a selector to the field to populate to - * @param {String} title - the title of the help icon - * @param {String} helpId - the ID of the helper - * @param {String} helpFile - the path to the helper template - */ - function injectHelpIcon ($form, accessNameSelector, title, helpId, helpFile) { - var $helpIcon; - var accessName = $form.find('[data-crm-custom="' + accessNameSelector + '"]').attr('name'); - var labelSelector = 'label[for=' + accessName + ']'; - - if ($form.find(labelSelector + ' .helpicon').length) { - return; - } - - $helpIcon = CRM.$(''); - - // Populates a space before the icon if there are no other markers - if (!$form.find(labelSelector + ' .crm-marker').length) { - $form.find(labelSelector).append(' '); - } - - $form.find(labelSelector).append($helpIcon); - - $helpIcon.on('click', function () { - CRM.help('', { id: helpId, file: helpFile }); - - return false; +(function (CRM) { + define(['hrcore/helpers/help-icon-injector'], function (injectHelpIcon) { + 'use strict'; + + CRM.$('body').on('crmFormLoad', function () { + injectHelpIcon( + 'custom-group-Career', + 'Career:End_Date', + 'End Date Help', + 'hrcareer-enddate', + 'CRM/HRCareer/Page/helptext'); }); - } - - /** - * Injects help icons into the Career CiviCRM form - */ - function injectHelpIcons () { - var form = CRM.$('.custom-group-Career'); - - if (!form.length) { - return; - } - - injectHelpIcon(form, 'Career:End_Date', 'End Date Help', - 'hrcareer-enddate', 'CRM/HRCareer/Page/helptext'); - } + }); }(CRM)); diff --git a/hrmed/js/build.js b/hrmed/js/build.js index 7ee245b290a..338b1b67ea6 100644 --- a/hrmed/js/build.js +++ b/hrmed/js/build.js @@ -5,5 +5,8 @@ out: 'dist/hrmed.min.js', name: 'hrmed', skipModuleInsertion: true, - generateSourceMaps: true + generateSourceMaps: true, + paths: { + 'hrcore': 'empty:' + } }) diff --git a/hrmed/js/dist/hrmed.min.js b/hrmed/js/dist/hrmed.min.js index 054088618c4..119be6e756f 100644 --- a/hrmed/js/dist/hrmed.min.js +++ b/hrmed/js/dist/hrmed.min.js @@ -1,2 +1,2 @@ -define(function(i){"use strict";function n(n,e,t,o,d){var a,c=n.find('[data-crm-custom="'+e+'"]').attr("name"),r="label[for="+c+"]";n.find(r+" .helpicon").length||(a=i.$(''),n.find(r+" .crm-marker").length||n.find(r).append(" "),n.find(r).append(a),a.on("click",function(){return i.help("",{id:o,file:d}),!1}))}function e(){var e=i.$(".custom-group-Medical_Disability");e.length&&n(e,"Medical_Disability:Condition","Condition Help","hrmed-med-condition","CRM/HRMed/Page/helptext")}i.$("body").on("crmFormLoad",e)}(CRM)),function(i){i(["hrmed/app"])}(require); +!function(i){define("hrmed/app",["hrcore/helpers/help-icon-injector"],function(e){"use strict";i.$("body").on("crmFormLoad",function(){e("custom-group-Medical_Disability","Medical_Disability:Condition","Condition Help","hrmed-med-condition","CRM/HRMed/Page/helptext")})})}(CRM),function(i){i(["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/src/hrmed/app.js b/hrmed/js/src/hrmed/app.js index 925d8e78811..2129048f983 100644 --- a/hrmed/js/src/hrmed/app.js +++ b/hrmed/js/src/hrmed/app.js @@ -1,55 +1,16 @@ /* eslint-env amd */ -define(function (CRM) { - 'use strict'; - - CRM.$('body').on('crmFormLoad', injectHelpIcons); - - /** - * Injects a help icon to a form field - * - * @param {jQuery} $form - * @param {String} accessNameSelector - a selector to the field to populate to - * @param {String} title - the title of the help icon - * @param {String} helpId - the ID of the helper - * @param {String} helpFile - the path to the helper template - */ - function injectHelpIcon ($form, accessNameSelector, title, helpId, helpFile) { - var $helpIcon; - var accessName = $form.find('[data-crm-custom="' + accessNameSelector + '"]').attr('name'); - var labelSelector = 'label[for=' + accessName + ']'; - - if ($form.find(labelSelector + ' .helpicon').length) { - return; - } - - $helpIcon = CRM.$(''); - - // Populates a space before the icon if there are no other markers - if (!$form.find(labelSelector + ' .crm-marker').length) { - $form.find(labelSelector).append(' '); - } - - $form.find(labelSelector).append($helpIcon); - - $helpIcon.on('click', function () { - CRM.help('', { id: helpId, file: helpFile }); - - return false; +(function (CRM) { + define(['hrcore/helpers/help-icon-injector'], function (injectHelpIcon) { + 'use strict'; + + CRM.$('body').on('crmFormLoad', function () { + injectHelpIcon( + 'custom-group-Medical_Disability', + 'Medical_Disability:Condition', + 'Condition Help', + 'hrmed-med-condition', + 'CRM/HRMed/Page/helptext'); }); - } - - /** - * Injects help icons into the Career CiviCRM form - */ - function injectHelpIcons () { - var form = CRM.$('.custom-group-Medical_Disability'); - - if (!form.length) { - return; - } - - injectHelpIcon(form, 'Medical_Disability:Condition', 'Condition Help', - 'hrmed-med-condition', 'CRM/HRMed/Page/helptext'); - } + }); }(CRM)); diff --git a/uk.co.compucorp.civicrm.hrcore/hrcore.php b/uk.co.compucorp.civicrm.hrcore/hrcore.php index cbc524590bd..621fe097a2d 100644 --- a/uk.co.compucorp.civicrm.hrcore/hrcore.php +++ b/uk.co.compucorp.civicrm.hrcore/hrcore.php @@ -326,7 +326,7 @@ function hrcore_civicrm_pageRun($page) { * Implements hook_civicrm_coreResourceList(). */ function hrcore_civicrm_coreResourceList(&$items, $region) { - CRM_Core_Resources::singleton()->addScriptFile('uk.co.compucorp.civicrm.hrcore', 'js/dist/hrcore.min.js', 1010); + CRM_Core_Resources::singleton()->addScriptFile('uk.co.compucorp.civicrm.hrcore', 'js/dist/hrcore.min.js', 1000); } /** diff --git a/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js b/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js index e29955f90af..c82ee59d881 100644 --- a/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js +++ b/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js @@ -1,2 +1,2 @@ -!function(e,a,t){define("hrcore/app",[],function(){"use strict";!function(){var n;t&&(n=e.location.pathname+"?reset=1&cid="+a.contactId,a.$("#mainTabContainer").on("tabsactivate",function(e,a){var i=a.newTab[0].id.replace("tab_","");t.push({event:"virtual-pageview",virtualPageviewPath:n+"&selectedChild="+i})}))}()})}(window,CRM,"undefined"!=typeof dataLayer?dataLayer:null),function(e){e(["hrcore/app"])}(require); +!function(e,n,t){define("hrcore/analytics/page-tracker",[],function(){"use strict";function a(){var a;t&&(a=e.location.pathname+"?reset=1&cid="+n.contactId,n.$("#mainTabContainer").on("tabsactivate",function(e,n){var r=n.newTab[0].id.replace("tab_","");t.push({event:"virtual-pageview",virtualPageviewPath:a+"&selectedChild="+r})}))}return a})}(window,CRM,"undefined"!=typeof dataLayer?dataLayer:null),function(e){define("hrcore/helpers/help-icon-injector",[],function(){"use strict";function n(n,t,a,r,i){var c,o=e.$("."+n),l=o.find('[data-crm-custom="'+t+'"]').attr("name"),f="label[for="+l+"]";o.length&&!o.find(f+" .helpicon").length&&(c=e.$(''),o.find(f+" .crm-marker").length||o.find(f).append(" "),o.find(f).append(c),c.on("click",function(){return e.help("",{id:r,file:i}),!1}))}return n})}(CRM),define("hrcore/app",["hrcore/analytics/page-tracker","hrcore/helpers/help-icon-injector"],function(e){e()}),function(e){e(["hrcore/app"])}(require); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics/page-tracker.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics/page-tracker.js new file mode 100644 index 00000000000..507ed73a923 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics/page-tracker.js @@ -0,0 +1,37 @@ +/* global dataLayer */ +/* eslint-env amd */ + +(function (window, CRM, dataLayer) { + define(function () { + 'use strict'; + + return trackContactTabVirtualPageviews; + + /** + * Sends a virtual pageview to Google Analytics whenever the user clicks on + * any of the tabs of the Contact Summary page + * + * The path of the pageview is the Contact Summary page path + the selectedChild + * param's value of the selected tab, thus simulating the user landing + * directly on the tab + */ + function trackContactTabVirtualPageviews () { + var contactPagePath; + + if (!dataLayer) { + return; + } + + contactPagePath = window.location.pathname + '?reset=1&cid=' + CRM.contactId; + + CRM.$('#mainTabContainer').on('tabsactivate', function (event, ui) { + var tabName = ui.newTab[0].id.replace('tab_', ''); + + dataLayer.push({ + event: 'virtual-pageview', + virtualPageviewPath: contactPagePath + '&selectedChild=' + tabName + }); + }); + } + }); +}(window, CRM, (typeof dataLayer !== 'undefined' ? dataLayer : null))); diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js index 8209b285e91..6b159ac3fe6 100644 --- a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js +++ b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js @@ -1,37 +1,8 @@ -/* global dataLayer */ /* eslint-env amd */ -(function (window, CRM, dataLayer) { - define(function () { - 'use strict'; - - trackContactTabVirtualPageviews(); - - /** - * Sends a virtual pageview to Google Analytics whenever the user clicks on - * any of the tabs of the Contact Summary page - * - * The path of the pageview is the Contact Summary page path + the selectedChild - * param's value of the selected tab, thus simulating the user landing - * directly on the tab - */ - function trackContactTabVirtualPageviews () { - var contactPagePath; - - if (!dataLayer) { - return; - } - - contactPagePath = window.location.pathname + '?reset=1&cid=' + CRM.contactId; - - CRM.$('#mainTabContainer').on('tabsactivate', function (event, ui) { - var tabName = ui.newTab[0].id.replace('tab_', ''); - - dataLayer.push({ - event: 'virtual-pageview', - virtualPageviewPath: contactPagePath + '&selectedChild=' + tabName - }); - }); - } - }); -}(window, CRM, (typeof dataLayer !== 'undefined' ? dataLayer : null))); +define([ + 'hrcore/analytics/page-tracker', + 'hrcore/helpers/help-icon-injector' +], function (trackContactTabVirtualPageviews) { + trackContactTabVirtualPageviews(); +}); diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers/help-icon-injector.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers/help-icon-injector.js new file mode 100644 index 00000000000..d6f7bd91bcc --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers/help-icon-injector.js @@ -0,0 +1,44 @@ +/* eslint-env amd */ + +(function (CRM) { + define(function () { + 'use strict'; + + return injectHelpIcon; + + /** + * Injects a help icon to a form field + * + * @param {jQuery} formClass - a class of the CiviCRM form + * @param {String} accessNameSelector - a selector to the field to populate to + * @param {String} title - the title of the help icon + * @param {String} helpId - the ID of the helper + * @param {String} helpFile - the path to the helper template + */ + function injectHelpIcon (formClass, accessNameSelector, title, helpId, helpFile) { + var $helpIcon; + var $form = CRM.$('.' + formClass); + var accessName = $form.find('[data-crm-custom="' + accessNameSelector + '"]').attr('name'); + var labelSelector = 'label[for=' + accessName + ']'; + + if (!$form.length || $form.find(labelSelector + ' .helpicon').length) { + return; + } + + $helpIcon = CRM.$(''); + + // Populates a space before the icon if there are no other markers + if (!$form.find(labelSelector + ' .crm-marker').length) { + $form.find(labelSelector).append(' '); + } + + $form.find(labelSelector).append($helpIcon); + + $helpIcon.on('click', function () { + CRM.help('', { id: helpId, file: helpFile }); + + return false; + }); + } + }); +}(CRM)); From 3103b51f431862205cdb3f3813e2980dc42a5fa1 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Fri, 3 Aug 2018 16:53:00 +0100 Subject: [PATCH 122/151] PCHR-4005: Refactor the code --- hrcareer/js/dist/hrcareer.min.js | 2 +- hrcareer/js/src/hrcareer/app.js | 23 ++++++--- hrmed/js/dist/hrmed.min.js | 2 +- hrmed/js/src/hrmed/app.js | 22 ++++++--- .../js/dist/hrcore.min.js | 2 +- .../page-tracker.js => analytics.js} | 4 +- .../js/src/hrcore/app.js | 8 ++-- .../js/src/hrcore/helpers.js | 47 +++++++++++++++++++ .../src/hrcore/helpers/help-icon-injector.js | 44 ----------------- 9 files changed, 88 insertions(+), 66 deletions(-) rename uk.co.compucorp.civicrm.hrcore/js/src/hrcore/{analytics/page-tracker.js => analytics.js} (92%) create mode 100644 uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers.js delete mode 100644 uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers/help-icon-injector.js diff --git a/hrcareer/js/dist/hrcareer.min.js b/hrcareer/js/dist/hrcareer.min.js index e82d8a9ac03..a7b4e51a178 100644 --- a/hrcareer/js/dist/hrcareer.min.js +++ b/hrcareer/js/dist/hrcareer.min.js @@ -1,2 +1,2 @@ -!function(e){define("hrcareer/app",["hrcore/helpers/help-icon-injector"],function(r){"use strict";e.$("body").on("crmFormLoad",function(){r("custom-group-Career","Career:End_Date","End Date Help","hrcareer-enddate","CRM/HRCareer/Page/helptext")})})}(CRM),function(e){e(["hrcareer/app"])}(require); +!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/src/hrcareer/app.js b/hrcareer/js/src/hrcareer/app.js index d27ec24c067..219c387c5a1 100644 --- a/hrcareer/js/src/hrcareer/app.js +++ b/hrcareer/js/src/hrcareer/app.js @@ -1,16 +1,25 @@ /* eslint-env amd */ -(function (CRM) { - define(['hrcore/helpers/help-icon-injector'], function (injectHelpIcon) { +(function ($) { + define([ + 'hrcore/helpers' + ], function (helpers) { 'use strict'; - CRM.$('body').on('crmFormLoad', function () { - injectHelpIcon( - 'custom-group-Career', - 'Career:End_Date', + $('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)); +}(CRM.$)); diff --git a/hrmed/js/dist/hrmed.min.js b/hrmed/js/dist/hrmed.min.js index 119be6e756f..c68df7aa9e1 100644 --- a/hrmed/js/dist/hrmed.min.js +++ b/hrmed/js/dist/hrmed.min.js @@ -1,2 +1,2 @@ -!function(i){define("hrmed/app",["hrcore/helpers/help-icon-injector"],function(e){"use strict";i.$("body").on("crmFormLoad",function(){e("custom-group-Medical_Disability","Medical_Disability:Condition","Condition Help","hrmed-med-condition","CRM/HRMed/Page/helptext")})})}(CRM),function(i){i(["hrmed/app"])}(require); +!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/src/hrmed/app.js b/hrmed/js/src/hrmed/app.js index 2129048f983..f96329a2d0a 100644 --- a/hrmed/js/src/hrmed/app.js +++ b/hrmed/js/src/hrmed/app.js @@ -1,16 +1,24 @@ /* eslint-env amd */ -(function (CRM) { - define(['hrcore/helpers/help-icon-injector'], function (injectHelpIcon) { +(function ($) { + define([ + 'hrcore/helpers' + ], function (helpers) { 'use strict'; - CRM.$('body').on('crmFormLoad', function () { - injectHelpIcon( - 'custom-group-Medical_Disability', - 'Medical_Disability:Condition', + $('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)); +}(CRM.$)); diff --git a/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js b/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js index c82ee59d881..01cc5e5ad6f 100644 --- a/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js +++ b/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js @@ -1,2 +1,2 @@ -!function(e,n,t){define("hrcore/analytics/page-tracker",[],function(){"use strict";function a(){var a;t&&(a=e.location.pathname+"?reset=1&cid="+n.contactId,n.$("#mainTabContainer").on("tabsactivate",function(e,n){var r=n.newTab[0].id.replace("tab_","");t.push({event:"virtual-pageview",virtualPageviewPath:a+"&selectedChild="+r})}))}return a})}(window,CRM,"undefined"!=typeof dataLayer?dataLayer:null),function(e){define("hrcore/helpers/help-icon-injector",[],function(){"use strict";function n(n,t,a,r,i){var c,o=e.$("."+n),l=o.find('[data-crm-custom="'+t+'"]').attr("name"),f="label[for="+l+"]";o.length&&!o.find(f+" .helpicon").length&&(c=e.$(''),o.find(f+" .crm-marker").length||o.find(f).append(" "),o.find(f).append(c),c.on("click",function(){return e.help("",{id:r,file:i}),!1}))}return n})}(CRM),define("hrcore/app",["hrcore/analytics/page-tracker","hrcore/helpers/help-icon-injector"],function(e){e()}),function(e){e(["hrcore/app"])}(require); +!function(e,a,n){define("hrcore/analytics",[],function(){"use strict";function t(){console.log("SHISH");var t;n&&(t=e.location.pathname+"?reset=1&cid="+a.contactId,a.$("#mainTabContainer").on("tabsactivate",function(e,a){var r=a.newTab[0].id.replace("tab_","");n.push({event:"virtual-pageview",virtualPageviewPath:t+"&selectedChild="+r})}))}return{trackContactTabVirtualPageviews:t}})}(window,CRM,"undefined"!=typeof dataLayer?dataLayer:null),function(e,a){define("hrcore/helpers",[],function(){"use strict";function n(n,t,r,i){var c=a('');n.append(c),c.on("click",function(){return e.help("",{id:r,file:i}),!1})}function t(e,n){var t=a("."+e),r=t.find('[data-crm-custom="'+n+'"]').attr("name"),i="label[for="+r+"]";return t.find(i)}return{appendHelpIcon:n,getCiviCRMFormLabel:t}})}(CRM,CRM.$),define("hrcore/app",["hrcore/analytics","hrcore/helpers"],function(e){e.trackContactTabVirtualPageviews()}),function(e){e(["hrcore/app"])}(require); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js.map \ No newline at end of file diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics/page-tracker.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics.js similarity index 92% rename from uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics/page-tracker.js rename to uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics.js index 507ed73a923..2ebe27c6640 100644 --- a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics/page-tracker.js +++ b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/analytics.js @@ -5,7 +5,9 @@ define(function () { 'use strict'; - return trackContactTabVirtualPageviews; + return { + trackContactTabVirtualPageviews: trackContactTabVirtualPageviews + }; /** * Sends a virtual pageview to Google Analytics whenever the user clicks on diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js index 6b159ac3fe6..76f3e44cfb1 100644 --- a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js +++ b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/app.js @@ -1,8 +1,8 @@ /* eslint-env amd */ define([ - 'hrcore/analytics/page-tracker', - 'hrcore/helpers/help-icon-injector' -], function (trackContactTabVirtualPageviews) { - trackContactTabVirtualPageviews(); + 'hrcore/analytics', + 'hrcore/helpers' +], function (analytics) { + analytics.trackContactTabVirtualPageviews(); }); diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers.js new file mode 100644 index 00000000000..c614a9da2c5 --- /dev/null +++ b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers.js @@ -0,0 +1,47 @@ +/* eslint-env amd */ + +(function (CRM, $) { + define(function () { + 'use strict'; + + return { + appendHelpIcon: appendHelpIcon, + getCiviCRMFormLabel: getCiviCRMFormLabel + }; + + /** + * Appends a help icon to a given element + * + * @param {jQuery} $element + * @param {String} title the title of the help icon + * @param {String} helpId the ID of the helper + * @param {String} helpFile the path to the helper template + */ + function appendHelpIcon ($element, title, helpId, helpFile) { + var $helpIcon = $(''); + + $element.append($helpIcon); + + $helpIcon.on('click', function () { + CRM.help('', { id: helpId, file: helpFile }); + + return false; + }); + } + + /** + * Gets a CiviCRM form field label + * + * @param {String} formClass a class of the CiviCRM form + * @param {String} accessNameSelector a selector to the field to populate to + * @return {jQuery} + */ + function getCiviCRMFormLabel (formClass, accessNameSelector) { + var $form = $('.' + formClass); + var accessName = $form.find('[data-crm-custom="' + accessNameSelector + '"]').attr('name'); + var labelSelector = 'label[for=' + accessName + ']'; + + return $form.find(labelSelector); + } + }); +}(CRM, CRM.$)); diff --git a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers/help-icon-injector.js b/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers/help-icon-injector.js deleted file mode 100644 index d6f7bd91bcc..00000000000 --- a/uk.co.compucorp.civicrm.hrcore/js/src/hrcore/helpers/help-icon-injector.js +++ /dev/null @@ -1,44 +0,0 @@ -/* eslint-env amd */ - -(function (CRM) { - define(function () { - 'use strict'; - - return injectHelpIcon; - - /** - * Injects a help icon to a form field - * - * @param {jQuery} formClass - a class of the CiviCRM form - * @param {String} accessNameSelector - a selector to the field to populate to - * @param {String} title - the title of the help icon - * @param {String} helpId - the ID of the helper - * @param {String} helpFile - the path to the helper template - */ - function injectHelpIcon (formClass, accessNameSelector, title, helpId, helpFile) { - var $helpIcon; - var $form = CRM.$('.' + formClass); - var accessName = $form.find('[data-crm-custom="' + accessNameSelector + '"]').attr('name'); - var labelSelector = 'label[for=' + accessName + ']'; - - if (!$form.length || $form.find(labelSelector + ' .helpicon').length) { - return; - } - - $helpIcon = CRM.$(''); - - // Populates a space before the icon if there are no other markers - if (!$form.find(labelSelector + ' .crm-marker').length) { - $form.find(labelSelector).append(' '); - } - - $form.find(labelSelector).append($helpIcon); - - $helpIcon.on('click', function () { - CRM.help('', { id: helpId, file: helpFile }); - - return false; - }); - } - }); -}(CRM)); From 09008efe307f397c6585002f65d5ddcd5b10cede Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Mon, 6 Aug 2018 14:53:42 +0100 Subject: [PATCH 123/151] PCHR-4005: Update dist files --- uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js b/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js index 01cc5e5ad6f..971e6699d52 100644 --- a/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js +++ b/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js @@ -1,2 +1,2 @@ -!function(e,a,n){define("hrcore/analytics",[],function(){"use strict";function t(){console.log("SHISH");var t;n&&(t=e.location.pathname+"?reset=1&cid="+a.contactId,a.$("#mainTabContainer").on("tabsactivate",function(e,a){var r=a.newTab[0].id.replace("tab_","");n.push({event:"virtual-pageview",virtualPageviewPath:t+"&selectedChild="+r})}))}return{trackContactTabVirtualPageviews:t}})}(window,CRM,"undefined"!=typeof dataLayer?dataLayer:null),function(e,a){define("hrcore/helpers",[],function(){"use strict";function n(n,t,r,i){var c=a('');n.append(c),c.on("click",function(){return e.help("",{id:r,file:i}),!1})}function t(e,n){var t=a("."+e),r=t.find('[data-crm-custom="'+n+'"]').attr("name"),i="label[for="+r+"]";return t.find(i)}return{appendHelpIcon:n,getCiviCRMFormLabel:t}})}(CRM,CRM.$),define("hrcore/app",["hrcore/analytics","hrcore/helpers"],function(e){e.trackContactTabVirtualPageviews()}),function(e){e(["hrcore/app"])}(require); +!function(e,a,n){define("hrcore/analytics",[],function(){"use strict";function t(){var t;n&&(t=e.location.pathname+"?reset=1&cid="+a.contactId,a.$("#mainTabContainer").on("tabsactivate",function(e,a){var r=a.newTab[0].id.replace("tab_","");n.push({event:"virtual-pageview",virtualPageviewPath:t+"&selectedChild="+r})}))}return{trackContactTabVirtualPageviews:t}})}(window,CRM,"undefined"!=typeof dataLayer?dataLayer:null),function(e,a){define("hrcore/helpers",[],function(){"use strict";function n(n,t,r,i){var c=a('');n.append(c),c.on("click",function(){return e.help("",{id:r,file:i}),!1})}function t(e,n){var t=a("."+e),r=t.find('[data-crm-custom="'+n+'"]').attr("name"),i="label[for="+r+"]";return t.find(i)}return{appendHelpIcon:n,getCiviCRMFormLabel:t}})}(CRM,CRM.$),define("hrcore/app",["hrcore/analytics","hrcore/helpers"],function(e){e.trackContactTabVirtualPageviews()}),function(e){e(["hrcore/app"])}(require); //# sourceMappingURL=/sites/all/modules/civicrm/tools/extensions/civihr/uk.co.compucorp.civicrm.hrcore/js/dist/hrcore.min.js.map \ No newline at end of file From a0613de024f919e3aabaad37b55aa766d1697a93 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Mon, 6 Aug 2018 17:51:39 +0100 Subject: [PATCH 124/151] PCHR-4049: Fix gulp tasks --- .../gulp/tasks/requirejs.js | 4 ++-- .../gulp/tasks/sass.js | 2 +- .../gulp/tasks/test.js | 2 +- uk.co.compucorp.civicrm.hrcore/gulp/utils.js | 16 ++++++++++---- uk.co.compucorp.civicrm.hrcore/gulpfile.js | 22 ++++++++++++------- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js index 9cb241e5679..2b92be0c8a5 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/requirejs.js @@ -71,7 +71,7 @@ function extensionDependenciesTask (cb) { return utils.spawnTaskForExtension('requirejs', requireJsTask, extension); }); - sequence.length ? gulp.series.apply(null, sequence)(function () { + sequence.length ? gulp.series(sequence)(function () { // Restore the original extension (used in the CLI) as the current extension // before marking the task as done utils.setCurrentExtension(originalExtension); @@ -205,7 +205,7 @@ function requireJsTask (cb) { ); } - gulp.series.apply(null, sequence)(cb); + gulp.series(sequence)(cb); } else { console.log('Not eligible for this task, skipping...'); cb(); diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js index 007a9dbbfa2..96ab5914dba 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js @@ -19,7 +19,7 @@ module.exports = [ utils.spawnTaskForExtension('sass:main', mainTask) ], 'sass'); - gulp.series.apply(null, sequence)(cb); + gulp.series(sequence)(cb); } else { console.log('Not eligible for this task, skipping...'); cb(); diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js index e40f26f72bc..7a53c6d5c7f 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/test.js @@ -14,7 +14,7 @@ module.exports = [ utils.spawnTaskForExtension('test:main', mainTask) ], 'test'); - gulp.series.apply(null, sequence)(cb); + gulp.series(sequence)(cb); } else { console.log('Not eligible for this task, skipping...'); cb(); diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/utils.js b/uk.co.compucorp.civicrm.hrcore/gulp/utils.js index 16594caab9d..e0e1e9f646c 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/utils.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/utils.js @@ -306,11 +306,15 @@ function setCurrentExtension (extension) { * Spawns a task for an extension on the fly, using the name and function provided * The extension specified is set as the current extension before executing the task fn * - * @param {String} taskName - * @param {Function} taskFn - * @param {String} extension If undefined, the current extension is used + * @param {String} taskName + * @param {Function} taskFn + * @param {String} [extension] if omitted, the current extension is used + * @param {Function} [callback] if ommited, no callback will be called + * @return {String} updated task name as per the selected extension */ -function spawnTaskForExtension (taskName, taskFn, extension) { +function spawnTaskForExtension (taskName, taskFn, extension, callback) { + var taskExecution; + extension = extension || getCurrentExtension(); taskName += ' (' + extension + ')'; @@ -320,6 +324,10 @@ function spawnTaskForExtension (taskName, taskFn, extension) { return taskFn(cb); }); + taskExecution = gulp.series([taskName]); + + (callback) && taskExecution(callback); + return taskName; } diff --git a/uk.co.compucorp.civicrm.hrcore/gulpfile.js b/uk.co.compucorp.civicrm.hrcore/gulpfile.js index 4640976ae70..7218ea6ec18 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulpfile.js +++ b/uk.co.compucorp.civicrm.hrcore/gulpfile.js @@ -5,25 +5,31 @@ var gulp = require('gulp'); var utils = require('./gulp/utils'); var tasks = getMainTasks(); -var watcherPromises = buildTaskPromises(['sass:watch', 'requirejs:watch', 'test:watch']); -var builderPromises = buildTaskPromises(['sass', 'requirejs', 'test']); +var watcherTasks = createTasksArray(['sass:watch', 'requirejs:watch', 'test:watch']); +var builderTasks = createTasksArray(['sass', 'requirejs', 'test']); _.each(tasks, function (fn, name) { gulp.task(name, fn); }); -gulp.task('watch', gulp.series(watcherPromises)); -gulp.task('build', gulp.series(builderPromises)); +gulp.task('watch', gulp.parallel(watcherTasks)); +gulp.task('build', gulp.series(builderTasks)); /** - * Builds extension tasks promises + * Builds extension tasks functions collection * * @param {Array} taskNames - * @return {Array} of task promises + * @return {Array} of task functions */ -function buildTaskPromises (taskNames) { +function createTasksArray (taskNames) { return taskNames.map(function (taskName) { - return utils.spawnTaskForExtension(taskName, tasks[taskName]); + var fn = function (cb) { + utils.spawnTaskForExtension(taskName, tasks[taskName], null, cb); + }; + + fn.displayName = taskName; + + return fn; }); } From 86b387a15b1f722044c40be1f6e403ce70df9d32 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 7 Aug 2018 11:40:45 +0100 Subject: [PATCH 125/151] PCHR-4049: PR Feedback --- uk.co.compucorp.civicrm.hrcore/gulp/utils.js | 9 +---- uk.co.compucorp.civicrm.hrcore/gulpfile.js | 41 ++++++++++---------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/utils.js b/uk.co.compucorp.civicrm.hrcore/gulp/utils.js index e0e1e9f646c..096d034794b 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/utils.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/utils.js @@ -309,12 +309,9 @@ function setCurrentExtension (extension) { * @param {String} taskName * @param {Function} taskFn * @param {String} [extension] if omitted, the current extension is used - * @param {Function} [callback] if ommited, no callback will be called * @return {String} updated task name as per the selected extension */ -function spawnTaskForExtension (taskName, taskFn, extension, callback) { - var taskExecution; - +function spawnTaskForExtension (taskName, taskFn, extension) { extension = extension || getCurrentExtension(); taskName += ' (' + extension + ')'; @@ -324,10 +321,6 @@ function spawnTaskForExtension (taskName, taskFn, extension, callback) { return taskFn(cb); }); - taskExecution = gulp.series([taskName]); - - (callback) && taskExecution(callback); - return taskName; } diff --git a/uk.co.compucorp.civicrm.hrcore/gulpfile.js b/uk.co.compucorp.civicrm.hrcore/gulpfile.js index 7218ea6ec18..0d724aed8d6 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulpfile.js +++ b/uk.co.compucorp.civicrm.hrcore/gulpfile.js @@ -5,33 +5,20 @@ var gulp = require('gulp'); var utils = require('./gulp/utils'); var tasks = getMainTasks(); -var watcherTasks = createTasksArray(['sass:watch', 'requirejs:watch', 'test:watch']); -var builderTasks = createTasksArray(['sass', 'requirejs', 'test']); - _.each(tasks, function (fn, name) { gulp.task(name, fn); }); -gulp.task('watch', gulp.parallel(watcherTasks)); -gulp.task('build', gulp.series(builderTasks)); - -/** - * Builds extension tasks functions collection - * - * @param {Array} taskNames - * @return {Array} of task functions - */ -function createTasksArray (taskNames) { - return taskNames.map(function (taskName) { - var fn = function (cb) { - utils.spawnTaskForExtension(taskName, tasks[taskName], null, cb); - }; +gulp.task('watch', function (cb) { + var watchTasksNames = spawnTasks(['sass:watch', 'requirejs:watch', 'test:watch']); - fn.displayName = taskName; + gulp.parallel(watchTasksNames)(cb); +}); +gulp.task('build', function (cb) { + var buildTasksNames = spawnTasks(['sass', 'requirejs', 'test']); - return fn; - }); -} + gulp.series(buildTasksNames)(cb); +}); /** * Gets all the task listed in the files under the gulp/task folder @@ -50,3 +37,15 @@ function getMainTasks () { .fromPairs() .value(); } + +/** + * Spawns tasks for the selected extension + * + * @param {Array} taskNames + * @return {Array} of updated tasks names as per the selected extension + */ +function spawnTasks (taskNames) { + return taskNames.map(function (taskName) { + return utils.spawnTaskForExtension(taskName, tasks[taskName]); + }); +} From 035317f93476ce2e8a0c1f0739f6a161ad99124e Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Fri, 3 Aug 2018 10:58:46 +0200 Subject: [PATCH 126/151] PCHR-4098: Fix angular urls --- .../backstop_data/scenarios/la-dashboard.json | 8 ++-- .../scenarios/ssp-la-manager.json | 28 ++++++------- .../scenarios/ssp-la-my-leave.json | 14 +++---- .../backstop_data/scenarios/ta-calendar.json | 2 +- .../backstop_data/scenarios/ta-documents.json | 14 +++---- .../backstop_data/scenarios/ta-tasks.json | 40 +++++++++---------- 6 files changed, 53 insertions(+), 53 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/la-dashboard.json b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/la-dashboard.json index dde84ec350c..1a1f23c2711 100644 --- a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/la-dashboard.json +++ b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/la-dashboard.json @@ -2,22 +2,22 @@ "scenarios": [ { "label": "L&A / Dashboard / Calendar", - "url": "{{siteUrl}}/civicrm/leaveandabsences/dashboard#/calendar", + "url": "{{siteUrl}}/civicrm/leaveandabsences/dashboard#!/calendar", "onReadyScript": "leave-absence-dashboard/leave-calendar/leave-calendar.js" }, { "label": "L&A / Dashboard / Leave Requests", - "url": "{{siteUrl}}/civicrm/leaveandabsences/dashboard#/requests", + "url": "{{siteUrl}}/civicrm/leaveandabsences/dashboard#!/requests", "onReadyScript": "leave-absence-dashboard/leave-requests/leave-requests.js" }, { "label": "L&A / Dashboard / Leave Requests / Show Filters", - "url": "{{siteUrl}}/civicrm/leaveandabsences/dashboard#/requests", + "url": "{{siteUrl}}/civicrm/leaveandabsences/dashboard#!/requests", "onReadyScript": "leave-absence-dashboard/leave-requests/leave-requests-with-filters.js" }, { "label": "L&A / Dashboard / Leave Balances", - "url": "{{siteUrl}}/civicrm/leaveandabsences/dashboard#/leave-balances", + "url": "{{siteUrl}}/civicrm/leaveandabsences/dashboard#!/leave-balances", "onReadyScript": "leave-absence-dashboard/leave-balances/leave-balances.js" } ] diff --git a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ssp-la-manager.json b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ssp-la-manager.json index d19e490dfb3..c017fa28c1d 100644 --- a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ssp-la-manager.json +++ b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ssp-la-manager.json @@ -2,85 +2,85 @@ "scenarios": [ { "label": "SSP / Manager Leave / Current month", - "url": "{{siteUrl}}/manager-leave#/manager-leave/calendar", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/calendar", "onReadyScript": "ssp/manager-leave/calendar-current-month-visible.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Legend expanded", - "url": "{{siteUrl}}/manager-leave#/manager-leave/calendar", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/calendar", "onReadyScript": "ssp/manager-leave/calendar-legend-expanded.js", "user": "civihr_manager", "requireSameDimensions": false }, { "label": "SSP / Manager Leave / Show all contacts", - "url": "{{siteUrl}}/manager-leave#/manager-leave/calendar", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/calendar", "onReadyScript": "ssp/manager-leave/calendar-all-contacts.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Show actions", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/leave-requests-show-actions.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Show without filters", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/leave-requests-without-filters.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Show with filters", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/leave-requests-with-filters.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Show staff edit toil request", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/modal-toil-edit.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Show staff edit sickness request", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/modal-sick-edit.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Apply leave on behalf of staff", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/modal-leave-on-behalf-of-staff.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Apply sickness on behalf of staff", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/modal-sick-on-behalf-of-staff.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Apply toil on behalf of staff", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/modal-toil-on-behalf-of-staff.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave / Leave Balances", - "url": "{{siteUrl}}/manager-leave#/manager-leave/leave-balances", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/leave-balances", "onReadyScript": "ssp/manager-leave/leave-balances.js", "user": "civihr_manager" }, { "label": "SSP / Manager Leave (as admin) / Leave Requests", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/leave-requests-as-admin.js" }, { "label": "SSP / Manager Leave (as admin) / Leave Requests / All Requests", - "url": "{{siteUrl}}/manager-leave#/manager-leave/requests", + "url": "{{siteUrl}}/manager-leave#!/manager-leave/requests", "onReadyScript": "ssp/manager-leave/leave-requests-as-admin-all-requests.js" } ] diff --git a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ssp-la-my-leave.json b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ssp-la-my-leave.json index ebbd90f628e..afebd66afb8 100644 --- a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ssp-la-my-leave.json +++ b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ssp-la-my-leave.json @@ -2,43 +2,43 @@ "scenarios": [ { "label": "SSP / My Leave / Report", - "url": "{{siteUrl}}/my-leave#/my-leave/report", + "url": "{{siteUrl}}/my-leave#!/my-leave/report", "onReadyScript": "ssp/my-leave/report.js", "user": "civihr_staff" }, { "label": "SSP / My Leave / Report / Modal / Show comments", - "url": "{{siteUrl}}/my-leave#/my-leave/report", + "url": "{{siteUrl}}/my-leave#!/my-leave/report", "onReadyScript": "ssp/my-leave/report-pending-show-comments.js", "user": "civihr_staff" }, { "label": "SSP / My Leave / Report / Modal / Show absence in hours", - "url": "{{siteUrl}}/my-leave#/my-leave/report", + "url": "{{siteUrl}}/my-leave#!/my-leave/report", "onReadyScript": "ssp/my-leave/report-show-absence-in-hours.js", "user": "civihr_staff" }, { "label": "SSP / My Leave / Report / Modal / Show deductions fields", - "url": "{{siteUrl}}/my-leave#/my-leave/report", + "url": "{{siteUrl}}/my-leave#!/my-leave/report", "onReadyScript": "ssp/my-leave/modal-show-deduction-fields.js", "user": "civihr_staff" }, { "label": "SSP / My Leave / Report / Modal / Show deductions fields expanded", - "url": "{{siteUrl}}/my-leave#/my-leave/report", + "url": "{{siteUrl}}/my-leave#!/my-leave/report", "onReadyScript": "ssp/my-leave/modal-show-deduction-fields-expanded.js", "user": "civihr_staff" }, { "label": "SSP / My Leave / Calendar / Current Month", - "url": "{{siteUrl}}/my-leave#/my-leave/calendar", + "url": "{{siteUrl}}/my-leave#!/my-leave/calendar", "onReadyScript": "ssp/my-leave/calendar-current-month-visible.js", "user": "civihr_staff" }, { "label": "SSP / My Leave / Calendar / Tooltip", - "url": "{{siteUrl}}/my-leave#/my-leave/calendar", + "url": "{{siteUrl}}/my-leave#!/my-leave/calendar", "onReadyScript": "ssp/my-leave/calendar-tooltip.js", "user": "civihr_staff" } diff --git a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-calendar.json b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-calendar.json index d8cc9f6242d..ec992ba55e2 100644 --- a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-calendar.json +++ b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-calendar.json @@ -2,7 +2,7 @@ "scenarios": [ { "label": "T&A / Calendar", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/calendar" + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/calendar" } ] } diff --git a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-documents.json b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-documents.json index 81c992bfaf4..bd9012d03be 100644 --- a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-documents.json +++ b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-documents.json @@ -2,37 +2,37 @@ "scenarios": [ { "label": "T&A / Documents", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/documents", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/documents", "onReadyScript": "documents/show.js" }, { "label": "T&A / Documents / Advanced Filters", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/documents", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/documents", "onReadyScript": "documents/advanced-filters.js" }, { "label": "T&A / Documents / Document / Add", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/documents", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/documents", "onReadyScript": "documents/document/add.js" }, { "label": "T&A / Documents / Document / Show All Fields", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/documents", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/documents", "onReadyScript": "documents/document/show-all-fields.js" }, { "label": "T&A / Documents / Document / Select Type", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/documents", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/documents", "onReadyScript": "documents/document/select-type.js" }, { "label": "T&A / Documents / Document / Select Assignee", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/documents", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/documents", "onReadyScript": "documents/document/select-assignee.js" }, { "label": "T&A / Documents / Document / Pick Due Date", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/documents", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/documents", "onReadyScript": "documents/document/pick-due-date.js" } ] diff --git a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-tasks.json b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-tasks.json index 5b81afb7900..686d40fdffb 100644 --- a/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-tasks.json +++ b/uk.co.compucorp.civicrm.hrcore/backstop_data/scenarios/ta-tasks.json @@ -2,102 +2,102 @@ "scenarios": [ { "label": "T&A / Tasks", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/task.js" }, { "label": "T&A / Tasks / Advanced Filters", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/advanced-filters.js" }, { "label": "T&A / Tasks / Select Dates", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/select-dates.js" }, { "label": "T&A / Tasks / Assignment / Add", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/assignment/add.js" }, { "label": "T&A / Tasks / Assignment / Select Type", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/assignment/select-type.js" }, { "label": "T&A / Tasks / Assignment / Add Task", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/assignment/add-task.js" }, { "label": "T&A / Tasks / Assignment / Add Document", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/assignment/add-document.js" }, { "label": "T&A / Tasks / Assignment / Pick Date", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/assignment/pick-date.js" }, { "label": "T&A / Tasks / Task / In Place Edit / Due Date", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/editable-date.js" }, { "label": "T&A / Tasks / Task / In Place Edit / Subject", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/editable-subject.js" }, { "label": "T&A / Tasks / Task / In Place Edit / Target", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/editable-target.js" }, { "label": "T&A / Tasks / Task / In Place Edit / Assigned To", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/editable-assigned.js" }, { "label": "T&A / Tasks / Task / Add", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/add.js" }, { "label": "T&A / Tasks / Task / Pick Date", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/pick-date.js" }, { "label": "T&A / Tasks / Task / Select Assignee", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/select-assignee.js" }, { "label": "T&A / Tasks / Task / Select Type", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/select-type.js" }, { "label": "T&A / Tasks / Task / Show All Fields", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/show-all-fields.js" }, { "label": "T&A / Tasks / Task / Show More", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/show-more.js" }, { "label": "T&A / Tasks / Task / Actions", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/actions.js" }, { "label": "T&A / Tasks / Task / Open", - "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#/tasks", + "url": "{{siteUrl}}/civicrm/tasksassignments/dashboard#!/tasks", "onReadyScript": "tasks/task/open.js" } ] From d3bd8a8704969d9c8011fcd033acb066193b4703 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Fri, 3 Aug 2018 10:59:08 +0200 Subject: [PATCH 127/151] PCHR-4098: Update selector for edit my details button --- .../backstop_data/page-objects/ssp-my-details.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uk.co.compucorp.civicrm.hrcore/backstop_data/page-objects/ssp-my-details.js b/uk.co.compucorp.civicrm.hrcore/backstop_data/page-objects/ssp-my-details.js index 3a0960b7ced..c95fe4dc777 100644 --- a/uk.co.compucorp.civicrm.hrcore/backstop_data/page-objects/ssp-my-details.js +++ b/uk.co.compucorp.civicrm.hrcore/backstop_data/page-objects/ssp-my-details.js @@ -6,7 +6,7 @@ module.exports = class SSPMyDetails extends SSP { * */ async showEditMyDetailsPopup () { - await this.puppet.click('[href="/my_details/nojs/view"]'); + await this.puppet.click('[href="/edit-my-personal-details/js/view"]'); await this.puppet.waitFor('.modal-civihr-custom__section', { visible: true }); } }; From 4cdd46a00b64b7697dd114d6b806b622328b460a Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Tue, 7 Aug 2018 16:54:01 +0200 Subject: [PATCH 128/151] PCHR-4098: Use backstopjs beta --- .../package-lock.json | 1980 ++++++++++------- uk.co.compucorp.civicrm.hrcore/package.json | 2 +- 2 files changed, 1233 insertions(+), 749 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/package-lock.json b/uk.co.compucorp.civicrm.hrcore/package-lock.json index 01183b8ea47..70785b2e470 100644 --- a/uk.co.compucorp.civicrm.hrcore/package-lock.json +++ b/uk.co.compucorp.civicrm.hrcore/package-lock.json @@ -16,9 +16,9 @@ "dev": true }, "@types/node": { - "version": "9.6.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.7.tgz", - "integrity": "sha512-MuUfEDBrQ/hb7KOqMiDeItAuRxlilQUgNRthTSCU4HgilH8UBh7wiHxWrv/lcyHyFZcREaODVVRNrAunphVwlg==", + "version": "9.6.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.25.tgz", + "integrity": "sha512-uZpzO9MKSHy7zBiTtziA3JgZP3upcAvLTASkKgheLj6/rNZmRX4UyvsFYaY2kbYcmmh8bNZ2T0eocBRCfZdGvQ==", "dev": true }, "@types/rimraf": { @@ -44,9 +44,9 @@ } }, "acorn": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", - "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", + "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", "dev": true }, "acorn-dynamic-import": { @@ -80,9 +80,9 @@ "dev": true }, "agent-base": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.0.tgz", - "integrity": "sha512-c+R/U5X+2zz2+UCrCFv6odQzJdoqI+YecuhnAJLa1zYaMc13zPfwMwZrr91Pd1DYNo/yPRbiM4WVf9whgwFsIg==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", "dev": true, "requires": { "es6-promisify": "^5.0.0" @@ -101,9 +101,9 @@ } }, "ajv-keywords": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.1.0.tgz", - "integrity": "sha1-rCsnk5xUPpXSwG5/f1wnvkqlQ74=", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", + "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", "dev": true }, "align-text": { @@ -247,23 +247,6 @@ "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" - }, - "dependencies": { - "buffer-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", - "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", - "dev": true - } - } - }, "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -473,6 +456,23 @@ "dev": true, "requires": { "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "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" + } + } } }, "assert-plus": { @@ -495,12 +495,12 @@ "optional": true }, "async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", - "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", "dev": true, "requires": { - "lodash": "^4.14.0" + "lodash": "^4.17.10" } }, "async-chain-proxy": { @@ -609,9 +609,9 @@ }, "dependencies": { "core-js": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", - "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=", + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", "dev": true } } @@ -627,9 +627,9 @@ }, "dependencies": { "core-js": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", - "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=", + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", "dev": true }, "regenerator-runtime": { @@ -673,9 +673,9 @@ } }, "backstopjs": { - "version": "3.2.15", - "resolved": "https://registry.npmjs.org/backstopjs/-/backstopjs-3.2.15.tgz", - "integrity": "sha512-VLpW9z8T3AbKsFIh3RcvV4Fuo0zFWTRzOpiincO9zheqlI6tXskZeHwotTc3dsBYbI1YSxMPyn8Ytam7eN07Dg==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/backstopjs/-/backstopjs-3.5.0.tgz", + "integrity": "sha512-WMvQQMKw6cylj1c8LIapmv2MornZyG14OLTMNvaaW1R98ixtlyx6K5k5076NZX1VKjI9ZN5vg+j169SYvFrfdA==", "dev": true, "requires": { "backstop-twentytwenty": "^1.0.4", @@ -689,14 +689,12 @@ "minimist": "^1.2.0", "node-resemble-js": "^0.2.0", "object-hash": "1.1.5", - "open": "0.0.5", + "opn": "^5.3.0", "os": "^0.1.1", "p-map": "^1.1.1", "path": "^0.12.7", "phantomjs-prebuilt": "^2.1.7", "puppeteer": "^1.2.0-next.1523485686787", - "react": "^15.6.1", - "react-dom": "^15.6.1", "react-modal": "^3.0.3", "react-redux": "^5.0.6", "react-sticky": "^6.0.1", @@ -712,8 +710,7 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", @@ -791,12 +788,6 @@ "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", "dev": true }, - "binaryextensions": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.1.1.tgz", - "integrity": "sha512-XBaoWE9RW8pPdPQNibZsW2zh8TW6gcarXp1FZPwT8Uop8ScSNldJEWf2k9l3HeTqdrEwsOsFcq74RiJECW34yA==", - "dev": true - }, "bitsyntax": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.0.4.tgz", @@ -927,7 +918,6 @@ "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" @@ -984,14 +974,23 @@ } }, "browserify-des": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.1.tgz", - "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", "dev": true, "requires": { "cipher-base": "^1.0.1", "des.js": "^1.0.0", - "inherits": "^2.0.1" + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "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 + } } }, "browserify-rsa": { @@ -1029,9 +1028,9 @@ } }, "buffer": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.1.0.tgz", - "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.0.tgz", + "integrity": "sha512-nUJyfChH7PMJy75eRDCCKtszSEFokUNXC1hNVSe+o+VdcgvDPLs20k3v8UXI8ruRYAJiYtyRea8mYyqPxoHWDw==", "dev": true, "requires": { "base64-js": "^1.0.2", @@ -1044,6 +1043,12 @@ "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=", "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 + }, "buffer-indexof": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", @@ -1191,23 +1196,24 @@ } }, "chokidar": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.3.tgz", - "integrity": "sha512-zW8iXYZtXMx4kux/nuZVXjkLP+CyIK5Al5FHnj1OgTKGZfp4Oy6/ymtMSKFv3GD8DviEmUPmJg9eFdJ/JzudMg==", + "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.1.2", + "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.0" + "upath": "^1.0.5" }, "dependencies": { "is-glob": { @@ -1238,9 +1244,9 @@ } }, "chrome-remote-interface": { - "version": "0.25.5", - "resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.25.5.tgz", - "integrity": "sha512-JACehSDwNwanDgWIO1Nvji9Td4KyCUUbQze10dNb8DAG72LmqH3uz7vdgujFKjmax8Q6yu1Xwapb8GODZykTDQ==", + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.25.7.tgz", + "integrity": "sha512-6zI6LbR2IiGmduFZededaerEr9hHXabxT/L+fRrdq65a0CfyLMzpq0BKuZiqN0Upqcacsb6q2POj7fmobwBsEA==", "dev": true, "requires": { "commander": "2.11.x", @@ -1410,8 +1416,7 @@ "dev": true, "requires": { "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" + "process-nextick-args": "^2.0.0" }, "dependencies": { "process-nextick-args": { @@ -1419,30 +1424,6 @@ "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" - } } } }, @@ -1549,41 +1530,57 @@ "dev": true }, "compressible": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.13.tgz", - "integrity": "sha1-DRAgq5JLL9tNYnmHXH1tq6a6p6k=", + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.14.tgz", + "integrity": "sha1-MmxfUH+7BV9UEWeCuWmoG2einac=", "dev": true, "requires": { - "mime-db": ">= 1.33.0 < 2" + "mime-db": ">= 1.34.0 < 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 + } } }, "compression": { - "version": "1.7.2", - "resolved": "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz", - "integrity": "sha1-qv+81qr4VLROuygDU9WtFlH1mmk=", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.3.tgz", + "integrity": "sha512-HSjyBG5N1Nnz7tF2+O7A9XUhyjru71/fwgNb7oIsEVHR0WShfs2tIS/EySLgiTe98aOK18YDlMXpzjCXY/n9mg==", "dev": true, "requires": { - "accepts": "~1.3.4", + "accepts": "~1.3.5", "bytes": "3.0.0", - "compressible": "~2.0.13", + "compressible": "~2.0.14", "debug": "2.6.9", "on-headers": "~1.0.1", - "safe-buffer": "5.1.1", + "safe-buffer": "5.1.2", "vary": "~1.1.2" + }, + "dependencies": { + "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 + } } }, "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 + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "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" @@ -1663,12 +1660,6 @@ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "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 - }, "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", @@ -1706,13 +1697,12 @@ "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 + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "create-ecdh": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.1.tgz", - "integrity": "sha512-iZvCCg8XqHQZ1ioNBTzXS/cQSkqkqcPs8xSX4upNB+DAk9Ht3uzQf2J32uAHNCne8LDmKr29AgZrEs4oIrwLuQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", "dev": true, "requires": { "bn.js": "^4.1.0", @@ -1821,9 +1811,9 @@ "dev": true }, "css-to-react-native": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-2.1.2.tgz", - "integrity": "sha512-akxvxNPNm+Qb7kGswgWhD8rLENM8857NVIn1lX0Dr9BQuju8vx6ypet7KvwvqBC01FUEne5V/jvt7FJXWJPtgw==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-2.2.1.tgz", + "integrity": "sha512-v++LRcf633phJiYZBDqtmGPj3+BVof0isd2jgwYLWZJ5YSuhCkrfYtDsNhM6oJthiEco0f9tDVJ1vUkDJNgGEA==", "dev": true, "requires": { "css-color-keywords": "^1.0.0", @@ -1996,9 +1986,9 @@ }, "dependencies": { "object-keys": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", - "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", "dev": true } } @@ -2174,8 +2164,39 @@ "requires": { "end-of-stream": "^1.0.0", "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" + "readable-stream": "^2.0.0" + }, + "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 + }, + "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": { @@ -2198,12 +2219,6 @@ "jsbn": "~0.1.0" } }, - "editions": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz", - "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==", - "dev": true - }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -2253,6 +2268,17 @@ "dev": true, "requires": { "once": "^1.4.0" + }, + "dependencies": { + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + } } }, "engine.io": { @@ -2369,9 +2395,9 @@ } }, "es-abstract": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.11.0.tgz", - "integrity": "sha512-ZnQrE/lXTTQ39ulXZ+J1DTFazV9qBy61x2bY071B+qGco8Z8q1QddsLdt/EF8Ai9hcWH72dWS0kFqXLxOxqslA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", "dev": true, "requires": { "es-to-primitive": "^1.1.1", @@ -2393,9 +2419,9 @@ } }, "es5-ext": { - "version": "0.10.42", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.42.tgz", - "integrity": "sha512-AJxO1rmPe1bDEfSR6TJ/FgMFYuTBhR5R57KW58iCkYACMyFbrkqVyzXSurYoScDGvgyMpk7uRF/lPUPPTmsRSA==", + "version": "0.10.45", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.45.tgz", + "integrity": "sha512-FkfM6Vxxfmztilbxxz5UKSD4ICMf5tSpRFtDNtkAhOxZ0EKtX6qwmXNyH/sFyIbX2P/nU5AMiA9jilWsUGJzCQ==", "dev": true, "requires": { "es6-iterator": "~2.0.3", @@ -2917,32 +2943,15 @@ } }, "extract-zip": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz", - "integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=", + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", "dev": true, "requires": { - "concat-stream": "1.6.0", + "concat-stream": "1.6.2", "debug": "2.6.9", - "mkdirp": "0.5.0", + "mkdirp": "0.5.1", "yauzl": "2.4.1" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", - "integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - } } }, "extsprintf": { @@ -2991,9 +3000,9 @@ } }, "fbjs": { - "version": "0.8.16", - "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz", - "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", + "version": "0.8.17", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.17.tgz", + "integrity": "sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90=", "dev": true, "requires": { "core-js": "^1.0.0", @@ -3002,7 +3011,7 @@ "object-assign": "^4.1.0", "promise": "^7.1.1", "setimmediate": "^1.0.5", - "ua-parser-js": "^0.7.9" + "ua-parser-js": "^0.7.18" }, "dependencies": { "object-assign": { @@ -3080,8 +3089,7 @@ "find-index": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", - "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=", - "dev": true + "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=" }, "find-up": { "version": "2.1.0", @@ -3120,8 +3128,7 @@ "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 + "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=" }, "flagged-respawn": { "version": "1.0.0", @@ -3129,16 +3136,6 @@ "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" - } - }, "follow-redirects": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz", @@ -3160,12 +3157,12 @@ } }, "for-each": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.2.tgz", - "integrity": "sha1-LEBFC5NI6X8oEyJZO6lnBLmr1NQ=", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dev": true, "requires": { - "is-function": "~1.0.0" + "is-callable": "^1.1.3" } }, "for-in": { @@ -3961,8 +3958,56 @@ "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", "dev": true, - "requires": { - "globule": "^1.0.0" + "dependencies": { + "glob": { + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "requires": { + "graceful-fs": "~1.2.0", + "inherits": "1", + "minimatch": "~0.2.11" + } + }, + "globule": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", + "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "requires": { + "glob": "~3.1.21", + "lodash": "~1.0.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=" + }, + "inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=" + }, + "lodash": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", + "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=" + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + } } }, "generate-function": { @@ -4108,60 +4153,168 @@ "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" - } - }, - "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": { - "async-done": "^1.2.0", - "chokidar": "^2.0.0", - "just-debounce": "^1.0.0", - "object.defaults": "^1.1.0" - } - }, - "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": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", - "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", - "dev": true, - "requires": { - "min-document": "^2.19.0", - "process": "~0.5.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", + "remove-trailing-separator": "^1.0.1" + }, + "dependencies": { + "glob": { + "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": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "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=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "requires": { + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + } + }, + "unique-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", + "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=" + } + } + }, + "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": { + "async-done": "^1.2.0", + "chokidar": "^2.0.0", + "object.defaults": "^1.1.0" + }, + "dependencies": { + "gaze": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", + "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "requires": { + "globule": "~0.1.0" + } + }, + "glob": { + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "requires": { + "graceful-fs": "~1.2.0", + "inherits": "1", + "minimatch": "~0.2.11" + } + }, + "globule": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", + "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "requires": { + "glob": "~3.1.21", + "lodash": "~1.0.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=" + }, + "inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=" + }, + "lodash": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", + "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=" + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + } + } + }, + "glob2base": { + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", + "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", + "requires": { + "find-index": "^0.1.1" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "dev": true, + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.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": { @@ -4199,17 +4352,6 @@ } } }, - "globule": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", - "integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==", - "dev": true, - "requires": { - "glob": "~7.1.1", - "lodash": "~4.17.10", - "minimatch": "~3.0.2" - } - }, "glogg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", @@ -4243,6 +4385,33 @@ "vinyl-fs": "^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 + }, + "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" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, "gulp-cli": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.0.1.tgz", @@ -4268,6 +4437,140 @@ "v8flags": "^3.0.1", "yargs": "^7.1.0" } + }, + "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": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "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-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" + } + }, + "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-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 + }, + "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" + } + }, + "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" + } + }, + "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" + } + }, + "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 + }, + "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" + } } } }, @@ -4333,6 +4636,26 @@ "arr-union": "^2.0.1", "extend-shallow": "^1.1.2" } + }, + "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" + } } } }, @@ -4392,6 +4715,20 @@ "xtend": "~2.1.1" } }, + "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" + } + }, "xtend": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", @@ -4455,6 +4792,25 @@ "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, + "lodash.template": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", + "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", + "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0" + } + }, "plugin-error": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", @@ -4482,9 +4838,29 @@ "integrity": "sha512-lgdmrFSI1SdhNMXZQbrC75MOl1UjYWlOWNbNRnz+F/KHmgxt3l6XstBoAYIdadwETFyG/6i+vWUSCawdC3pqOw==", "dev": true, "requires": { - "istextorbinary": "2.2.1", "readable-stream": "^2.0.1", "replacestream": "^4.0.0" + }, + "dependencies": { + "binaryextensions": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-1.0.1.tgz", + "integrity": "sha1-HmN0iLNbWL2l9HdL+WpSEqjJB1U=" + }, + "istextorbinary": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-1.0.2.tgz", + "integrity": "sha1-rOGTVNGpoBc+/rEITOD4ewrX3s8=", + "requires": { + "binaryextensions": "~1.0.0", + "textextensions": "~1.0.0" + } + }, + "textextensions": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-1.0.2.tgz", + "integrity": "sha1-ZUhjk+4fK7A5pgy7oFsLaL2VAdI=" + } } }, "gulp-sass": { @@ -4877,12 +5253,12 @@ } }, "has": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", - "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { - "function-bind": "^1.0.2" + "function-bind": "^1.1.1" } }, "has-ansi": { @@ -4978,13 +5354,13 @@ } }, "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", "dev": true, "requires": { "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" + "minimalistic-assert": "^1.0.1" } }, "hasha": { @@ -5038,9 +5414,9 @@ "dev": true }, "hoist-non-react-statics": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.0.tgz", - "integrity": "sha512-6Bl6XsDT1ntE0lHbIhr4Kp2PGcleGZ66qu5Jqk8lc0Xc/IeG6gVLmwUGs/K0Us+L8VWoKgj0uWdPMataOsm31w==", + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz", + "integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==", "dev": true }, "homedir-polyfill": { @@ -5095,9 +5471,9 @@ } }, "http-parser-js": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.12.tgz", - "integrity": "sha1-uc+/Sizybw/DSxDKFImid3HjR08=", + "version": "0.4.13", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz", + "integrity": "sha1-O9bW/ebjFyyTNMOzO2wZPYD+ETc=", "dev": true }, "http-proxy": { @@ -5300,18 +5676,18 @@ } }, "iconv-lite": { - "version": "0.4.21", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", - "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", + "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.0" + "safer-buffer": ">= 2.1.2 < 3" } }, "ieee754": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.11.tgz", - "integrity": "sha512-VhDzCKN7K8ufStx/CLj5/PDTMgph+qwN5Pkd5i0sGnVwk56zJ0lkT8Qzi1xqWLS0Wp29DgDtNeS7v8/wMoZeHg==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", "dev": true }, "import-local": { @@ -5353,7 +5729,6 @@ "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" @@ -5362,8 +5737,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", @@ -5590,9 +5964,9 @@ "dev": true }, "ipaddr.js": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", - "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=", "dev": true }, "is": { @@ -5651,9 +6025,9 @@ } }, "is-callable": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", - "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", "dev": true }, "is-data-descriptor": { @@ -5763,12 +6137,6 @@ "xtend": "^4.0.0" } }, - "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", @@ -5910,8 +6278,7 @@ "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" }, "is-valid-glob": { "version": "1.0.0", @@ -5971,17 +6338,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "istextorbinary": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-2.2.1.tgz", - "integrity": "sha512-TS+hoFl8Z5FAFMK38nhBkdLt44CclNRgDHWeMgsV8ko3nDlr/9UI2Sf839sW7enijf8oKsZYXRvM8g0it9Zmcw==", - "dev": true, - "requires": { - "binaryextensions": "2", - "editions": "^1.3.3", - "textextensions": "2" - } - }, "jasmine-core": { "version": "2.99.1", "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", @@ -6033,9 +6389,9 @@ "dev": true }, "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, "jsbn": { @@ -6180,12 +6536,6 @@ } } }, - "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 - }, "karma": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/karma/-/karma-2.0.2.tgz", @@ -6483,10 +6833,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", - "dev": true, - "requires": { - "flush-write-stream": "^1.0.2" - } + "dev": true }, "levn": { "version": "0.3.0", @@ -6639,31 +6986,18 @@ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, + "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.mergewith": { "version": "4.6.1", "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", "dev": true }, - "lodash.template": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", - "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", - "dev": true, - "requires": { - "lodash._reinterpolate": "~3.0.0", - "lodash.templatesettings": "^4.0.0" - } - }, - "lodash.templatesettings": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", - "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", - "dev": true, - "requires": { - "lodash._reinterpolate": "~3.0.0" - } - }, "log4js": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/log4js/-/log4js-2.5.3.tgz", @@ -6886,12 +7220,12 @@ "dev": true }, "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", "dev": true, "requires": { - "js-tokens": "^3.0.0" + "js-tokens": "^3.0.0 || ^4.0.0" } }, "loud-rejection": { @@ -7341,9 +7675,9 @@ } }, "node-forge": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.1.tgz", - "integrity": "sha1-naYR6giYL0uUIGs760zJZl8gwwA=", + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz", + "integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ==", "dev": true }, "node-gyp": { @@ -8214,17 +8548,10 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } }, - "open": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/open/-/open-0.0.5.tgz", - "integrity": "sha1-QsPhjslUZra/DcQvOilFw/DK2Pw=", - "dev": true - }, "opn": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/opn/-/opn-5.3.0.tgz", @@ -8276,34 +8603,13 @@ } } }, - "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": { - "readable-stream": "^2.0.1" - } - }, "original": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/original/-/original-1.0.0.tgz", - "integrity": "sha1-kUf5P6FpbQS+YeAb1QuurKZWvTs=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/original/-/original-1.0.1.tgz", + "integrity": "sha512-IEvtB5vM5ULvwnqMxWBLxkS13JIEXbakizMSo3yoPNPCIWzg8TG3Usn/UhXoZFM/m+FuEA20KdzPSFq/0rS+UA==", "dev": true, "requires": { - "url-parse": "1.0.x" - }, - "dependencies": { - "url-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.0.5.tgz", - "integrity": "sha1-CFSGBCKv3P7+tsllxmLUgAFpkns=", - "dev": true, - "requires": { - "querystringify": "0.0.x", - "requires-port": "1.0.x" - } - } + "url-parse": "~1.4.0" } }, "os": { @@ -8358,9 +8664,9 @@ "dev": true }, "p-limit": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", - "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", "dev": true, "requires": { "p-try": "^1.0.0" @@ -8657,9 +8963,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-proxy": { @@ -8927,12 +9233,11 @@ "dev": true }, "prop-types": { - "version": "15.6.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.1.tgz", - "integrity": "sha512-4ec7bY1Y66LymSUOH/zARVYObB23AT2h8cf6e/O6ZALB/N0sqZFEx7rq6EYPX2MkOdKORuooI/H5k9TlR4q7kQ==", + "version": "15.6.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", + "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==", "dev": true, "requires": { - "fbjs": "^0.8.16", "loose-envify": "^1.3.1", "object-assign": "^4.1.1" }, @@ -8946,13 +9251,13 @@ } }, "proxy-addr": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", - "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", "dev": true, "requires": { "forwarded": "~0.1.2", - "ipaddr.js": "1.6.0" + "ipaddr.js": "1.8.0" } }, "proxy-agent": { @@ -9068,26 +9373,50 @@ "dev": true }, "puppeteer": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0.tgz", - "integrity": "sha512-wx10aPQPpGJVxdB6yoDSLm9p4rCwARUSLMVV0bx++owuqkvviXKyiFM3EWsywaFmjOKNPXacIjplF7xhHiFP3w==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2.tgz", + "integrity": "sha512-KBgMr/ZdwIwDQWTqcAlGhnQ2Vd6p+o5B89H60XUfdmCpia2KViSZsdRjvrf2wYOxXSrpYx6OuCBzV7ppLuNjNg==", "dev": true, "requires": { - "debug": "^2.6.8", - "extract-zip": "^1.6.5", - "https-proxy-agent": "^2.1.0", - "mime": "^1.3.4", + "debug": "^3.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^2.2.1", + "mime": "^2.0.3", "progress": "^2.0.0", "proxy-from-env": "^1.0.0", "rimraf": "^2.6.1", - "ws": "^3.0.0" + "ws": "^5.1.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" + } + }, + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + }, "progress": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", "dev": true + }, + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } } } }, @@ -9123,9 +9452,9 @@ "dev": true }, "querystringify": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-0.0.4.tgz", - "integrity": "sha1-DPf4T5Rj/wrlHExLFC2VvjdyTZw=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", + "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==", "dev": true }, "quick-lru": { @@ -9254,36 +9583,16 @@ } } }, - "react-dom": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-15.6.2.tgz", - "integrity": "sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=", - "dev": true, - "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.0", - "prop-types": "^15.5.10" - }, - "dependencies": { - "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 - } - } - }, "react-lifecycles-compat": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.2.tgz", - "integrity": "sha512-pbZOSMVVkvppW7XRn9fcHK5OgEDnYLwMva7P6TgS44/SN9uGGjfh3Z1c8tomO+y4IsHQ6Fsz2EGwmE7sMeNZgQ==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==", "dev": true }, "react-modal": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.4.4.tgz", - "integrity": "sha512-5VYNvy301Z0xxGBQhPmDdzOcyEkUG8sU7bpRsAPI4OHgEUkbBFrpjzs/ocNI0m824/lOqTxddXzwgmDJXx3s3Q==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.5.1.tgz", + "integrity": "sha512-GxL7ycOgKC+p641cR+V1bw5dC1faL2N86/AJlzbMVmvt1totoylgkJmn9zvLuHeuarGbB7CLfHMGpeRowaj2jQ==", "dev": true, "requires": { "exenv": "^1.2.0", @@ -9326,9 +9635,9 @@ } }, "react-sticky": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/react-sticky/-/react-sticky-6.0.2.tgz", - "integrity": "sha512-eXsij6ifE2k1d6eCwQzil0JRS3VLP6BYfiF7qEbVPL3GLqciedGJfbavpXx5T95x5HvhuAA4FChYEDv83r1NyQ==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/react-sticky/-/react-sticky-6.0.3.tgz", + "integrity": "sha512-LNH4UJlRatOqo29/VHxDZOf6fwbgfgcHO4mkEFvrie5FuaZCSTGtug5R8NGqJ0kSnX8gHw8qZN37FcvnFBJpTQ==", "dev": true, "requires": { "prop-types": "^15.5.8", @@ -9554,6 +9863,14 @@ "escape-string-regexp": "^1.0.3", "object-assign": "^4.0.1", "readable-stream": "^2.0.2" + }, + "dependencies": { + "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 + } } }, "request": { @@ -9737,6 +10054,169 @@ "lodash": "^4.0.0", "scss-tokenizer": "^0.2.3", "yargs": "^7.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 + }, + "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" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "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": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "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-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" + } + }, + "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-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 + }, + "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" + } + }, + "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" + } + }, + "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" + } + }, + "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 + }, + "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" + } + } } }, "sax": { @@ -9773,12 +10253,12 @@ "dev": true }, "selfsigned": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.2.tgz", - "integrity": "sha1-tESVgNmZKbZbEKSDiTAaZZIIh1g=", + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.3.tgz", + "integrity": "sha512-vmZenZ+8Al3NLHkWnhBQ0x6BkML1eCP2xEi3JE+f3D9wW9fipD9NNJHYtE9XJM4TsPaHGZJIamrSI6MTg1dU2Q==", "dev": true, "requires": { - "node-forge": "0.7.1" + "node-forge": "0.7.5" } }, "semver": { @@ -9931,8 +10411,7 @@ "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", - "dev": true + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" }, "signal-exit": { "version": "3.0.2", @@ -10505,24 +10984,50 @@ "dev": true }, "stream-http": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.1.tgz", - "integrity": "sha512-cQ0jo17BLca2r0GfRdZKYAGLU6JRoIWxqSOakUMuKOT6MOK7AAlE856L33QuDmAy/eeOrhLee3dZKX0Uadu93A==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", "dev": true, "requires": { "builtin-status-codes": "^3.0.0", "inherits": "^2.0.1", - "readable-stream": "^2.3.3", + "readable-stream": "^2.3.6", "to-arraybuffer": "^1.0.0", "xtend": "^4.0.0" + }, + "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 + }, + "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" + } + } } }, - "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 - }, "stream-to": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stream-to/-/stream-to-0.2.2.tgz", @@ -10646,9 +11151,9 @@ "dev": true }, "styled-components": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-2.4.0.tgz", - "integrity": "sha512-bLW0/lQxTgJ0y+TEllctly+/B0Hz2N82e5AhubP+FIVPSisyOzyFnZzWdqRml7RDwRCsT+EGNN8YYa0VFutT+w==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-2.4.1.tgz", + "integrity": "sha1-ZjvQSF1LarRvlGIQ3APSOY0a3nQ=", "dev": true, "requires": { "buffer": "^5.0.3", @@ -10679,9 +11184,9 @@ } }, "stylis": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.0.tgz", - "integrity": "sha512-pP7yXN6dwMzAR29Q0mBrabPCe0/mNO1MSr93bhay+hcZondvMMTpeGyd8nbhYJdyperNT2DRxONQuUGcJr5iPw==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.3.tgz", + "integrity": "sha512-TxU0aAscJghF9I3V9q601xcK3Uw1JbXvpsBGj/HULqexKOKlOEzzlIpLFRbKkCK990ccuxfXUqmPbIIo7Fq/cQ==", "dev": true }, "supports-color": { @@ -10741,12 +11246,6 @@ } } }, - "textextensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-2.2.0.tgz", - "integrity": "sha512-j5EMxnryTvKxwH2Cq+Pb43tsf6sdEgw6Pdwxk83mPaq0ToeFJt6WE4J3s5BqY7vmjlLgkgXvhtXUxo80FyBhCA==", - "dev": true - }, "throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", @@ -10763,16 +11262,6 @@ "xtend": "~4.0.1" } }, - "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": { - "through2": "~2.0.0", - "xtend": "~4.0.0" - } - }, "thunkify": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/thunkify/-/thunkify-2.1.2.tgz", @@ -10823,16 +11312,6 @@ "os-tmpdir": "~1.0.2" } }, - "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-array": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", @@ -11069,9 +11548,9 @@ "dev": true }, "ua-parser-js": { - "version": "0.7.17", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz", - "integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==", + "version": "0.7.18", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.18.tgz", + "integrity": "sha512-LtzwHlVHwFGTptfNSgezHp7WUlwiqb0gA9AALRbKaERfxwJoiX0A73QbTToxteIAuIaFshhgIZfqK8s7clqgnA==", "dev": true }, "uglify-js": { @@ -11190,16 +11669,6 @@ } } }, - "unique-stream": { - "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" - } - }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -11247,24 +11716,24 @@ } }, "upath": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.0.4.tgz", - "integrity": "sha512-d4SJySNBXDaQp+DPrziv3xGS6w3d2Xt69FijJr86zMPBy23JEloMCEOUBBzuN7xCtjLCnmB9tI/z7SBCahHBOw==", + "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 }, "uri-js": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-3.0.2.tgz", - "integrity": "sha1-+QuFhQf4HepNz7s8TD2/orVX+qo=", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", "dev": true, "requires": { "punycode": "^2.1.0" }, "dependencies": { "punycode": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true } } @@ -11294,21 +11763,13 @@ } }, "url-parse": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.0.tgz", - "integrity": "sha512-ERuGxDiQ6Xw/agN4tuoCRbmwRuZP0cJ1lJxJubXr5Q/5cDa78+Dc4wfvtxzhzhkm5VvmW6Mf8EVj9SPGN4l8Lg==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", + "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", "dev": true, "requires": { "querystringify": "^2.0.0", "requires-port": "^1.0.0" - }, - "dependencies": { - "querystringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", - "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==", - "dev": true - } } }, "url-regex": { @@ -11418,20 +11879,12 @@ } }, "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", "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 - } + "inherits": "2.0.3" } }, "util-deprecate": { @@ -11507,12 +11960,26 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "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" + "remove-trailing-separator": "^1.0.1" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=" + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=" + } } }, "vinyl-fs": { @@ -11546,13 +12013,181 @@ "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" + }, + "dependencies": { + "gaze": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", + "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "requires": { + "globule": "~0.1.0" + } + }, + "glob": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", + "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", + "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=", + "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" + } + }, + "glob-watcher": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", + "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", + "requires": { + "gaze": "^0.5.1" + } + }, + "globule": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", + "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "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=", + "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=" + }, + "inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=" + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + } + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "lodash": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", + "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=" + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" + }, + "minimatch": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", + "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "requires": { + "brace-expansion": "^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=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "strip-bom": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", + "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", + "requires": { + "first-chunk-stream": "^1.0.0", + "is-utf8": "^0.2.0" + } + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "requires": { + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + } + }, + "unique-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", + "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=" + }, + "vinyl": { + "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": "^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-sourcemaps-apply": { @@ -11609,9 +12244,9 @@ } }, "webpack": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.11.0.tgz", - "integrity": "sha512-3kOFejWqj5ISpJk4Qj/V7w98h9Vl52wak3CLiw/cDOfbVTq7FeoZ0SdoHHY9PYlHr50ZS42OfvzE2vB4nncKQg==", + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.12.0.tgz", + "integrity": "sha512-Sw7MdIIOv/nkzPzee4o0EdvCuPmxT98+vVpIvwtcwcF1Q4SDSNp92vwcKc4REe7NItH9f1S4ra9FuQ7yuYZ8bQ==", "dev": true, "requires": { "acorn": "^5.0.0", @@ -11639,40 +12274,22 @@ }, "dependencies": { "ajv": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz", - "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.2.tgz", + "integrity": "sha512-hOs7GfvI6tUI1LfZddH82ky6mOMyTuY0mk7kE2pWpmhhUSkumzaTO5vbVwij39MdwPQWCV4Zv57Eo06NtL/GVA==", "dev": true, "requires": { - "fast-deep-equal": "^1.0.0", + "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0", - "uri-js": "^3.0.2" + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.1" } }, - "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" - }, - "dependencies": { - "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" - } - } - } + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true }, "has-flag": { "version": "2.0.0", @@ -11680,63 +12297,12 @@ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - } - }, - "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" - } - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - } - }, "supports-color": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", @@ -11745,36 +12311,6 @@ "requires": { "has-flag": "^2.0.0" } - }, - "yargs": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", - "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "read-pkg-up": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^7.0.0" - } - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } } } }, @@ -11792,9 +12328,9 @@ }, "dependencies": { "time-stamp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.0.tgz", - "integrity": "sha1-lcakRTDhW6jW9KPsuMOj+sRto1c=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.1.tgz", + "integrity": "sha512-KUnkvOWC3C+pEbwE/0u3CcmNpGCDqkYGYZOphe1QFxApYQkJ5g195TDBjgZch/zG6chU1NcabLwnM7BCpWAzTQ==", "dev": true } } @@ -12130,8 +12666,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { "version": "3.3.3", @@ -12145,9 +12680,9 @@ } }, "xhr": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.4.1.tgz", - "integrity": "sha512-pAIU5vBr9Hiy5cpFIbPnwf0C18ZF86DBsZKrlsf87N5De/JbA6RJ83UP/cv+aljl4S40iRVMqP4pr4sF9Dnj0A==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", "dev": true, "requires": { "global": "~4.3.0", @@ -12200,8 +12735,7 @@ "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" }, "y18n": { "version": "3.2.1", @@ -12216,32 +12750,26 @@ "dev": true }, "yargs": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", - "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", "dev": true, "requires": { - "camelcase": "^3.0.0", + "camelcase": "^4.1.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", + "os-locale": "^2.0.0", + "read-pkg-up": "^2.0.0", "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", + "string-width": "^2.0.0", + "which-module": "^2.0.0", "y18n": "^3.2.1", - "yargs-parser": "^5.0.0" + "yargs-parser": "^7.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 - }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -12251,38 +12779,31 @@ "string-width": "^1.0.1", "strip-ansi": "^3.0.1", "wrap-ansi": "^2.0.0" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "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" + } + } } }, "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=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "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" + "strip-bom": "^3.0.0" } }, "parse-json": { @@ -12294,24 +12815,13 @@ "error-ex": "^1.2.0" } }, - "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-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "pify": "^2.0.0" } }, "pify": { @@ -12321,67 +12831,41 @@ "dev": true }, "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", "dev": true, "requires": { - "load-json-file": "^1.0.0", + "load-json-file": "^2.0.0", "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" + "path-type": "^2.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" - } - }, - "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" - } - }, - "strip-bom": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true, "requires": { - "is-utf8": "^0.2.0" + "find-up": "^2.0.0", + "read-pkg": "^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 - }, "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=", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", "dev": true, "requires": { - "camelcase": "^3.0.0" + "camelcase": "^4.1.0" } } } }, "yargs-parser": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.0.0.tgz", - "integrity": "sha512-+DHejWujTVYeMHLff8U96rLc4uE4Emncoftvn5AjhB1Jw1pWxLzgBUT/WYbPrHmy6YPEBTZQx5myHhVcuuu64g==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", "dev": true, "requires": { "camelcase": "^4.1.0" diff --git a/uk.co.compucorp.civicrm.hrcore/package.json b/uk.co.compucorp.civicrm.hrcore/package.json index f2d459b684a..25659657f1d 100644 --- a/uk.co.compucorp.civicrm.hrcore/package.json +++ b/uk.co.compucorp.civicrm.hrcore/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "ansi-colors": "^1.1.0", - "backstopjs": "^3.2.15", + "backstopjs": "^3.5.0", "civicrm-scssroot": "git://github.com/totten/civicrm-scssroot.git#v0.1.1", "detect-installed": "^2.0.4", "es6-promise": "^4.2.4", From af28150febce740f8ef286ed329d46cca8fded7a Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 8 Aug 2018 10:27:00 +0200 Subject: [PATCH 129/151] PCHR-4105: Fix linter issue --- hrjobcontract/scss/civihr/modules/_unset.scss | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/hrjobcontract/scss/civihr/modules/_unset.scss b/hrjobcontract/scss/civihr/modules/_unset.scss index e67f3a2a0e1..28934a54ede 100755 --- a/hrjobcontract/scss/civihr/modules/_unset.scss +++ b/hrjobcontract/scss/civihr/modules/_unset.scss @@ -70,27 +70,31 @@ tr, th, td { background: initial; + border: initial; margin: initial; padding: initial; - border: initial; vertical-align: 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 +102,7 @@ q:after { ins { text-decoration: initial; } + del { text-decoration: initial; } @@ -107,9 +112,10 @@ table { border-collapse: initial; border-spacing: initial; - td, th { - color: inherit; - font-size: inherit; + td, + th { + color: inherit; + font-size: inherit; } } @@ -125,7 +131,8 @@ select, textarea { font-family: initial; } + textarea { font-size: initial; line-height: initial; -} \ No newline at end of file +} From 774f91c0367f348cc1fa13702a6b11244ce5811d Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 8 Aug 2018 10:31:43 +0200 Subject: [PATCH 130/151] PCHR-4105: Add reset styles for h3 --- hrjobcontract/css/hrjc.css | 27 +++++++++++++------ hrjobcontract/scss/civihr/modules/_unset.scss | 9 +++++++ 2 files changed, 28 insertions(+), 8 deletions(-) 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/scss/civihr/modules/_unset.scss b/hrjobcontract/scss/civihr/modules/_unset.scss index 28934a54ede..7051be27bd0 100755 --- a/hrjobcontract/scss/civihr/modules/_unset.scss +++ b/hrjobcontract/scss/civihr/modules/_unset.scss @@ -76,6 +76,15 @@ td { vertical-align: initial; } +h3 { + border: 0; + border: initial; + border-radius: 0; + border-radius: initial; + box-shadow: none; + box-shadow: initial; +} + ol, ul { list-style: initial; From 4a6639ed670e2f8b7265102b62f002a6c78419f5 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 8 Aug 2018 13:37:20 +0200 Subject: [PATCH 131/151] PCHR-4098: Use standard 3.5.2 version --- .../package-lock.json | 399 ++++++++++-------- uk.co.compucorp.civicrm.hrcore/package.json | 2 +- 2 files changed, 226 insertions(+), 175 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/package-lock.json b/uk.co.compucorp.civicrm.hrcore/package-lock.json index 70785b2e470..28a447ceee0 100644 --- a/uk.co.compucorp.civicrm.hrcore/package-lock.json +++ b/uk.co.compucorp.civicrm.hrcore/package-lock.json @@ -16,9 +16,9 @@ "dev": true }, "@types/node": { - "version": "9.6.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.25.tgz", - "integrity": "sha512-uZpzO9MKSHy7zBiTtziA3JgZP3upcAvLTASkKgheLj6/rNZmRX4UyvsFYaY2kbYcmmh8bNZ2T0eocBRCfZdGvQ==", + "version": "9.6.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.26.tgz", + "integrity": "sha512-3LKKscYUZdZreOuvnly8oWsCA1TOWtmkV3mbcUnV34f+nqDWJic+4SGjRi1C/sPHnZcSs/x209O+Dgy8aWHt2A==", "dev": true }, "@types/rimraf": { @@ -247,6 +247,23 @@ "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" + }, + "dependencies": { + "buffer-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", + "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", + "dev": true + } + } + }, "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -673,9 +690,9 @@ } }, "backstopjs": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/backstopjs/-/backstopjs-3.5.0.tgz", - "integrity": "sha512-WMvQQMKw6cylj1c8LIapmv2MornZyG14OLTMNvaaW1R98ixtlyx6K5k5076NZX1VKjI9ZN5vg+j169SYvFrfdA==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/backstopjs/-/backstopjs-3.5.2.tgz", + "integrity": "sha512-2QqAbbQerk4T/M+a+YBxAPJnkZbl9nfXUuSVlzu2mAfW0Uq+gp9NYzsIUsfLjy2vISPJwBBa5ANnVMz86QcgwQ==", "dev": true, "requires": { "backstop-twentytwenty": "^1.0.4", @@ -788,6 +805,12 @@ "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", "dev": true }, + "binaryextensions": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.1.1.tgz", + "integrity": "sha512-XBaoWE9RW8pPdPQNibZsW2zh8TW6gcarXp1FZPwT8Uop8ScSNldJEWf2k9l3HeTqdrEwsOsFcq74RiJECW34yA==", + "dev": true + }, "bitsyntax": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.0.4.tgz", @@ -1416,7 +1439,8 @@ "dev": true, "requires": { "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0" + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" }, "dependencies": { "process-nextick-args": { @@ -1424,6 +1448,30 @@ "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" + } } } }, @@ -1660,6 +1708,12 @@ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "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 + }, "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", @@ -1745,14 +1799,6 @@ "fbjs": "^0.8.9", "loose-envify": "^1.3.1", "object-assign": "^4.1.1" - }, - "dependencies": { - "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 - } } }, "cross-spawn": { @@ -2164,7 +2210,8 @@ "requires": { "end-of-stream": "^1.0.0", "inherits": "^2.0.1", - "readable-stream": "^2.0.0" + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" }, "dependencies": { "process-nextick-args": { @@ -2219,6 +2266,12 @@ "jsbn": "~0.1.0" } }, + "editions": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz", + "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==", + "dev": true + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -2360,14 +2413,6 @@ "memory-fs": "^0.4.0", "object-assign": "^4.0.1", "tapable": "^0.2.7" - }, - "dependencies": { - "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 - } } }, "ent": { @@ -3012,14 +3057,6 @@ "promise": "^7.1.1", "setimmediate": "^1.0.5", "ua-parser-js": "^0.7.18" - }, - "dependencies": { - "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 - } } }, "fd-slicer": { @@ -3136,6 +3173,16 @@ "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" + } + }, "follow-redirects": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz", @@ -3958,56 +4005,8 @@ "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", "dev": true, - "dependencies": { - "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", - "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" - } - }, - "globule": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", - "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", - "requires": { - "glob": "~3.1.21", - "lodash": "~1.0.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=" - }, - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=" - }, - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=" - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } + "requires": { + "globule": "^1.0.0" } }, "generate-function": { @@ -4153,8 +4152,13 @@ "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", - "remove-trailing-separator": "^1.0.1" + "readable-stream": "^2.1.5", + "remove-trailing-separator": "^1.0.1", + "to-absolute-glob": "^2.0.0", + "unique-stream": "^2.0.2" }, "dependencies": { "glob": { @@ -4171,45 +4175,43 @@ "path-is-absolute": "^1.0.0" } }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "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=" + "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" } }, "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + "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" + } }, "through2": { "version": "0.6.5", "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", "xtend": ">=4.0.0 <4.1.0-0" } - }, - "unique-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", - "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=" } } }, @@ -4221,6 +4223,7 @@ "requires": { "async-done": "^1.2.0", "chokidar": "^2.0.0", + "just-debounce": "^1.0.0", "object.defaults": "^1.1.0" }, "dependencies": { @@ -4338,12 +4341,6 @@ "pinkie-promise": "^2.0.0" }, "dependencies": { - "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 - }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -4352,6 +4349,17 @@ } } }, + "globule": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", + "integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==", + "dev": true, + "requires": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + } + }, "glogg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", @@ -4838,29 +4846,9 @@ "integrity": "sha512-lgdmrFSI1SdhNMXZQbrC75MOl1UjYWlOWNbNRnz+F/KHmgxt3l6XstBoAYIdadwETFyG/6i+vWUSCawdC3pqOw==", "dev": true, "requires": { + "istextorbinary": "2.2.1", "readable-stream": "^2.0.1", "replacestream": "^4.0.0" - }, - "dependencies": { - "binaryextensions": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-1.0.1.tgz", - "integrity": "sha1-HmN0iLNbWL2l9HdL+WpSEqjJB1U=" - }, - "istextorbinary": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-1.0.2.tgz", - "integrity": "sha1-rOGTVNGpoBc+/rEITOD4ewrX3s8=", - "requires": { - "binaryextensions": "~1.0.0", - "textextensions": "~1.0.0" - } - }, - "textextensions": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-1.0.2.tgz", - "integrity": "sha1-ZUhjk+4fK7A5pgy7oFsLaL2VAdI=" - } } }, "gulp-sass": { @@ -5832,12 +5820,6 @@ "trim-newlines": "^1.0.0" } }, - "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 - }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", @@ -6137,6 +6119,12 @@ "xtend": "^4.0.0" } }, + "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", @@ -6338,6 +6326,17 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, + "istextorbinary": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-2.2.1.tgz", + "integrity": "sha512-TS+hoFl8Z5FAFMK38nhBkdLt44CclNRgDHWeMgsV8ko3nDlr/9UI2Sf839sW7enijf8oKsZYXRvM8g0it9Zmcw==", + "dev": true, + "requires": { + "binaryextensions": "2", + "editions": "^1.3.3", + "textextensions": "2" + } + }, "jasmine-core": { "version": "2.99.1", "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", @@ -6536,6 +6535,12 @@ } } }, + "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 + }, "karma": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/karma/-/karma-2.0.2.tgz", @@ -6833,7 +6838,10 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", - "dev": true + "dev": true, + "requires": { + "flush-write-stream": "^1.0.2" + } }, "levn": { "version": "0.3.0", @@ -8603,13 +8611,22 @@ } } }, - "original": { + "ordered-read-streams": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/original/-/original-1.0.1.tgz", - "integrity": "sha512-IEvtB5vM5ULvwnqMxWBLxkS13JIEXbakizMSo3yoPNPCIWzg8TG3Usn/UhXoZFM/m+FuEA20KdzPSFq/0rS+UA==", + "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", + "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", "dev": true, "requires": { - "url-parse": "~1.4.0" + "readable-stream": "^2.0.1" + } + }, + "original": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz", + "integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==", + "dev": true, + "requires": { + "url-parse": "^1.4.3" } }, "os": { @@ -9151,9 +9168,9 @@ "dev": true }, "portfinder": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.13.tgz", - "integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=", + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.16.tgz", + "integrity": "sha512-icBXCFQxzlK2PMepOM0QeEdPPFSLAaXXeuKOv5AClJlMy1oVCBrkDGJ12IZYesI/BF8mpeVco3vRCmgeBb4+hw==", "dev": true, "requires": { "async": "^1.5.2", @@ -9240,14 +9257,6 @@ "requires": { "loose-envify": "^1.3.1", "object-assign": "^4.1.1" - }, - "dependencies": { - "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 - } } }, "proxy-addr": { @@ -9573,14 +9582,6 @@ "loose-envify": "^1.1.0", "object-assign": "^4.1.0", "prop-types": "^15.5.10" - }, - "dependencies": { - "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 - } } }, "react-lifecycles-compat": { @@ -11028,6 +11029,12 @@ } } }, + "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 + }, "stream-to": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stream-to/-/stream-to-0.2.2.tgz", @@ -11246,6 +11253,12 @@ } } }, + "textextensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-2.2.0.tgz", + "integrity": "sha512-j5EMxnryTvKxwH2Cq+Pb43tsf6sdEgw6Pdwxk83mPaq0ToeFJt6WE4J3s5BqY7vmjlLgkgXvhtXUxo80FyBhCA==", + "dev": true + }, "throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", @@ -11262,6 +11275,16 @@ "xtend": "~4.0.1" } }, + "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": { + "through2": "~2.0.0", + "xtend": "~4.0.0" + } + }, "thunkify": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/thunkify/-/thunkify-2.1.2.tgz", @@ -11312,6 +11335,16 @@ "os-tmpdir": "~1.0.2" } }, + "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-array": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", @@ -11669,6 +11702,16 @@ } } }, + "unique-stream": { + "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" + } + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -11960,25 +12003,31 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "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" + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" }, "dependencies": { "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "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=" + "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": "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 } } }, @@ -12013,6 +12062,8 @@ "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", diff --git a/uk.co.compucorp.civicrm.hrcore/package.json b/uk.co.compucorp.civicrm.hrcore/package.json index 25659657f1d..ea96d763584 100644 --- a/uk.co.compucorp.civicrm.hrcore/package.json +++ b/uk.co.compucorp.civicrm.hrcore/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "ansi-colors": "^1.1.0", - "backstopjs": "^3.5.0", + "backstopjs": "^3.5.2", "civicrm-scssroot": "git://github.com/totten/civicrm-scssroot.git#v0.1.1", "detect-installed": "^2.0.4", "es6-promise": "^4.2.4", From 9164976c83c09e924705dc5dc27c279684cd7bdb Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Mon, 13 Aug 2018 12:58:06 +0100 Subject: [PATCH 132/151] PCHR-4072: Update help link to lead to freshdesk knowledge base home page --- uk.co.compucorp.civicrm.hrcore/hrcore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uk.co.compucorp.civicrm.hrcore/hrcore.php b/uk.co.compucorp.civicrm.hrcore/hrcore.php index b455d9025e7..a00c0105d3d 100644 --- a/uk.co.compucorp.civicrm.hrcore/hrcore.php +++ b/uk.co.compucorp.civicrm.hrcore/hrcore.php @@ -507,7 +507,7 @@ function _hrcore_createHelpMenu(&$menu) { _hrcore_civix_insert_navigation_menu($menu, 'Help', [ 'name' => ts('User Guide'), - 'url' => 'http://civihr-documentation.readthedocs.io/en/latest/', + 'url' => 'https://sprt.freshdesk.com/support/home', 'target' => '_blank', 'permission' => 'access CiviCRM' ]); From 83e8fbcf4dc8f50af03f1da89f583a2b3c38112d Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Tue, 14 Aug 2018 09:25:39 +0100 Subject: [PATCH 133/151] PCHR-4072: Updated the link as stated in ticket description --- uk.co.compucorp.civicrm.hrcore/hrcore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uk.co.compucorp.civicrm.hrcore/hrcore.php b/uk.co.compucorp.civicrm.hrcore/hrcore.php index a00c0105d3d..f1575d1f1fc 100644 --- a/uk.co.compucorp.civicrm.hrcore/hrcore.php +++ b/uk.co.compucorp.civicrm.hrcore/hrcore.php @@ -507,7 +507,7 @@ function _hrcore_createHelpMenu(&$menu) { _hrcore_civix_insert_navigation_menu($menu, 'Help', [ 'name' => ts('User Guide'), - 'url' => 'https://sprt.freshdesk.com/support/home', + 'url' => 'http://userguide.civihr.org/en/latest/', 'target' => '_blank', 'permission' => 'access CiviCRM' ]); From 11ecf680a103506a698f40b1a484d8d9d6e9c2b1 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 14 Aug 2018 16:46:27 +0100 Subject: [PATCH 134/151] PCHR-4110: Fix calendar feeds leave requests inclusion logic --- .../Service/LeaveRequestCalendarFeedData.php | 4 +- .../LeaveRequestCalendarFeedDataTest.php | 86 +++++++++++-------- 2 files changed, 52 insertions(+), 38 deletions(-) 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/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) { From dfefd132b2d3462e6fa9d0233b93b895e23cbfd3 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 15 Aug 2018 16:44:44 +0200 Subject: [PATCH 135/151] PCHR-4046: (root) Auto fixes with npm audit fix --- package-lock.json | 58 ++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index 59d508afa9b..11ec5ffca9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1195,14 +1195,14 @@ "dev": true }, "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" } @@ -2364,6 +2364,12 @@ "integrity": "sha1-Sz3ToTPRUYuO8NvHCb8qG0gkvIw=", "dev": true }, + "math-random": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", + "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", + "dev": true + }, "mathml-tag-names": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.0.1.tgz", @@ -3250,43 +3256,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 } } }, From 60c08216302f8460da55f587cad87cbf4f5827b5 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Wed, 15 Aug 2018 16:46:43 +0200 Subject: [PATCH 136/151] PCHR-4046: Remove unused package.json for hrui --- hrui/package-lock.json | 2825 ---------------------------------------- hrui/package.json | 19 - 2 files changed, 2844 deletions(-) delete mode 100644 hrui/package-lock.json delete mode 100644 hrui/package.json 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" - } -} From d6e60e608c694c129d98a1778bf32f81d64beddd Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 12:18:00 +0200 Subject: [PATCH 137/151] PCHR-4046: Update to gulp4 in bootstrapcivihr --- org.civicrm.bootstrapcivihr/package-lock.json | 3417 +++++++++++------ org.civicrm.bootstrapcivihr/package.json | 2 +- 2 files changed, 2334 insertions(+), 1085 deletions(-) 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", From a4542f79a608cc5f7b71870c8d6e7a01e81b53f6 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 12:18:10 +0200 Subject: [PATCH 138/151] PCHR-4046: Update civihr.css --- org.civicrm.bootstrapcivihr/css/civihr.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.civicrm.bootstrapcivihr/css/civihr.css b/org.civicrm.bootstrapcivihr/css/civihr.css index 603203cd856..cd97d7d45f6 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}#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)}} From 34faa0b5a1f6c80c1a961ff04d4ff76176f12829 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 12:21:57 +0200 Subject: [PATCH 139/151] PCHR-4046: (reqangular) Auto fixes with npm audit fix --- org.civicrm.reqangular/package-lock.json | 126 ++++++++++++++++------- org.civicrm.reqangular/package.json | 2 +- 2 files changed, 91 insertions(+), 37 deletions(-) diff --git a/org.civicrm.reqangular/package-lock.json b/org.civicrm.reqangular/package-lock.json index 88586f3d31a..63114f07b08 100644 --- a/org.civicrm.reqangular/package-lock.json +++ b/org.civicrm.reqangular/package-lock.json @@ -288,14 +288,52 @@ "dev": true }, "cloneable-readable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.0.0.tgz", - "integrity": "sha1-pikNQT8hemEjL5XkWP84QYz7ARc=", + "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": "^1.0.6", - "through2": "^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 + }, + "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" + } + } } }, "collection-visit": { @@ -327,9 +365,9 @@ "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==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", + "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==", "dev": true, "requires": { "source-map": "^0.6.1" @@ -438,7 +476,7 @@ }, "event-stream": { "version": "3.3.4", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { @@ -863,15 +901,15 @@ } }, "gulp-angular-templatecache": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/gulp-angular-templatecache/-/gulp-angular-templatecache-2.2.0.tgz", - "integrity": "sha512-IDe9UwPgtoFpp4QLC+pFTzo6GjqTxJ1IeDCR9ks1V/K7uwrnRogXIIQXnclmx5Zk1QoO/eg2C0rYOjJiyOLYdw==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/gulp-angular-templatecache/-/gulp-angular-templatecache-2.2.1.tgz", + "integrity": "sha512-MAsOPoefYUaZ9a19+inieP+1r+/dD+QNy0QqYQD4WKn7nYiHob4cjJLIfZGl3M3wRGBxPM+la0zqUDSfUJWozQ==", "dev": true, "requires": { "event-stream": "3.3.4", "gulp-concat": "2.6.1", - "gulp-footer": "1.0.5", - "gulp-header": "1.8.9", + "gulp-footer": "2.0.1", + "gulp-header": "2.0.5", "jsesc": "2.5.1", "lodash.template": "^4.4.0", "through2": "^2.0.3" @@ -910,9 +948,9 @@ }, "dependencies": { "clone": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", - "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", "dev": true }, "clone-stats": { @@ -928,9 +966,9 @@ "dev": true }, "vinyl": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.1.0.tgz", - "integrity": "sha1-Ah+cLPlR1rk5lDyJ617lrdT9kkw=", + "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": "^2.1.1", @@ -944,26 +982,48 @@ } }, "gulp-footer": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/gulp-footer/-/gulp-footer-1.0.5.tgz", - "integrity": "sha1-6Eynd+Jmvnu8LUXS3w5+uo36PlQ=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/gulp-footer/-/gulp-footer-2.0.1.tgz", + "integrity": "sha512-leXmoTEwXjklKuIE+8xGhuqlN/OdWubnkn3W/jNzmxxYbzQVjCtl2XI5iZztgPKLZ+Mh1t+7tTTGyVQqZva4+A==", "dev": true, "requires": { "event-stream": "*", - "gulp-util": "*", - "lodash.assign": "*" + "lodash._reescape": "^3.0.0", + "lodash._reevaluate": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.template": "^3.6.2" } }, "gulp-header": { - "version": "1.8.9", - "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-1.8.9.tgz", - "integrity": "sha1-yfEP7gYy2B6Tl4nG7PRaFRvzCYs=", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-2.0.5.tgz", + "integrity": "sha512-7bOIiHvM1GUHIG3LRH+UIanOxyjSys0FbzzgUBlV2cZIIZihEW+KKKKm0ejUBNGvRdhISEFFr6HlptXoa28gtQ==", "dev": true, "requires": { "concat-with-sourcemaps": "*", - "gulp-util": "*", - "object-assign": "*", + "lodash.template": "^4.4.0", "through2": "^2.0.0" + }, + "dependencies": { + "lodash.template": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", + "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", + "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0" + } + } } }, "gulp-replace": { @@ -1390,12 +1450,6 @@ "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", "dev": true }, - "lodash.assign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", - "dev": true - }, "lodash.escape": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", diff --git a/org.civicrm.reqangular/package.json b/org.civicrm.reqangular/package.json index 8cb95c4efec..f34757bf033 100644 --- a/org.civicrm.reqangular/package.json +++ b/org.civicrm.reqangular/package.json @@ -10,7 +10,7 @@ "license": "ISC", "devDependencies": { "gulp": "^3.9.1", - "gulp-angular-templatecache": "^2.2.0", + "gulp-angular-templatecache": "^2.2.1", "gulp-replace": "^0.6.1", "path": "^0.12.7" } From 1b0f59fc536fdbe86c80040aa6660057fd06e71d Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 13:41:21 +0200 Subject: [PATCH 140/151] PCHR-4046: (reqangular) Update to gulp4 --- org.civicrm.reqangular/package-lock.json | 3212 +++++++++++++++------- org.civicrm.reqangular/package.json | 2 +- 2 files changed, 2171 insertions(+), 1043 deletions(-) diff --git a/org.civicrm.reqangular/package-lock.json b/org.civicrm.reqangular/package-lock.json index 63114f07b08..a9ed185b55e 100644 --- a/org.civicrm.reqangular/package-lock.json +++ b/org.civicrm.reqangular/package-lock.json @@ -4,6 +4,15 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "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-gray": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", @@ -19,18 +28,31 @@ "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 }, + "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", @@ -43,41 +65,101 @@ "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", "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "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", @@ -91,12 +173,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", @@ -116,12 +242,52 @@ "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" + } + } } }, - "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 }, "binaryextensions": { @@ -131,9 +297,9 @@ "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", @@ -141,14 +307,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", @@ -157,8 +322,37 @@ "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", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -176,17 +370,31 @@ "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=", + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, + "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": { - "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" + "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": { @@ -209,70 +417,24 @@ "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 } } }, + "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": "1.0.3", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.3.tgz", - "integrity": "sha1-KY1+IjFmD0DAA8LtMUDezz9TCF8=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", "dev": true }, "clone-buffer": { @@ -282,9 +444,9 @@ "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=", + "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 }, "cloneable-readable": { @@ -336,6 +498,23 @@ } } }, + "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 + }, + "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", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -364,6 +543,18 @@ "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" + } + }, "concat-with-sourcemaps": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", @@ -381,23 +572,42 @@ } } }, + "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", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "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 + "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", @@ -408,76 +618,197 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "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": { + "default-compare": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz", + "integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==", "dev": true, "requires": { - "is-descriptor": "^1.0.0" + "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 + } } }, - "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 - }, - "duplexer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", - "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "default-resolution": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", + "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", "dev": true }, - "duplexer2": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", - "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", + "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": { - "readable-stream": "~1.1.9" + "object-keys": "^1.0.12" } }, - "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=", + "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": { - "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 - }, - "event-stream": { - "version": "3.3.4", - "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", - "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "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", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "dev": true + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "dev": true + }, + "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" + } + }, + "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": "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.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "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", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { "duplexer": "~0.1.1", @@ -513,62 +844,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 } } }, @@ -582,18 +865,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": { @@ -610,6 +905,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": { @@ -633,13 +977,28 @@ "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", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } }, "findup-sync": { "version": "2.0.0", @@ -651,6 +1010,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": { @@ -666,18 +1036,22 @@ "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 }, + "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" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -708,15 +1082,563 @@ "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", "dev": true }, - "gaze": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", - "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "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": { - "globule": "~0.1.0" + "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 + }, + "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 + }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -724,71 +1646,68 @@ "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-stream": { - "version": "3.1.18", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", - "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", + "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": { - "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" + "is-glob": "^3.1.0", + "path-dirname": "^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=", + "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": { - "readable-stream": ">=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": { @@ -815,89 +1734,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=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.0.tgz", + "integrity": "sha1-lXZsYB2t5Kd+0+eyttwDiBtZY2Y=", "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" + "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-angular-templatecache": { @@ -1065,34 +1954,8 @@ "dev": true, "requires": { "safe-buffer": "~5.1.0" - } - } - } - }, - "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": { @@ -1104,23 +1967,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", @@ -1163,6 +2014,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", @@ -1191,6 +2048,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", @@ -1202,12 +2065,38 @@ } }, "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": "^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": { @@ -1216,24 +2105,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": { + "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": "^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-extendable": { @@ -1248,15 +2165,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", @@ -1277,15 +2209,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", @@ -1319,16 +2242,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": { @@ -1359,19 +2288,68 @@ "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", "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": { @@ -1390,11 +2368,18 @@ "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 + "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": { + "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._basecopy": { "version": "3.0.1", @@ -1450,6 +2435,12 @@ "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", "dev": true }, + "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.escape": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", @@ -1515,30 +2506,13 @@ "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-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": { @@ -1562,46 +2536,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", @@ -1619,75 +2599,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": { @@ -1710,43 +2699,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", @@ -1758,6 +2710,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", @@ -1767,6 +2725,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", @@ -1798,37 +2768,42 @@ "isobject": "^3.0.1" } }, - "once": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", - "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", + "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": { - "wrappy": "1" + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" } }, - "orchestrator": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", - "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "end-of-stream": "~0.1.5", - "sequencify": "~0.0.7", - "stream-consume": "~0.1.0" + "wrappy": "1" } }, "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 + "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": { + "readable-stream": "^2.0.1" + } }, - "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", @@ -1841,6 +2816,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", @@ -1863,10 +2847,31 @@ "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", + "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": { @@ -1884,6 +2889,17 @@ "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" + } + }, "pause-stream": { "version": "0.0.11", "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", @@ -1893,6 +2909,27 @@ "through": "~2.3" } }, + "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" + } + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -1917,16 +2954,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": { @@ -1939,12 +3041,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": { @@ -1966,11 +3090,22 @@ "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" + } + }, "replacestream": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz", @@ -2020,10 +3155,22 @@ } } }, + "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" @@ -2039,39 +3186,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==", "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", @@ -2082,18 +3259,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", @@ -2103,7 +3285,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": { @@ -2115,62 +3297,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 } } }, @@ -2183,6 +3317,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": { @@ -2212,12 +3386,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", @@ -2231,9 +3405,41 @@ "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": { + "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": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "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": { + "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": { @@ -2249,107 +3455,35 @@ "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": { + "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 } } }, @@ -2362,18 +3496,38 @@ "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 }, - "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", @@ -2384,20 +3538,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" + } }, "textextensions": { "version": "1.0.2", @@ -2453,13 +3610,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": { @@ -2468,6 +3626,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", @@ -2489,82 +3657,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": { @@ -2577,12 +3678,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", @@ -2595,6 +3734,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", @@ -2610,10 +3758,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", @@ -2652,15 +3804,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", @@ -2668,88 +3820,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": { @@ -2776,90 +3849,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", @@ -2871,6 +3963,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/org.civicrm.reqangular/package.json b/org.civicrm.reqangular/package.json index f34757bf033..df318e6517e 100644 --- a/org.civicrm.reqangular/package.json +++ b/org.civicrm.reqangular/package.json @@ -9,7 +9,7 @@ "author": "", "license": "ISC", "devDependencies": { - "gulp": "^3.9.1", + "gulp": "^4.0.0", "gulp-angular-templatecache": "^2.2.1", "gulp-replace": "^0.6.1", "path": "^0.12.7" From fe2333e892af8f85a902cb8a419f1f379a5516b1 Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Thu, 16 Aug 2018 12:58:18 +0100 Subject: [PATCH 141/151] PCHR-3797: Improve apply core fork patch script to avoid api rate limit errors --- bin/apply-core-fork-patch.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/apply-core-fork-patch.sh b/bin/apply-core-fork-patch.sh index 17889610737..18195d0bf8a 100755 --- a/bin/apply-core-fork-patch.sh +++ b/bin/apply-core-fork-patch.sh @@ -2,7 +2,7 @@ set -e -API_URL_BASE="https://api.github.com/repos/compucorp/civicrm-core" +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 +27,7 @@ applyPatch () { # Creates a diff patch file by sending a request to the given GitHub API url # # Globals: -# $API_URL_BASE +# $BASE_URL # $civiRoot # $PATCH_FILE # Arguments: @@ -37,7 +37,7 @@ applyPatch () { # None ####################################### createPatch () { - curl "$API_URL_BASE/compare/$1...$2" -s -H "Accept: application/vnd.github.v3.diff" > "$civiRoot/$PATCH_FILE" + curl "$BASE_URL/compare/$1...$2.diff" -s -H "Accept: application/vnd.github.v3.diff" > "$civiRoot/$PATCH_FILE" } ####################################### @@ -97,7 +97,7 @@ setCivicrmRootPath () { ####################################### updateLastCommitPatched () { # It uses the same file as temporary recipient of the full commit data - curl "$API_URL_BASE/commits/$1" -s > "$LAST_COMMIT_PATCHED_FILE" + curl "$BASE_URL/commits/$1" -s > "$LAST_COMMIT_PATCHED_FILE" sha=$(JSONValue "$LAST_COMMIT_PATCHED_FILE" "sha") echo "$sha" > "$LAST_COMMIT_PATCHED_FILE" From 6adc98aebfe916ee5bfb4251e1d091e0cb3c431a Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 14:20:55 +0200 Subject: [PATCH 142/151] PCHR-4046: Remove added trailing slash from gulp-angular-templatecache + use config --- org.civicrm.reqangular/gulp-tasks/requirejs.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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(); From f1e7db8e8984be1eaec32abc86284f3fb6c1c772 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 14:23:45 +0200 Subject: [PATCH 143/151] PCHR-4046: (L&A) Update to gulp4 --- .../package-lock.json | 3526 +++++++++++------ .../package.json | 2 +- 2 files changed, 2265 insertions(+), 1263 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrleaveandabsences/package-lock.json b/uk.co.compucorp.civicrm.hrleaveandabsences/package-lock.json index 6c6bbb5d493..6cbff50687b 100644 --- a/uk.co.compucorp.civicrm.hrleaveandabsences/package-lock.json +++ b/uk.co.compucorp.civicrm.hrleaveandabsences/package-lock.json @@ -4,6 +4,15 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "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", @@ -37,18 +46,31 @@ "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 }, + "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", @@ -61,41 +83,101 @@ "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", "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "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", @@ -109,12 +191,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", @@ -134,12 +260,52 @@ "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" + } + } } }, - "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": { @@ -153,14 +319,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", @@ -169,8 +334,37 @@ "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", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -188,17 +382,31 @@ "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=", + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, + "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": { - "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" + "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": { @@ -221,70 +429,24 @@ "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 } } }, + "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": "1.0.3", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.3.tgz", - "integrity": "sha1-KY1+IjFmD0DAA8LtMUDezz9TCF8=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", "dev": true }, "clone-buffer": { @@ -294,9 +456,9 @@ "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=", + "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 }, "cloneable-readable": { @@ -310,6 +472,23 @@ "through2": "^2.0.1" } }, + "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 + }, + "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", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -338,23 +517,54 @@ "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" + } + }, + "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", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "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 + "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", @@ -365,79 +575,205 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "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": { + "default-compare": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz", + "integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==", "dev": true, "requires": { - "is-descriptor": "^1.0.0" + "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 + } } }, - "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=", + "default-resolution": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", + "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", "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=", + "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": { - "once": "~1.3.0" + "object-keys": "^1.0.12" } }, - "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=", + "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": { - "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" + "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", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "dev": true + }, + "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" + } + }, + "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": "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.4.0" + }, + "dependencies": { + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + } + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "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" + } + }, + "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": { @@ -446,213 +782,798 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "^0.1.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" + } + } + } + }, + "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.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "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" + }, + "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": { + "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" + }, + "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": { + "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" + }, + "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-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "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" + }, + "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": { + "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" + } + }, + "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" + } + }, + "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" + } + }, + "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" } }, - "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=", + "string_decoder": { + "version": "1.1.1", + "bundled": true, "dev": true, + "optional": 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" - } - } + "safe-buffer": "~5.1.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=", + "strip-ansi": { + "version": "3.0.1", + "bundled": true, "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" - } - } + "ansi-regex": "^2.0.0" } }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "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": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "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" } }, - "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==", + "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 } } }, - "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-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=", + "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" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "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-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -660,71 +1581,68 @@ "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-stream": { - "version": "3.1.18", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", - "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", + "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": { - "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" + "is-glob": "^3.1.0", + "path-dirname": "^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=", + "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": { - "readable-stream": ">=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" From 61b2e66993fbf5e9691c6a5a75d0724a0a6523ee Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 14:58:34 +0200 Subject: [PATCH 144/151] PCHR-4046: (hrcore) Auto fixes with npm audit fix --- .../package-lock.json | 3716 ++--------------- uk.co.compucorp.civicrm.hrcore/package.json | 2 +- 2 files changed, 342 insertions(+), 3376 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/package-lock.json b/uk.co.compucorp.civicrm.hrcore/package-lock.json index 28a447ceee0..7a37127004d 100644 --- a/uk.co.compucorp.civicrm.hrcore/package-lock.json +++ b/uk.co.compucorp.civicrm.hrcore/package-lock.json @@ -16,9 +16,9 @@ "dev": true }, "@types/node": { - "version": "9.6.26", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.26.tgz", - "integrity": "sha512-3LKKscYUZdZreOuvnly8oWsCA1TOWtmkV3mbcUnV34f+nqDWJic+4SGjRi1C/sPHnZcSs/x209O+Dgy8aWHt2A==", + "version": "9.6.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.28.tgz", + "integrity": "sha512-LMSOxMKNJ8tGqUVs8lSIT8RGo1XGWYada/ZU2QZcbcD6AW9futXDE99tfQA0K6DK60GXcwplsGGK5KABRmI5GA==", "dev": true }, "@types/rimraf": { @@ -43,29 +43,6 @@ "negotiator": "0.6.1" } }, - "acorn": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", - "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", - "dev": true - }, - "acorn-dynamic-import": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz", - "integrity": "sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ=", - "dev": true, - "requires": { - "acorn": "^4.0.3" - }, - "dependencies": { - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - } - } - }, "addressparser": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/addressparser/-/addressparser-1.0.1.tgz", @@ -100,34 +77,6 @@ "json-schema-traverse": "^0.3.0" } }, - "ajv-keywords": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", - "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", - "dev": true - }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true, - "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.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" - } - } - } - }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", @@ -204,12 +153,6 @@ "ansi-wrap": "0.1.0" } }, - "ansi-html": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", - "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=", - "dev": true - }, "ansi-red": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", @@ -334,22 +277,6 @@ "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true }, - "array-flatten": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.1.tgz", - "integrity": "sha1-Qmu52oQJDBg42BLIFQryCoMx4pY=", - "dev": true - }, - "array-includes": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", - "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.7.0" - } - }, "array-initial": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", @@ -410,21 +337,6 @@ } } }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "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", @@ -443,55 +355,12 @@ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", - "dev": true - }, "asn1": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", "dev": true }, - "asn1.js": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "assert": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", - "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", - "dev": true, - "requires": { - "util": "0.10.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "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" - } - } - } - }, "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", @@ -511,15 +380,6 @@ "dev": true, "optional": true }, - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "dev": true, - "requires": { - "lodash": "^4.17.10" - } - }, "async-chain-proxy": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/async-chain-proxy/-/async-chain-proxy-0.1.5.tgz", @@ -623,14 +483,6 @@ "babel-runtime": "^6.26.0", "core-js": "^2.5.0", "regenerator-runtime": "^0.10.5" - }, - "dependencies": { - "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", - "dev": true - } } }, "babel-runtime": { @@ -643,12 +495,6 @@ "regenerator-runtime": "^0.11.0" }, "dependencies": { - "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", - "dev": true - }, "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", @@ -680,22 +526,12 @@ "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", "dev": true }, - "backstop-twentytwenty": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/backstop-twentytwenty/-/backstop-twentytwenty-1.0.4.tgz", - "integrity": "sha512-sENfpossNAbVKZjTzBU6bkbR1vIb7t6brjqH9ZMEIYh/RyCIGFM3BSgERzh+tdwpAVXHSbIV1gQRrtzBYzUrjw==", - "dev": true, - "requires": { - "react": "^15.6.2" - } - }, "backstopjs": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/backstopjs/-/backstopjs-3.5.2.tgz", - "integrity": "sha512-2QqAbbQerk4T/M+a+YBxAPJnkZbl9nfXUuSVlzu2mAfW0Uq+gp9NYzsIUsfLjy2vISPJwBBa5ANnVMz86QcgwQ==", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/backstopjs/-/backstopjs-3.5.4.tgz", + "integrity": "sha512-xduJRy1pw96U6+2TlQszfGoGLZhBc6akLPZkdLFwWOJltRPR7rV1JRJRlLX1HkbbRjmKf9dUCLA3BBnc374G6Q==", "dev": true, "requires": { - "backstop-twentytwenty": "^1.0.4", "casperjs": "^1.1.0-beta5", "chalk": "^1.1.3", "chromy": "0.5.11", @@ -712,16 +548,7 @@ "path": "^0.12.7", "phantomjs-prebuilt": "^2.1.7", "puppeteer": "^1.2.0-next.1523485686787", - "react-modal": "^3.0.3", - "react-redux": "^5.0.6", - "react-sticky": "^6.0.1", - "react-toggle-button": "^2.1.0", - "redux": "^3.7.2", - "sinon": "^1.17.7", - "styled-components": "^2.1.2", - "temp": "^0.8.3", - "webpack": "^3.5.6", - "webpack-dev-server": "^2.7.1" + "temp": "^0.8.3" } }, "balanced-match": { @@ -750,24 +577,12 @@ "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", "dev": true }, - "base64-js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", - "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", - "dev": true - }, "base64id": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", "dev": true }, - "batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", - "dev": true - }, "bcrypt-pbkdf": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", @@ -787,12 +602,6 @@ "callsite": "1.0.0" } }, - "big.js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", - "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", - "dev": true - }, "bignumber.js": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-2.4.0.tgz", @@ -882,12 +691,6 @@ "integrity": "sha1-ZBE+nHzxICs3btYHvzBibr5XsYo=", "dev": true }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, "body-parser": { "version": "1.18.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", @@ -914,20 +717,6 @@ } } }, - "bonjour": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz", - "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", - "dev": true, - "requires": { - "array-flatten": "^2.1.0", - "deep-equal": "^1.0.1", - "dns-equal": "^1.0.0", - "dns-txt": "^2.0.2", - "multicast-dns": "^6.0.1", - "multicast-dns-service-types": "^1.1.0" - } - }, "boom": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", @@ -965,101 +754,6 @@ "to-regex": "^3.0.1" } }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "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 - } - } - }, - "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", - "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", - "dev": true, - "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" - } - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "requires": { - "pako": "~1.0.5" - } - }, - "buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.0.tgz", - "integrity": "sha512-nUJyfChH7PMJy75eRDCCKtszSEFokUNXC1hNVSe+o+VdcgvDPLs20k3v8UXI8ruRYAJiYtyRea8mYyqPxoHWDw==", - "dev": true, - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, "buffer-equal": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", @@ -1072,24 +766,12 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, - "buffer-indexof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", - "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==", - "dev": true - }, "buffer-more-ints": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-0.0.2.tgz", "integrity": "sha1-JrOIXRD6E9t/wBquOquHAZngEkw=", "dev": true }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true - }, "buildmail": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/buildmail/-/buildmail-4.0.1.tgz", @@ -1112,12 +794,6 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", - "dev": true - }, "bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -1176,24 +852,6 @@ "integrity": "sha1-6wH07YWsUgqPTZMrTap00+d7x0Y=", "dev": true }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - }, - "dependencies": { - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true - } - } - }, "chalk": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", @@ -1290,16 +948,6 @@ "uuid": "^3.2.1" } }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, "circular-json": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.3.tgz", @@ -1403,17 +1051,6 @@ } } }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - } - }, "clone": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", @@ -1577,46 +1214,6 @@ "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", "dev": true }, - "compressible": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.14.tgz", - "integrity": "sha1-MmxfUH+7BV9UEWeCuWmoG2einac=", - "dev": true, - "requires": { - "mime-db": ">= 1.34.0 < 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 - } - } - }, - "compression": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.3.tgz", - "integrity": "sha512-HSjyBG5N1Nnz7tF2+O7A9XUhyjru71/fwgNb7oIsEVHR0WShfs2tIS/EySLgiTe98aOK18YDlMXpzjCXY/n9mg==", - "dev": true, - "requires": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.14", - "debug": "2.6.9", - "on-headers": "~1.0.1", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - }, - "dependencies": { - "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 - } - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1669,39 +1266,12 @@ } } }, - "connect-history-api-fallback": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz", - "integrity": "sha1-sGhzk0vF40T+9hGhlqb6rgruAVo=", - "dev": true - }, - "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "^0.1.4" - } - }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", - "dev": true - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=", - "dev": true - }, "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", @@ -1720,12 +1290,6 @@ "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", "dev": true }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", - "dev": true - }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -1743,9 +1307,9 @@ } }, "core-js": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", - "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", "dev": true }, "core-util-is": { @@ -1753,54 +1317,6 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, - "create-ecdh": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", - "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.0.0" - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "create-react-class": { - "version": "15.6.3", - "resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.6.3.tgz", - "integrity": "sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg==", - "dev": true, - "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" - } - }, "cross-spawn": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", @@ -1831,49 +1347,13 @@ } } }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "css-color-keywords": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", - "integrity": "sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=", - "dev": true - }, - "css-to-react-native": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-2.2.1.tgz", - "integrity": "sha512-v++LRcf633phJiYZBDqtmGPj3+BVof0isd2jgwYLWZJ5YSuhCkrfYtDsNhM6oJthiEco0f9tDVJ1vUkDJNgGEA==", - "dev": true, - "requires": { - "css-color-keywords": "^1.0.0", - "fbjs": "^0.8.5", - "postcss-value-parser": "^3.3.0" - } - }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dev": true, - "requires": { - "array-find-index": "^1.0.1" + "array-find-index": "^1.0.1" } }, "custom-event": { @@ -1913,12 +1393,6 @@ "integrity": "sha1-YV6CjiM90aubua4JUODOzPpuytg=", "dev": true }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true - }, "dateformat": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz", @@ -1968,11 +1442,12 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, - "deep-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", - "dev": true + "deep-extend": { + "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, + "optional": true }, "deep-is": { "version": "0.1.3", @@ -2060,20 +1535,6 @@ "esprima": "3.x.x" } }, - "del": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", - "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", - "dev": true, - "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" - } - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2092,22 +1553,6 @@ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "dev": true }, - "des.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", - "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", - "dev": true - }, "detect-file": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", @@ -2123,54 +1568,12 @@ "get-installed-path": "^2.0.3" } }, - "detect-node": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz", - "integrity": "sha1-ogM8CcyOFY03dI+951B4Mr1s4Sc=", - "dev": true - }, "di": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", "dev": true }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "dns-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", - "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=", - "dev": true - }, - "dns-packet": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz", - "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", - "dev": true, - "requires": { - "ip": "^1.1.0", - "safe-buffer": "^5.0.1" - } - }, - "dns-txt": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz", - "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", - "dev": true, - "requires": { - "buffer-indexof": "^1.0.0" - } - }, "dom-serialize": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", @@ -2189,12 +1592,6 @@ "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=", "dev": true }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "dev": true - }, "double-ended-queue": { "version": "2.1.0-0", "resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz", @@ -2278,42 +1675,12 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "dev": true }, - "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", - "dev": true, - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", - "dev": true - }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", "dev": true }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "dev": true, - "requires": { - "iconv-lite": "~0.4.13" - } - }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -2403,33 +1770,12 @@ "has-binary2": "~1.0.2" } }, - "enhanced-resolve": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", - "integrity": "sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", - "object-assign": "^4.0.1", - "tapable": "^0.2.7" - } - }, "ent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", "dev": true }, - "errno": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", - "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", - "dev": true, - "requires": { - "prr": "~1.0.1" - } - }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", @@ -2439,30 +1785,6 @@ "is-arrayish": "^0.2.1" } }, - "es-abstract": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", - "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", - "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", - "dev": true, - "requires": { - "is-callable": "^1.1.1", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.1" - } - }, "es5-ext": { "version": "0.10.45", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.45.tgz", @@ -2485,20 +1807,6 @@ "es6-symbol": "^3.1.1" } }, - "es6-map": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", - "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14", - "es6-iterator": "~2.0.1", - "es6-set": "~0.1.5", - "es6-symbol": "~3.1.1", - "event-emitter": "~0.3.5" - } - }, "es6-promise": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", @@ -2514,19 +1822,6 @@ "es6-promise": "^4.0.3" } }, - "es6-set": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", - "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14", - "es6-iterator": "~2.0.1", - "es6-symbol": "3.1.1", - "event-emitter": "~0.3.5" - } - }, "es6-symbol": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", @@ -2584,38 +1879,18 @@ } } }, - "escope": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", - "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", - "dev": true, - "requires": { - "es6-map": "^0.1.3", - "es6-weak-map": "^2.0.1", - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, "esprima": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", "dev": true }, - "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", - "dev": true, - "requires": { - "estraverse": "^4.1.0" - } - }, "estraverse": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true + "dev": true, + "optional": true }, "esutils": { "version": "2.0.2", @@ -2624,87 +1899,12 @@ "dev": true, "optional": true }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "dev": true - }, - "event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, "eventemitter3": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", "dev": true }, - "events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", - "dev": true - }, - "eventsource": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-0.1.6.tgz", - "integrity": "sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI=", - "dev": true, - "requires": { - "original": ">=0.0.5" - } - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - } - } - }, - "exenv": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", - "integrity": "sha1-KueOhdmJQVhnCwPUe+wfA72Ru50=", - "dev": true - }, "exif-parser": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", @@ -2910,52 +2110,6 @@ "homedir-polyfill": "^1.0.1" } }, - "express": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", - "dev": true, - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", - "dev": true - } - } - }, "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", @@ -3035,30 +2189,6 @@ "dev": true, "optional": true }, - "faye-websocket": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", - "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", - "dev": true, - "requires": { - "websocket-driver": ">=0.5.1" - } - }, - "fbjs": { - "version": "0.8.17", - "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.17.tgz", - "integrity": "sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90=", - "dev": true, - "requires": { - "core-js": "^1.0.0", - "isomorphic-fetch": "^2.1.1", - "loose-envify": "^1.0.0", - "object-assign": "^4.1.0", - "promise": "^7.1.1", - "setimmediate": "^1.0.5", - "ua-parser-js": "^0.7.18" - } - }, "fd-slicer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", @@ -3099,21 +2229,6 @@ "to-regex-range": "^2.1.0" } }, - "finalhandler": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - } - }, "find": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/find/-/find-0.2.9.tgz", @@ -3250,21 +2365,6 @@ "mime-types": "^2.1.12" } }, - "formatio": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", - "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", - "dev": true, - "requires": { - "samsam": "~1.1" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", - "dev": true - }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -3274,12 +2374,6 @@ "map-cache": "^0.2.2" } }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", - "dev": true - }, "fs-access": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", @@ -3418,13 +2512,6 @@ "ms": "2.0.0" } }, - "deep-extend": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", - "dev": true, - "optional": true - }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -3532,13 +2619,6 @@ "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, - "optional": 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", @@ -3740,28 +2820,6 @@ "dev": true, "optional": true }, - "rc": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.6.tgz", - "integrity": "sha1-6xiYnG1PTxYsOZ953dKfODVWgJI=", - "dev": true, - "optional": true, - "requires": { - "deep-extend": "~0.4.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true, - "optional": true - } - } - }, "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", @@ -3859,13 +2917,6 @@ "ansi-regex": "^2.0.0" } }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true, - "optional": true - }, "tar": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.1.tgz", @@ -4047,12 +3098,6 @@ "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", "dev": true }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, "get-uri": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-2.0.1.tgz", @@ -4328,27 +3373,6 @@ "which": "^1.2.14" } }, - "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } - } - }, "globule": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", @@ -5218,12 +4242,6 @@ "glogg": "^1.0.0" } }, - "handle-thing": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", - "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=", - "dev": true - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -5240,15 +4258,6 @@ "har-schema": "^2.0.0" } }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -5281,12 +4290,6 @@ "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", "dev": true }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", @@ -5331,26 +4334,6 @@ } } }, - "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "hash.js": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", - "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, "hasha": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", @@ -5384,29 +4367,12 @@ "request": "^2.0.0" } }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, "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 }, - "hoist-non-react-statics": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz", - "integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==", - "dev": true - }, "homedir-polyfill": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", @@ -5422,30 +4388,6 @@ "integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", "dev": true }, - "hpack.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", - "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - } - }, - "html-entities": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz", - "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=", - "dev": true - }, - "http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", - "dev": true - }, "http-errors": { "version": "1.6.3", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", @@ -5458,12 +4400,6 @@ "statuses": ">= 1.4.0 < 2" } }, - "http-parser-js": { - "version": "0.4.13", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz", - "integrity": "sha1-O9bW/ebjFyyTNMOzO2wZPYD+ETc=", - "dev": true - }, "http-proxy": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", @@ -5504,111 +4440,6 @@ } } }, - "http-proxy-middleware": { - "version": "0.17.4", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.17.4.tgz", - "integrity": "sha1-ZC6ISIUdZvCdTxJJEoRtuutBuDM=", - "dev": true, - "requires": { - "http-proxy": "^1.16.2", - "is-glob": "^3.1.0", - "lodash": "^4.17.2", - "micromatch": "^2.3.11" - }, - "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "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" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - }, - "dependencies": { - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - } - } - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -5636,12 +4467,6 @@ "integrity": "sha1-QzX/2CzZaWaKOUZckprGHWOTYn8=", "dev": true }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", - "dev": true - }, "https-proxy-agent": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", @@ -5663,31 +4488,6 @@ } } }, - "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" - } - }, - "ieee754": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", - "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", - "dev": true - }, - "import-local": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", - "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", - "dev": true, - "requires": { - "pkg-dir": "^2.0.0", - "resolve-cwd": "^2.0.0" - } - }, "in-publish": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz", @@ -5733,234 +4533,40 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, - "internal-ip": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-1.2.0.tgz", - "integrity": "sha1-rp+/k7mEh4eF1QqN4bNWlWBYz1w=", - "dev": true, - "requires": { - "meow": "^3.3.0" - }, - "dependencies": { - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "dev": true, - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, - "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": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - }, - "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "dev": true, - "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - } - }, - "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" - } - }, - "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-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 - }, - "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" - } - }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "dev": true, - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - } - }, - "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" - } - }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true, - "requires": { - "get-stdin": "^4.0.1" - } - }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", - "dev": true - } - } - }, - "interpret": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", - "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", - "dev": true - }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dev": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, - "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 - }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", - "dev": true - }, - "ip-regex": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-1.0.3.tgz", - "integrity": "sha1-3FiQdvZZ9BnCIgOaMzFvHHOH7/0=", - "dev": true - }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=", - "dev": true - }, - "is": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/is/-/is-3.2.1.tgz", - "integrity": "sha1-0Kwq1V63sL7JJqUmb2xmKqqD3KU=", - "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==", + "interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "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 + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true + }, + "ip-regex": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-1.0.3.tgz", + "integrity": "sha1-3FiQdvZZ9BnCIgOaMzFvHHOH7/0=", + "dev": true + }, + "is": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is/-/is-3.2.1.tgz", + "integrity": "sha1-0Kwq1V63sL7JJqUmb2xmKqqD3KU=", + "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", @@ -6021,12 +4627,6 @@ "kind-of": "^6.0.0" } }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true - }, "is-descriptor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", @@ -6145,39 +4745,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-path-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", - "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", - "dev": true - }, - "is-path-in-cwd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", - "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", - "dev": true, - "requires": { - "is-path-inside": "^1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", - "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", - "dev": true, - "requires": { - "path-is-inside": "^1.0.1" - } - }, "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -6212,15 +4779,6 @@ "dev": true, "optional": true }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, - "requires": { - "has": "^1.0.1" - } - }, "is-regexp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", @@ -6242,12 +4800,6 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, - "is-symbol": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", - "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", - "dev": true - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -6310,16 +4862,6 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, - "isomorphic-fetch": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", - "dev": true, - "requires": { - "node-fetch": "^1.0.1", - "whatwg-fetch": ">=0.10.0" - } - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -6387,12 +4929,6 @@ "integrity": "sha512-hm2nYpDrwoO/OzBhdcqs/XGT6XjSuSSCVEpia+Kl2J6x4CYt5hISlVL/AYU1khoDXv0AQVgxtdJySb9gjAn56Q==", "dev": true }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -6400,12 +4936,6 @@ "dev": true, "optional": true }, - "json-loader": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz", - "integrity": "sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==", - "dev": true - }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -6439,18 +4969,6 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, "jsonfile": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", @@ -6776,12 +5294,6 @@ "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", "dev": true }, - "killable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.0.tgz", - "integrity": "sha1-2ouEvUfeU5WHj5XWTQLyRJ/gXms=", - "dev": true - }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", @@ -6807,15 +5319,6 @@ "es6-weak-map": "^2.0.1" } }, - "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" - } - }, "lazystream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", @@ -6911,16 +5414,16 @@ } }, "load-bmfont": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.3.0.tgz", - "integrity": "sha1-u358cQ3mvK/LE8s7jIHgwBMey8k=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.3.1.tgz", + "integrity": "sha512-lQkEawgez06lM2iw1vQEEOtVLJXyMzFcUqbwWMrB0g6zwhdUs/+e0KNd1zEJ7OFBbMVz0tbzQyjgjtTB47+PBg==", "dev": true, "requires": { "buffer-equal": "0.0.1", "mime": "^1.3.4", "parse-bmfont-ascii": "^1.0.3", "parse-bmfont-binary": "^1.0.5", - "parse-bmfont-xml": "^1.1.0", + "parse-bmfont-xml": "^1.1.4", "xhr": "^2.0.1", "xtend": "^4.0.0" } @@ -6937,23 +5440,6 @@ "strip-bom": "^3.0.0" } }, - "loader-runner": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz", - "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", - "dev": true - }, - "loader-utils": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", - "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", - "dev": true, - "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0" - } - }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -6970,12 +5456,6 @@ "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", "dev": true }, - "lodash-es": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.10.tgz", - "integrity": "sha512-iesFYPmxYYGTcmQK0sL8bX3TGHyM6b2qREaB4kamHfQyfPJP0xgoGxp19nsH16nsfquLdiyKyX3mQkfiSGV8Rg==", - "dev": true - }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", @@ -7209,33 +5689,6 @@ } } }, - "loglevel": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", - "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=", - "dev": true - }, - "lolex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", - "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=", - "dev": true - }, - "longest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, "loud-rejection": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", @@ -7368,41 +5821,12 @@ "stack-trace": "0.0.10" } }, - "md5.js": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", - "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "dev": true }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "memory-fs": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", - "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, "meow": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", @@ -7426,49 +5850,138 @@ "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", "dev": true }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", - "dev": true - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", - "dev": true - }, "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" - } - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - } - }, + "to-regex": "^3.0.2" + }, + "dependencies": { + "braces": { + "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", + "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" + }, + "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" + } + } + } + }, + "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" + } + }, + "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" + }, + "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" + } + } + } + }, + "is-windows": { + "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 + }, + "nanomatch": { + "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": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "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" + } + }, + "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" + } + } + } + } + } + }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -7490,12 +6003,6 @@ "mime-db": "~1.33.0" } }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, "min-document": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", @@ -7505,18 +6012,6 @@ "dom-walk": "^0.1.0" } }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -7586,22 +6081,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "multicast-dns": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz", - "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", - "dev": true, - "requires": { - "dns-packet": "^1.3.1", - "thunky": "^1.0.2" - } - }, - "multicast-dns-service-types": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", - "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", - "dev": true - }, "mute-stdout": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.0.tgz", @@ -7614,33 +6093,6 @@ "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", "dev": true }, - "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.4", "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.4.tgz", @@ -7653,12 +6105,6 @@ "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", "dev": true }, - "neo-async": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.1.tgz", - "integrity": "sha512-3KL3fvuRkZ7s4IFOMfztb7zJp3QaVWnBeGoJlgB38XnCRPj/0tLzzLG5IB8NYOHbJ8g8UGrgZv44GLDk6CxTxA==", - "dev": true - }, "netmask": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/netmask/-/netmask-1.0.6.tgz", @@ -7672,26 +6118,10 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, - "node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", - "dev": true, - "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" - } - }, - "node-forge": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz", - "integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ==", - "dev": true - }, "node-gyp": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.7.0.tgz", - "integrity": "sha512-qDQE/Ft9xXP6zphwx4sD0t+VhwV7yFaloMpfbL2QnnDZcyaiakWlLdtFGGQfTAwpFHdpbRhRxVhIHN1OKAjgbg==", + "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", @@ -7701,214 +6131,116 @@ "nopt": "2 || 3", "npmlog": "0 || 1 || 2 || 3 || 4", "osenv": "0", - "request": ">=2.9.0 <2.82.0", + "request": "^2.87.0", "rimraf": "2", "semver": "~5.3.0", "tar": "^2.0.0", "which": "1" }, "dependencies": { - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "dev": true, - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "dev": true - }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "dev": true, - "requires": { - "hoek": "2.x.x" - } - }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "dev": true, - "requires": { - "boom": "2.x.x" - } - }, - "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" - } - }, - "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "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" - } - }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "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": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" + "ajv": "^5.3.0", + "har-schema": "^2.0.0" } }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "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 }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "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": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "mime-db": "~1.35.0" } }, - "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "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 }, "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", + "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.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", + "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.6.0", - "aws4": "^1.2.1", + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", + "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.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", + "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.0.0" + "uuid": "^3.3.2" } }, + "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 + }, "semver": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "dev": true, - "requires": { - "hoek": "2.x.x" - } - } - } - }, - "node-libs-browser": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", - "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", - "dev": true, - "requires": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^1.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "0.0.0", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.10.3", - "vm-browserify": "0.0.4" - }, - "dependencies": { - "buffer": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", - "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "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": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" + "psl": "^1.1.24", + "punycode": "^1.4.1" } }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "dev": true } } @@ -8317,15 +6649,6 @@ "once": "^1.3.2" } }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", @@ -8531,12 +6854,6 @@ "make-iterator": "^1.0.0" } }, - "obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true - }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -8546,12 +6863,6 @@ "ee-first": "1.1.1" } }, - "on-headers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", - "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=", - "dev": true - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -8620,44 +6931,18 @@ "readable-stream": "^2.0.1" } }, - "original": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz", - "integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==", - "dev": true, - "requires": { - "url-parse": "^1.4.3" - } - }, "os": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/os/-/os-0.1.1.tgz", "integrity": "sha1-IIhF6J4ZOtTZcUdLk5R3NqVtE/M=", "dev": true }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", - "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": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true, - "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - } - }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -8674,12 +6959,6 @@ "os-tmpdir": "^1.0.0" } }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -8788,25 +7067,6 @@ } } }, - "pako": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", - "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", - "dev": true - }, - "parse-asn1": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", - "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", - "dev": true, - "requires": { - "asn1.js": "^4.0.0", - "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3" - } - }, "parse-bmfont-ascii": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", @@ -8820,9 +7080,9 @@ "dev": true }, "parse-bmfont-xml": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.3.tgz", - "integrity": "sha1-1rZqNxr9OcUAfZ8O6yYqTyzOe3w=", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", + "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", "dev": true, "requires": { "xml-parse-from-string": "^1.0.0", @@ -8943,12 +7203,6 @@ } } }, - "path-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", - "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", - "dev": true - }, "path-dirname": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", @@ -8967,18 +7221,6 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", @@ -9019,12 +7261,6 @@ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", "dev": true }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", - "dev": true - }, "path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -9034,19 +7270,6 @@ "pify": "^3.0.0" } }, - "pbkdf2": { - "version": "3.0.16", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", - "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -9119,15 +7342,6 @@ "pngjs": "^3.0.0" } }, - "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - } - }, "plugin-error": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", @@ -9167,37 +7381,12 @@ "integrity": "sha512-1n3Z4p3IOxArEs1VRXnZ/RXdfEniAUS9jb68g58FIXMNkPJeZd+Qh4Uq7/e0LVxAQGos1eIUrqrt4FpjdnEd+Q==", "dev": true }, - "portfinder": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.16.tgz", - "integrity": "sha512-icBXCFQxzlK2PMepOM0QeEdPPFSLAaXXeuKOv5AClJlMy1oVCBrkDGJ12IZYesI/BF8mpeVco3vRCmgeBb4+hw==", - "dev": true, - "requires": { - "async": "^1.5.2", - "debug": "^2.2.0", - "mkdirp": "0.5.x" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "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 }, - "postcss-value-parser": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz", - "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=", - "dev": true - }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -9234,41 +7423,12 @@ "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, - "promise": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", - "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", - "dev": true, - "requires": { - "asap": "~2.0.3" - } - }, "promise-polyfill": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.1.0.tgz", "integrity": "sha1-36lpQ+qcEh/KTem1hoyznTRy4Fc=", "dev": true }, - "prop-types": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", - "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==", - "dev": true, - "requires": { - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" - } - }, - "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", - "dev": true, - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" - } - }, "proxy-agent": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-2.0.0.tgz", @@ -9329,30 +7489,17 @@ "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=", "dev": true }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", - "dev": true - }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, - "public-encrypt": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", - "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1" - } + "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 }, "pump": { "version": "2.0.1", @@ -9382,9 +7529,9 @@ "dev": true }, "puppeteer": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2.tgz", - "integrity": "sha512-KBgMr/ZdwIwDQWTqcAlGhnQ2Vd6p+o5B89H60XUfdmCpia2KViSZsdRjvrf2wYOxXSrpYx6OuCBzV7ppLuNjNg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0.tgz", + "integrity": "sha512-f+1DxKHPqce6CXUBz2eVO2WcATeVeQSOPG9GYaGObEZDCiCEUwG+gogjMsrvn7he2wHTqNVb5p6RUrwmr8XFBA==", "dev": true, "requires": { "debug": "^3.1.0", @@ -9448,39 +7595,12 @@ "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", "dev": true }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "dev": true - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "dev": true - }, - "querystringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", - "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==", - "dev": true - }, "quick-lru": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", "dev": true }, - "raf": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.0.tgz", - "integrity": "sha512-pDP/NMRAXoTfrhCfyfSEwJAKLaxBU9eApMeBPB1TkDouZmvPerIClV8lTAd+uF8ZiTaVl69e1FCxQrAd/VTjGw==", - "dev": true, - "requires": { - "performance-now": "^2.1.0" - } - }, "randomatic": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", @@ -9502,25 +7622,6 @@ } } }, - "randombytes": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", - "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, "range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", @@ -9571,88 +7672,17 @@ } } }, - "react": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/react/-/react-15.6.2.tgz", - "integrity": "sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=", - "dev": true, - "requires": { - "create-react-class": "^15.6.0", - "fbjs": "^0.8.9", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.0", - "prop-types": "^15.5.10" - } - }, - "react-lifecycles-compat": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", - "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==", - "dev": true - }, - "react-modal": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.5.1.tgz", - "integrity": "sha512-GxL7ycOgKC+p641cR+V1bw5dC1faL2N86/AJlzbMVmvt1totoylgkJmn9zvLuHeuarGbB7CLfHMGpeRowaj2jQ==", - "dev": true, - "requires": { - "exenv": "^1.2.0", - "prop-types": "^15.5.10", - "react-lifecycles-compat": "^3.0.0", - "warning": "^3.0.0" - } - }, - "react-motion": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/react-motion/-/react-motion-0.5.2.tgz", - "integrity": "sha512-9q3YAvHoUiWlP3cK0v+w1N5Z23HXMj4IF4YuvjvWegWqNPfLXsOBE/V7UvQGpXxHFKRQQcNcVQE31g9SB/6qgQ==", - "dev": true, - "requires": { - "performance-now": "^0.2.0", - "prop-types": "^15.5.8", - "raf": "^3.1.0" - }, - "dependencies": { - "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", - "dev": true - } - } - }, - "react-redux": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-5.0.7.tgz", - "integrity": "sha512-5VI8EV5hdgNgyjfmWzBbdrqUkrVRKlyTKk1sGH3jzM2M2Mhj/seQgPXaz6gVAj2lz/nz688AdTqMO18Lr24Zhg==", - "dev": true, - "requires": { - "hoist-non-react-statics": "^2.5.0", - "invariant": "^2.0.0", - "lodash": "^4.17.5", - "lodash-es": "^4.17.5", - "loose-envify": "^1.1.0", - "prop-types": "^15.6.0" - } - }, - "react-sticky": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/react-sticky/-/react-sticky-6.0.3.tgz", - "integrity": "sha512-LNH4UJlRatOqo29/VHxDZOf6fwbgfgcHO4mkEFvrie5FuaZCSTGtug5R8NGqJ0kSnX8gHw8qZN37FcvnFBJpTQ==", - "dev": true, - "requires": { - "prop-types": "^15.5.8", - "raf": "^3.3.0" - } - }, - "react-toggle-button": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/react-toggle-button/-/react-toggle-button-2.2.0.tgz", - "integrity": "sha1-obkhQ6oN9BRkL8sUHwh59UW8Wok=", + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, + "optional": true, "requires": { - "prop-types": "^15.6.0", - "react-motion": "^0.5.2" + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" } }, "read-chunk": { @@ -9754,18 +7784,6 @@ "dev": true, "optional": true }, - "redux": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/redux/-/redux-3.7.2.tgz", - "integrity": "sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==", - "dev": true, - "requires": { - "lodash": "^4.2.1", - "lodash-es": "^4.2.1", - "loose-envify": "^1.1.0", - "symbol-observable": "^1.0.3" - } - }, "regenerator-runtime": { "version": "0.10.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", @@ -9959,15 +7977,6 @@ "path-parse": "^1.0.5" } }, - "resolve-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", - "dev": true, - "requires": { - "resolve-from": "^3.0.0" - } - }, "resolve-dir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", @@ -9978,12 +7987,6 @@ "global-modules": "^1.0.0" } }, - "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", - "dev": true - }, "resolve-options": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz", @@ -9999,14 +8002,11 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "dev": true, - "requires": { - "align-text": "^0.1.1" - } + "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", @@ -10017,33 +8017,20 @@ "glob": "^7.0.5" } }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, "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 }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "samsam": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz", - "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=", - "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" + } }, "sass-graph": { "version": "2.2.4", @@ -10247,21 +8234,6 @@ } } }, - "select-hose": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", - "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", - "dev": true - }, - "selfsigned": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.3.tgz", - "integrity": "sha512-vmZenZ+8Al3NLHkWnhBQ0x6BkML1eCP2xEi3JE+f3D9wW9fipD9NNJHYtE9XJM4TsPaHGZJIamrSI6MTg1dU2Q==", - "dev": true, - "requires": { - "node-forge": "0.7.5" - } - }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", @@ -10277,77 +8249,12 @@ "sver-compat": "^1.5.0" } }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "dev": true, - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "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.4.0" - }, - "dependencies": { - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", - "dev": true - } - } - }, - "serve-index": { - "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.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - } - }, - "serve-static": { - "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.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, "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-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-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", @@ -10366,43 +8273,12 @@ "split-string": "^3.0.1" } }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", - "dev": true - }, "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", "dev": true }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, "shellwords": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", @@ -10420,18 +8296,6 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "sinon": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz", - "integrity": "sha1-RUKk9JugxFwF6y6d2dID4rjv4L8=", - "dev": true, - "requires": { - "formatio": "1.1.1", - "lolex": "1.3.2", - "samsam": "1.1.2", - "util": ">=0.10.3 <1" - } - }, "slack-node": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/slack-node/-/slack-node-0.2.0.tgz", @@ -10459,9 +8323,9 @@ } }, "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", @@ -10471,7 +8335,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": { @@ -10539,6 +8403,12 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true + }, + "use": { + "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 } } }, @@ -10651,41 +8521,6 @@ } } }, - "sockjs": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.19.tgz", - "integrity": "sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw==", - "dev": true, - "requires": { - "faye-websocket": "^0.10.0", - "uuid": "^3.0.1" - } - }, - "sockjs-client": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.1.4.tgz", - "integrity": "sha1-W6vjhrd15M8U51IJEUUmVAFsixI=", - "dev": true, - "requires": { - "debug": "^2.6.6", - "eventsource": "0.1.6", - "faye-websocket": "~0.11.0", - "inherits": "^2.0.1", - "json3": "^3.3.2", - "url-parse": "^1.1.8" - }, - "dependencies": { - "faye-websocket": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.1.tgz", - "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", - "dev": true, - "requires": { - "websocket-driver": ">=0.5.1" - } - } - } - }, "socks": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/socks/-/socks-1.1.10.tgz", @@ -10725,12 +8560,6 @@ } } }, - "source-list-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", - "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", - "dev": true - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -10794,35 +8623,6 @@ "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", "dev": true }, - "spdy": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-3.4.7.tgz", - "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=", - "dev": true, - "requires": { - "debug": "^2.6.8", - "handle-thing": "^1.2.5", - "http-deceiver": "^1.2.7", - "safe-buffer": "^5.0.1", - "select-hose": "^2.0.0", - "spdy-transport": "^2.0.18" - } - }, - "spdy-transport": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-2.1.0.tgz", - "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==", - "dev": true, - "requires": { - "debug": "^2.6.8", - "detect-node": "^2.0.3", - "hpack.js": "^2.1.6", - "obuf": "^1.1.1", - "readable-stream": "^2.2.9", - "safe-buffer": "^5.0.1", - "wbuf": "^1.7.2" - } - }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -10968,67 +8768,12 @@ "readable-stream": "^2.0.1" } }, - "stream-browserify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", - "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", - "dev": true, - "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" - } - }, "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-http": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", - "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", - "dev": true, - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" - }, - "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 - }, - "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" - } - } - } - }, "stream-shift": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", @@ -11116,9 +8861,9 @@ } }, "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==", "dev": true }, "strip-ansi": { @@ -11145,56 +8890,18 @@ "is-regexp": "^1.0.0" } }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, "strip-indent": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", "dev": true }, - "styled-components": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-2.4.1.tgz", - "integrity": "sha1-ZjvQSF1LarRvlGIQ3APSOY0a3nQ=", + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, - "requires": { - "buffer": "^5.0.3", - "css-to-react-native": "^2.0.3", - "fbjs": "^0.8.9", - "hoist-non-react-statics": "^1.2.0", - "is-plain-object": "^2.0.1", - "prop-types": "^15.5.4", - "stylis": "^3.4.0", - "supports-color": "^3.2.3" - }, - "dependencies": { - "hoist-non-react-statics": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz", - "integrity": "sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "requires": { - "has-flag": "^1.0.0" - } - } - } - }, - "stylis": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.3.tgz", - "integrity": "sha512-TxU0aAscJghF9I3V9q601xcK3Uw1JbXvpsBGj/HULqexKOKlOEzzlIpLFRbKkCK990ccuxfXUqmPbIIo7Fq/cQ==", - "dev": true + "optional": true }, "supports-color": { "version": "2.0.0", @@ -11212,18 +8919,6 @@ "es6-symbol": "^3.1.1" } }, - "symbol-observable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", - "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", - "dev": true - }, - "tapable": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz", - "integrity": "sha1-mTcqXJmb8t8WCvwNdL7U9HlIzSI=", - "dev": true - }, "tar": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", @@ -11292,27 +8987,12 @@ "dev": true, "optional": true }, - "thunky": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.0.2.tgz", - "integrity": "sha1-qGLgGOP7HqLsP85dVWBc9X8kc3E=", - "dev": true - }, "time-stamp": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", "dev": true }, - "timers-browserify": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", - "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", - "dev": true, - "requires": { - "setimmediate": "^1.0.4" - } - }, "timespan": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/timespan/-/timespan-2.3.0.tgz", @@ -11351,12 +9031,6 @@ "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", "dev": true }, - "to-arraybuffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", - "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", - "dev": true - }, "to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", @@ -11533,12 +9207,6 @@ "dev": true, "optional": true }, - "tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", - "dev": true - }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -11580,61 +9248,6 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, - "ua-parser-js": { - "version": "0.7.18", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.18.tgz", - "integrity": "sha512-LtzwHlVHwFGTptfNSgezHp7WUlwiqb0gA9AALRbKaERfxwJoiX0A73QbTToxteIAuIaFshhgIZfqK8s7clqgnA==", - "dev": true - }, - "uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "dev": true, - "requires": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" - }, - "dependencies": { - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true - }, - "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true, - "optional": true - }, - "uglifyjs-webpack-plugin": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz", - "integrity": "sha1-uVH0q7a9YX5m9j64kUmOORdj4wk=", - "dev": true, - "requires": { - "source-map": "^0.5.6", - "uglify-js": "^2.8.29", - "webpack-sources": "^1.0.1" - } - }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", @@ -11764,57 +9377,12 @@ "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", "dev": true }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "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 }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", - "dev": true - } - } - }, - "url-parse": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", - "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", - "dev": true, - "requires": { - "querystringify": "^2.0.0", - "requires-port": "^1.0.0" - } - }, "url-regex": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/url-regex/-/url-regex-3.2.0.tgz", @@ -11824,85 +9392,6 @@ "ip-regex": "^1.0.1" } }, - "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 - } - } - }, "useragent": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.2.1.tgz", @@ -11980,12 +9469,6 @@ "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=", "dev": true }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", - "dev": true - }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -12250,466 +9733,62 @@ "source-map": "^0.5.1" } }, - "vm-browserify": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", - "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", - "dev": true, - "requires": { - "indexof": "0.0.1" - } - }, "void-elements": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", "dev": true }, - "warning": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", - "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=", + "when": { + "version": "3.7.8", + "resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", + "integrity": "sha1-xxMLan6gRpPoQs3J56Hyqjmjn4I=", + "dev": true, + "optional": true + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "loose-envify": "^1.0.0" + "isexe": "^2.0.0" } }, - "watchpack": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", - "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, "requires": { - "chokidar": "^2.0.2", - "graceful-fs": "^4.1.2", - "neo-async": "^2.5.0" - } - }, - "wbuf": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", - "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", - "dev": true, - "requires": { - "minimalistic-assert": "^1.0.0" - } - }, - "webpack": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.12.0.tgz", - "integrity": "sha512-Sw7MdIIOv/nkzPzee4o0EdvCuPmxT98+vVpIvwtcwcF1Q4SDSNp92vwcKc4REe7NItH9f1S4ra9FuQ7yuYZ8bQ==", - "dev": true, - "requires": { - "acorn": "^5.0.0", - "acorn-dynamic-import": "^2.0.0", - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0", - "async": "^2.1.2", - "enhanced-resolve": "^3.4.0", - "escope": "^3.6.0", - "interpret": "^1.0.0", - "json-loader": "^0.5.4", - "json5": "^0.5.1", - "loader-runner": "^2.3.0", - "loader-utils": "^1.1.0", - "memory-fs": "~0.4.1", - "mkdirp": "~0.5.0", - "node-libs-browser": "^2.0.0", - "source-map": "^0.5.3", - "supports-color": "^4.2.1", - "tapable": "^0.2.7", - "uglifyjs-webpack-plugin": "^0.4.6", - "watchpack": "^1.4.0", - "webpack-sources": "^1.0.1", - "yargs": "^8.0.2" + "string-width": "^1.0.2 || 2" + } + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "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" }, "dependencies": { - "ajv": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.2.tgz", - "integrity": "sha512-hOs7GfvI6tUI1LfZddH82ky6mOMyTuY0mk7kE2pWpmhhUSkumzaTO5vbVwij39MdwPQWCV4Zv57Eo06NtL/GVA==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.1" - } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "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": { - "has-flag": "^2.0.0" - } - } - } - }, - "webpack-dev-middleware": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.12.2.tgz", - "integrity": "sha512-FCrqPy1yy/sN6U/SaEZcHKRXGlqU0DUaEBL45jkUYoB8foVb6wCnbIJ1HKIx+qUFTW+3JpVcCJCxZ8VATL4e+A==", - "dev": true, - "requires": { - "memory-fs": "~0.4.1", - "mime": "^1.5.0", - "path-is-absolute": "^1.0.0", - "range-parser": "^1.0.3", - "time-stamp": "^2.0.0" - }, - "dependencies": { - "time-stamp": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.1.tgz", - "integrity": "sha512-KUnkvOWC3C+pEbwE/0u3CcmNpGCDqkYGYZOphe1QFxApYQkJ5g195TDBjgZch/zG6chU1NcabLwnM7BCpWAzTQ==", - "dev": true - } - } - }, - "webpack-dev-server": { - "version": "2.11.2", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.11.2.tgz", - "integrity": "sha512-zrPoX97bx47vZiAXfDrkw8pe9QjJ+lunQl3dypojyWwWr1M5I2h0VSrMPfTjopHQPRNn+NqfjcMmhoLcUJe2gA==", - "dev": true, - "requires": { - "ansi-html": "0.0.7", - "array-includes": "^3.0.3", - "bonjour": "^3.5.0", - "chokidar": "^2.0.0", - "compression": "^1.5.2", - "connect-history-api-fallback": "^1.3.0", - "debug": "^3.1.0", - "del": "^3.0.0", - "express": "^4.16.2", - "html-entities": "^1.2.0", - "http-proxy-middleware": "~0.17.4", - "import-local": "^1.0.0", - "internal-ip": "1.2.0", - "ip": "^1.1.5", - "killable": "^1.0.0", - "loglevel": "^1.4.1", - "opn": "^5.1.0", - "portfinder": "^1.0.9", - "selfsigned": "^1.9.1", - "serve-index": "^1.7.2", - "sockjs": "0.3.19", - "sockjs-client": "1.1.4", - "spdy": "^3.4.1", - "strip-ansi": "^3.0.0", - "supports-color": "^5.1.0", - "webpack-dev-middleware": "1.12.2", - "yargs": "6.6.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 - }, - "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" - } - }, - "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" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "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": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "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-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" - } - }, - "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-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 - }, - "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" - } - }, - "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" - } - }, - "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" - } - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.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 - }, - "yargs": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz", - "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", - "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": "^4.2.0" - } - }, - "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": "^3.0.0" - } - } - } - }, - "webpack-sources": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", - "integrity": "sha512-aqYp18kPphgoO5c/+NaUvEeACtZjMESmDChuD3NBciVpah3XpMEU9VAAtIaB1BsfJWWTSdv8Vv1m3T0aRk2dUw==", - "dev": true, - "requires": { - "source-list-map": "^2.0.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 - } - } - }, - "websocket-driver": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", - "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", - "dev": true, - "requires": { - "http-parser-js": ">=0.4.0", - "websocket-extensions": ">=0.1.1" - } - }, - "websocket-extensions": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", - "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", - "dev": true - }, - "whatwg-fetch": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz", - "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==", - "dev": true - }, - "when": { - "version": "3.7.8", - "resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", - "integrity": "sha1-xxMLan6gRpPoQs3J56Hyqjmjn4I=", - "dev": true, - "optional": true - }, - "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" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true - }, - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "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" - }, - "dependencies": { - "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" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } } } @@ -12800,119 +9879,6 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, - "yargs": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", - "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "read-pkg-up": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^7.0.0" - }, - "dependencies": { - "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" - }, - "dependencies": { - "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" - } - } - } - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - } - }, - "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" - } - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - } - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } - } - } - }, "yargs-parser": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", diff --git a/uk.co.compucorp.civicrm.hrcore/package.json b/uk.co.compucorp.civicrm.hrcore/package.json index ea96d763584..145776c9d16 100644 --- a/uk.co.compucorp.civicrm.hrcore/package.json +++ b/uk.co.compucorp.civicrm.hrcore/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "ansi-colors": "^1.1.0", - "backstopjs": "^3.5.2", + "backstopjs": "^3.5.4", "civicrm-scssroot": "git://github.com/totten/civicrm-scssroot.git#v0.1.1", "detect-installed": "^2.0.4", "es6-promise": "^4.2.4", From 0e36c184c215e664775c4c126488dfd8b48af4cb Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 15:03:04 +0200 Subject: [PATCH 145/151] PCHR-4046: (hrcore) Use gulp-sass-glob --- .../gulp/tasks/sass.js | 4 +- .../package-lock.json | 292 +----------------- uk.co.compucorp.civicrm.hrcore/package.json | 2 +- 3 files changed, 20 insertions(+), 278 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js index 96ab5914dba..42ceaf676c2 100644 --- a/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js +++ b/uk.co.compucorp.civicrm.hrcore/gulp/tasks/sass.js @@ -1,4 +1,4 @@ -var bulk = require('gulp-sass-bulk-import'); +var glob = require('gulp-sass-glob'); var civicrmScssRoot = require('civicrm-scssroot')(); var gulp = require('gulp'); var path = require('path'); @@ -57,7 +57,7 @@ function mainTask (cb) { var extPath = utils.getExtensionPath(); return gulp.src(path.join(extPath, '/scss/*.scss')) - .pipe(bulk()) + .pipe(glob()) .pipe(sass({ outputStyle: 'compressed', includePaths: civicrmScssRoot.getPath(), diff --git a/uk.co.compucorp.civicrm.hrcore/package-lock.json b/uk.co.compucorp.civicrm.hrcore/package-lock.json index 7a37127004d..acada6ce328 100644 --- a/uk.co.compucorp.civicrm.hrcore/package-lock.json +++ b/uk.co.compucorp.civicrm.hrcore/package-lock.json @@ -1479,23 +1479,6 @@ "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", "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" - }, - "dependencies": { - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - } - } - }, "define-properties": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", @@ -2238,11 +2221,6 @@ "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=" - }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -2277,11 +2255,6 @@ "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=" - }, "flagged-respawn": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz", @@ -3325,20 +3298,11 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "lru-cache": "2" } } } }, - "glob2base": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", - "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", - "requires": { - "find-index": "^0.1.1" - } - }, "global": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", @@ -3943,231 +3907,17 @@ } } }, - "gulp-sass-bulk-import": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gulp-sass-bulk-import/-/gulp-sass-bulk-import-1.0.1.tgz", - "integrity": "sha1-AvHW0xDgGOae/iUlgRpOc4E5ZCM=", + "gulp-sass-glob": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/gulp-sass-glob/-/gulp-sass-glob-1.0.9.tgz", + "integrity": "sha512-5NgvOYE8OrYj3hmxL4Tf79qdxRTJXe2UdAM+L6R/qu4h9ZPvoujtPYk/CmpNReuBJdDXR2DNWeq6t58NFARYUA==", "dev": true, "requires": { - "glob": "^4.0.6", - "through2": "^0.6.3", - "vinyl-fs": "^0.3.9" - }, - "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", - "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 - }, - "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" - } - }, - "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" - } - }, - "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" - } - }, - "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" - } - } - } - }, - "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" - } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", - "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": "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" - } - }, - "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 - }, - "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" - } - }, - "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-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" - } - }, - "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" - } - }, - "unique-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", - "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=", - "dev": true - }, - "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-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" - } - } + "glob": "^7.1.2", + "minimatch": "^3.0.4", + "safe-buffer": "^5.1.1", + "slash": "^2.0.0", + "through2": "^2.0.3" } }, "gulp-strip-css-comments": { @@ -6093,12 +5843,6 @@ "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", "dev": true }, - "natives": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.4.tgz", - "integrity": "sha512-Q29yeg9aFKwhLVdkTAejM/HvYG0Y1Am1+HUkFQGn5k2j8GS+v60TVmZh6nujpEAj/qql+wGUrlryO8bF+b1jEg==", - "dev": true - }, "negotiator": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", @@ -8285,11 +8029,6 @@ "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", "dev": true }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" - }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -8306,6 +8045,12 @@ "requestretry": "^1.2.2" } }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true + }, "smart-buffer": { "version": "1.1.15", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-1.1.15.tgz", @@ -9579,7 +9324,6 @@ "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", "requires": { "glob": "^4.3.1", - "glob2base": "^0.0.12", "minimatch": "^2.0.1", "ordered-read-streams": "^0.1.0", "through2": "^0.6.1", @@ -9629,8 +9373,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "lru-cache": "2" } } } @@ -9690,7 +9433,6 @@ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", "requires": { - "first-chunk-stream": "^1.0.0", "is-utf8": "^0.2.0" } }, diff --git a/uk.co.compucorp.civicrm.hrcore/package.json b/uk.co.compucorp.civicrm.hrcore/package.json index 145776c9d16..28ffbbca1e2 100644 --- a/uk.co.compucorp.civicrm.hrcore/package.json +++ b/uk.co.compucorp.civicrm.hrcore/package.json @@ -19,7 +19,7 @@ "gulp-rename": "^1.4.0", "gulp-replace": "^1.0.0", "gulp-sass": "^4.0.1", - "gulp-sass-bulk-import": "^1.0.1", + "gulp-sass-glob": "^1.0.9", "gulp-strip-css-comments": "^2.0.0", "jasmine-core": "^2.99.1", "karma": "^2.0.2", From d71cbe78a3469b205e5a2ae7258a2c8449228ccb Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 15:08:41 +0200 Subject: [PATCH 146/151] PCHR-4046: (hrcore) Update to karma v3 --- .../package-lock.json | 1860 ++--------------- uk.co.compucorp.civicrm.hrcore/package.json | 2 +- 2 files changed, 213 insertions(+), 1649 deletions(-) diff --git a/uk.co.compucorp.civicrm.hrcore/package-lock.json b/uk.co.compucorp.civicrm.hrcore/package-lock.json index acada6ce328..09e5635f850 100644 --- a/uk.co.compucorp.civicrm.hrcore/package-lock.json +++ b/uk.co.compucorp.civicrm.hrcore/package-lock.json @@ -43,13 +43,6 @@ "negotiator": "0.6.1" } }, - "addressparser": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/addressparser/-/addressparser-1.0.1.tgz", - "integrity": "sha1-R6++GiqSYhkdtoOOT9HTm0CCF0Y=", - "dev": true, - "optional": true - }, "after": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", @@ -83,49 +76,6 @@ "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", "dev": true }, - "amqplib": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/amqplib/-/amqplib-0.5.2.tgz", - "integrity": "sha512-l9mCs6LbydtHqRniRwYkKdqxVa6XMz3Vw1fh+2gJaaVgTM6Jk3o8RccAKWKtlhT1US5sWrFh+KKxsVUALURSIA==", - "dev": true, - "optional": true, - "requires": { - "bitsyntax": "~0.0.4", - "bluebird": "^3.4.6", - "buffer-more-ints": "0.0.2", - "readable-stream": "1.x >=1.1.9", - "safe-buffer": "^5.0.1" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true, - "optional": 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, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "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, - "optional": true - } - } - }, "ansi-colors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", @@ -373,13 +323,6 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, - "ast-types": { - "version": "0.11.3", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.11.3.tgz", - "integrity": "sha512-XA5o5dsNw8MhyW0Q7MWXJWc4oOzZKbdsEJq45h7c8q/d9DwWZ5F2ugUc1PuMLPGsUnphCt/cNDHu8JeBbxf1qA==", - "dev": true, - "optional": true - }, "async-chain-proxy": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/async-chain-proxy/-/async-chain-proxy-0.1.5.tgz", @@ -435,9 +378,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-sign2": { @@ -452,28 +395,6 @@ "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", "dev": true }, - "axios": { - "version": "0.15.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.15.3.tgz", - "integrity": "sha1-LJ1jiy4ZGgjqHWzJiOrda6W9wFM=", - "dev": true, - "optional": true, - "requires": { - "follow-redirects": "1.0.0" - }, - "dependencies": { - "follow-redirects": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.0.0.tgz", - "integrity": "sha1-jjQpjL0uF28lTv/sdaHHjMhJ/Tc=", - "dev": true, - "optional": true, - "requires": { - "debug": "^2.2.0" - } - } - } - }, "babel-polyfill": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", @@ -620,50 +541,6 @@ "integrity": "sha512-XBaoWE9RW8pPdPQNibZsW2zh8TW6gcarXp1FZPwT8Uop8ScSNldJEWf2k9l3HeTqdrEwsOsFcq74RiJECW34yA==", "dev": true }, - "bitsyntax": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.0.4.tgz", - "integrity": "sha1-6xDMb4K4xJDj6FaY8H6D1G4MuoI=", - "dev": true, - "optional": true, - "requires": { - "buffer-more-ints": "0.0.2" - } - }, - "bl": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.1.2.tgz", - "integrity": "sha1-/cqHGplxOqANGeO7ukHER4emU5g=", - "dev": true, - "optional": true, - "requires": { - "readable-stream": "~2.0.5" - }, - "dependencies": { - "readable-stream": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" - } - }, - "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, - "optional": true - } - } - }, "blob": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", @@ -692,27 +569,27 @@ "dev": true }, "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", "dev": true, "requires": { "bytes": "3.0.0", "content-type": "~1.0.4", "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" }, "dependencies": { - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "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 } } @@ -754,40 +631,40 @@ "to-regex": "^3.0.1" } }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, "buffer-equal": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=", "dev": true }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "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 }, - "buffer-more-ints": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-0.0.2.tgz", - "integrity": "sha1-JrOIXRD6E9t/wBquOquHAZngEkw=", - "dev": true - }, - "buildmail": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/buildmail/-/buildmail-4.0.1.tgz", - "integrity": "sha1-h393OLeHKYccmhBeO4N9K+EaenI=", - "dev": true, - "optional": true, - "requires": { - "addressparser": "1.0.1", - "libbase64": "0.1.0", - "libmime": "3.0.0", - "libqp": "1.1.0", - "nodemailer-fetch": "1.6.0", - "nodemailer-shared": "1.1.0", - "punycode": "1.4.1" - } - }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -949,9 +826,9 @@ } }, "circular-json": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.3.tgz", - "integrity": "sha512-YlxLOimeIoQGHnMe3kbf8qIV2Bj7uXLbljMPRguNT49GmSAzooNfS9EJ91rSJKbLBOOzM5agvtx0WyechZN/Hw==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.5.tgz", + "integrity": "sha512-13YaR6kiz0kBNmIVM87Io8Hp7bWOo4r61vkEANy8iH9R9bc6avud/1FT0SBpqR1RpIQADOh/Q+yHZDA1iL6ysA==", "dev": true }, "civicrm-cv": { @@ -1241,29 +1118,6 @@ "finalhandler": "1.1.0", "parseurl": "~1.3.2", "utils-merge": "1.0.1" - }, - "dependencies": { - "finalhandler": { - "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.6.9", - "encodeurl": "~1.0.1", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.3.1", - "unpipe": "~1.0.0" - } - }, - "statuses": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", - "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", - "dev": true - } } }, "console-control-strings": { @@ -1380,13 +1234,6 @@ "assert-plus": "^1.0.0" } }, - "data-uri-to-buffer": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-1.2.0.tgz", - "integrity": "sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ==", - "dev": true, - "optional": true - }, "date-format": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz", @@ -1449,13 +1296,6 @@ "dev": true, "optional": true }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true, - "optional": true - }, "default-compare": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz", @@ -1506,18 +1346,6 @@ "is-descriptor": "^1.0.0" } }, - "degenerator": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-1.0.4.tgz", - "integrity": "sha1-/PSQo37OJmRk2cxDGrmMWBnO0JU=", - "dev": true, - "optional": true, - "requires": { - "ast-types": "0.x.x", - "escodegen": "1.x.x", - "esprima": "3.x.x" - } - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -1575,13 +1403,6 @@ "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=", "dev": true }, - "double-ended-queue": { - "version": "2.1.0-0", - "resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz", - "integrity": "sha1-ED01J/0xUo9AGIEwyEHv3XgmTlw=", - "dev": true, - "optional": true - }, "duplexify": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", @@ -1685,9 +1506,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", @@ -1695,7 +1516,6 @@ "cookie": "0.3.1", "debug": "~3.1.0", "engine.io-parser": "~2.1.0", - "uws": "~9.14.0", "ws": "~3.3.1" }, "dependencies": { @@ -1711,9 +1531,9 @@ } }, "engine.io-client": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.1.6.tgz", - "integrity": "sha512-hnuHsFluXnsKOndS4Hv6SvUrgdYx1pk2NqfaDMW+GWdgfU3+/V25Cj7I8a0x92idSpa5PIhJRKxPvp9mnoLsfg==", + "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", @@ -1839,49 +1659,6 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "escodegen": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.1.tgz", - "integrity": "sha512-6hTjO1NAWkHnDk3OqQ4YrCuwwmGHL9S3nPlzBOUG/R44rda3wLNrfvQ5fkSGjyhHFKM7ALPKcKGrwvCLe0lC7Q==", - "dev": true, - "optional": true, - "requires": { - "esprima": "^3.1.3", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "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, - "optional": true - } - } - }, - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true, - "optional": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true, - "optional": true - }, "eventemitter3": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", @@ -1925,28 +1702,6 @@ "requires": { "expand-range": "^0.1.0" } - }, - "expand-range": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", - "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", - "dev": true, - "requires": { - "is-number": "^0.1.1", - "repeat-string": "^0.2.2" - } - }, - "is-number": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-0.1.1.tgz", - "integrity": "sha1-aaevEWlj1HIG7JvZtIoUIW8eOAY=", - "dev": true - }, - "repeat-string": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-0.2.2.tgz", - "integrity": "sha1-x6jTI2BoNiBZp+RlH8aITosftK4=", - "dev": true } } }, @@ -2034,53 +1789,26 @@ } }, "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", + "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", "dev": true, "requires": { - "fill-range": "^2.1.0" + "is-number": "^0.1.1", + "repeat-string": "^0.2.2" }, "dependencies": { - "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", - "dev": true, - "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^1.1.3", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - } - }, "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "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" - } + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-0.1.1.tgz", + "integrity": "sha1-aaevEWlj1HIG7JvZtIoUIW8eOAY=", + "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" - } + "repeat-string": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-0.2.2.tgz", + "integrity": "sha1-x6jTI2BoNiBZp+RlH8aITosftK4=", + "dev": true } } }, @@ -2165,13 +1893,6 @@ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true, - "optional": true - }, "fd-slicer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", @@ -2187,19 +1908,6 @@ "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", "dev": true }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -2212,6 +1920,29 @@ "to-regex-range": "^2.1.0" } }, + "finalhandler": { + "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.6.9", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", + "dev": true + } + } + }, "find": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/find/-/find-0.2.9.tgz", @@ -2272,9 +2003,9 @@ } }, "follow-redirects": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz", - "integrity": "sha512-uxYePVPogtya1ktGnAAXOacnbIuRMB4dkvqeNz2qTtTQsuzSfbDolV+wMMKxAmCx0bLgAKLbBOkjItMbbkR1vg==", + "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" @@ -2949,46 +2680,6 @@ "rimraf": "2" } }, - "ftp": { - "version": "0.3.10", - "resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz", - "integrity": "sha1-kZfYYa2BQvPmPVqDv+TFn3MwiF0=", - "dev": true, - "optional": true, - "requires": { - "readable-stream": "1.1.x", - "xregexp": "2.0.0" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true, - "optional": 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, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "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, - "optional": true - } - } - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -3033,23 +2724,6 @@ "globule": "^1.0.0" } }, - "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", - "dev": true, - "optional": true - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", - "dev": true, - "optional": true, - "requires": { - "is-property": "^1.0.0" - } - }, "get-caller-file": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", @@ -3071,21 +2745,6 @@ "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", "dev": true }, - "get-uri": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-2.0.1.tgz", - "integrity": "sha512-7aelVrYqCLuVjq2kEKRTH8fXPTC0xKTkM+G7UlFkEwCXY3sFbSxvY375JoFowOAYbkaU47SrBvOefUlLZZ+6QA==", - "dev": true, - "optional": true, - "requires": { - "data-uri-to-buffer": "1", - "debug": "2", - "extend": "3", - "file-uri-to-path": "1", - "ftp": "~0.3.10", - "readable-stream": "2" - } - }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -3115,42 +2774,6 @@ "path-is-absolute": "^1.0.0" } }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" - }, - "dependencies": { - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - }, "glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -4018,9 +3641,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" @@ -4106,17 +3729,6 @@ "sntp": "2.x.x" } }, - "hipchat-notifier": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/hipchat-notifier/-/hipchat-notifier-1.1.0.tgz", - "integrity": "sha1-ttJJdVQ3wZEII2d5nTupoPI7Ix4=", - "dev": true, - "optional": true, - "requires": { - "lodash": "^4.0.0", - "request": "^2.0.0" - } - }, "hoek": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", @@ -4161,35 +3773,6 @@ "requires-port": "^1.0.0" } }, - "http-proxy-agent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-1.0.0.tgz", - "integrity": "sha1-zBzjjkU7+YSg93AtLdWcc9CBKEo=", - "dev": true, - "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3" - }, - "dependencies": { - "agent-base": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", - "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", - "dev": true, - "requires": { - "extend": "~3.0.0", - "semver": "~5.0.1" - } - }, - "semver": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", - "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=", - "dev": true - } - } - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -4201,22 +3784,6 @@ "sshpk": "^1.7.0" } }, - "httpntlm": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/httpntlm/-/httpntlm-1.6.1.tgz", - "integrity": "sha1-rQFScUOi6Hc8+uapb1hla7UqNLI=", - "dev": true, - "requires": { - "httpreq": ">=0.4.22", - "underscore": "~1.7.0" - } - }, - "httpreq": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/httpreq/-/httpreq-0.4.24.tgz", - "integrity": "sha1-QzX/2CzZaWaKOUZckprGHWOTYn8=", - "dev": true - }, "https-proxy-agent": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", @@ -4238,6 +3805,15 @@ } } }, + "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" + } + }, "in-publish": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz", @@ -4256,13 +3832,6 @@ "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", "dev": true }, - "inflection": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.10.0.tgz", - "integrity": "sha1-W//LEZetPoEFD44X4hZoCH7p6y8=", - "dev": true, - "optional": true - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -4295,12 +3864,6 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", - "dev": true - }, "ip-regex": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-1.0.3.tgz", @@ -4388,21 +3951,6 @@ "kind-of": "^6.0.2" } }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "requires": { - "is-primitive": "^2.0.0" - } - }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -4448,27 +3996,6 @@ "is-extglob": "^2.1.0" } }, - "is-my-ip-valid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", - "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", - "dev": true, - "optional": true - }, - "is-my-json-valid": { - "version": "2.17.2", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", - "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", - "dev": true, - "optional": true, - "requires": { - "generate-function": "^2.0.0", - "generate-object-property": "^1.1.0", - "is-my-ip-valid": "^1.0.0", - "jsonpointer": "^4.0.0", - "xtend": "^4.0.0" - } - }, "is-negated-glob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", @@ -4510,25 +4037,6 @@ "isobject": "^3.0.1" } }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true, - "optional": true - }, "is-regexp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", @@ -4595,10 +4103,13 @@ "dev": true }, "isbinaryfile": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.2.tgz", - "integrity": "sha1-Sj6XTsDLqQBNP8bN5yCeppNopiE=", - "dev": true + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.3.tgz", + "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", + "dev": true, + "requires": { + "buffer-alloc": "^1.2.0" + } }, "isexe": { "version": "2.0.0", @@ -4734,13 +4245,6 @@ "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", "dev": true }, - "jsonpointer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", - "dev": true, - "optional": true - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -4810,14 +4314,14 @@ "dev": true }, "karma": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/karma/-/karma-2.0.2.tgz", - "integrity": "sha1-TS25QChQpmVR+nhLAWT7CCTtjEs=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/karma/-/karma-3.0.0.tgz", + "integrity": "sha512-ZTjyuDXVXhXsvJ1E4CnZzbCjSxD6sEdzEsFYogLuZM0yqvg/mgz+O+R1jb0J7uAQeuzdY8kJgx6hSNXLwFuHIQ==", "dev": true, "requires": { "bluebird": "^3.3.0", "body-parser": "^1.16.1", - "chokidar": "^1.4.1", + "chokidar": "^2.0.3", "colors": "^1.1.0", "combine-lists": "^1.0.0", "connect": "^3.6.0", @@ -4830,151 +4334,26 @@ "http-proxy": "^1.13.0", "isbinaryfile": "^3.0.0", "lodash": "^4.17.4", - "log4js": "^2.3.9", - "mime": "^1.3.4", + "log4js": "^3.0.0", + "mime": "^2.3.1", "minimatch": "^3.0.2", "optimist": "^0.6.1", "qjobs": "^1.1.4", "range-parser": "^1.2.0", "rimraf": "^2.6.0", "safe-buffer": "^5.0.1", - "socket.io": "2.0.4", + "socket.io": "2.1.1", "source-map": "^0.6.1", "tmp": "0.0.33", "useragent": "2.2.1" }, "dependencies": { - "anymatch": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", - "dev": true, - "requires": { - "micromatch": "^2.1.5", - "normalize-path": "^2.0.0" - } - }, - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "chokidar": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", - "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", - "dev": true, - "requires": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "fsevents": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" - } - }, - "core-js": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", - "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=", - "dev": true - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", "dev": true }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "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" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5096,48 +4475,6 @@ "flush-write-stream": "^1.0.2" } }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "optional": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "libbase64": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/libbase64/-/libbase64-0.1.0.tgz", - "integrity": "sha1-YjUag5VjrF/1vSbxL2Dpgwu3UeY=", - "dev": true - }, - "libmime": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/libmime/-/libmime-3.0.0.tgz", - "integrity": "sha1-UaGp50SOy9Ms2lRCFnW7IbwJPaY=", - "dev": true, - "requires": { - "iconv-lite": "0.4.15", - "libbase64": "0.1.0", - "libqp": "1.1.0" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.15", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.15.tgz", - "integrity": "sha1-/iZaIYrGpXz+hUkn6dBMGYJe3es=", - "dev": true - } - } - }, - "libqp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/libqp/-/libqp-1.1.0.tgz", - "integrity": "sha1-9ebgatdLeU+1tbZpiL9yjvHe2+g=", - "dev": true - }, "liftoff": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", @@ -5237,24 +4574,16 @@ "dev": true }, "log4js": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-2.5.3.tgz", - "integrity": "sha512-YL/qpTxYtK0iWWbuKCrevDZz5lh+OjyHHD+mICqpjnYGKdNRBvPeh/1uYjkKUemT1CSO4wwLOwphWMpKAnD9kw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-3.0.5.tgz", + "integrity": "sha512-IX5c3G/7fuTtdr0JjOT2OIR12aTESVhsH6cEsijloYwKgcPRlO6DgOU72v0UFhWcoV1HN6+M3dwT89qVPLXm0w==", "dev": true, "requires": { - "amqplib": "^0.5.2", - "axios": "^0.15.3", - "circular-json": "^0.5.1", + "circular-json": "^0.5.5", "date-format": "^1.2.0", "debug": "^3.1.0", - "hipchat-notifier": "^1.1.0", - "loggly": "^1.1.0", - "mailgun-js": "^0.7.0", - "nodemailer": "^2.5.0", - "redis": "^2.7.1", - "semver": "^5.3.0", - "slack-node": "~0.2.0", - "streamroller": "^0.7.0" + "rfdc": "^1.1.2", + "streamroller": "0.7.0" }, "dependencies": { "debug": { @@ -5268,177 +4597,6 @@ } } }, - "loggly": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/loggly/-/loggly-1.1.1.tgz", - "integrity": "sha1-Cg/B0/o6XsRP3HuJe+uipGlc6+4=", - "dev": true, - "optional": true, - "requires": { - "json-stringify-safe": "5.0.x", - "request": "2.75.x", - "timespan": "2.3.x" - }, - "dependencies": { - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", - "dev": true, - "optional": true - }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "dev": true, - "optional": true - }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "dev": true, - "requires": { - "hoek": "2.x.x" - } - }, - "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", - "dev": true, - "optional": true - }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "dev": true, - "optional": true, - "requires": { - "boom": "2.x.x" - } - }, - "form-data": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.0.0.tgz", - "integrity": "sha1-bwrrrcxdoWwT4ezBETfYX5uIOyU=", - "dev": true, - "optional": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.11" - } - }, - "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", - "dev": true, - "optional": true, - "requires": { - "chalk": "^1.1.1", - "commander": "^2.9.0", - "is-my-json-valid": "^2.12.4", - "pinkie-promise": "^2.0.0" - } - }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "dev": true, - "optional": true, - "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" - } - }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "node-uuid": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=", - "dev": true, - "optional": true - }, - "qs": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.3.tgz", - "integrity": "sha1-HPyyXBCpsrSDBT/zn138kjOQjP4=", - "dev": true, - "optional": true - }, - "request": { - "version": "2.75.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.75.0.tgz", - "integrity": "sha1-0rgmiihtoT6qXQGt9dGMyQ9lfZM=", - "dev": true, - "optional": true, - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "bl": "~1.1.2", - "caseless": "~0.11.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.0.0", - "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", - "node-uuid": "~1.4.7", - "oauth-sign": "~0.8.1", - "qs": "~6.2.0", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "~0.4.1" - } - }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "dev": true, - "optional": true, - "requires": { - "hoek": "2.x.x" - } - }, - "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "dev": true, - "optional": true - } - } - }, "loud-rejection": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", @@ -5459,76 +4617,6 @@ "yallist": "^2.1.2" } }, - "mailcomposer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/mailcomposer/-/mailcomposer-4.0.1.tgz", - "integrity": "sha1-DhxEsqB890DuF9wUm6AJ8Zyt/rQ=", - "dev": true, - "optional": true, - "requires": { - "buildmail": "4.0.1", - "libmime": "3.0.0" - } - }, - "mailgun-js": { - "version": "0.7.15", - "resolved": "https://registry.npmjs.org/mailgun-js/-/mailgun-js-0.7.15.tgz", - "integrity": "sha1-7jZqINrGTDwVwD1sGz4O15UlKrs=", - "dev": true, - "optional": true, - "requires": { - "async": "~2.1.2", - "debug": "~2.2.0", - "form-data": "~2.1.1", - "inflection": "~1.10.0", - "is-stream": "^1.1.0", - "path-proxy": "~1.0.0", - "proxy-agent": "~2.0.0", - "q": "~1.4.0", - "tsscmp": "~1.0.0" - }, - "dependencies": { - "async": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/async/-/async-2.1.5.tgz", - "integrity": "sha1-5YfGhYCZSsZ/xW/4bTrFa9voELw=", - "dev": true, - "optional": true, - "requires": { - "lodash": "^4.14.0" - } - }, - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "dev": true, - "optional": true, - "requires": { - "ms": "0.7.1" - } - }, - "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, - "optional": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" - } - }, - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", - "dev": true, - "optional": true - } - } - }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -5788,9 +4876,9 @@ } }, "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", @@ -5849,13 +4937,6 @@ "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", "dev": true }, - "netmask": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/netmask/-/netmask-1.0.6.tgz", - "integrity": "sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU=", - "dev": true, - "optional": true - }, "next-tick": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", @@ -6269,91 +5350,6 @@ "is": "^3.2.1" } }, - "nodemailer": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-2.7.2.tgz", - "integrity": "sha1-8kLmSa7q45tsftdA73sGHEBNMPk=", - "dev": true, - "optional": true, - "requires": { - "libmime": "3.0.0", - "mailcomposer": "4.0.1", - "nodemailer-direct-transport": "3.3.2", - "nodemailer-shared": "1.1.0", - "nodemailer-smtp-pool": "2.8.2", - "nodemailer-smtp-transport": "2.7.2", - "socks": "1.1.9" - }, - "dependencies": { - "socks": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/socks/-/socks-1.1.9.tgz", - "integrity": "sha1-Yo1+TQSRJDVEWsC25Fk3bLPm1pE=", - "dev": true, - "optional": true, - "requires": { - "ip": "^1.1.2", - "smart-buffer": "^1.0.4" - } - } - } - }, - "nodemailer-direct-transport": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/nodemailer-direct-transport/-/nodemailer-direct-transport-3.3.2.tgz", - "integrity": "sha1-6W+vuQNYVglH5WkBfZfmBzilCoY=", - "dev": true, - "optional": true, - "requires": { - "nodemailer-shared": "1.1.0", - "smtp-connection": "2.12.0" - } - }, - "nodemailer-fetch": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/nodemailer-fetch/-/nodemailer-fetch-1.6.0.tgz", - "integrity": "sha1-ecSQihwPXzdbc/6IjamCj23JY6Q=", - "dev": true - }, - "nodemailer-shared": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/nodemailer-shared/-/nodemailer-shared-1.1.0.tgz", - "integrity": "sha1-z1mU4v0mjQD1zw+nZ6CBae2wfsA=", - "dev": true, - "requires": { - "nodemailer-fetch": "1.6.0" - } - }, - "nodemailer-smtp-pool": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/nodemailer-smtp-pool/-/nodemailer-smtp-pool-2.8.2.tgz", - "integrity": "sha1-LrlNbPhXgLG0clzoU7nL1ejajHI=", - "dev": true, - "optional": true, - "requires": { - "nodemailer-shared": "1.1.0", - "nodemailer-wellknown": "0.1.10", - "smtp-connection": "2.12.0" - } - }, - "nodemailer-smtp-transport": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/nodemailer-smtp-transport/-/nodemailer-smtp-transport-2.7.2.tgz", - "integrity": "sha1-A9ccdjFPFKx9vHvwM6am0W1n+3c=", - "dev": true, - "optional": true, - "requires": { - "nodemailer-shared": "1.1.0", - "nodemailer-wellknown": "0.1.10", - "smtp-connection": "2.12.0" - } - }, - "nodemailer-wellknown": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/nodemailer-wellknown/-/nodemailer-wellknown-0.1.10.tgz", - "integrity": "sha1-WG24EB2zDLRDjrVGc3pBqtDPE9U=", - "dev": true - }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -6558,27 +5554,6 @@ "make-iterator": "^1.0.0" } }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true, - "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" - }, - "dependencies": { - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - } - } - }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -6642,30 +5617,6 @@ } } }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "optional": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - }, - "dependencies": { - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true, - "optional": true - } - } - }, "ordered-read-streams": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", @@ -6703,114 +5654,36 @@ "os-tmpdir": "^1.0.0" } }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", - "dev": true - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "pac-proxy-agent": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-1.1.0.tgz", - "integrity": "sha512-QBELCWyLYPgE2Gj+4wUEiMscHrQ8nRPBzYItQNOHWavwBt25ohZHQC4qnd5IszdVVrFbLsQ+dPkm6eqdjJAmwQ==", - "dev": true, - "optional": true, - "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3", - "get-uri": "2", - "http-proxy-agent": "1", - "https-proxy-agent": "1", - "pac-resolver": "~2.0.0", - "raw-body": "2", - "socks-proxy-agent": "2" - }, - "dependencies": { - "agent-base": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", - "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", - "dev": true, - "requires": { - "extend": "~3.0.0", - "semver": "~5.0.1" - } - }, - "https-proxy-agent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz", - "integrity": "sha1-NffabEjOTdv6JkiRrFk+5f+GceY=", - "dev": true, - "optional": true, - "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3" - } - }, - "semver": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", - "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=", - "dev": true - } + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" } }, - "pac-resolver": { + "p-locate": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-2.0.0.tgz", - "integrity": "sha1-mbiNLxk/ve78HJpSnB8yYKtSd80=", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, - "optional": true, "requires": { - "co": "~3.0.6", - "degenerator": "~1.0.2", - "ip": "1.0.1", - "netmask": "~1.0.4", - "thunkify": "~2.1.1" - }, - "dependencies": { - "co": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/co/-/co-3.0.6.tgz", - "integrity": "sha1-FEXyJsXrlWE45oyawwFn6n0ua9o=", - "dev": true, - "optional": true - }, - "ip": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.0.1.tgz", - "integrity": "sha1-x+NWzeoiWucbNtcPLnGpK6TkJZA=", - "dev": true, - "optional": true - } + "p-limit": "^1.1.0" } }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, "parse-bmfont-ascii": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", @@ -6844,35 +5717,6 @@ "path-root": "^0.1.1" } }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - }, "parse-headers": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", @@ -6971,25 +5815,6 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, - "path-proxy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/path-proxy/-/path-proxy-1.0.0.tgz", - "integrity": "sha1-GOijaFn8nS8aU7SN7hOFQ8Ag3l4=", - "dev": true, - "optional": true, - "requires": { - "inflection": "~1.3.0" - }, - "dependencies": { - "inflection": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.3.8.tgz", - "integrity": "sha1-y9Fg2p91sUw8xjV41POWeEvzAU4=", - "dev": true, - "optional": true - } - } - }, "path-root": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", @@ -7131,18 +5956,6 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true - }, "pretty-hrtime": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", @@ -7173,60 +5986,6 @@ "integrity": "sha1-36lpQ+qcEh/KTem1hoyznTRy4Fc=", "dev": true }, - "proxy-agent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-2.0.0.tgz", - "integrity": "sha1-V+tTR6qAXXTsaByyVknbo5yTNJk=", - "dev": true, - "optional": true, - "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3", - "http-proxy-agent": "1", - "https-proxy-agent": "1", - "lru-cache": "~2.6.5", - "pac-proxy-agent": "1", - "socks-proxy-agent": "2" - }, - "dependencies": { - "agent-base": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", - "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", - "dev": true, - "requires": { - "extend": "~3.0.0", - "semver": "~5.0.1" - } - }, - "https-proxy-agent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz", - "integrity": "sha1-NffabEjOTdv6JkiRrFk+5f+GceY=", - "dev": true, - "optional": true, - "requires": { - "agent-base": "2", - "debug": "2", - "extend": "3" - } - }, - "lru-cache": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz", - "integrity": "sha1-5W1jVBSO3o13B7WNFDIg/QjfD9U=", - "dev": true, - "optional": true - }, - "semver": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", - "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=", - "dev": true - } - } - }, "proxy-from-env": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", @@ -7320,13 +6079,6 @@ } } }, - "q": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", - "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", - "dev": true, - "optional": true - }, "qjobs": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", @@ -7345,27 +6097,6 @@ "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", "dev": true }, - "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", - "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" - } - } - } - }, "range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", @@ -7373,47 +6104,15 @@ "dev": true }, "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "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.2", - "iconv-lite": "0.4.19", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", - "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" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", - "dev": true - } } }, "rc": { @@ -7502,47 +6201,12 @@ "strip-indent": "^2.0.0" } }, - "redis": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/redis/-/redis-2.8.0.tgz", - "integrity": "sha512-M1OkonEQwtRmZv4tEWF2VgpG0JWJ8Fv1PhlgT5+B+uNq2cA3Rt1Yt/ryoR+vQNOQcIEgdCdfH0jr3bDpihAw1A==", - "dev": true, - "optional": true, - "requires": { - "double-ended-queue": "^2.1.0-0", - "redis-commands": "^1.2.0", - "redis-parser": "^2.6.0" - } - }, - "redis-commands": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.3.5.tgz", - "integrity": "sha512-foGF8u6MXGFF++1TZVC6icGXuMYPftKXt1FBT2vrfU9ZATNtZJ8duRC5d1lEfE8hyVe3jhelHGB91oB7I6qLsA==", - "dev": true, - "optional": true - }, - "redis-parser": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-2.6.0.tgz", - "integrity": "sha1-Uu0J2srBCPGmMcB+m2mUHnoZUEs=", - "dev": true, - "optional": true - }, "regenerator-runtime": { "version": "0.10.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", "dev": true }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", - "dev": true, - "requires": { - "is-equal-shallow": "^0.1.3" - } - }, "regex-not": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", @@ -7675,19 +6339,6 @@ "throttleit": "^1.0.0" } }, - "requestretry": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/requestretry/-/requestretry-1.13.0.tgz", - "integrity": "sha512-Lmh9qMvnQXADGAQxsXHP4rbgO6pffCfuR8XUBdP9aitJcLQJxhp7YZK4xAVYXnPJ5E52mwrfiKQtKonPL8xsmg==", - "dev": true, - "optional": true, - "requires": { - "extend": "^3.0.0", - "lodash": "^4.15.0", - "request": "^2.74.0", - "when": "^3.7.7" - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -7752,6 +6403,12 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "rfdc": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.2.tgz", + "integrity": "sha512-92ktAgvZhBzYTIK0Mja9uen5q5J3NRVMoDkJL2VMwq6SXjVCgqvQeVP2XAaUY6HT+XpQYeLSjb3UoitBryKmdA==", + "dev": true + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -7776,6 +6433,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", @@ -8035,38 +6698,12 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "slack-node": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/slack-node/-/slack-node-0.2.0.tgz", - "integrity": "sha1-3kuN3aqLeT9h29KTgQT9q/N9+jA=", - "dev": true, - "optional": true, - "requires": { - "requestretry": "^1.2.2" - } - }, "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true }, - "smart-buffer": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-1.1.15.tgz", - "integrity": "sha1-fxFLW2X6s+KjWqd1uxLw0cZJvxY=", - "dev": true - }, - "smtp-connection": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/smtp-connection/-/smtp-connection-2.12.0.tgz", - "integrity": "sha1-1275EnyyPCJZ7bHoNJwujV4tdME=", - "dev": true, - "requires": { - "httpntlm": "1.6.1", - "nodemailer-shared": "1.1.0" - } - }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -8198,16 +6835,28 @@ } }, "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" + } + } } }, "socket.io-adapter": { @@ -8217,35 +6866,46 @@ "dev": true }, "socket.io-client": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.0.4.tgz", - "integrity": "sha1-CRilUkBtxeVAs4Dc2Xr8SmQzL44=", + "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": "~2.6.4", - "engine.io-client": "~3.1.0", + "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.1.1", + "socket.io-parser": "~3.2.0", "to-array": "0.1.4" + }, + "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" + } + } } }, "socket.io-parser": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.1.3.tgz", - "integrity": "sha512-g0a2HPqLguqAczs3dMECuA1RgoGFPyvDqcbaDEdCWY9g59kdUAz3YRmaJBNKXflrHNwB7Q12Gkf/0CZXfdHR7g==", + "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", - "has-binary2": "~1.0.2", "isarray": "2.0.1" }, "dependencies": { @@ -8266,45 +6926,6 @@ } } }, - "socks": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/socks/-/socks-1.1.10.tgz", - "integrity": "sha1-W4t/x8jzQcU+0FbpKbe/Tei6e1o=", - "dev": true, - "requires": { - "ip": "^1.1.4", - "smart-buffer": "^1.0.13" - } - }, - "socks-proxy-agent": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-2.1.1.tgz", - "integrity": "sha512-sFtmYqdUK5dAMh85H0LEVFUCO7OhJJe1/z2x/Z6mxp3s7/QPf1RkZmpZy+BpuU0bEjcV9npqKjq9Y3kwFUjnxw==", - "dev": true, - "requires": { - "agent-base": "2", - "extend": "3", - "socks": "~1.1.5" - }, - "dependencies": { - "agent-base": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", - "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", - "dev": true, - "requires": { - "extend": "~3.0.0", - "semver": "~5.0.1" - } - }, - "semver": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", - "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=", - "dev": true - } - } - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -8499,9 +7120,9 @@ } }, "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", "dev": true }, "stdout-stream": { @@ -8725,26 +7346,12 @@ "xtend": "~4.0.0" } }, - "thunkify": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/thunkify/-/thunkify-2.1.2.tgz", - "integrity": "sha1-+qDp0jDFGsyVyhOjYawFyn4EVT0=", - "dev": true, - "optional": true - }, "time-stamp": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", "dev": true }, - "timespan": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/timespan/-/timespan-2.3.0.tgz", - "integrity": "sha1-SQLOBAvRPYRcj1myfp1ZutbzmSk=", - "dev": true, - "optional": true - }, "tinycolor2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", @@ -8945,13 +7552,6 @@ } } }, - "tsscmp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.5.tgz", - "integrity": "sha1-fcSjOvcVgatDN9qR2FylQn69mpc=", - "dev": true, - "optional": true - }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -8968,15 +7568,6 @@ "dev": true, "optional": true }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, "type-is": { "version": "1.6.16", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", @@ -9005,12 +7596,6 @@ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, - "underscore": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", - "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=", - "dev": true - }, "undertaker": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.0.tgz", @@ -9182,13 +7767,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", @@ -9481,13 +8059,6 @@ "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", "dev": true }, - "when": { - "version": "3.7.8", - "resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", - "integrity": "sha1-xxMLan6gRpPoQs3J56Hyqjmjn4I=", - "dev": true, - "optional": true - }, "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", @@ -9507,9 +8078,9 @@ } }, "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", "dev": true }, "wrap-ansi": { @@ -9597,13 +8168,6 @@ "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=", "dev": true }, - "xregexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", - "integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=", - "dev": true, - "optional": true - }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", diff --git a/uk.co.compucorp.civicrm.hrcore/package.json b/uk.co.compucorp.civicrm.hrcore/package.json index 28ffbbca1e2..7bb2a7da901 100644 --- a/uk.co.compucorp.civicrm.hrcore/package.json +++ b/uk.co.compucorp.civicrm.hrcore/package.json @@ -22,7 +22,7 @@ "gulp-sass-glob": "^1.0.9", "gulp-strip-css-comments": "^2.0.0", "jasmine-core": "^2.99.1", - "karma": "^2.0.2", + "karma": "^3.0.0", "karma-chrome-launcher": "^2.2.0", "karma-jasmine": "^1.1.1", "karma-junit-reporter": "^1.2.0", From 698d5d1144525ef034f751a833c521602815bb28 Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Thu, 16 Aug 2018 15:40:53 +0200 Subject: [PATCH 147/151] PCHR-4046: Update L&A min css file --- .../css/leaveandabsence.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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} From a88b5f0671c9b25325c1a514e78633b5ffdda04a Mon Sep 17 00:00:00 2001 From: Samson Alajede Date: Thu, 16 Aug 2018 15:46:24 +0100 Subject: [PATCH 148/151] PCHR-3797: Changed last commit patched file update to use API --- bin/apply-core-fork-patch.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/apply-core-fork-patch.sh b/bin/apply-core-fork-patch.sh index 18195d0bf8a..70d23373976 100755 --- a/bin/apply-core-fork-patch.sh +++ b/bin/apply-core-fork-patch.sh @@ -2,7 +2,8 @@ set -e -BASE_URL="https://github.com/compucorp/civicrm-core" +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: -# $BASE_URL +# $REPO_BASE_URL # $civiRoot # $PATCH_FILE # Arguments: @@ -37,7 +38,7 @@ applyPatch () { # None ####################################### createPatch () { - curl "$BASE_URL/compare/$1...$2.diff" -s -H "Accept: application/vnd.github.v3.diff" > "$civiRoot/$PATCH_FILE" + curl "$REPO_BASE_URL/compare/$1...$2.diff" -s > "$civiRoot/$PATCH_FILE" } ####################################### @@ -97,7 +98,7 @@ setCivicrmRootPath () { ####################################### updateLastCommitPatched () { # It uses the same file as temporary recipient of the full commit data - curl "$BASE_URL/commits/$1" -s > "$LAST_COMMIT_PATCHED_FILE" + curl "$API_URL_BASE/commits/$1" -s > "$LAST_COMMIT_PATCHED_FILE" sha=$(JSONValue "$LAST_COMMIT_PATCHED_FILE" "sha") echo "$sha" > "$LAST_COMMIT_PATCHED_FILE" From af749c7ef070eb641804114da1cf61a41fded19e Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Fri, 17 Aug 2018 09:04:18 +0200 Subject: [PATCH 149/151] PCHR-4046: (hremails) Auto fixes with npm audit fix --- .../email-templates/package-lock.json | 2367 ++++++++--------- .../email-templates/package.json | 4 +- .../package-lock.json | 251 +- 3 files changed, 1148 insertions(+), 1474 deletions(-) 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/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": { From 5660247f00306a5cdb763ca886054bfda4f6ffdc Mon Sep 17 00:00:00 2001 From: Alessandro Verdura Date: Fri, 17 Aug 2018 11:39:24 +0200 Subject: [PATCH 150/151] PCHR-4046: (bootstrapcivihr) Fix glob patterns --- org.civicrm.bootstrapcivihr/css/civihr.css | 2 +- org.civicrm.bootstrapcivihr/scss/civihr.scss | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/org.civicrm.bootstrapcivihr/css/civihr.css b/org.civicrm.bootstrapcivihr/css/civihr.css index cd97d7d45f6..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/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/*'; From e890bc25444c6b020342b8bd95f729230e1a5f12 Mon Sep 17 00:00:00 2001 From: Davi Alexandre Date: Mon, 20 Aug 2018 12:18:29 -0300 Subject: [PATCH 151/151] PCHR-4116: Bump version to 1.7.10 --- com.civicrm.hrjobroles/info.xml | 4 ++-- contactaccessrights/info.xml | 4 ++-- contactsummary/info.xml | 4 ++-- hrbank/info.xml | 4 ++-- hrcareer/info.xml | 4 ++-- hrcase/info.xml | 4 ++-- hrim/info.xml | 4 ++-- hrjobcontract/info.xml | 4 ++-- hrmed/info.xml | 4 ++-- hrprofile/info.xml | 4 ++-- hrqual/info.xml | 4 ++-- hrrecruitment/info.xml | 4 ++-- hrreport/info.xml | 4 ++-- hrstaffdir/info.xml | 4 ++-- hrui/info.xml | 4 ++-- org.civicrm.bootstrapcivihr/info.xml | 4 ++-- org.civicrm.hremergency/info.xml | 4 ++-- org.civicrm.reqangular/info.xml | 4 ++-- uk.co.compucorp.civicrm.hrcomments/info.xml | 4 ++-- uk.co.compucorp.civicrm.hrcontactactionsmenu/info.xml | 4 ++-- uk.co.compucorp.civicrm.hrcore/info.xml | 4 ++-- uk.co.compucorp.civicrm.hremails/info.xml | 4 ++-- uk.co.compucorp.civicrm.hrleaveandabsences/info.xml | 4 ++-- uk.co.compucorp.civicrm.hrsampledata/info.xml | 4 ++-- 24 files changed, 48 insertions(+), 48 deletions(-) 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/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/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/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/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/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/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/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/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/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/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/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/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/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.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/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/uk.co.compucorp.civicrm.hrcomments/info.xml b/uk.co.compucorp.civicrm.hrcomments/info.xml index 266b5f3c62d..e13751719a0 100644 --- a/uk.co.compucorp.civicrm.hrcomments/info.xml +++ b/uk.co.compucorp.civicrm.hrcomments/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.2 diff --git a/uk.co.compucorp.civicrm.hrcontactactionsmenu/info.xml b/uk.co.compucorp.civicrm.hrcontactactionsmenu/info.xml index 70426eb2ab6..563c14368b3 100644 --- a/uk.co.compucorp.civicrm.hrcontactactionsmenu/info.xml +++ b/uk.co.compucorp.civicrm.hrcontactactionsmenu/info.xml @@ -9,8 +9,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.hrcore/info.xml b/uk.co.compucorp.civicrm.hrcore/info.xml index e79d1f97e11..790751c8365 100644 --- a/uk.co.compucorp.civicrm.hrcore/info.xml +++ b/uk.co.compucorp.civicrm.hrcore/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/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.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.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