diff --git a/extras/deploy-scripts/pandora_agent_deploy.sh b/extras/deploy-scripts/pandora_agent_deploy.sh index a16f5afc47..88bfe4dd83 100644 --- a/extras/deploy-scripts/pandora_agent_deploy.sh +++ b/extras/deploy-scripts/pandora_agent_deploy.sh @@ -78,16 +78,16 @@ cd unix && ./pandora_agent_installer --install } -install_autodiscover () { - local arch=$1 - wget http://firefly.pandorafms.com/projects/autodiscover-linux.zip - unzip autodiscover-linux.zip - chmod +x $arch/autodiscover - mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover -} +# install_autodiscover () { +# local arch=$1 +# wget http://firefly.pandorafms.com/projects/autodiscover-linux.zip +# unzip autodiscover-linux.zip +# chmod +x $arch/autodiscover +# mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover +# } ## Main -echo "Starting PandoraFMS Agent deployment ver. $S_VERSION" +echo "Starting PandoraFMS Agent binary deployment ver. $S_VERSION" execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP' @@ -104,8 +104,6 @@ OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release [[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS [[ $OS =~ 'fedora' ]] && OS_RELEASE=$OS [[ $OS =~ 'debian' ]] && OS_RELEASE=$OS -#[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS -#[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS # initialice logfile execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE" @@ -126,6 +124,30 @@ check_repo_connection execute_cmd "grep --version" 'Checking needed tools: grep' execute_cmd "sed --version" 'Checking needed tools: sed' +# Arch check +arch=$(uname -m) +case $arch in + + x86_64) + echo -e "${cyan}Arch: $arch ${reset} " + ;; + + x86) + echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}" + exit -1 + ;; + + armv7l) + echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}" + exit -1 + ;; + + *) + echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}" + exit -1 + ;; +esac + # Creating working directory rm -rf $HOME/pandora_deploy_tmp/ &>> $LOGFILE mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE @@ -148,6 +170,10 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then # Check rh version if [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ] ; then package_manager_cmd=dnf + execute_cmd "$package_manager_cmd install -y libnsl" "Installing dependencies" + elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '9' ] ; then + package_manager_cmd=dnf + execute_cmd "$package_manager_cmd install -y libnsl libxcrypt-compat" "Installing dependencies" elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '7' ] ; then package_manager_cmd=yum @@ -158,24 +184,23 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset} # Insatall pandora agent - $package_manager_cmd install -y http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm &>> $LOGFILE - echo -en "${cyan}Installing Pandora FMS agent...${reset}" - check_cmd_status 'Error installing Pandora FMS agent' - [[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection" + [ "$PANDORA_AGENT_PACKAGE_EL" ] || PANDORA_AGENT_PACKAGE_EL="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm " + execute_cmd "$package_manager_cmd install -y ${PANDORA_AGENT_PACKAGE_EL}" 'Installing Pandora FMS agent package' + #[[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection" fi if [[ $OS_RELEASE == 'debian' ]]; then + [ "$PANDORA_AGENT_PACKAGE_UBUNTU" ] || PANDORA_AGENT_PACKAGE_UBUNTU='https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG_x86_64.tar.gz' execute_cmd "apt update" 'Updating repos' - execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies' - execute_cmd 'wget http://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz' 'Downloading Pandora FMS agent package' + execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies' + execute_cmd "curl --output pandorafms_agent_linux-7.0NG.tar.gz ${PANDORA_AGENT_PACKAGE_UBUNTU}" 'Downloading Pandora FMS agent package' execute_cmd 'install_tarball pandorafms_agent_linux-7.0NG.tar.gz' 'Installing Pandora FMS agent' - [[ $PANDORA_AGENT_SSL ]] && execute_cmd 'apt install -y libio-socket-ssl-perl' "Installing SSL libraries for encrypted connection" + #[[ $PANDORA_AGENT_SSL ]] && execute_cmd 'apt install -y libio-socket-ssl-perl' "Installing SSL libraries for encrypted connection" cd $HOME/pandora_deploy_tmp fi # Configuring Agente - [[ $PANDORA_SERVER_IP ]] && sed -i "s/^server_ip.*$/server_ip $PANDORA_SERVER_IP/g" $PANDORA_AGENT_CONF [[ $PANDORA_REMOTE_CONFIG ]] && sed -i "s/^remote_config.*$/remote_config $PANDORA_REMOTE_CONFIG/g" $PANDORA_AGENT_CONF [[ $PANDORA_GROUP ]] && sed -i "s/^group.*$/group $PANDORA_GROUP/g" $PANDORA_AGENT_CONF @@ -187,27 +212,6 @@ fi [[ $PANDORA_AGENT_SSL ]] && sed -i "s/^#server_ssl.*$/server_ssl $PANDORA_AGENT_SSL/g" $PANDORA_AGENT_CONF -#installing autodiscover - -arch=$(uname -m) -case $arch in - - x86_64) - execute_cmd 'install_autodiscover x86_64' "installing service autodiscover on $arch" 'Error unable to install autodiscovery' - ;; - - x86) - execute_cmd 'install_autodiscover x84' "installing service autodiscover on $arch" 'Error unable to install autodiscovery' - ;; - - armv7l) - echo -e "${cyan}Skiping autodiscover installation arch $arch not suported${reset}" - ;; - - *) - echo -e "${yellow}Skiping autodiscover installation arch $arch not suported${reset}" - ;; -esac #Starting pandora agent daemon. execute_cmd '/etc/init.d/pandora_agent_daemon restart' 'Starting Pandora Agent' diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index 745b464803..0a3a48950c 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -166,7 +166,7 @@ module_description User CPU Usage (%) module_min_warning 70 module_max_warning 90 module_min_critical 91 -module_max_critical 100 +module_max_critical 0 module_unit % module_end diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index 53b368f5ee..edf5a7847a 100644 --- a/pandora_agents/pc/Win32/pandora_agent.conf +++ b/pandora_agents/pc/Win32/pandora_agent.conf @@ -119,7 +119,7 @@ module_description CPU Load (%) module_min_warning 80 module_max_warning 90 module_min_critical 91 -module_max_critical 100 +module_max_critical 0 module_end # Number processes diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index fa007e26c5..4a10fb7ac8 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.773.3-230905 +Version: 7.0NG.773.3-230907 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 0e1ee31b9c..9304a38d93 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.773.3-230905" +pandora_version="7.0NG.773.3-230907" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 27b3dfd479..44f909aee8 100644 --- a/pandora_agents/unix/Darwin/pandora_agent.conf +++ b/pandora_agents/unix/Darwin/pandora_agent.conf @@ -187,7 +187,7 @@ module_description User CPU Usage (%) module_min_warning 70 module_max_warning 90 module_min_critical 91 -module_max_critical 100 +module_max_critical 0 module_end #Get load average diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index a172ae37a2..1b8131a42d 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -219,7 +219,7 @@ module_description User CPU Usage (%) module_min_warning 70 module_max_warning 90 module_min_critical 91 -module_max_critical 100 +module_max_critical 0 module_unit % module_group System module_end diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 8a1fa430db..f8fdb985c4 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1031,7 +1031,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.773.3'; -use constant AGENT_BUILD => '230905'; +use constant AGENT_BUILD => '230907'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 08a167c305..cf506511f5 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.773.3 -%define release 230905 +%define release 230907 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index adf2c178a3..7c7373124e 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.773.3 -%define release 230905 +%define release 230907 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 54e969e6f4..40ecbc015c 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.773.3 -%define release 230905 +%define release 230907 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 51fc2f84c5..60dd5f2a43 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.773.3" -PI_BUILD="230905" +PI_BUILD="230907" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 97974c62fa..d299325f3b 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -165,7 +165,7 @@ module_description User CPU Usage (%) module_min_warning 70 module_max_warning 90 module_min_critical 91 -module_max_critical 100 +module_max_critical 0 module_unit % module_group System module_end diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index cf781ede3c..5ec92eec40 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230905} +{230907} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index f1b6c611df..c9ada13790 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.773.3 Build 230905") +#define PANDORA_VERSION ("7.0NG.773.3 Build 230907") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 93923f6e30..5c694f8a90 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.773.3(Build 230905))" + VALUE "ProductVersion", "(7.0NG.773.3(Build 230907))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index d4b0f6563f..658070ae58 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.773.3-230905 +Version: 7.0NG.773.3-230907 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index a2037000f0..ff558a0de4 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.773.3-230905" +pandora_version="7.0NG.773.3-230907" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/66.sql b/pandora_console/extras/mr/66.sql index bcd0c8eb83..e0652e13a3 100644 --- a/pandora_console/extras/mr/66.sql +++ b/pandora_console/extras/mr/66.sql @@ -22,6 +22,28 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2'; UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2'; UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2'; +ALTER TABLE `tsesion_filter_log_viewer` +CHANGE COLUMN `date_range` `custom_date` INT NULL DEFAULT NULL , +CHANGE COLUMN `start_date_defined` `date` VARCHAR(45) NULL DEFAULT NULL , +CHANGE COLUMN `start_date_time` `date_text` VARCHAR(45) NULL DEFAULT NULL , +CHANGE COLUMN `start_date_date` `date_units` VARCHAR(45) NULL DEFAULT NULL , +CHANGE COLUMN `start_date_date_range` `date_init` VARCHAR(45) NULL DEFAULT NULL , +CHANGE COLUMN `start_date_time_range` `time_init` VARCHAR(45) NULL DEFAULT NULL , +CHANGE COLUMN `end_date_date_range` `date_end` VARCHAR(45) NULL DEFAULT NULL , +CHANGE COLUMN `end_date_time_range` `time_end` VARCHAR(45) NULL DEFAULT NULL ; + +ALTER TABLE `tsesion_filter` +CHANGE COLUMN `period` `date_text` VARCHAR(45) NULL DEFAULT NULL AFTER `user`; + +ALTER TABLE `tsesion_filter` +ADD COLUMN `custom_date` INT NULL AFTER `user`, +ADD COLUMN `date` VARCHAR(45) NULL AFTER `custom_date`, +ADD COLUMN `date_units` VARCHAR(45) NULL AFTER `date_text`, +ADD COLUMN `date_init` VARCHAR(45) NULL AFTER `date_units`, +ADD COLUMN `time_init` VARCHAR(45) NULL AFTER `date_init`, +ADD COLUMN `date_end` VARCHAR(45) NULL AFTER `time_init`, +ADD COLUMN `time_end` VARCHAR(45) NULL AFTER `date_end`; + ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0; ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0; ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 5fa92f8c85..701ce4894b 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1475,13 +1475,13 @@ if ($update_module === true || $create_module === true) { $plugin_pass = io_input_password( (string) get_parameter('snmp3_auth_pass') ); - $plugin_parameter = (string) get_parameter('snmp3_auth_method'); + $plugin_parameter = (string) get_parameter('snmp3_auth_method', 'MD5'); - $custom_string_1 = (string) get_parameter('snmp3_privacy_method'); + $custom_string_1 = (string) get_parameter('snmp3_privacy_method', 'DES'); $custom_string_2 = io_input_password( (string) get_parameter('snmp3_privacy_pass') ); - $custom_string_3 = (string) get_parameter('snmp3_security_level'); + $custom_string_3 = (string) get_parameter('snmp3_security_level', 'noAuthNoPriv'); } else if ($id_module_type >= 34 && $id_module_type <= 37) { $tcp_send = (string) get_parameter('command_text'); $custom_string_1 = (string) get_parameter( diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 42aa286c8a..452d2a498a 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -459,10 +459,10 @@ if ($id_agent_module) { $snmp_version = 1; $snmp3_auth_user = ''; $snmp3_auth_pass = ''; - $snmp3_auth_method = ''; - $snmp3_privacy_method = ''; + $snmp3_auth_method = 'MD5'; + $snmp3_privacy_method = 'DES'; $snmp3_privacy_pass = ''; - $snmp3_security_level = ''; + $snmp3_security_level = 'noAuthNoPriv'; // For Remote CMD. $command_text = ''; diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index 656dac2b0b..a5f0b4d184 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -405,7 +405,22 @@ push_table_simple($data, 'field_snmpv3_row1'); $data = []; $data[0] = __('Privacy method'); -$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy); +$data[1] = html_print_select( + [ + 'DES' => __('DES'), + 'AES' => __('AES'), + ], + 'snmp3_privacy_method', + $snmp3_privacy_method, + '', + '', + '', + true, + false, + false, + '', + $disabledBecauseInPolicy +); $data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true); $data[3] = html_print_input_password( 'snmp3_privacy_pass', diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 75a80d8d57..b6231544d1 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -97,7 +97,7 @@ if (is_ajax()) { if (!empty($field_description)) { // If the value is 5, this because severity in snmp alerts is not permit to show. - if (($i > 5) && ($command['id'] == 3)) { + if (($i > 5) && ($command['id'] === 3)) { $fdesc = $field_description.'
'.sprintf( __('Field %s'), ($i - 1) @@ -118,7 +118,7 @@ if (is_ajax()) { } } else { // If the macro hasn't description and doesnt appear in command, set with empty description to dont show it. - if (($i > 5) && ($command['id'] == 3)) { + if (($i > 5) && ($command['id'] === 3)) { if (substr_count($command['command'], '_field'.($i - 1).'_') > 0) { $fdesc = sprintf(__('Field %s'), ($i - 1)); } else { diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 6753d1d499..68f2e1dfe2 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -759,6 +759,31 @@ if (enterprise_installed() === true) { ); } +$days_week = [ + 0 => __('Sunday'), + 1 => __('Monday'), + 2 => __('Tuesday'), + 3 => __('Wednesday'), + 4 => __('Thursday'), + 5 => __('Friday'), + 6 => __('Saturday'), +]; + +$table_styles->data[$row][] = html_print_label_input_block( + __('Datepicker first day of week'), + html_print_select( + $days_week, + 'datepicker_first_day', + $config['datepicker_first_day'], + '', + '', + false, + true, + false, + false + ) +); + $row++; // Title Header. diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index d23b65d7ea..2c139e4f21 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -2312,7 +2312,7 @@ $(document).ready (function () { // The row provided has a predefined class. We delete it. $('#table_macros-field' + i) .removeAttr('class'); - if(old_value && i != 4){ + if(old_value){ $("[name=field" + i + "_value]").val(old_value).trigger('change'); } $('#table_macros-field').show(); diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index af88c3e51f..347458ff62 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -912,7 +912,7 @@ class DiscoveryTaskList extends HTML 'class' => 'main_menu_icon invert_filter', ] ).'  '; - $data[6] .= __('Discovery.NetScan (legacy)'); + $data[6] .= __('Discovery.NetScan'); } else { // APP or external script recon task. $data[6] = html_print_image( @@ -920,7 +920,7 @@ class DiscoveryTaskList extends HTML true, ['class' => 'main_menu_icon invert_filter'] ).'  '; - $data[6] .= $recon_script_name.' (legacy)'; + $data[6] .= $recon_script_name; } break; } diff --git a/pandora_console/images/widgets/inventory.png b/pandora_console/images/widgets/inventory.png new file mode 100644 index 0000000000..9d3b198b7c Binary files /dev/null and b/pandora_console/images/widgets/inventory.png differ diff --git a/pandora_console/include/ajax/audit_log.php b/pandora_console/include/ajax/audit_log.php index c0d1c4f73e..754d679f5b 100644 --- a/pandora_console/include/ajax/audit_log.php +++ b/pandora_console/include/ajax/audit_log.php @@ -58,7 +58,14 @@ if ($save_log_filter) { $values = []; $values['id_name'] = get_parameter('id_name'); $values['text'] = get_parameter('text', ''); - $values['period'] = get_parameter('period', ''); + $values['custom_date'] = get_parameter('custom_date'); + $values['date'] = get_parameter('date'); + $values['date_text'] = get_parameter('date_text'); + $values['date_units'] = get_parameter('date_units'); + $values['date_init'] = get_parameter('date_init'); + $values['time_init'] = get_parameter('time_init'); + $values['date_end'] = get_parameter('date_end'); + $values['time_end'] = get_parameter('time_end'); $values['ip'] = get_parameter('ip', ''); $values['type'] = get_parameter('type', -1); $values['user'] = get_parameter('user', -1); @@ -91,7 +98,14 @@ if ($update_log_filter) { $values = []; $id = get_parameter('id'); $values['text'] = get_parameter('text', ''); - $values['period'] = get_parameter('period', ''); + $values['custom_date'] = get_parameter('custom_date'); + $values['date'] = get_parameter('date'); + $values['date_text'] = get_parameter('date_text'); + $values['date_units'] = get_parameter('date_units'); + $values['date_init'] = get_parameter('date_init'); + $values['time_init'] = get_parameter('time_init'); + $values['date_end'] = get_parameter('date_end'); + $values['time_end'] = get_parameter('time_end'); $values['ip'] = get_parameter('ip', ''); $values['type'] = get_parameter('type', -1); $values['user'] = get_parameter('user', -1); @@ -211,18 +225,42 @@ function load_filter_values() { $.each(data,function(i,value){ if (i == 'text'){ $("#text-filter_text").val(value); - } - if (i == 'period'){ - $("#filter_period").val(value).change(); - } - if (i == 'ip'){ + } else if (i == 'ip'){ $("#text-filter_ip").val(value); - } - if (i == 'type'){ + } else if (i == 'type'){ $("#filter_type").val(value).change(); - } - if (i == 'user'){ + } else if (i == 'user'){ $("#filter_user").val(value).change(); + } else if (i == 'custom_date'){ + $('#hidden-custom_date').val(value).change(); + if ($('#hidden-custom_date').val()==='0'){ + $('#date_default').show(); + $('#date_range').hide(); + $('#date_extend').hide(); + $('#date').val('".SECONDS_1DAY."').trigger('change'); + } else if ($('#hidden-custom_date').val()==='1'){ + $('#date_range').show(); + $('#date_default').hide(); + $('#date_extend').hide(); + } else { + $('#date_range').hide(); + $('#date_default').hide(); + $('#date_extend').show(); + } + } else if (i == 'date'){ + $('#date').val(value).change(); + } else if (i == 'date_end'){ + $('#text-date_end').val(value); + } else if (i == 'date_init'){ + $('#text-date_init').val(value); + } else if (i == 'date_text'){ + $('#text-date_text').val(value); + } else if (i == 'date_units'){ + $('#date_units').val(value).change(); + } else if (i == 'time_end'){ + $('#text-time_end').val(value); + } else if (i == 'time_init'){ + $('#text-time_init').val(value); } }); } @@ -408,7 +446,14 @@ function save_new_filter() { "save_log_filter" : 1, "id_name" : $("#text-id_name").val(), "text" : $("#text-filter_text").val(), - "period" : $("#filter_period :selected").val(), + "custom_date": $('#hidden-custom_date').val(), + "date": $('#date option:selected').val(), + "date_text": $('#text-date_text').val(), + "date_units": $('#date_units option:selected').val(), + "date_init": $('#text-date_init').val(), + "time_init": $('#text-time_init').val(), + "date_end": $('#text-date_end').val(), + "time_end": $('#text-time_end').val(), "ip" : $('#text-filter_ip').val(), "type" : $('#filter_type :selected').val(), "user" : $('#filter_user :selected').val(), @@ -444,7 +489,14 @@ function save_update_filter() { "update_log_filter" : 1, "id" : $("#overwrite_filter :selected").val(), "text" : $("#text-filter_text").val(), - "period" : $("#filter_period :selected").val(), + "custom_date": $('#hidden-custom_date').val(), + "date": $('#date option:selected').val(), + "date_text": $('#text-date_text').val(), + "date_units": $('#date_units option:selected').val(), + "date_init": $('#text-date_init').val(), + "time_init": $('#text-time_init').val(), + "date_end": $('#text-date_end').val(), + "time_end": $('#text-time_end').val(), "ip" : $('#text-filter_ip').val(), "type" : $('#filter_type :selected').val(), "user" : $('#filter_user :selected').val(), diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 921a1e1bc0..1e529c487c 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1486,27 +1486,53 @@ if (check_login()) { metaconsole_connect($server); } - if ($params['histogram'] === true) { - $params['id_agent_module'] = $params['agent_module_id']; - $params['dinamic_proc'] = 1; + if ($params['enable_projected_period'] === '1') { + $params_graphic = [ + 'period' => $params['period'], + 'date' => strtotime(date('Y-m-d H:i:s')), + 'only_image' => false, + 'homeurl' => ui_get_full_url(false, false, false, false).'/', + 'ttl' => false, + 'height' => $config['graph_image_height'], + 'landscape' => $content['landscape'], + 'return_img_base_64' => true, + ]; + $params_combined = [ + 'projection' => $params['period_projected'], + ]; + + $return['chart'] = graphic_combined_module( + [$params['agent_module_id']], + $params_graphic, + $params_combined + ); $output .= '
'; - if ($params['compare'] === 'separated') { + $output .= $return['chart']; + $output .= '
'; + } else { + if ($params['histogram'] === true) { + $params['id_agent_module'] = $params['agent_module_id']; + $params['dinamic_proc'] = 1; + + $output .= '
'; + if ($params['compare'] === 'separated') { + $graph = \reporting_module_histogram_graph( + ['datetime' => ($params['begin_date'] - $params['period'])], + $params + ); + $output .= $graph['chart']; + } + $graph = \reporting_module_histogram_graph( - ['datetime' => ($params['begin_date'] - $params['period'])], + ['datetime' => $params['begin_date']], $params ); $output .= $graph['chart']; + $output .= '
'; + } else { + $output .= grafico_modulo_sparse($params); } - - $graph = \reporting_module_histogram_graph( - ['datetime' => $params['begin_date']], - $params - ); - $output .= $graph['chart']; - $output .= ''; - } else { - $output .= grafico_modulo_sparse($params); } if (is_metaconsole() === true && empty($server_id) === false) { diff --git a/pandora_console/include/class/AuditLog.class.php b/pandora_console/include/class/AuditLog.class.php index f35f4e4e6d..261ffac531 100644 --- a/pandora_console/include/class/AuditLog.class.php +++ b/pandora_console/include/class/AuditLog.class.php @@ -201,23 +201,8 @@ class AuditLog extends HTML 'name' => 'filter_text', ], [ - 'label' => __('Max. hours old'), - 'type' => 'select', - 'class' => 'w20px', - 'select2_enable' => true, - 'sort' => false, - 'selected' => 168, - 'fields' => [ - 24 => __('1 day'), - 168 => __('7 days'), - 360 => __('15 days'), - 744 => __('1 month'), - 2160 => __('3 months'), - 4320 => __('6 months'), - 8760 => __('1 Year'), - ], - 'id' => 'filter_period', - 'name' => 'filter_period', + 'label' => __('Date'), + 'type' => 'date_range', ], [ 'label' => __('IP'), @@ -312,10 +297,35 @@ class AuditLog extends HTML $filter .= sprintf(" AND ip_origen LIKE '%%%s%%'", $this->filterIp); } - if (empty($this->filterPeriod) === false) { - $filter .= sprintf(' AND fecha >= DATE_ADD(NOW(), INTERVAL -%d HOUR)', $this->filterPeriod); + // Calculate range dates. + $custom_date = $filters['custom_date']; + if ($custom_date === '1') { + $date_from = ($filters['date_init'].' '.$filters['time_init']); + $date_to = ($filters['date_end'].' '.$filters['time_end']); + } else if ($custom_date === '2') { + $period = ($filters['date_text'] * $filters['date_units']); + $date_to = date('Y-m-d H:i:s'); + $date_from = date('Y-m-d H:i:s', (strtotime($date_to) - $period)); + } else if (in_array($filters['date'], ['this_week', 'this_month', 'past_week', 'past_month'])) { + if ($filters['date'] === 'this_week') { + $date_from = date('Y-m-d 00:00:00', strtotime('last monday')); + $date_to = date('Y-m-d 23:59:59', strtotime($date_from.' +6 days')); + } else if ($filters['date'] === 'this_month') { + $date_from = date('Y-m-d 23:59:59', strtotime('first day of this month')); + $date_to = date('Y-m-d 00:00:00', strtotime('last day of this month')); + } else if ($filters['date'] === 'past_month') { + $date_from = date('Y-m-d 00:00:00', strtotime('first day of previous month')); + $date_to = date('Y-m-d 23:59:59', strtotime('last day of previous month')); + } else if ($filters['date'] === 'past_week') { + $date_from = date('Y-m-d 00:00:00', strtotime('monday', strtotime('last week'))); + $date_to = date('Y-m-d 23:59:59', strtotime('sunday', strtotime('last week'))); + } + } else { + $date_to = date('Y-m-d H:i:s'); + $date_from = date('Y-m-d H:i:s', (strtotime($date_to) - $filters['date'])); } + $filter .= sprintf(' AND fecha BETWEEN "%s" AND "%s"', $date_from, $date_to); $count = (int) db_get_value_sql(sprintf('SELECT COUNT(*) as "total" FROM tsesion WHERE %s', $filter)); if ($length !== '-1') { diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index d7b7fba714..ec8dc69f48 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC230905'; +$build_version = 'PC230907'; $pandora_version = 'v7.0NG.773.3'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 033b2067b6..9bda03f8fd 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1168,6 +1168,10 @@ function config_update_config() $error_update[] = __('Custom title header'); } + if (config_update_value('datepicker_first_day', (string) get_parameter('datepicker_first_day'), true) === false) { + $error_update[] = __('Datepicker first day'); + } + if (config_update_value('custom_subtitle_header', (string) get_parameter('custom_subtitle_header'), true) === false) { $error_update[] = __('Custom subtitle header'); } @@ -2751,6 +2755,10 @@ function config_process_config() config_update_value('custom_title_header', __('Pandora FMS')); } + if (!isset($config['datepicker_first_day'])) { + config_update_value('datepicker_first_day', '0'); + } + if (!isset($config['custom_subtitle_header'])) { config_update_value('custom_subtitle_header', __('the Flexible Monitoring System')); } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 1b20cdfc3c..3d8eb231b9 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -7228,6 +7228,298 @@ function html_print_code_picker( } +function html_print_select_date_range( + $name, + $return, + $selected=SECONDS_1DAY, + $date_init='', + $time_init='', + $date_end='', + $time_end='', + $date_text=SECONDS_1DAY, + $class='w100p' +) { + global $config; + + if ($selected === 'custom') { + $display_extend = ''; + $display_range = 'style="display:none"'; + $display_default = 'style="display:none"'; + $custom_date = 2; + } else if ($selected === 'chose_range') { + $display_range = ''; + $display_default = 'style="display:none"'; + $display_extend = 'style="display:none"'; + $custom_date = 1; + } else { + $display_default = ''; + $display_range = 'style="display:none"'; + $display_extend = 'style="display:none"'; + $custom_date = 0; + } + + if ($date_end === '') { + $date_end = date('Y/m/d'); + } + + if ($date_init === '') { + $date_init = date('Y/m/d', strtotime($date_end.' -1 days')); + } + + if ($time_init === '') { + $time_init = date('H:i:s'); + } + + if ($time_end === '') { + $time_end = date('H:i:s'); + } + + $fields[SECONDS_1DAY] = __('Last 24hr'); + $fields['this_week'] = __('This week'); + $fields['this_month'] = __('This month'); + $fields['past_week'] = __('Past week'); + $fields['past_month'] = __('Past month'); + $fields[SECONDS_1WEEK] = __('Last 7 days'); + $fields[SECONDS_15DAYS] = __('Last 15 days'); + $fields[SECONDS_1MONTH] = __('Last 30 days'); + $fields['custom'] = __('Custom'); + $fields['chose_range'] = __('Chose start/end date period'); + + $output = html_print_input_hidden('custom_date', $custom_date, true); + $output .= '
'; + $output .= html_print_select( + $fields, + $name, + $selected, + '', + '', + 0, + true, + false, + false, + $class + ); + $output .= '
'; + $output .= '
'; + $table = new stdClass(); + $table->class = 'table-adv-filter'; + $table->data[0][0] .= '
'.__('From').':
'; + $table->data[0][0] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' '; + $table->data[0][0] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' '; + $table->data[0][0] .= '
'; + $table->data[0][0] .= '
'.__('to').':
'; + $table->data[0][0] .= html_print_input_text('date_end', $date_end, '', 12, 10, true).' '; + $table->data[0][0] .= '
'; + $table->data[0][0] .= html_print_input_text('time_end', $time_end, '', 10, 7, true).' '; + $table->data[0][0] .= ' '.html_print_image( + 'images/logs@svg.svg', + true, + [ + 'id' => 'back_default', + 'class' => ' main_menu_icon invert_filter', + 'alt' => __('List'), + 'title' => __('List'), + 'style' => 'width: 18px;', + ] + ).''; + $table->data[0][0] .= '
'; + $output .= html_print_table($table, true); + $output .= '
'; + + $units = [ + 1 => __('seconds'), + SECONDS_1MINUTE => __('minutes'), + SECONDS_1HOUR => __('hours'), + SECONDS_1DAY => __('days'), + SECONDS_1WEEK => __('weeks'), + SECONDS_1MONTH => __('months'), + SECONDS_1YEAR => __('years'), + ]; + $output .= '
'; + $output .= html_print_input_text($name.'_text', $date_text, '', false, 255, true); + $output .= html_print_select( + $units, + $name.'_units', + '1', + '', + '', + 0, + true, + false, + false, + '', + false, + ' margin-left: 5px; width: 140px;', + false, + false, + false, + '', + false, + false, + false, + false, + false + ); + $output .= ' '.html_print_image( + 'images/logs@svg.svg', + true, + [ + 'id' => 'back_default_extend', + 'class' => $name.'_toggler main_menu_icon invert_filter', + 'alt' => __('List'), + 'title' => __('List'), + 'style' => 'width: 18px;margin-bottom: -5px; padding-top: 10px;', + ] + ).''; + $output .= '
'; + ui_include_time_picker(); + ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/'); + $output .= ""; + + if ($return === true) { + return $output; + } else { + echo $output; + } + +} + + function html_print_wizard_diagnosis( $title, $id_button, @@ -7266,4 +7558,5 @@ function html_print_wizard_diagnosis( } else { echo $output; } + } \ No newline at end of file diff --git a/pandora_console/include/functions_inventory.php b/pandora_console/include/functions_inventory.php index 89fe0da71e..8e69da7445 100644 --- a/pandora_console/include/functions_inventory.php +++ b/pandora_console/include/functions_inventory.php @@ -31,6 +31,7 @@ function inventory_get_data( $agents_ids, $inventory_module_name, $utimestamp, + $period, $inventory_search_string='', $export_csv=false, $return_mode=false, @@ -97,7 +98,7 @@ function inventory_get_data( // Prepare pagination. $url = sprintf( - '?sec=estado&sec2=operation/inventory/inventory&agent_id=%s&agent=%s&id_group=%s&export=%s&module_inventory_general_view=%s&search_string=%s&utimestamp=%s&order_by_agent=%s&submit_filter=%d', + '?sec=estado&sec2=operation/inventory/inventory&agent_id=%s&agent=%s&id_group=%s&export=%s&module_inventory_general_view=%s&search_string=%s&utimestamp=%s&period=%s&order_by_agent=%s&submit_filter=%d', $pagination_url_parameters['inventory_id_agent'], $pagination_url_parameters['inventory_agent'], $pagination_url_parameters['inventory_id_group'], @@ -105,6 +106,7 @@ function inventory_get_data( $inventory_module_name, $inventory_search_string, $utimestamp, + $period, $order_by_agent, 1 ); @@ -328,7 +330,7 @@ function inventory_get_data( $timestamp = db_get_value_sql( "SELECT timestamp FROM tagente_datos_inventory - WHERE utimestamp = $utimestamp" + WHERE utimestamp BETWEEN '".($utimestamp - $period)."' AND '".$utimestamp."'" ); } else { $timestamp = db_get_value_sql( @@ -892,6 +894,14 @@ function get_data_basic_info_sql($params, $count=false) ); } + if ($params['utimestamp'] > 0 && $count === false) { + $where .= sprintf( + ' AND utimestamp BETWEEN %d AND %d', + ($params['utimestamp'] - $params['period']), + $params['utimestamp'] + ); + } + if ($params['order'] > 0) { $str_split = explode(' ', $params['order']); switch ($str_split[0]) { diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 614c0df43e..a1927bb60a 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -143,6 +143,10 @@ function menu_print_menu(&$menu) if (empty($new_msg) === false) { $sec2 = 'operation/messages/message_edit&new_msg='.$new_msg; } + } else if ($sec2 === 'enterprise/godmode/servers/credential_boxes_satellite' + || $sec2 === 'enterprise/godmode/servers/manage_credential_boxes' + ) { + $sec2 = 'enterprise/godmode/servers/list_satellite'; } else { $sec2 = (string) get_parameter('sec2'); } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 4bacf6c920..a57a9346b7 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -4022,7 +4022,11 @@ function ui_print_datatable(array $parameters) $filter .= ''; diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 37162f5a37..56cd4a71a1 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -943,17 +943,25 @@ function pandoraFlotSlicebar( // Format functions function xFormatter(v) { - // var ct = new Date(); - var ct = new timezoneJS.Date(); - ct.setTimezone(phpTimezone); + var ct; + if (typeof timezoneJS === "undefined") { + ct = new Date(); + } else { + ct = new timezoneJS.Date(); + ct.setTimezone(phpTimezone); + } var currentTime = ct.getTime(); var diffDates = (currentTime - 1000 * datelimit) / 1000; - // var d = new Date(1000 * (v + datelimit)); - var d = new timezoneJS.Date(1000 * (v + datelimit)); - d.setTimezone(phpTimezone); + var d; + if (typeof timezoneJS === "undefined") { + d = new Date(1000 * (v + datelimit)); + } else { + d = new timezoneJS.Date(1000 * (v + datelimit)); + d.setTimezone(phpTimezone); + } var monthNames = [ "Jan", diff --git a/pandora_console/include/javascript/jquery-ui.min.js b/pandora_console/include/javascript/jquery-ui.min.js index 50b036f4d2..c39e5c7792 100644 --- a/pandora_console/include/javascript/jquery-ui.min.js +++ b/pandora_console/include/javascript/jquery-ui.min.js @@ -3,4 +3,4 @@ * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js * Copyright jQuery Foundation and other contributors; Licensed MIT */ -!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(V){"use strict";V.ui=V.ui||{};V.ui.version="1.13.2";var n,i=0,a=Array.prototype.hasOwnProperty,r=Array.prototype.slice;V.cleanData=(n=V.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)(e=V._data(i,"events"))&&e.remove&&V(i).triggerHandler("remove");n(t)}),V.widget=function(t,i,e){var s,n,o,a={},r=t.split(".")[0],l=r+"-"+(t=t.split(".")[1]);return e||(e=i,i=V.Widget),Array.isArray(e)&&(e=V.extend.apply(null,[{}].concat(e))),V.expr.pseudos[l.toLowerCase()]=function(t){return!!V.data(t,l)},V[r]=V[r]||{},s=V[r][t],n=V[r][t]=function(t,e){if(!this||!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},V.extend(n,s,{version:e.version,_proto:V.extend({},e),_childConstructors:[]}),(o=new i).options=V.widget.extend({},o.options),V.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}a[e]="function"==typeof s?function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}:s}),n.prototype=V.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},a,{constructor:n,namespace:r,widgetName:t,widgetFullName:l}),s?(V.each(s._childConstructors,function(t,e){var i=e.prototype;V.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),V.widget.bridge(t,n),n},V.widget.extend=function(t){for(var e,i,s=r.call(arguments,1),n=0,o=s.length;n",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=V(e||this.defaultElement||this)[0],this.element=V(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=V(),this.hoverable=V(),this.focusable=V(),this.classesElementLookup={},e!==this&&(V.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=V(e.style?e.ownerDocument:e.document||e),this.window=V(this.document[0].defaultView||this.document[0].parentWindow)),this.options=V.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:V.noop,_create:V.noop,_init:V.noop,destroy:function(){var i=this;this._destroy(),V.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:V.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return V.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=V.widget.extend({},this.options[t]),n=0;n
"),i=e.children()[0];return V("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthx(k(s),k(n))?o.important="horizontal":o.important="vertical",u.using.call(this,t,o)}),a.offset(V.extend(h,{using:t}))})},V.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,a=s-o,r=o+e.collisionWidth-n-s;e.collisionWidth>n?0n?0")[0],w=d.each;function P(t){return null==t?t+"":"object"==typeof t?p[e.call(t)]||"object":typeof t}function M(t,e,i){var s=v[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:Math.min(s.max,Math.max(0,t)))}function S(s){var n=m(),o=n._rgba=[];return s=s.toLowerCase(),w(g,function(t,e){var i=e.re.exec(s),i=i&&e.parse(i),e=e.space||"rgba";if(i)return i=n[e](i),n[_[e].cache]=i[_[e].cache],o=n._rgba=i._rgba,!1}),o.length?("0,0,0,0"===o.join()&&d.extend(o,B.transparent),n):B[s]}function H(t,e,i){return 6*(i=(i+1)%1)<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}y.style.cssText="background-color:rgba(1,1,1,.5)",b.rgba=-1o.mod/2?s+=o.mod:s-n>o.mod/2&&(s-=o.mod)),l[i]=M((n-s)*a+s,e)))}),this[e](l)},blend:function(t){if(1===this._rgba[3])return this;var e=this._rgba.slice(),i=e.pop(),s=m(t)._rgba;return m(d.map(e,function(t,e){return(1-i)*s[e]+i*t}))},toRgbaString:function(){var t="rgba(",e=d.map(this._rgba,function(t,e){return null!=t?t:2").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:i.width(),height:i.height()},n=document.activeElement;try{n.id}catch(t){n=document.body}return i.wrap(t),i[0]!==n&&!V.contains(i[0],n)||V(n).trigger("focus"),t=i.parent(),"static"===i.css("position")?(t.css({position:"relative"}),i.css({position:"relative"})):(V.extend(s,{position:i.css("position"),zIndex:i.css("z-index")}),V.each(["top","left","bottom","right"],function(t,e){s[e]=i.css(e),isNaN(parseInt(s[e],10))&&(s[e]="auto")}),i.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),i.css(e),t.css(s).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!V.contains(t[0],e)||V(e).trigger("focus")),t}}),V.extend(V.effects,{version:"1.13.2",define:function(t,e,i){return i||(i=e,e="effect"),V.effects.effect[t]=i,V.effects.effect[t].mode=e,i},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,e="vertical"!==i?(e||100)/100:1;return{height:t.height()*e,width:t.width()*s,outerHeight:t.outerHeight()*e,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();1").insertAfter(t).css({display:/^(inline|ruby)/.test(t.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight"),float:t.css("float")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).addClass("ui-effects-placeholder"),t.data(j+"placeholder",e)),t.css({position:i,left:s.left,top:s.top}),e},removePlaceholder:function(t){var e=j+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(t){V.effects.restoreStyle(t),V.effects.removePlaceholder(t)},setTransition:function(s,t,n,o){return o=o||{},V.each(t,function(t,e){var i=s.cssUnit(e);0");l.appendTo("body").addClass(t.className).css({top:s.top-a,left:s.left-r,height:i.innerHeight(),width:i.innerWidth(),position:n?"fixed":"absolute"}).animate(o,t.duration,t.easing,function(){l.remove(),"function"==typeof e&&e()})}}),V.fx.step.clip=function(t){t.clipInit||(t.start=V(t.elem).cssClip(),"string"==typeof t.end&&(t.end=G(t.end,t.elem)),t.clipInit=!0),V(t.elem).cssClip({top:t.pos*(t.end.top-t.start.top)+t.start.top,right:t.pos*(t.end.right-t.start.right)+t.start.right,bottom:t.pos*(t.end.bottom-t.start.bottom)+t.start.bottom,left:t.pos*(t.end.left-t.start.left)+t.start.left})},Y={},V.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){Y[t]=function(t){return Math.pow(t,e+2)}}),V.extend(Y,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),V.each(Y,function(t,e){V.easing["easeIn"+t]=e,V.easing["easeOut"+t]=function(t){return 1-e(1-t)},V.easing["easeInOut"+t]=function(t){return t<.5?e(2*t)/2:1-e(-2*t+2)/2}});y=V.effects,V.effects.define("blind","hide",function(t,e){var i={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},s=V(this),n=t.direction||"up",o=s.cssClip(),a={clip:V.extend({},o)},r=V.effects.createPlaceholder(s);a.clip[i[n][0]]=a.clip[i[n][1]],"show"===t.mode&&(s.cssClip(a.clip),r&&r.css(V.effects.clipToBox(a)),a.clip=o),r&&r.animate(V.effects.clipToBox(a),t.duration,t.easing),s.animate(a,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("bounce",function(t,e){var i,s,n=V(this),o=t.mode,a="hide"===o,r="show"===o,l=t.direction||"up",h=t.distance,c=t.times||5,o=2*c+(r||a?1:0),u=t.duration/o,d=t.easing,p="up"===l||"down"===l?"top":"left",f="up"===l||"left"===l,g=0,t=n.queue().length;for(V.effects.createPlaceholder(n),l=n.css(p),h=h||n["top"==p?"outerHeight":"outerWidth"]()/3,r&&((s={opacity:1})[p]=l,n.css("opacity",0).css(p,f?2*-h:2*h).animate(s,u,d)),a&&(h/=Math.pow(2,c-1)),(s={})[p]=l;g").css({position:"absolute",visibility:"visible",left:-s*p,top:-i*f}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:p,height:f,left:n+(u?a*p:0),top:o+(u?r*f:0),opacity:u?0:1}).animate({left:n+(u?0:a*p),top:o+(u?0:r*f),opacity:u?1:0},t.duration||500,t.easing,m)}),V.effects.define("fade","toggle",function(t,e){var i="show"===t.mode;V(this).css("opacity",i?0:1).animate({opacity:i?1:0},{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("fold","hide",function(e,t){var i=V(this),s=e.mode,n="show"===s,o="hide"===s,a=e.size||15,r=/([0-9]+)%/.exec(a),l=!!e.horizFirst?["right","bottom"]:["bottom","right"],h=e.duration/2,c=V.effects.createPlaceholder(i),u=i.cssClip(),d={clip:V.extend({},u)},p={clip:V.extend({},u)},f=[u[l[0]],u[l[1]]],s=i.queue().length;r&&(a=parseInt(r[1],10)/100*f[o?0:1]),d.clip[l[0]]=a,p.clip[l[0]]=a,p.clip[l[1]]=0,n&&(i.cssClip(p.clip),c&&c.css(V.effects.clipToBox(p)),p.clip=u),i.queue(function(t){c&&c.animate(V.effects.clipToBox(d),h,e.easing).animate(V.effects.clipToBox(p),h,e.easing),t()}).animate(d,h,e.easing).animate(p,h,e.easing).queue(t),V.effects.unshift(i,s,4)}),V.effects.define("highlight","show",function(t,e){var i=V(this),s={backgroundColor:i.css("backgroundColor")};"hide"===t.mode&&(s.opacity=0),V.effects.saveStyle(i),i.css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(s,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("size",function(s,e){var n,i=V(this),t=["fontSize"],o=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],a=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],r=s.mode,l="effect"!==r,h=s.scale||"both",c=s.origin||["middle","center"],u=i.css("position"),d=i.position(),p=V.effects.scaledDimensions(i),f=s.from||p,g=s.to||V.effects.scaledDimensions(i,0);V.effects.createPlaceholder(i),"show"===r&&(r=f,f=g,g=r),n={from:{y:f.height/p.height,x:f.width/p.width},to:{y:g.height/p.height,x:g.width/p.width}},"box"!==h&&"both"!==h||(n.from.y!==n.to.y&&(f=V.effects.setTransition(i,o,n.from.y,f),g=V.effects.setTransition(i,o,n.to.y,g)),n.from.x!==n.to.x&&(f=V.effects.setTransition(i,a,n.from.x,f),g=V.effects.setTransition(i,a,n.to.x,g))),"content"!==h&&"both"!==h||n.from.y!==n.to.y&&(f=V.effects.setTransition(i,t,n.from.y,f),g=V.effects.setTransition(i,t,n.to.y,g)),c&&(c=V.effects.getBaseline(c,p),f.top=(p.outerHeight-f.outerHeight)*c.y+d.top,f.left=(p.outerWidth-f.outerWidth)*c.x+d.left,g.top=(p.outerHeight-g.outerHeight)*c.y+d.top,g.left=(p.outerWidth-g.outerWidth)*c.x+d.left),delete f.outerHeight,delete f.outerWidth,i.css(f),"content"!==h&&"both"!==h||(o=o.concat(["marginTop","marginBottom"]).concat(t),a=a.concat(["marginLeft","marginRight"]),i.find("*[width]").each(function(){var t=V(this),e=V.effects.scaledDimensions(t),i={height:e.height*n.from.y,width:e.width*n.from.x,outerHeight:e.outerHeight*n.from.y,outerWidth:e.outerWidth*n.from.x},e={height:e.height*n.to.y,width:e.width*n.to.x,outerHeight:e.height*n.to.y,outerWidth:e.width*n.to.x};n.from.y!==n.to.y&&(i=V.effects.setTransition(t,o,n.from.y,i),e=V.effects.setTransition(t,o,n.to.y,e)),n.from.x!==n.to.x&&(i=V.effects.setTransition(t,a,n.from.x,i),e=V.effects.setTransition(t,a,n.to.x,e)),l&&V.effects.saveStyle(t),t.css(i),t.animate(e,s.duration,s.easing,function(){l&&V.effects.restoreStyle(t)})})),i.animate(g,{queue:!1,duration:s.duration,easing:s.easing,complete:function(){var t=i.offset();0===g.opacity&&i.css("opacity",f.opacity),l||(i.css("position","static"===u?"relative":u).offset(t),V.effects.saveStyle(i)),e()}})}),V.effects.define("scale",function(t,e){var i=V(this),s=t.mode,s=parseInt(t.percent,10)||(0===parseInt(t.percent,10)||"effect"!==s?0:100),s=V.extend(!0,{from:V.effects.scaledDimensions(i),to:V.effects.scaledDimensions(i,s,t.direction||"both"),origin:t.origin||["middle","center"]},t);t.fade&&(s.from.opacity=1,s.to.opacity=0),V.effects.effect.size.call(this,s,e)}),V.effects.define("puff","hide",function(t,e){t=V.extend(!0,{},t,{fade:!0,percent:parseInt(t.percent,10)||150});V.effects.effect.scale.call(this,t,e)}),V.effects.define("pulsate","show",function(t,e){var i=V(this),s=t.mode,n="show"===s,o=2*(t.times||5)+(n||"hide"===s?1:0),a=t.duration/o,r=0,l=1,s=i.queue().length;for(!n&&i.is(":visible")||(i.css("opacity",0).show(),r=1);l li > :first-child").add(t.find("> :not(li)").even())},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=V(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():V()}},_createIcons:function(){var t,e=this.options.icons;e&&(t=V(""),this._addClass(t,"ui-accordion-header-icon","ui-icon "+e.header),t.prependTo(this.headers),t=this.active.children(".ui-accordion-header-icon"),this._removeClass(t,e.header)._addClass(t,null,e.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())):this._activate(e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=V.ui.keyCode,i=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:n=this.headers[(s+1)%i];break;case e.LEFT:case e.UP:n=this.headers[(s-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:n=this.headers[0];break;case e.END:n=this.headers[i-1]}n&&(V(t.target).attr("tabIndex",-1),V(n).attr("tabIndex",0),V(n).trigger("focus"),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===V.ui.keyCode.UP&&t.ctrlKey&&V(t.currentTarget).prev().trigger("focus")},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=V()):!1===t.active?this._activate(0):this.active.length&&!V.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=V()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,s=this.element.parent();this.active=this._findActive(t.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var t=V(this),e=t.uniqueId().attr("id"),i=t.next(),s=i.uniqueId().attr("id");t.attr("aria-controls",s),i.attr("aria-labelledby",e)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(t.event),"fill"===e?(i=s.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=V(this).outerHeight(!0)}),this.headers.next().each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){var t=V(this).is(":visible");t||V(this).show(),i=Math.max(i,V(this).css("height","").height()),t||V(this).hide()}).height(i))},_activate:function(t){t=this._findActive(t)[0];t!==this.active[0]&&(t=t||this.active[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):V()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():s.next(),r=i.next(),a={oldHeader:i,oldPanel:r,newHeader:o?V():s,newPanel:a};t.preventDefault(),n&&!e.collapsible||!1===this._trigger("beforeActivate",t,a)||(e.active=!o&&this.headers.index(s),this.active=n?V():s,this._toggle(a),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),e.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,e.icons.activeHeader)._addClass(i,null,e.icons.header)),n||(this._removeClass(s,"ui-accordion-header-collapsed")._addClass(s,"ui-accordion-header-active","ui-state-active"),e.icons&&(n=s.children(".ui-accordion-header-icon"),this._removeClass(n,null,e.icons.header)._addClass(n,null,e.icons.activeHeader)),this._addClass(s.next(),"ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(V(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!i.length||t.index()",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=V(t.target),i=V(V.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){V.contains(this.element[0],V.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=V(t.target).closest(".ui-menu-item"),i=V(t.currentTarget),e[0]===i[0]&&(i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=V(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case V.ui.keyCode.PAGE_UP:this.previousPage(t);break;case V.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case V.ui.keyCode.HOME:this._move("first","first",t);break;case V.ui.keyCode.END:this._move("last","last",t);break;case V.ui.keyCode.UP:this.previous(t);break;case V.ui.keyCode.DOWN:this.next(t);break;case V.ui.keyCode.LEFT:this.collapse(t);break;case V.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case V.ui.keyCode.ENTER:case V.ui.keyCode.SPACE:this._activate(t);break;case V.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=V(this),e=t.prev(),i=V("").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=V(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!V.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(V.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(V.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=V("