Commit 1b7f5ea9 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

initial

parent b0df5d3b
<?xml version="1.0" encoding="UTF-8"?><properties><r_xy_2_y>0.0</r_xy_2_y><r_xy_2_x>0.0</r_xy_2_x><comment_arrays>Array corrections from acquired image to radially distorted, in pixels</comment_arrays><distortion_formula>(normalized by distortionRadius in mm) Rdist/R=A8*R^7+A7*R^6+A6*R^5+A5*R^4+A*R^3+B*R^2+C*R+(1-A6-A7-A6-A5-A-B-C)</distortion_formula><arraysSet>true</arraysSet><elevation>55.23272690216834</elevation><r_xy_1_y>0.0</r_xy_1_y><r_xy_1_x>0.0</r_xy_1_x><pixelSize>2.2</pixelSize><r_xy_0_y>0.0</r_xy_0_y><r_xy_0_x>0.0</r_xy_0_x><pixelCorrectionWidth>2592</pixelCorrectionWidth><subchannel>0</subchannel><maskSet>true</maskSet><distortionRadius>2.8512</distortionRadius><height>38.16414288388006</height><distortionC>0.021580979121640767</distortionC><distortionB>-0.1490870106930063</distortionB><distortionA>0.1715459452204896</distortionA><radius>42.886065727550715</radius><comment_subchannel>number of the sensor port on a subcamera (0..2)</comment_subchannel><comment_roll>lens rotation around the lens axis. Positive - CW looking to the target, degrees</comment_roll><pixelCorrectionHeight>1936</pixelCorrectionHeight><roll>91.03911481464476</roll><distortionRadius_unuts>mm</distortionRadius_unuts><entrancePupilForward>-1.1988297137736406</entrancePupilForward><comment_subcamera>number of the subcamera with individual IP, starting with 0</comment_subcamera><sensor_port>3</sensor_port><r_od_6_o>0.0</r_od_6_o><focalLength>4.387358364054829</focalLength><r_od_5_o>0.0</r_od_5_o><comment_channel>number of the sensor (channel) in the camera</comment_channel><r_od_6_d>0.0</r_od_6_d><r_od_4_o>0.0</r_od_4_o><comment_azimuth>lens center azimuth, CW from top, degrees</comment_azimuth><r_od_5_d>0.0</r_od_5_d><r_od_3_o>0.0</r_od_3_o><comment_elevation>lens elevation from horizontal, positive - above horizon, degrees</comment_elevation><py0>967.0225937334275</py0><r_od_4_d>0.0</r_od_4_d><r_od_2_o>0.0</r_od_2_o><comment_px0_py0>lens center on the sensor, in pixels</comment_px0_py0><comment_defects>Sensor hot/cold pixels list as x:y:difference</comment_defects><VERSION>1.0</VERSION><comment_heading>lens heading - added to azimuth</comment_heading><r_od_3_d>0.0</r_od_3_d><r_od_1_o>0.0</r_od_1_o><focalLength_units>mm</focalLength_units><r_od_2_d>0.0</r_od_2_d><r_od_0_o>0.0</r_od_0_o><r_od_1_d>0.0</r_od_1_d><channel>0</channel><comment_decimation>when decimation use integer divide to find the index, corection values are in non-decimated pixels</comment_decimation><r_od_0_d>0.0</r_od_0_d><px0>1472.7260914907251</px0><azimuth>0.0</azimuth><subcamera>0</subcamera><lensDistortionModel>200</lensDistortionModel><comment_radius>lens center distance from the camera vertical axis, mm</comment_radius><heading>-0.567737495009799</heading><comment_height>lens center vertical position from the head center, mm</comment_height><r_xy_5_y>0.0</r_xy_5_y><r_xy_5_x>0.0</r_xy_5_x><pixelCorrectionDecimation>4</pixelCorrectionDecimation><comment_entrancePupilForward>entrance pupil distance from the azimuth/radius/height, outwards in mm</comment_entrancePupilForward><r_xy_4_y>0.0</r_xy_4_y><r_xy_4_x>0.0</r_xy_4_x><distortionA8>0.0</distortionA8><distortionA7>0.0</distortionA7><pixelSize_units>um</pixelSize_units><distortionA6>0.05379610812355174</distortionA6><distortionA5>-0.12746135163056044</distortionA5><r_xy_3_y>0.0</r_xy_3_y><r_xy_3_x>0.0</r_xy_3_x><comment_lensDistortionModel>Integer specifying lens distrotion model (0 - radial)</comment_lensDistortionModel></properties>
\ No newline at end of file
<?php
/*!***************************************************************************
*! FILE NAME : convert_image.php
*! DESCRIPTION: based on Paulo's original jp4-proxy.php
*! CO-AUTHOR: Oleg K Dzhimiev <oleg@elphel.com>
*! Copyright (C) Paulo Henrique Silva <ph.silva@gmail.com>
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
/*!
Copyright 2010 Paulo Henrique Silva <ph.silva@gmail.com>
This file is part of movie2dng.
movie2dng is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
movie2dng is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with movie2dng. If not, see <http://www.gnu.org/licenses/>.
*/
if (isset($_GET['source'])||(isset($argv[1])&&$argv[1]=='source')) {
$source=file_get_contents ($_SERVER['SCRIPT_FILENAME']);
header("Content-Type: text/php");
header("Content-Length: ".strlen($source)."\n");
header("Pragma: no-cache\n");
echo $source;
exit(0);
}
if (isset($_GET['help'])||isset($_GET['usage'])) {_help();}
if (isset($argv[1])) {
if ($argv[1]=="help"||$argv[1]=="usage") _help();
}
if (isset($_GET['path'])) $path=$_GET['path'];
else if (isset($argv[1])) $path=$argv[1];
else die("File is not specified. Use with 'help'-key or type in a terminal: php convert_image.php help\n");
if (isset($_GET['mode'])) $mode = $_GET['mode'];
else if (isset($argv[2])) $mode = $argv[2];
else $mode = "jpeg";
if (isset($_GET['quality'])) $quality=$_GET['quality'];
else if (isset($argv[3])) $quality=$argv[3];
else $quality=100;
if (isset($_GET['print'])) $print=true;
else if (isset($argv[4])) $print=true;
else $print=false;
if (!is_file($path)&&!is_dir($path)) die("file/folder does not exist\n");
if (is_dir($path)) {
$list = scandir($path);
foreach($list as $file) {
$tmp = pathinfo($file);
if ($tmp['extension']=="jp4"||$tmp['extension']=="dng") convert_file("$path/$file",$mode,$quality);
}
}else{
convert_file($path,$mode,$quality);
if ($print){
$pathinfo = pathinfo($path);
$file_jpeg = $pathinfo['dirname']."/".$pathinfo['filename'].".jpeg";
$output = file_get_contents($file_jpeg);
header("Content-type: image/jpeg");
echo $output;
}
}
function convert_file($path,$mode,$quality){
$pathinfo = pathinfo($path);
$file_extension = $pathinfo['extension'];
$file_dng = $pathinfo['dirname']."/".$pathinfo['filename'].".dng";
$file_jpeg = $pathinfo['dirname']."/".$pathinfo['filename'].".jpeg";
if (($mode=="jpeg"||$mode=="dng")&&$file_extension=="jp4") exec("movie2dng --dng $path");
if ($mode=="jpeg"&&is_file($file_dng)) {
exec("dcraw -c $file_dng | cjpeg -quality $quality > $file_jpeg");
if ($file_extension=="jp4") exec("rm $file_dng");
}
}
function _help(){
echo "<pre>\n";
echo "requirements:\n";
echo "\tLinux OS,\n";
echo "\tApache2,\n";
echo "\tPHP5,\n";
echo "\tmovie2dng (http://wiki.elphel.com/index.php?title=Movie2dng)\n";
echo "\tcjpeg (package - libjpeg-progs, terminal: sudo apt-get install libjpeg-progs\n";
echo "Usage (browser):\n\thttp://.../convert_image.php?path={full-path-to-file/folder}&mode={jpeg|dng}&quality={0-100}&print={true|false}\n";
echo "\t\tpath - full path to folder or file, if a folder is specified then all the files will be processed\n";
echo "\t\tmode - convert file into 'jpeg' or 'dng' (default - 'jpeg')\n";
echo "\t\tquality - jpeg compression quality (default - 100)\n";
echo "\t\tprint - show result contents (default - false)\n";
echo "\t\tsource (w/o value) - show source\n";
echo "\t\tusage (w/o value) - print this guide.\n";
echo "\t\thelp (w/o value) - print this guide.\n";
echo "Usage (terminal):\n\tphp convert_image.php {file/dir-full-path} {jpeg|dng} {0-100} {true|false}\n";
echo "Examples:\n";
echo "http://127.0.0.1/.../convert_image.php?path=/home/user/src/file.jp4\n";
echo "http://127.0.0.1/.../convert_image.php?path=/home/user/src\n";
exit(0);
}
?>
<?php
/*!***************************************************************************
*! FILE NAME : jp4-proxy.php
*! DESCRIPTION: based on Paulo's original jp4-proxy.php
*! CO-AUTHOR: Oleg K Dzhimiev <oleg@elphel.com>
*! Copyright (C) Paulo Henrique Silva <ph.silva@gmail.com>
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*! $Log: jp4-proxy.php,v $
*/
/*!
Copyright 2010 Paulo Henrique Silva <ph.silva@gmail.com>
This file is part of movie2dng.
movie2dng is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
movie2dng is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with movie2dng. If not, see <http://www.gnu.org/licenses/>.
*/
if (!is_dir("tmp")){
$old = umask(0);
@mkdir("tmp");
umask($old);
}
$url = $_REQUEST["url"];
$tmp_base = $_GET["n"];
if (isset($_GET['mode'])) $mode = $_GET['mode'];
else $mode = "jp4";
if (is_file("$tmp_base.jp4")) exec("rm $tmp_base.jp4");
if (is_file("$tmp_base.dng")) exec("rm $tmp_base.dng");
if (is_file("$tmp_base.jpeg")) exec("rm $tmp_base.jpeg");
file_put_contents("$tmp_base.$mode", file_get_contents($url));
if ($mode=="jp4") {
exec("movie2dng --dng $tmp_base.jp4");
exec("dcraw -c $tmp_base.dng | cjpeg -quality 75 > $tmp_base.jpeg");
}else{
//even jpegs need to be flipped to be shown correctly, movie2dng flips aotumatically
if ((substr($tmp_base,-1,1))%2!=0) exec("convert $tmp_base.jpeg -flip $tmp_base.jpeg");
}
$output = file_get_contents("$tmp_base.jpeg");
header("Content-type: image/jpeg");
print($output);
if (is_file("$tmp_base.jp4")) exec("rm $tmp_base.jp4");
if (is_file("$tmp_base.dng")) exec("rm $tmp_base.dng");
if (is_file("$tmp_base.jpeg")) exec("rm $tmp_base.jpeg");
?>
<?php
/*!***************************************************************************
*! FILE NAME : jp4-2-jpeg.php
*! DESCRIPTION: based on Paulo's original jp4-proxy.php
*! CO-AUTHOR: Oleg K Dzhimiev <oleg@elphel.com>
*! Copyright (C) Paulo Henrique Silva <ph.silva@gmail.com>
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*! $Log: jp4-to-jpeg.php,v $
*/
/*!
Copyright 2010 Paulo Henrique Silva <ph.silva@gmail.com>
This file is part of movie2dng.
movie2dng is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
movie2dng is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with movie2dng. If not, see <http://www.gnu.org/licenses/>.
*/
if (isset($_GET['source'])||(isset($argv[1])&&$argv[1]=='source')) {
$source=file_get_contents ($_SERVER['SCRIPT_FILENAME']);
header("Content-Type: text/php");
header("Content-Length: ".strlen($source)."\n");
header("Pragma: no-cache\n");
echo $source;
exit(0);
}
if (isset($_GET['help'])||isset($_GET['usage'])||(isset($argv[1])&&$argv[1]=="help"||$argv[1]=="usage")) {
echo "<pre>\n";
echo "web:\n\tconvert_image.php?file=<full-path-to-file>&mode=<jpeg|dng>&quality=<0-100>&print=<true|false>\n";
echo "\t\tfile - full path to file\n";
echo "\t\tmode - convert file into 'jpeg' or 'dng' (default - 'jpeg')\n";
echo "\t\tquality - jpeg compression quality (default - 100)\n";
echo "\t\tprint - show result contents (default - false)\n";
echo "terminal:\n\tphp convert_image.php <file-full-path> <jpeg|dng> <0-100> <true|false>\n";
exit(0);
}
if (isset($_GET['file'])) $file=$GET['file'];
else if (isset($argv[1])) $file=$argv[1];
else die("file is not specified\n");
if (isset($_GET['mode'])) $mode = $_GET['mode'];
else if (isset($argv[2])) $mode = $argv[2];
else $mode = "jpeg";
if (isset($_GET['quality'])) $quality=$_GET['quality'];
else if (isset($argv[3])) $quality=$argv[3];
else $quality=100;
if (isset($_GET['print'])) $print=true;
else if (isset($argv[4])) $print=true;
else $print=false;
if (!is_file($file)) die("file does not exist\n");
$pathinfo = pathinfo($file);
$file_extension = $pathinfo['extension'];
$file_dng = $pathinfo['dirname']."/".$pathinfo['filename'].".dng";
$file_jpeg = $pathinfo['dirname']."/".$pathinfo['filename'].".jpeg";
if (($mode=="jpeg"||$mode=="dng")&&$file_extension=="jp4") exec("movie2dng --dng $file");
if ($mode=="jpeg"&&is_file($file_dng)) {
exec("dcraw -c $file_dng | cjpeg -quality $quality > $file_jpeg");
if ($file_extension=="jp4") exec("rm $file_dng");
}
if ($print){
$output = file_get_contents($file_jpeg);
header("Content-type: image/jpeg");
echo $output;
}
?>
<?php
$file=$_GET['file'];//"map_points.kml";
$xml=file_get_contents($file);
header("Content-Type: text/xml\n");
header("Content-Length: ".strlen($xml)."\n");
header("Pragma: no-cache\n");
echo ($xml);
?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<Document>
<image_0>
<ch0_flip_h>0</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>0</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>1</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_0>
<image_1>
<ch0_flip_h>1</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>1</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>0</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_1>
<image_2>
<ch0_flip_h>0</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>0</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>1</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_2>
<image_3>
<ch0_flip_h>1</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>1</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>0</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_3>
<image_4>
<ch0_flip_h>0</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>0</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>1</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_4>
<image_5>
<ch0_flip_h>1</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>1</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>0</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_5>
<image_6>
<ch0_flip_h>0</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>0</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>1</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_6>
<image_7>
<ch0_flip_h>1</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>1</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>0</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_7>
</Document>
<?php
/*!*******************************************************************************
*! FILE NAME : copy.php
*! DESCRIPTION : copies selected files to a specified destination
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
$dest_folder = "/data/oleg/process_folder/src";
$folder = $_GET["folder"];
$file = $_GET["file"];
$imagej = $_GET["imagej"];
$dest_folder = $_GET["dest_path"];
if (!is_dir($dest_folder)){
$old = umask(0);
@mkdir($dest_folder);
umask($old);
}
if (!is_dir($imagej)){
$old = umask(0);
@mkdir($imagej);
umask($old);
}
if (substr($dest_folder,-1,1)!="/") $dest_folder = $dest_folder."/";
if (substr($folder,-1,1)!="/") $folder = $folder."/";
$file_prefix = substr($file,0,strlen($file)-6);
$file_ending = substr($file,strlen($file)-4,4);
if (strstr($file_prefix,"/")) $new_file_prefix = substr($file_prefix,strpos($file_prefix,"/")+1);
else $new_file_prefix = $file_prefix;
//for ($i=1;$i<10;$i++){
exec("cp {$folder}{$file_prefix}_* {$dest_folder}");
//}
?>
<?php
/*!*******************************************************************************
*! FILE NAME : copy_all.php
*! DESCRIPTION : copies all the files to a specified destination
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
$folder = $_GET["src"];
$dest_folder = $_GET["dest"];
$imagej = $_GET["imagej"];
$ext = "jp4";
if (substr($dest_folder,-1,1)!="/") $dest_folder = $dest_folder."/";
if (substr($folder,-1,1)!="/") $folder = $folder."/";
if (substr($imagej,-1,1)!="/") $imagej = $imagej."/";
if (!is_dir($dest_folder)){
$old = umask(0);
@mkdir($dest_folder);
umask($old);
}
if (!is_dir($imagej)){
$old = umask(0);
@mkdir($imagej);
umask($old);
}
$subs = scandir($folder);
foreach($subs as $sub){
if (is_dir($folder.$sub)&&($sub!="trash")) {
exec("cp {$folder}{$sub}/*.$ext {$dest_folder}");
}
}
?>
<?php
/*!*******************************************************************************
*! FILE NAME : fullsize_canvas.php
*! DESCRIPTION : full size preview page
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
if (!isset($_GET['path']) || !isset($_GET['name'])) echo("Too bad, some of the parameters are missing.\n");
$path = $_GET['path'];
$name = $_GET['name'];
$file_prefix = substr($name,0,strlen($name)-6);
$file_ending = substr($name,strlen($name)-4,4);
for($i=0;$i<8;$i++){
//$img_name[$i] = "{$path}/{$file_prefix}_".($i+1).$file_ending;
$img_name[$i] = "\"./jp4-proxy.php?n=tmp/".$i."&url={$path}/{$file_prefix}_".($i+1).$file_ending."\"";
}
if (isset($_GET['width'])) $w = $_GET['width'];
else $w = 400;
if (isset($_GET['height'])) $h = $_GET['height'];
else $h = 300;
?>
<html>
<head>
<title>Footage Viewer</title>
<link rel="stylesheet" type="text/css" href="js/fullsize_canvas.css" />
<script src="js/jquery-3.1.1.min.js" type="text/javascript"></script>
<script src="js/elphel.js"></script>
<script src="js/jcanvas.min.js"></script>
<script src="js/exif.js"></script>
<script src="js/jquery-jp4.js"></script>
<script src="js/fullsize_canvas.js"></script>
</head>
<body>
<div id="camerawindow" class="round_borders">
<canvas id="canvas"></canvas>
</div>
<script type="text/javascript">
var W = 2592;
var H = 1944;
var w = <?=$w?>;
var h = <?=$h?>;
var baseWidth = w;
var baseHeight = h;
$("#camerawindow").css({width:8*h,height:3*w});
var cnv;
var cContext;
cnv = document.getElementById('canvas');
cContext = cnv.getContext('2d');
cnv.setAttribute('width',baseHeight*8);cnv.setAttribute('height',baseWidth*3);
// init hidden canvases
for(var i=0;i<cams.length;i++){
append_hidden_div(i);
}
refresh_images();
function refresh_images(){
var image_name = new Array();
<?php
for($i=0;$i<8;$i++){
echo "\timage_name[$i]=".$img_name[$i].";\n";
}
?>
for (var i=0;i<8;i++){
$("#div_"+i).jp4({image:image_name[cams[i].index-1],width:w,fast:true});
}
}
</script>
</body>
</html>
\ No newline at end of file
<?php
$kmlFile=$_GET['kml'];//"map_points.kml";
$kml=file_get_contents($kmlFile);
header("Content-Type: text/xml\n");
header("Content-Length: ".strlen($kml)."\n");
header("Pragma: no-cache\n");
echo ($kml);
?>
\ No newline at end of file
<html>
<head>
<title>Eyesis4Pi (10393) Footage Preview</title>
<script src="js/jquery-3.1.1.min.js" type="text/javascript"></script>
<script src="js/jquery_list.js"></script>
<script src="js/elphel.js"></script>
<script src="js/jcanvas.min.js"></script>
<script src="js/exif.js"></script>
<script src="js/jquery-jp4.js"></script>
<script src="js/leaflet/leaflet.js"></script>
<script type="text/javascript" src="js/os_map.js"></script>
<script src="js/get_kml.js"></script>
<script src="js/map.js"></script>
<script src="js/panorama_preview.js"></script>
<link rel="stylesheet" type="text/css" href="js/leaflet/leaflet.css" />
<link rel="stylesheet" type="text/css" href="js/panorama_preview.css" />
<link rel="stylesheet" type="text/css" href="js/list.css" />
</head>
<body>
<div id=larger_preview ></div>
<div id=options>
Process files as JPEGs: <input type="checkbox" id="jpeg_mode">
</div>
<div id=input_date_list class=list>
</div>
<div id=input_text_div>
Image number
<a id=button1 class=button onclick="image_change(-1)">-</a>
<input type=text id=input_image_number value="0" onchange="refresh_map()"/>
<a id=button2 class=button onclick="image_change(1)">+</a>
</div>
<div id=filename_div>
Image name:&nbsp<div id=filename></div>
</div>
<div id="camerawindow" class="round_borders">
<a id=canvas_link href="#"><canvas id="canvas"></canvas></a>
</div>
<div id="status_div">
Status:&nbsp<div id=status>Idle</div>
</div>
<div id=osmap_wrap>
<div id=osmap>
</div>
</div>
<div id=copy_button_div>
<a id=copy_all_button class=button onclick="copy_all()">Copy All</a>
&nbsp;OR&nbsp;
<input type=text id=panos_number value="1"/>
image set(s)
<a id=copy_button class=button onclick="copy_files()">Copy to</a>
<input type=text id=copy_path value="/data/post-processing/src/"/>
</div>
</body>
</html>
\ No newline at end of file
<?php
/*!***************************************************************************
*! FILE NAME : jp4-proxy.php
*! DESCRIPTION: based on Paulo's original jp4-proxy.php
*! CO-AUTHOR: Oleg K Dzhimiev <oleg@elphel.com>
*! Copyright (C) Paulo Henrique Silva <ph.silva@gmail.com>
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*! $Log: jp4-proxy.php,v $
*/
/*!
Copyright 2010 Paulo Henrique Silva <ph.silva@gmail.com>
This file is part of movie2dng.
movie2dng is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
movie2dng is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with movie2dng. If not, see <http://www.gnu.org/licenses/>.
*/
$url = $_REQUEST["url"];
$output = file_get_contents($url);
header("Content-type: image/jpeg");
print($output);
?>
/**
* @file elphel.js
* @brief functions for pixel manipulation and drawing on canvas
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/
var Elphel = {
// Drawing
Canvas:{
/**
* Name: putImageData - the same but not the same
* Description: -
*/
putImageData: function(ctx,px,width,height){
var t0 = Date.now();
ctx.canvas.width = width;
ctx.canvas.height = height;
var imgdata = new ImageData(new Uint8ClampedArray(px), width, height);
ctx.putImageData(imgdata,0,0);
console.log("drawImageData(): "+(Date.now()-t0)/1000+" s");
/*
// new: http://stackoverflow.com/questions/15908179/draw-image-from-pixel-array-on-canvas-with-putimagedata
// obsolete:
//var img = ctx.createImageData(ctx.canvas.width,ctx.canvas.height);
//var imgdata = img.data;
// byte-copy?!!
for(var i=0;i<(imgdata.length>>2);i++){
imgdata[4*i+0] = px[4*i+0];
imgdata[4*i+1] = px[4*i+1];
imgdata[4*i+2] = px[4*i+2];
imgdata[4*i+3] = px[4*i+3];
}
ctx.putImageData(img,0,0);
*/
},
/**
* Name: drawScaled
* Description: Plugin specific. Takes source canvas - draws a scaled
* version on destination canvas
*/
drawScaled: function(cnv_src,cnv_dst,width){
var t0 = Date.now();
var ctx = cnv_src[0].getContext('2d');
var tw = ctx.canvas.width;
var th = ctx.canvas.height;
var tr = tw/th;
var sctx = cnv_dst[0].getContext('2d');
var w = Math.round(width);
var h = Math.round(w/tr);
sctx.canvas.width = w;
sctx.canvas.height = h;
cscale = Math.round(w/tw*100)/100;
sctx.scale(cscale,cscale);
sctx.drawImage(cnv_src[0],0,0);
console.log("drawScaled(): "+(Date.now()-t0)/1000+" s");
}
},
// Pixel manipulation
Pixels:{
/**
* Name: reorderJP4Blocks
* Description: clear from the function's name
*
* @pixels - pixel array, read from origin canvas
* pixels is a long 1-D array with the following structure:
* pix[i+0] - red
* pix[i+1] - green
* pix[i+2] - blue
* pix[i+3] - alpha
* @width - origin canvas width
* @height - origin canvas height
* @format - value comes from exif.js function
* 'jpeg' - skip reordering
* 'jp4' - jp4 reordeing
* 'jp46' - jp46 reordering
* @mosaic - [["Gr","R"],["B","Gb"]] - value comes from application
* odd lines: Gr,R,Gr,R
* even lines: B,Gb,B,Gb
* @nwd - true/false - comes from application - demosaicing: 'Nearest Neighbor' with 1/2 scale -
* put mosaic (different channels) for GrRBGb into one pixel for
* faster performance
*/
reorderBlocksJPx: function(pixels,width,height,format="JP4",mosaic=[["Gr","R"],["B" ,"Gb"]],nwd=false){
var t0 = Date.now();
// pixels is a long 1-D array with the following structure:
// pix[i+0] - red
// pix[i+1] - green
// pix[i+2] - blue
// pix[i+3] - alpha
var oPixels = new Uint8Array((nwd)?pixels.length/4:pixels.length);
// buffer for reordering pixels
var macroblock = new Array(); //16x16
for (var y=0;y<16;y++) macroblock[y]=new Array();
// in JP4 format the 16x16 block is 32x8 (GRBG)
// the 1st line of 32x8 blocks is the left half of the image
// the 2nd line of 32x8 blocks is the right half
// vertical step = 16 pixels
for (yb=0;yb<(height>>4);yb++){
// horizontal step = 16 pixels
for (xb=0;xb<(width>>4);xb++) {
if (format=="JP4") {
// 32x8 block reorder into 16x16
for (nb=0;nb<4;nb++) {
xbyr= nb&1; // horizontal odd-even
ybyr=(nb>>1)&1; // vertical odd-even
for (y=0;y<8;y++) {
// xb < half image -> 1st line of 32x8
// xb >= half image -> 2nd line of 32x8
//offset=(((yb<<4)+y)*width)+(nb<<3)+((xb>=(width>>5))?(((xb<<5)-width)+(width<<3)):(xb<<5));
offset=(((yb<<4)+y)*width)+(nb<<3)+(xb<<5)+((xb>=(width>>5))?((width<<3)-width):0);
for (x=0;x<8;x++) {
macroblock[(y<<1)|ybyr][(x<<1)|xbyr]=pixels[4*(offset+x)];
}
}
}
}
if (format=="JP46") {
for (y=0;y<16;y++) {
offset=((yb<<4)+y)*width+(xb<<4);
for (x=0;x<16;x++) {
//Red value only
macroblock[((y<<1)&0xe)|((y>>3)&0x1)][((x<<1)&0xe)|((x>>3)&0x1)]=pixels[4*(offset+x)];
}
}
}
if (nwd){
for (y=0;y<8;y++){
offset=width/2*((yb<<4)/2+y)+(xb<<4)/2;
for (x=0;x<8;x++) {
for(k=0;k<4;k++){
y0 = 2*y+((k>>1)&1);
x0 = 2*x+(k&1);
if (mosaic[y0&1][x0&1]=="R") r = macroblock[y0][x0];
else if (mosaic[y0&1][x0&1]=="Gr") gr = macroblock[y0][x0];
else if (mosaic[y0&1][x0&1]=="Gb") gb = macroblock[y0][x0];
else if (mosaic[y0&1][x0&1]=="B") b = macroblock[y0][x0];
}
g = (gr+gb)>>1;
oPixels[4*(offset+x)+0] = r;//4*(8*y+x);
oPixels[4*(offset+x)+1] = g;//4*(8*y+x);
oPixels[4*(offset+x)+2] = b;//4*(8*y+x);
oPixels[4*(offset+x)+3] = 255;
}
}
}else{
for (y=0;y<16;y++){
offset=width*((yb<<4)+y)+(xb<<4);
for (x=0;x<16;x++) {
//red +0, green +1, blue +2, alpha +3
// thinking: GRBG
oPixels[4*(offset+x)+0] = ((mosaic[y&1][x&1]=="R" ) )?macroblock[y][x]:0;
oPixels[4*(offset+x)+1] = ((mosaic[y&1][x&1]=="Gr")||(mosaic[y%2][x%2]=="Gb"))?macroblock[y][x]:0;
oPixels[4*(offset+x)+2] = ((mosaic[y&1][x&1]=="B" ) )?macroblock[y][x]:0;
oPixels[4*(offset+x)+3] = 255;
}
}
}
}
}
console.log("reorderJP4Blocks: "+(Date.now()-t0)/1000+" s");
return oPixels;
},
/**
* Name: demosaicNearestNeighbor with downscale
* Description: A separate function, just in case, same as in
* reorderJP4Blocks
*
* @pixels - pixel array, read from origin canvas
* pixels is a long 1-D array with the following structure:
* pix[i+0] - red
* pix[i+1] - green
* pix[i+2] - blue
* pix[i+3] - alpha
* @width - origin canvas width
* @height - origin canvas height
* @mosaic - [["Gr","R"],["B","Gb"]] - value comes from application
* odd lines: Gr,R,Gr,R
* even lines: B,Gb,B,Gb
*/
demosaicNearestNeighbor: function(pixels,width,height,mosaic=[["Gr","R"],["B" ,"Gb"]]){
var t0 = Date.now();
var oPixels = new Uint8Array(pixels.length/4);
for(var y=0;y<height/2;y++){
for(var x=0;x<width/2;x++){
for(var k=0;k<4;k++){
y0 = (k>>1)&1;
x0 = k&1;
if (mosaic[y0&1][x0&1]=="R") r = pixels[4*(width*(2*y+y0)+2*x+x0)+0];
else if (mosaic[y0&1][x0&1]=="Gr") gr = pixels[4*(width*(2*y+y0)+2*x+x0)+1];
else if (mosaic[y0&1][x0&1]=="Gb") gb = pixels[4*(width*(2*y+y0)+2*x+x0)+1];
else if (mosaic[y0&1][x0&1]=="B") b = pixels[4*(width*(2*y+y0)+2*x+x0)+2];
}
g = (gr+gb)>>1;
oPixels[4*(width/2*y+x)+0] = r;
oPixels[4*(width/2*y+x)+1] = g;
oPixels[4*(width/2*y+x)+2] = b;
oPixels[4*(width/2*y+x)+3] = 255;
}
}
console.log("demosaicNearestNeighbor(): "+(Date.now()-t0)/1000+" s");
return oPixels;
},
/**
* Name: demosaicBilinear
* Description: a simple bilinear demosaicing
*
* @pixels - pixel array, read from origin canvas
* pixels is a long 1-D array with the following structure:
* pix[i+0] - red
* pix[i+1] - green
* pix[i+2] - blue
* pix[i+3] - alpha
* @width - origin canvas width
* @height - origin canvas height
* @mosaic - [["Gr","R"],["B","Gb"]] - value comes from application
* odd lines: Gr,R,Gr,R
* even lines: B,Gb,B,Gb
* @precise - true/false:
* true - calculate values then apply gamma - provide linear pixel array
* px_linear (8bit) = px^gamma (32bit), gamma=2
* false - calculate values from gamma encoded pixels - 2-4x times faster
*/
demosaicBilinear: function(pixels, width, height, mosaic=[["Gr","R"],["B" ,"Gb"]], precise=false){
var t0 = Date.now();
var oPixels = new Uint8Array(pixels.length);
var x_l = 0, x_r = 0;
var y_t = 0, y_b = 0;
var x = width;
var y = height;
for(var y=0;y<height;y++){
for(var x=0;x<width;x++){
x_l = (x==0)?1:(x-1);
x_r = (x==(width-1))?(width-2):(x+1);
y_t = (y==0)?1:(y-1);
y_b = (y==(height-1))?(height-2):(y+1);
//Gr
if (mosaic[y%2][x%2]=="Gr"){
Pr_y0xl = pixels[4*(width*(y+0)+(x_l))+0];
Pr_y0xr = pixels[4*(width*(y+0)+(x_r))+0];
Pb_ybx0 = pixels[4*(width*(y_b)+(x+0))+2];
Pb_ytx0 = pixels[4*(width*(y_t)+(x+0))+2];
if (precise){
//Pr = pixel_l2g(1/2*(pixel_g2l(Pr_y0xl)+pixel_g2l(Pr_y0xr)));
//Pb = pixel_l2g(1/2*(pixel_g2l(Pb_ybx0)+pixel_g2l(Pb_ytx0)));
Pr = this.Functions.l2g(1/2*(Pr_y0xl+Pr_y0xr));
Pb = this.Functions.l2g(1/2*(Pb_ybx0+Pb_ytx0));
}else{
Pr = 1/2*(Pr_y0xl+Pr_y0xr);
Pb = 1/2*(Pb_ybx0+Pb_ytx0);
}
oPixels[4*(width*y+x)+0]=Math.round(Pr);
oPixels[4*(width*y+x)+2]=Math.round(Pb);
}
//R
if (mosaic[y%2][x%2]=="R"){
Pg_ytx0 = pixels[4*(width*(y_t)+(x+0))+1];
Pg_y0xl = pixels[4*(width*(y+0)+(x_l))+1];
Pg_y0xr = pixels[4*(width*(y+0)+(x_r))+1];
Pg_ybx0 = pixels[4*(width*(y_b)+(x+0))+1];
Pb_ytxl = pixels[4*(width*(y_t)+(x_l))+2];
Pb_ytxr = pixels[4*(width*(y_t)+(x_r))+2];
Pb_ybxl = pixels[4*(width*(y_b)+(x_l))+2];
Pb_ybxr = pixels[4*(width*(y_b)+(x_r))+2];
if (precise){
Pg = this.Functions.l2g(1/4*(Pg_ytx0+Pg_y0xl+Pg_y0xr+Pg_ybx0));
Pb = this.Functions.l2g(1/4*(Pb_ytxl+Pb_ytxr+Pb_ybxl+Pb_ybxr));
}else{
Pg = 1/4*(Pg_ytx0+Pg_y0xl+Pg_y0xr+Pg_ybx0);
Pb = 1/4*(Pb_ytxl+Pb_ytxr+Pb_ybxl+Pb_ybxr);
}
oPixels[4*(width*y+x)+1]=Math.round(Pg);
oPixels[4*(width*y+x)+2]=Math.round(Pb);
}
//B
if (mosaic[y%2][x%2]=="B"){
Pr_ytxl = pixels[4*(width*(y_t)+(x_l))+0];
Pr_ytxr = pixels[4*(width*(y_t)+(x_r))+0];
Pr_ybxl = pixels[4*(width*(y_b)+(x_l))+0];
Pr_ybxr = pixels[4*(width*(y_b)+(x_r))+0];
Pg_ytx0 = pixels[4*(width*(y_t)+(x+0))+1];
Pg_y0xl = pixels[4*(width*(y+0)+(x_l))+1];
Pg_y0xr = pixels[4*(width*(y+0)+(x_r))+1];
Pg_ybx0 = pixels[4*(width*(y_b)+(x+0))+1];
if (precise){
Pr = this.Functions.l2g(1/4*(Pr_ytxl+Pr_ytxr+Pr_ybxl+Pr_ybxr));
Pg = this.Functions.l2g(1/4*(Pg_ytx0+Pg_y0xl+Pg_y0xr+Pg_ybx0));
}else{
Pr = 1/4*(Pr_ytxl+Pr_ytxr+Pr_ybxl+Pr_ybxr);
Pg = 1/4*(Pg_ytx0+Pg_y0xl+Pg_y0xr+Pg_ybx0);
}
oPixels[4*(width*y+x)+0]=Math.round(Pr);
oPixels[4*(width*y+x)+1]=Math.round(Pg);
}
//Gb
if (mosaic[y%2][x%2]=="Gb"){
Pr_ytx0 = pixels[4*(width*(y_t)+(x+0))+0];
Pr_ybx0 = pixels[4*(width*(y_b)+(x+0))+0];
Pb_y0xl = pixels[4*(width*(y+0)+(x_l))+2];
Pb_y0xr = pixels[4*(width*(y+0)+(x_r))+2];
if (precise){
Pr = this.Functions.l2g(1/2*(Pr_ytx0+Pr_ybx0));
Pb = this.Functions.l2g(1/2*(Pb_y0xl+Pb_y0xr));
}else{
Pr = 1/2*(Pr_ytx0+Pr_ybx0);
Pb = 1/2*(Pb_y0xl+Pb_y0xr);
}
oPixels[4*(width*y+x)+0]=Math.round(Pr);
oPixels[4*(width*y+x)+2]=Math.round(Pb);
}
}
}
console.log("demosaicBilinear(): "+(Date.now()-t0)/1000+" s");
return oPixels;
},
/**
* Name: showSingleColorChannel
* Description: make a BW from selected channel
*
* @pixels - pixel array, read from origin canvas
* pixels is a long 1-D array with the following structure:
* pix[i+0] - red
* pix[i+1] - green
* pix[i+2] - blue
* pix[i+3] - alpha
* @width - origin canvas width (not really needed)
* @height - origin canvas height (not really needed)
* @channel - string - "red","green","blue"
*/
showSingleColorChannel: function(pixels, width, height, channel){
for(var y=0;y<height;y++){
for(var x=0;x<width;x++){
r = pixels[4*(width*y+x)+0];
g = pixels[4*(width*y+x)+1];
b = pixels[4*(width*y+x)+2];
if (channel=="red"){
pixels[4*(width*y+x)+0]=r;
pixels[4*(width*y+x)+1]=r;
pixels[4*(width*y+x)+2]=r;
}else if (channel=="green"){
pixels[4*(width*y+x)+0]=g;
pixels[4*(width*y+x)+1]=g;
pixels[4*(width*y+x)+2]=g;
}else if (channel=="blue"){
pixels[4*(width*y+x)+0]=b;
pixels[4*(width*y+x)+1]=b;
pixels[4*(width*y+x)+2]=b;
}
}
}
return pixels;
},
/**
* Name: applySaturation
* Description: get data from ctx saturate and redraw
*
* @pixels - pixel array, read from origin canvas
* pixels is a long 1-D array with the following structure:
* pix[i+0] - red
* pix[i+1] - green
* pix[i+2] - blue
* pix[i+3] - alpha
* @width - origin canvas width
* @height - origin canvas height
* @s - saturation coefficient
*/
applySaturation: function(pixels,width,height,s){
var r,g,b;
var Y,Cb,Cr;
for(var y=0;y<height;y++){
for(var x=0;x<width;x++){
r = pixels[4*(width*y+x)+0];
g = pixels[4*(width*y+x)+1];
b = pixels[4*(width*y+x)+2];
Y = 0.299*r+0.5870*g+ 0.144*b;
Cb = 128+s*(-0.1687*r-0.3313*g+ 0.500*b);
Cr = 128+s*( 0.5*r-0.4187*g-0.0813*b);
if (Cb<0) Cb=0; if (Cb>255) Cb=255;
if (Cr<0) Cr=0; if (Cr>255) Cr=255;
r = Y + 1.402*(Cr-128);
g = Y - 0.34414*(Cb-128)-0.71414*(Cr-128);
b = Y + 1.772*(Cb-128);
if (r<0) r=0; if (r>255) r=255;
if (g<0) g=0; if (g>255) g=255;
if (b<0) b=0; if (b>255) b=255;
pixels[4*(width*y+x)+0]=r;
pixels[4*(width*y+x)+1]=g;
pixels[4*(width*y+x)+2]=b;
pixels[4*(width*y+x)+3]=255;
}
}
return pixels;
},
/**
* Name: diffColorChannels
* Description: color channel difference
*
*/
diffColorChannels: function(pixels,chn1,chn2,k=1){
var t0 = Date.now();
var i1 = 0;
if (chn1=="green") i1 = 1;
if (chn1=="blue") i1 = 2;
var i2 = 0;
if (chn2=="green") i2 = 1;
if (chn2=="blue") i2 = 2;
for(var i=0;i<(pixels.length>>2);i++){
diff = k*pixels[4*i+i1] - pixels[4*i+i2];
pixels[4*i+0] = diff;
pixels[4*i+1] = diff;
pixels[4*i+2] = diff;
pixels[4*i+3] = 255;
}
console.log("diffColorChannels(): "+(Date.now()-t0)/1000+" s");
return pixels;
},
/**
* Name: ndvi_experimental
* Description: get ndvi
*/
ndvi_experimental: function(pixels){
var r,g,b;
var NIR,RED,NDVI;
for(var i=0;i<(pixels.length>>2);i++){
r = pixels[4*i+0];
g = pixels[4*i+1];
b = pixels[4*i+2];
if ((b>r)||(g>r)) {
console.log("Color error!");
NIR = 0;
RED = 1;
//if (b>r) pixels[4*(width*y+x)+2]=255;
if (b>r) pixels[4*i+2]=0;
if (g>r) pixels[4*i+1]=0;
pixels[4*i+0]=200;
}else{
if ((r-b)<20) b = 0;
k = 0.6;
RED = (r-g)/(1-k);
NIR = (r - RED)*2.5;
NDVI = (NIR-RED)/(NIR+RED);
//color
if (NDVI<0.00){r=0;g= 0;b= 0;}
else if (NDVI<0.50){r=200 ;g=400*(0.5-NDVI);b=0;}
else if (NDVI<1.00){r=400*(1-NDVI);g=200; b=0;}
else{
r = 150; g = 150; b = 150;
}
//console.log("RED="+RED+" NIR="+NIR);
pixels[4*i+0]=r;
pixels[4*i+1]=g;
pixels[4*i+2]=b;
}
}
return pixels;
},
/**
* Name: gammaEncode
* Description: -
*/
gammaEncode: function(pixels){
for(var i=0;i<(pixels.length>>2);i++){
pixels[4*i+0] = this.Functions.l2g(pixels[4*i+0]);
pixels[4*i+1] = this.Functions.l2g(pixels[4*i+1]);
pixels[4*i+2] = this.Functions.l2g(pixels[4*i+2]);
}
return pixels;
},
/**
* Name: gammaDecode
* Description: -
*/
gammaDecode: function(pixels){
for(var i=0;i<(pixels.length>>2);i++){
pixels[4*i+0] = this.Functions.g2l(pixels[4*i+0]);
pixels[4*i+1] = this.Functions.g2l(pixels[4*i+1]);
pixels[4*i+2] = this.Functions.g2l(pixels[4*i+2]);
}
return pixels;
}
},
// simple funcitons
Functions:{
/**
* Name: l2g
* Desctiptin: convert a value from linear to gamma encoded,
* close to square root
*/
l2g: function(pv){
// assuming gamma=2
var tmp = Math.sqrt(pv);
if (tmp>255) tmp = 255;
return tmp;
},
/*
* Name: g2l
* Desctiptin: convert a value gamma encoded to linear,
* close to square
*/
g2l: function(pv){
// assuming gamma = 2
var tmp = pv*pv;
return tmp;
}
},
test: function(){
console.log("Test message from elphel.js: ok");
}
}
\ No newline at end of file
/*
The MIT License (MIT)
Copyright (c) 2008 Jacob Seidelin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR
A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------------------------------*/
(function() {
var debug = false;
var root = this;
var EXIF = function(obj) {
if (obj instanceof EXIF) return obj;
if (!(this instanceof EXIF)) return new EXIF(obj);
this.EXIFwrapped = obj;
};
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = EXIF;
}
exports.EXIF = EXIF;
} else {
root.EXIF = EXIF;
}
var ExifTags = EXIF.Tags = {
// version tags
0x9000 : "ExifVersion", // EXIF version
0xA000 : "FlashpixVersion", // Flashpix format version
// colorspace tags
0xA001 : "ColorSpace", // Color space information tag
// image configuration
0xA002 : "PixelXDimension", // Valid width of meaningful image
0xA003 : "PixelYDimension", // Valid height of meaningful image
0x9101 : "ComponentsConfiguration", // Information about channels
0x9102 : "CompressedBitsPerPixel", // Compressed bits per pixel
// user information
0x927C : "MakerNote", // Any desired information written by the manufacturer
0x9286 : "UserComment", // Comments by user
// related file
0xA004 : "RelatedSoundFile", // Name of related sound file
// date and time
0x9003 : "DateTimeOriginal", // Date and time when the original image was generated
0x9004 : "DateTimeDigitized", // Date and time when the image was stored digitally
0x9290 : "SubsecTime", // Fractions of seconds for DateTime
0x9291 : "SubsecTimeOriginal", // Fractions of seconds for DateTimeOriginal
0x9292 : "SubsecTimeDigitized", // Fractions of seconds for DateTimeDigitized
// picture-taking conditions
0x829A : "ExposureTime", // Exposure time (in seconds)
0x829D : "FNumber", // F number
0x8822 : "ExposureProgram", // Exposure program
0x8824 : "SpectralSensitivity", // Spectral sensitivity
0x8827 : "ISOSpeedRatings", // ISO speed rating
0x8828 : "OECF", // Optoelectric conversion factor
0x9201 : "ShutterSpeedValue", // Shutter speed
0x9202 : "ApertureValue", // Lens aperture
0x9203 : "BrightnessValue", // Value of brightness
0x9204 : "ExposureBias", // Exposure bias
0x9205 : "MaxApertureValue", // Smallest F number of lens
0x9206 : "SubjectDistance", // Distance to subject in meters
0x9207 : "MeteringMode", // Metering mode
0x9208 : "LightSource", // Kind of light source
0x9209 : "Flash", // Flash status
0x9214 : "SubjectArea", // Location and area of main subject
0x920A : "FocalLength", // Focal length of the lens in mm
0xA20B : "FlashEnergy", // Strobe energy in BCPS
0xA20C : "SpatialFrequencyResponse", //
0xA20E : "FocalPlaneXResolution", // Number of pixels in width direction per FocalPlaneResolutionUnit
0xA20F : "FocalPlaneYResolution", // Number of pixels in height direction per FocalPlaneResolutionUnit
0xA210 : "FocalPlaneResolutionUnit", // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution
0xA214 : "SubjectLocation", // Location of subject in image
0xA215 : "ExposureIndex", // Exposure index selected on camera
0xA217 : "SensingMethod", // Image sensor type
0xA300 : "FileSource", // Image source (3 == DSC)
0xA301 : "SceneType", // Scene type (1 == directly photographed)
0xA302 : "CFAPattern", // Color filter array geometric pattern
0xA401 : "CustomRendered", // Special processing
0xA402 : "ExposureMode", // Exposure mode
0xA403 : "WhiteBalance", // 1 = auto white balance, 2 = manual
0xA404 : "DigitalZoomRation", // Digital zoom ratio
0xA405 : "FocalLengthIn35mmFilm", // Equivalent foacl length assuming 35mm film camera (in mm)
0xA406 : "SceneCaptureType", // Type of scene
0xA407 : "GainControl", // Degree of overall image gain adjustment
0xA408 : "Contrast", // Direction of contrast processing applied by camera
0xA409 : "Saturation", // Direction of saturation processing applied by camera
0xA40A : "Sharpness", // Direction of sharpness processing applied by camera
0xA40B : "DeviceSettingDescription", //
0xA40C : "SubjectDistanceRange", // Distance to subject
// other tags
0xA005 : "InteroperabilityIFDPointer",
0xA420 : "ImageUniqueID" // Identifier assigned uniquely to each image
};
var TiffTags = EXIF.TiffTags = {
0x0100 : "ImageWidth",
0x0101 : "ImageHeight",
0x8769 : "ExifIFDPointer",
0x8825 : "GPSInfoIFDPointer",
0xA005 : "InteroperabilityIFDPointer",
0x0102 : "BitsPerSample",
0x0103 : "Compression",
0x0106 : "PhotometricInterpretation",
0x0112 : "Orientation",
0x0115 : "SamplesPerPixel",
0x011C : "PlanarConfiguration",
0x0212 : "YCbCrSubSampling",
0x0213 : "YCbCrPositioning",
0x011A : "XResolution",
0x011B : "YResolution",
0x0128 : "ResolutionUnit",
0x0111 : "StripOffsets",
0x0116 : "RowsPerStrip",
0x0117 : "StripByteCounts",
0x0201 : "JPEGInterchangeFormat",
0x0202 : "JPEGInterchangeFormatLength",
0x012D : "TransferFunction",
0x013E : "WhitePoint",
0x013F : "PrimaryChromaticities",
0x0211 : "YCbCrCoefficients",
0x0214 : "ReferenceBlackWhite",
0x0132 : "DateTime",
0x010E : "ImageDescription",
0x010F : "Make",
0x0110 : "Model",
0x0131 : "Software",
0x013B : "Artist",
0x8298 : "Copyright"
};
var GPSTags = EXIF.GPSTags = {
0x0000 : "GPSVersionID",
0x0001 : "GPSLatitudeRef",
0x0002 : "GPSLatitude",
0x0003 : "GPSLongitudeRef",
0x0004 : "GPSLongitude",
0x0005 : "GPSAltitudeRef",
0x0006 : "GPSAltitude",
0x0007 : "GPSTimeStamp",
0x0008 : "GPSSatellites",
0x0009 : "GPSStatus",
0x000A : "GPSMeasureMode",
0x000B : "GPSDOP",
0x000C : "GPSSpeedRef",
0x000D : "GPSSpeed",
0x000E : "GPSTrackRef",
0x000F : "GPSTrack",
0x0010 : "GPSImgDirectionRef",
0x0011 : "GPSImgDirection",
0x0012 : "GPSMapDatum",
0x0013 : "GPSDestLatitudeRef",
0x0014 : "GPSDestLatitude",
0x0015 : "GPSDestLongitudeRef",
0x0016 : "GPSDestLongitude",
0x0017 : "GPSDestBearingRef",
0x0018 : "GPSDestBearing",
0x0019 : "GPSDestDistanceRef",
0x001A : "GPSDestDistance",
0x001B : "GPSProcessingMethod",
0x001C : "GPSAreaInformation",
0x001D : "GPSDateStamp",
0x001E : "GPSDifferential"
};
var StringValues = EXIF.StringValues = {
ExposureProgram : {
0 : "Not defined",
1 : "Manual",
2 : "Normal program",
3 : "Aperture priority",
4 : "Shutter priority",
5 : "Creative program",
6 : "Action program",
7 : "Portrait mode",
8 : "Landscape mode"
},
MeteringMode : {
0 : "Unknown",
1 : "Average",
2 : "CenterWeightedAverage",
3 : "Spot",
4 : "MultiSpot",
5 : "Pattern",
6 : "Partial",
255 : "Other"
},
LightSource : {
0 : "Unknown",
1 : "Daylight",
2 : "Fluorescent",
3 : "Tungsten (incandescent light)",
4 : "Flash",
9 : "Fine weather",
10 : "Cloudy weather",
11 : "Shade",
12 : "Daylight fluorescent (D 5700 - 7100K)",
13 : "Day white fluorescent (N 4600 - 5400K)",
14 : "Cool white fluorescent (W 3900 - 4500K)",
15 : "White fluorescent (WW 3200 - 3700K)",
17 : "Standard light A",
18 : "Standard light B",
19 : "Standard light C",
20 : "D55",
21 : "D65",
22 : "D75",
23 : "D50",
24 : "ISO studio tungsten",
255 : "Other"
},
Flash : {
0x0000 : "Flash did not fire",
0x0001 : "Flash fired",
0x0005 : "Strobe return light not detected",
0x0007 : "Strobe return light detected",
0x0009 : "Flash fired, compulsory flash mode",
0x000D : "Flash fired, compulsory flash mode, return light not detected",
0x000F : "Flash fired, compulsory flash mode, return light detected",
0x0010 : "Flash did not fire, compulsory flash mode",
0x0018 : "Flash did not fire, auto mode",
0x0019 : "Flash fired, auto mode",
0x001D : "Flash fired, auto mode, return light not detected",
0x001F : "Flash fired, auto mode, return light detected",
0x0020 : "No flash function",
0x0041 : "Flash fired, red-eye reduction mode",
0x0045 : "Flash fired, red-eye reduction mode, return light not detected",
0x0047 : "Flash fired, red-eye reduction mode, return light detected",
0x0049 : "Flash fired, compulsory flash mode, red-eye reduction mode",
0x004D : "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
0x004F : "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
0x0059 : "Flash fired, auto mode, red-eye reduction mode",
0x005D : "Flash fired, auto mode, return light not detected, red-eye reduction mode",
0x005F : "Flash fired, auto mode, return light detected, red-eye reduction mode"
},
SensingMethod : {
1 : "Not defined",
2 : "One-chip color area sensor",
3 : "Two-chip color area sensor",
4 : "Three-chip color area sensor",
5 : "Color sequential area sensor",
7 : "Trilinear sensor",
8 : "Color sequential linear sensor"
},
SceneCaptureType : {
0 : "Standard",
1 : "Landscape",
2 : "Portrait",
3 : "Night scene"
},
SceneType : {
1 : "Directly photographed"
},
CustomRendered : {
0 : "Normal process",
1 : "Custom process"
},
WhiteBalance : {
0 : "Auto white balance",
1 : "Manual white balance"
},
GainControl : {
0 : "None",
1 : "Low gain up",
2 : "High gain up",
3 : "Low gain down",
4 : "High gain down"
},
Contrast : {
0 : "Normal",
1 : "Soft",
2 : "Hard"
},
Saturation : {
0 : "Normal",
1 : "Low saturation",
2 : "High saturation"
},
Sharpness : {
0 : "Normal",
1 : "Soft",
2 : "Hard"
},
SubjectDistanceRange : {
0 : "Unknown",
1 : "Macro",
2 : "Close view",
3 : "Distant view"
},
FileSource : {
3 : "DSC"
},
Components : {
0 : "",
1 : "Y",
2 : "Cb",
3 : "Cr",
4 : "R",
5 : "G",
6 : "B"
}
};
function addEvent(element, event, handler) {
if (element.addEventListener) {
element.addEventListener(event, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on" + event, handler);
}
}
function imageHasData(img) {
return !!(img.exifdata);
}
function base64ToArrayBuffer(base64, contentType) {
contentType = contentType || base64.match(/^data\:([^\;]+)\;base64,/mi)[1] || ''; // e.g. 'data:image/jpeg;base64,...' => 'image/jpeg'
base64 = base64.replace(/^data\:([^\;]+)\;base64,/gmi, '');
var binary = atob(base64);
var len = binary.length;
var buffer = new ArrayBuffer(len);
var view = new Uint8Array(buffer);
for (var i = 0; i < len; i++) {
view[i] = binary.charCodeAt(i);
}
return buffer;
}
function objectURLToBlob(url, callback) {
var http = new XMLHttpRequest();
http.open("GET", url, true);
http.responseType = "blob";
http.onload = function(e) {
if (this.status == 200 || this.status === 0) {
callback(this.response);
}
};
http.send();
}
function getImageData(img, callback) {
function handleBinaryFile(binFile) {
var data = findEXIFinJPEG(binFile);
var iptcdata = findIPTCinJPEG(binFile);
img.exifdata = data || {};
img.iptcdata = iptcdata || {};
if (callback) {
callback.call(img);
}
}
if (img.src) {
if (/^data\:/i.test(img.src)) { // Data URI
var arrayBuffer = base64ToArrayBuffer(img.src);
handleBinaryFile(arrayBuffer);
} else if (/^blob\:/i.test(img.src)) { // Object URL
var fileReader = new FileReader();
fileReader.onload = function(e) {
handleBinaryFile(e.target.result);
};
objectURLToBlob(img.src, function (blob) {
fileReader.readAsArrayBuffer(blob);
});
} else {
var http = new XMLHttpRequest();
http.onload = function() {
if (this.status == 200 || this.status === 0) {
handleBinaryFile(http.response);
} else {
throw "Could not load image";
}
http = null;
};
http.open("GET", img.src, true);
http.responseType = "arraybuffer";
http.send(null);
}
} else if (window.FileReader && (img instanceof window.Blob || img instanceof window.File)) {
var fileReader = new FileReader();
fileReader.onload = function(e) {
if (debug) console.log("Got file of length " + e.target.result.byteLength);
handleBinaryFile(e.target.result);
};
fileReader.readAsArrayBuffer(img);
}
}
function findEXIFinJPEG(file) {
var dataView = new DataView(file);
if (debug) console.log("Got file of length " + file.byteLength);
if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
if (debug) console.log("Not a valid JPEG");
return false; // not a valid jpeg
}
var offset = 2,
length = file.byteLength,
marker;
while (offset < length) {
if (dataView.getUint8(offset) != 0xFF) {
if (debug) console.log("Not a valid marker at offset " + offset + ", found: " + dataView.getUint8(offset));
return false; // not a valid marker, something is wrong
}
marker = dataView.getUint8(offset + 1);
if (debug) console.log(marker);
// we could implement handling for other markers here,
// but we're only looking for 0xFFE1 for EXIF data
if (marker == 225) {
if (debug) console.log("Found 0xFFE1 marker");
return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2);
// offset += 2 + file.getShortAt(offset+2, true);
} else {
offset += 2 + dataView.getUint16(offset+2);
}
}
}
function findIPTCinJPEG(file) {
var dataView = new DataView(file);
if (debug) console.log("Got file of length " + file.byteLength);
if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
if (debug) console.log("Not a valid JPEG");
return false; // not a valid jpeg
}
var offset = 2,
length = file.byteLength;
var isFieldSegmentStart = function(dataView, offset){
return (
dataView.getUint8(offset) === 0x38 &&
dataView.getUint8(offset+1) === 0x42 &&
dataView.getUint8(offset+2) === 0x49 &&
dataView.getUint8(offset+3) === 0x4D &&
dataView.getUint8(offset+4) === 0x04 &&
dataView.getUint8(offset+5) === 0x04
);
};
while (offset < length) {
if ( isFieldSegmentStart(dataView, offset )){
// Get the length of the name header (which is padded to an even number of bytes)
var nameHeaderLength = dataView.getUint8(offset+7);
if(nameHeaderLength % 2 !== 0) nameHeaderLength += 1;
// Check for pre photoshop 6 format
if(nameHeaderLength === 0) {
// Always 4
nameHeaderLength = 4;
}
var startOffset = offset + 8 + nameHeaderLength;
var sectionLength = dataView.getUint16(offset + 6 + nameHeaderLength);
return readIPTCData(file, startOffset, sectionLength);
break;
}
// Not the marker, continue searching
offset++;
}
}
var IptcFieldMap = {
0x78 : 'caption',
0x6E : 'credit',
0x19 : 'keywords',
0x37 : 'dateCreated',
0x50 : 'byline',
0x55 : 'bylineTitle',
0x7A : 'captionWriter',
0x69 : 'headline',
0x74 : 'copyright',
0x0F : 'category'
};
function readIPTCData(file, startOffset, sectionLength){
var dataView = new DataView(file);
var data = {};
var fieldValue, fieldName, dataSize, segmentType, segmentSize;
var segmentStartPos = startOffset;
while(segmentStartPos < startOffset+sectionLength) {
if(dataView.getUint8(segmentStartPos) === 0x1C && dataView.getUint8(segmentStartPos+1) === 0x02){
segmentType = dataView.getUint8(segmentStartPos+2);
if(segmentType in IptcFieldMap) {
dataSize = dataView.getInt16(segmentStartPos+3);
segmentSize = dataSize + 5;
fieldName = IptcFieldMap[segmentType];
fieldValue = getStringFromDB(dataView, segmentStartPos+5, dataSize);
// Check if we already stored a value with this name
if(data.hasOwnProperty(fieldName)) {
// Value already stored with this name, create multivalue field
if(data[fieldName] instanceof Array) {
data[fieldName].push(fieldValue);
}
else {
data[fieldName] = [data[fieldName], fieldValue];
}
}
else {
data[fieldName] = fieldValue;
}
}
}
segmentStartPos++;
}
return data;
}
function readTags(file, tiffStart, dirStart, strings, bigEnd) {
var entries = file.getUint16(dirStart, !bigEnd),
tags = {},
entryOffset, tag,
i;
for (i=0;i<entries;i++) {
entryOffset = dirStart + i*12 + 2;
tag = strings[file.getUint16(entryOffset, !bigEnd)];
if (!tag && debug) console.log("Unknown tag: " + file.getUint16(entryOffset, !bigEnd));
tags[tag] = readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);
}
return tags;
}
function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
var type = file.getUint16(entryOffset+2, !bigEnd),
numValues = file.getUint32(entryOffset+4, !bigEnd),
valueOffset = file.getUint32(entryOffset+8, !bigEnd) + tiffStart,
offset,
vals, val, n,
numerator, denominator;
switch (type) {
case 1: // byte, 8-bit unsigned int
case 7: // undefined, 8-bit byte, value depending on field
if (numValues == 1) {
return file.getUint8(entryOffset + 8, !bigEnd);
} else {
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getUint8(offset + n);
}
return vals;
}
case 2: // ascii, 8-bit byte
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
return getStringFromDB(file, offset, numValues-1);
case 3: // short, 16 bit int
if (numValues == 1) {
return file.getUint16(entryOffset + 8, !bigEnd);
} else {
offset = numValues > 2 ? valueOffset : (entryOffset + 8);
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getUint16(offset + 2*n, !bigEnd);
}
return vals;
}
case 4: // long, 32 bit int
if (numValues == 1) {
return file.getUint32(entryOffset + 8, !bigEnd);
} else {
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getUint32(valueOffset + 4*n, !bigEnd);
}
return vals;
}
case 5: // rational = two long values, first is numerator, second is denominator
if (numValues == 1) {
numerator = file.getUint32(valueOffset, !bigEnd);
denominator = file.getUint32(valueOffset+4, !bigEnd);
val = new Number(numerator / denominator);
val.numerator = numerator;
val.denominator = denominator;
return val;
} else {
vals = [];
for (n=0;n<numValues;n++) {
numerator = file.getUint32(valueOffset + 8*n, !bigEnd);
denominator = file.getUint32(valueOffset+4 + 8*n, !bigEnd);
vals[n] = new Number(numerator / denominator);
vals[n].numerator = numerator;
vals[n].denominator = denominator;
}
return vals;
}
case 9: // slong, 32 bit signed int
if (numValues == 1) {
return file.getInt32(entryOffset + 8, !bigEnd);
} else {
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getInt32(valueOffset + 4*n, !bigEnd);
}
return vals;
}
case 10: // signed rational, two slongs, first is numerator, second is denominator
if (numValues == 1) {
return file.getInt32(valueOffset, !bigEnd) / file.getInt32(valueOffset+4, !bigEnd);
} else {
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getInt32(valueOffset + 8*n, !bigEnd) / file.getInt32(valueOffset+4 + 8*n, !bigEnd);
}
return vals;
}
}
}
function getStringFromDB(buffer, start, length) {
var outstr = "";
for (n = start; n < start+length; n++) {
outstr += String.fromCharCode(buffer.getUint8(n));
}
return outstr;
}
function readEXIFData(file, start) {
if (getStringFromDB(file, start, 4) != "Exif") {
if (debug) console.log("Not valid EXIF data! " + getStringFromDB(file, start, 4));
return false;
}
var bigEnd,
tags, tag,
exifData, gpsData,
tiffOffset = start + 6;
// test for TIFF validity and endianness
if (file.getUint16(tiffOffset) == 0x4949) {
bigEnd = false;
} else if (file.getUint16(tiffOffset) == 0x4D4D) {
bigEnd = true;
} else {
if (debug) console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
return false;
}
if (file.getUint16(tiffOffset+2, !bigEnd) != 0x002A) {
if (debug) console.log("Not valid TIFF data! (no 0x002A)");
return false;
}
var firstIFDOffset = file.getUint32(tiffOffset+4, !bigEnd);
if (firstIFDOffset < 0x00000008) {
if (debug) console.log("Not valid TIFF data! (First offset less than 8)", file.getUint32(tiffOffset+4, !bigEnd));
return false;
}
tags = readTags(file, tiffOffset, tiffOffset + firstIFDOffset, TiffTags, bigEnd);
if (tags.ExifIFDPointer) {
exifData = readTags(file, tiffOffset, tiffOffset + tags.ExifIFDPointer, ExifTags, bigEnd);
for (tag in exifData) {
switch (tag) {
case "LightSource" :
case "Flash" :
case "MeteringMode" :
case "ExposureProgram" :
case "SensingMethod" :
case "SceneCaptureType" :
case "SceneType" :
case "CustomRendered" :
case "WhiteBalance" :
case "GainControl" :
case "Contrast" :
case "Saturation" :
case "Sharpness" :
case "SubjectDistanceRange" :
case "FileSource" :
exifData[tag] = StringValues[tag][exifData[tag]];
break;
case "ExifVersion" :
case "FlashpixVersion" :
exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);
break;
case "ComponentsConfiguration" :
exifData[tag] =
StringValues.Components[exifData[tag][0]] +
StringValues.Components[exifData[tag][1]] +
StringValues.Components[exifData[tag][2]] +
StringValues.Components[exifData[tag][3]];
break;
}
tags[tag] = exifData[tag];
}
}
if (tags.GPSInfoIFDPointer) {
gpsData = readTags(file, tiffOffset, tiffOffset + tags.GPSInfoIFDPointer, GPSTags, bigEnd);
for (tag in gpsData) {
switch (tag) {
case "GPSVersionID" :
gpsData[tag] = gpsData[tag][0] +
"." + gpsData[tag][1] +
"." + gpsData[tag][2] +
"." + gpsData[tag][3];
break;
}
tags[tag] = gpsData[tag];
}
}
return tags;
}
EXIF.getData = function(img, callback) {
if ((img instanceof Image || img instanceof HTMLImageElement) && !img.complete) return false;
if (!imageHasData(img)) {
getImageData(img, callback);
} else {
if (callback) {
callback.call(img);
}
}
return true;
}
EXIF.getTag = function(img, tag) {
if (!imageHasData(img)) return;
return img.exifdata[tag];
}
EXIF.getAllTags = function(img) {
if (!imageHasData(img)) return {};
var a,
data = img.exifdata,
tags = {};
for (a in data) {
if (data.hasOwnProperty(a)) {
tags[a] = data[a];
}
}
return tags;
}
EXIF.pretty = function(img) {
if (!imageHasData(img)) return "";
var a,
data = img.exifdata,
strPretty = "";
for (a in data) {
if (data.hasOwnProperty(a)) {
if (typeof data[a] == "object") {
if (data[a] instanceof Number) {
strPretty += a + " : " + data[a] + " [" + data[a].numerator + "/" + data[a].denominator + "]\r\n";
} else {
strPretty += a + " : [" + data[a].length + " values]\r\n";
}
} else {
strPretty += a + " : " + data[a] + "\r\n";
}
}
}
return strPretty;
}
EXIF.readFromBinaryFile = function(file) {
return findEXIFinJPEG(file);
}
if (typeof define === 'function' && define.amd) {
define('exif-js', [], function() {
return EXIF;
});
}
}.call(this));
#camerawindow {
position: absolute;
top: 5px;
left: 5px;
/* width:1200px;
height:600px;*/
padding:5px;
/*background:#99ff99;*/
}
.invisible_element {
position:absolute;
top:0px;
left:0px;
visibility:hidden;
}
.round_borders {
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
\ No newline at end of file
/*!*******************************************************************************
*! FILE NAME : fullsize_canvas.js
*! DESCRIPTION : functions for creating a full size preview
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
// sort
var cams = [
{"ip":"192.168.0.161","port":2326,"channel":3,"master":0,"logger":0,"index":4},
{"ip":"192.168.0.161","port":2325,"channel":2,"master":0,"logger":0,"index":3},
{"ip":"192.168.0.161","port":2323,"channel":0,"master":0,"logger":1,"index":1},
{"ip":"192.168.0.161","port":2324,"channel":1,"master":0,"logger":0,"index":2},
{"ip":"192.168.0.162","port":2326,"channel":3,"master":0,"logger":0,"index":8},
{"ip":"192.168.0.162","port":2325,"channel":2,"master":0,"logger":0,"index":7},
{"ip":"192.168.0.162","port":2323,"channel":0,"master":0,"logger":0,"index":5},
{"ip":"192.168.0.162","port":2324,"channel":1,"master":0,"logger":0,"index":6},
{"ip":"192.168.0.163","port":2325,"channel":2,"master":1,"logger":0,"index":9},
{"ip":"192.168.0.163","port":2326,"channel":3,"master":0,"logger":0,"index":10}
];
var settings_file = "settings.xml";
function draw_image(img,index){
var w = baseWidth;
var h = baseHeight;
index = +index;
cContext.rotate(90*Math.PI/180);
if (index%2==0) {
cContext.drawImage(img, 0,0*h,w,h, 0*w,-1*h*(index+1),w,h);
cContext.drawImage(img, 0,1*h,w,h, 1*w,-1*h*(index+1),w,h);
cContext.scale(-1,1);
cContext.drawImage(img, 0,2*h,w,h, -3*w, -1*h*(index+1), w, h);
cContext.scale(-1,1);
}else{
cContext.scale(1,-1); //mirror is needed
cContext.drawImage(img, 0,0*h,w,h, 0*w,index*h,w,h);
cContext.drawImage(img, 0,1*h,w,h, 1*w,index*h,w,h);
cContext.scale(-1,1);
cContext.drawImage(img, 0,2*h,w,h, -3*w,h*(index),w,h);
cContext.scale(-1,1);
cContext.scale(1,-1);
}
cContext.rotate(-90*Math.PI/180);
}
function append_hidden_div(index){
el = $("<div>",{
id: "div_"+index
}).css({
display: "none"
});
el.attr("index",index);
el.on("canvas_ready",function(){
//can draw on main canvas
var cnv = $(this).find("#scaled")[0];
var index = $(this).attr("index");
draw_image(cnv,index);
});
$("body").append(el);
}
/*!*******************************************************************************
*! FILE NAME : get_kml.js
*! DESCRIPTION: reads a kml certain record
*! Copyright (C) 2011 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
var gXML_req;
function requestNode(url,callbacFunc) { // callbacFunc should accept array of panorama parameters as an argument
gXML_req=new XMLHttpRequest();
// made it sync (false = sync)
gXML_req.open("GET", url, false);
gXML_req.onreadystatechange = function() {
if (typeof(gXML_req)=="undefined") return; ///
if (gXML_req.readyState == 4) {
if (((gXML_req.status >= 200) && (gXML_req.status < 300)) || (gXML_req.status ==304) ||
((typeof(gXML_req.status) =='undefined' ) && ((navigator.userAgent.indexOf("Safari")>=0) ||
(navigator.userAgent.indexOf("Konqueror")>=0)))) {
parseRequest(gXML_req.responseXML,callbacFunc);
return;
} else {
if (gXML_req.status) {
alert("There was a problem retrieving the XML data:\n" + (gXML_req.status?gXML_req.statusText:"gXML_req.status==0")+
"\nYou may safely ignore this message if you just reloaded this page");
}
}
}
}
gXML_req.send(null);
}
function parseRequest(xml,callbacFunc) {
var node;
var links;
var panos=[];
var pano={};
if (xml.getElementsByTagName('NumberOfNodes').length>0) {
pano.numberofnodes = xml.getElementsByTagName('NumberOfNodes')[0].firstChild.nodeValue;
}
if (xml.getElementsByTagName('ThisNode').length>0) {
pano.thisnode = xml.getElementsByTagName('ThisNode')[0].firstChild.nodeValue;
}
if (xml.getElementsByTagName('PhotoOverlay').length>0) {
node=xml.getElementsByTagName('PhotoOverlay')[0];
if (node.getElementsByTagName('name').length>0) {
pano.name = node.getElementsByTagName('name')[0].firstChild.nodeValue;
}
if (node.getElementsByTagName('Camera').length>0) {
nodeCam=node.getElementsByTagName('Camera')[0];
if (nodeCam.getElementsByTagName('longitude').length>0) pano.longitude=parseFloat(nodeCam.getElementsByTagName('longitude')[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('latitude' ).length>0) pano.latitude= parseFloat(nodeCam.getElementsByTagName('latitude' )[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('altitude' ).length>0) pano.altitude= parseFloat(nodeCam.getElementsByTagName('altitude' )[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('heading' ).length>0) pano.heading= parseFloat(nodeCam.getElementsByTagName('heading' )[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('tilt' ).length>0) pano.tilt= parseFloat(nodeCam.getElementsByTagName('tilt' )[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('roll' ).length>0) pano.roll= parseFloat(nodeCam.getElementsByTagName('roll' )[0].firstChild.nodeValue);
if (node.getElementsByTagName('Icon').length>0) {
nodeIcon=node.getElementsByTagName('Icon')[0];
if (nodeIcon.getElementsByTagName('href').length>0) pano.href=nodeIcon.getElementsByTagName('href')[0].firstChild.nodeValue;
}
// panos.push(pano);
}
}
if (xml.getElementsByTagName('Links').length>0) {
nodeLinks=xml.getElementsByTagName('Links')[0];
pano.links = [];
if (nodeLinks.getElementsByTagName('Link').length>0) {
for (var i=0;i<nodeLinks.getElementsByTagName('Link').length;i++) {
nodeLink=nodeLinks.getElementsByTagName('Link')[i];
pano.links[i] = {};
pano.links[i].pano = nodeLink.getElementsByTagName('href')[0].firstChild.nodeValue;
pano.links[i].description = nodeLink.getElementsByTagName('name')[0].firstChild.nodeValue;
pano.links[i].heading = nodeLink.getElementsByTagName('azimuth')[0].firstChild.nodeValue;
}
}
}
callbacFunc(pano);
}
/*
jCanvas v15.03.29
Copyright 2015 Caleb Evans
Released under the MIT license
*/
(function(f,L,G){"object"===typeof module&&"object"===typeof module.exports?module.exports=L.document?G(L,!0):function(f,L){return G(f,L)}:G(f,L)})("undefined"!==typeof window?window.$:{},"undefined"!==typeof window?window:this,function(f,L){function G(d){for(var c in d)d.hasOwnProperty(c)&&(this[c]=d[c]);return this}function na(){aa(this,na.baseDefaults)}function ja(d){return"string"===ba(d)}function K(d){return d&&d.getContext?d.getContext("2d"):h}function ka(d){var c,a,b;for(c in d)d.hasOwnProperty(c)&&
(b=d[c],a=ba(b),"string"!==a||isNaN(oa(b))||isNaN(Y(b))||"text"===c||(d[c]=Y(b)));void 0!==d.text&&(d.text=String(d.text))}function la(d){d=aa({},d);d.masks=d.masks.slice(0);return d}function fa(d,c){var a;d.save();a=la(c.transforms);c.savedTransforms.push(a)}function xa(d,c,a,b){a[b]&&(da(a[b])?c[b]=a[b].call(d,a):c[b]=a[b])}function S(d,c,a){xa(d,c,a,"fillStyle");xa(d,c,a,"strokeStyle");c.lineWidth=a.strokeWidth;a.rounded?c.lineCap=c.lineJoin="round":(c.lineCap=a.strokeCap,c.lineJoin=a.strokeJoin,
c.miterLimit=a.miterLimit);a.strokeDash||(a.strokeDash=[]);c.setLineDash&&c.setLineDash(a.strokeDash);c.webkitLineDash=c.mozDash=a.strokeDash;c.lineDashOffset=c.webkitLineDashOffset=c.mozDashOffset=a.strokeDashOffset;c.shadowOffsetX=a.shadowX;c.shadowOffsetY=a.shadowY;c.shadowBlur=a.shadowBlur;c.shadowColor=a.shadowColor;c.globalAlpha=a.opacity;c.globalCompositeOperation=a.compositing;a.imageSmoothing&&(c.imageSmoothingEnabled=c.mozImageSmoothingEnabled=a.imageSmoothingEnabled)}function ya(d,c,a){a.mask&&
(a.autosave&&fa(d,c),d.clip(),c.transforms.masks.push(a._args))}function W(d,c,a){a.closed&&c.closePath();a.shadowStroke&&0!==a.strokeWidth?(c.stroke(),c.fill(),c.shadowColor="transparent",c.shadowBlur=0,c.stroke()):(c.fill(),"transparent"!==a.fillStyle&&(c.shadowColor="transparent"),0!==a.strokeWidth&&c.stroke());a.closed||c.closePath();a._transformed&&c.restore();a.mask&&(d=N(d),ya(c,d,a))}function R(d,c,a,b,g){a._toRad=a.inDegrees?D/180:1;a._transformed=u;c.save();a.fromCenter||a._centered||b===
p||(g===p&&(g=b),a.x+=b/2,a.y+=g/2,a._centered=u);a.rotate&&za(c,a,h);1===a.scale&&1===a.scaleX&&1===a.scaleY||Aa(c,a,h);(a.translate||a.translateX||a.translateY)&&Ba(c,a,h)}function N(d){var c=ca.dataCache,a;c._canvas===d&&c._data?a=c._data:(a=f.data(d,"jCanvas"),a||(a={canvas:d,layers:[],layer:{names:{},groups:{}},eventHooks:{},intersecting:[],lastIntersected:h,cursor:f(d).css("cursor"),drag:{layer:h,dragging:A},event:{type:h,x:h,y:h},events:{},transforms:la(pa),savedTransforms:[],animating:A,animated:h,
pixelRatio:1,scaled:A},f.data(d,"jCanvas",a)),c._canvas=d,c._data=a);return a}function Ca(d,c,a){for(var b in Z.events)Z.events.hasOwnProperty(b)&&(a[b]||a.cursors&&a.cursors[b])&&Da(d,c,a,b);c.events.mouseout||(d.bind("mouseout.jCanvas",function(){var a=c.drag.layer,b;a&&(c.drag={},Q(d,c,a,"dragcancel"));for(b=0;b<c.layers.length;b+=1)a=c.layers[b],a._hovered&&d.triggerLayerEvent(c.layers[b],"mouseout");d.drawLayers()}),c.events.mouseout=u)}function Da(d,c,a,b){Z.events[b](d,c);a._event=u}function Ea(d,
c,a){var b,g,e;if(a.draggable||a.cursors){b=["mousedown","mousemove","mouseup"];for(e=0;e<b.length;e+=1)g=b[e],Da(d,c,a,g);a._event=u}}function qa(d,c,a,b){d=c.layer.names;b?b.name!==p&&ja(a.name)&&a.name!==b.name&&delete d[a.name]:b=a;ja(b.name)&&(d[b.name]=a)}function ra(d,c,a,b){d=c.layer.groups;var g,e,k,f;if(!b)b=a;else if(b.groups!==p&&a.groups!==h)for(e=0;e<a.groups.length;e+=1)if(g=a.groups[e],c=d[g]){for(f=0;f<c.length;f+=1)if(c[f]===a){k=f;c.splice(f,1);break}0===c.length&&delete d[g]}if(b.groups!==
p&&b.groups!==h)for(e=0;e<b.groups.length;e+=1)g=b.groups[e],c=d[g],c||(c=d[g]=[],c.name=g),k===p&&(k=c.length),c.splice(k,0,a)}function sa(d,c,a,b,g){b[a]&&c._running&&!c._running[a]&&(c._running[a]=u,b[a].call(d[0],c,g),c._running[a]=A)}function Q(d,c,a,b,g){if(!(a.disableEvents||a.intangible&&-1!==f.inArray(b,Va))){if("mouseout"!==b){var e;a.cursors&&(e=a.cursors[b]);-1!==f.inArray(e,V.cursors)&&(e=V.prefix+e);e&&d.css({cursor:e})}sa(d,a,b,a,g);sa(d,a,b,c.eventHooks,g);sa(d,a,b,Z.eventHooks,g)}}
function O(d,c,a,b){var g,e=c._layer?a:c;c._args=a;if(c.draggable||c.dragGroups)c.layer=u,c.draggable=u;c._method||(c._method=b?b:c.method?f.fn[c.method]:c.type?f.fn[X.drawings[c.type]]:function(){});if(c.layer&&!c._layer){if(a=f(d),b=N(d),g=b.layers,e.name===h||ja(e.name)&&b.layer.names[e.name]===p)ka(c),e=new G(c),e.canvas=d,e.layer=u,e._layer=u,e._running={},e.data=e.data!==h?aa({},e.data):{},e.groups=e.groups!==h?e.groups.slice(0):[],qa(a,b,e),ra(a,b,e),Ca(a,b,e),Ea(a,b,e),c._event=e._event,e._method===
f.fn.drawText&&a.measureText(e),e.index===h&&(e.index=g.length),g.splice(e.index,0,e),c._args=e,Q(a,b,e,"add")}else c.layer||ka(c);return e}function Fa(d,c){var a,b;for(b=0;b<V.props.length;b+=1)a=V.props[b],d[a]!==p&&(d["_"+a]=d[a],V.propsObj[a]=u,c&&delete d[a])}function Wa(d,c,a){var b,g,e,k;for(b in a)if(a.hasOwnProperty(b)&&(g=a[b],da(g)&&(a[b]=g.call(d,c,b)),"object"===ba(g)&&Ga(g))){for(e in g)g.hasOwnProperty(e)&&(k=g[e],c[b]!==p&&(c[b+"."+e]=c[b][e],a[b+"."+e]=k));delete a[b]}return a}function Ha(d){var c,
a,b=[],g=1;d.match(/^([a-z]+|#[0-9a-f]+)$/gi)&&("transparent"===d&&(d="rgba(0, 0, 0, 0)"),a=Ia.head,c=a.style.color,a.style.color=d,d=f.css(a,"color"),a.style.color=c);d.match(/^rgb/gi)&&(b=d.match(/(\d+(\.\d+)?)/gi),d.match(/%/gi)&&(g=2.55),b[0]*=g,b[1]*=g,b[2]*=g,b[3]=b[3]!==p?Y(b[3]):1);return b}function Xa(d){var c=3,a;"array"!==ba(d.start)&&(d.start=Ha(d.start),d.end=Ha(d.end));d.now=[];if(1!==d.start[3]||1!==d.end[3])c=4;for(a=0;a<c;a+=1)d.now[a]=d.start[a]+(d.end[a]-d.start[a])*d.pos,3>a&&
(d.now[a]=Ya(d.now[a]));1!==d.start[3]||1!==d.end[3]?d.now="rgba( "+d.now.join(",")+" )":(d.now.slice(0,3),d.now="rgb( "+d.now.join(",")+" )");d.elem.nodeName?d.elem.style[d.prop]=d.now:d.elem[d.prop]=d.now}function Za(d){X.touchEvents[d]&&(d=X.touchEvents[d]);return d}function $a(d){Z.events[d]=function(c,a){function b(a){k.x=a.offsetX;k.y=a.offsetY;k.type=g;k.event=a;c.drawLayers({resetFire:u});a.preventDefault()}var g,e,k;k=a.event;g="mouseover"===d||"mouseout"===d?"mousemove":d;e=Za(g);a.events[g]||
(e!==g?c.bind(g+".jCanvas "+e+".jCanvas",b):c.bind(g+".jCanvas",b),a.events[g]=u)}}function T(d,c,a){var b,g,e,k;if(a=a._args)d=N(d),b=d.event,b.x!==h&&b.y!==h&&(e=b.x*d.pixelRatio,k=b.y*d.pixelRatio,g=c.isPointInPath(e,k)||c.isPointInStroke&&c.isPointInStroke(e,k)),c=d.transforms,a.eventX=b.x,a.eventY=b.y,a.event=b.event,b=d.transforms.rotate,e=a.eventX,k=a.eventY,0!==b?(a._eventX=e*P(-b)-k*U(-b),a._eventY=k*P(-b)+e*U(-b)):(a._eventX=e,a._eventY=k),a._eventX/=c.scaleX,a._eventY/=c.scaleY,g&&d.intersecting.push(a),
a.intersects=!!g}function za(d,c,a){c._toRad=c.inDegrees?D/180:1;d.translate(c.x,c.y);d.rotate(c.rotate*c._toRad);d.translate(-c.x,-c.y);a&&(a.rotate+=c.rotate*c._toRad)}function Aa(d,c,a){1!==c.scale&&(c.scaleX=c.scaleY=c.scale);d.translate(c.x,c.y);d.scale(c.scaleX,c.scaleY);d.translate(-c.x,-c.y);a&&(a.scaleX*=c.scaleX,a.scaleY*=c.scaleY)}function Ba(d,c,a){c.translate&&(c.translateX=c.translateY=c.translate);d.translate(c.translateX,c.translateY);a&&(a.translateX+=c.translateX,a.translateY+=c.translateY)}
function Ja(d){for(;0>d;)d+=2*D;return d}function Ka(d,c,a,b){var g,e,k,f,x,w,z;a===b?z=w=0:(w=a.x,z=a.y);b.inDegrees||360!==b.end||(b.end=2*D);b.start*=a._toRad;b.end*=a._toRad;b.start-=D/2;b.end-=D/2;x=D/180;b.ccw&&(x*=-1);g=b.x+b.radius*P(b.start+x);e=b.y+b.radius*U(b.start+x);k=b.x+b.radius*P(b.start);f=b.y+b.radius*U(b.start);ga(d,c,a,b,g,e,k,f);c.arc(b.x+w,b.y+z,b.radius,b.start,b.end,b.ccw);g=b.x+b.radius*P(b.end+x);x=b.y+b.radius*U(b.end+x);e=b.x+b.radius*P(b.end);k=b.y+b.radius*U(b.end);
ha(d,c,a,b,e,k,g,x)}function La(d,c,a,b,g,e,k,f){var x,w;b.arrowRadius&&!a.closed&&(w=ab(f-e,k-g),w-=D,d=a.strokeWidth*P(w),x=a.strokeWidth*U(w),a=k+b.arrowRadius*P(w+b.arrowAngle/2),g=f+b.arrowRadius*U(w+b.arrowAngle/2),e=k+b.arrowRadius*P(w-b.arrowAngle/2),b=f+b.arrowRadius*U(w-b.arrowAngle/2),c.moveTo(a-d,g-x),c.lineTo(k-d,f-x),c.lineTo(e-d,b-x),c.moveTo(k-d,f-x),c.lineTo(k+d,f+x),c.moveTo(k,f))}function ga(d,c,a,b,g,e,k,f){b._arrowAngleConverted||(b.arrowAngle*=a._toRad,b._arrowAngleConverted=
u);b.startArrow&&La(d,c,a,b,g,e,k,f)}function ha(d,c,a,b,g,e,k,f){b._arrowAngleConverted||(b.arrowAngle*=a._toRad,b._arrowAngleConverted=u);b.endArrow&&La(d,c,a,b,g,e,k,f)}function Ma(d,c,a,b){var g,e,k;g=2;ga(d,c,a,b,b.x2+a.x,b.y2+a.y,b.x1+a.x,b.y1+a.y);for(b.x1!==p&&b.y1!==p&&c.moveTo(b.x1+a.x,b.y1+a.y);u;)if(e=b["x"+g],k=b["y"+g],e!==p&&k!==p)c.lineTo(e+a.x,k+a.y),g+=1;else break;g-=1;ha(d,c,a,b,b["x"+(g-1)]+a.x,b["y"+(g-1)]+a.y,b["x"+g]+a.x,b["y"+g]+a.y)}function Na(d,c,a,b){var g,e,k,f,x;g=2;
ga(d,c,a,b,b.cx1+a.x,b.cy1+a.y,b.x1+a.x,b.y1+a.y);for(b.x1!==p&&b.y1!==p&&c.moveTo(b.x1+a.x,b.y1+a.y);u;)if(e=b["x"+g],k=b["y"+g],f=b["cx"+(g-1)],x=b["cy"+(g-1)],e!==p&&k!==p&&f!==p&&x!==p)c.quadraticCurveTo(f+a.x,x+a.y,e+a.x,k+a.y),g+=1;else break;g-=1;ha(d,c,a,b,b["cx"+(g-1)]+a.x,b["cy"+(g-1)]+a.y,b["x"+g]+a.x,b["y"+g]+a.y)}function Oa(d,c,a,b){var g,e,k,f,x,w,z,h;g=2;e=1;ga(d,c,a,b,b.cx1+a.x,b.cy1+a.y,b.x1+a.x,b.y1+a.y);for(b.x1!==p&&b.y1!==p&&c.moveTo(b.x1+a.x,b.y1+a.y);u;)if(k=b["x"+g],f=b["y"+
g],x=b["cx"+e],w=b["cy"+e],z=b["cx"+(e+1)],h=b["cy"+(e+1)],k!==p&&f!==p&&x!==p&&w!==p&&z!==p&&h!==p)c.bezierCurveTo(x+a.x,w+a.y,z+a.x,h+a.y,k+a.x,f+a.y),g+=1,e+=2;else break;g-=1;e-=2;ha(d,c,a,b,b["cx"+(e+1)]+a.x,b["cy"+(e+1)]+a.y,b["x"+g]+a.x,b["y"+g]+a.y)}function Pa(d,c,a){c*=d._toRad;c-=D/2;return a*P(c)}function Qa(d,c,a){c*=d._toRad;c-=D/2;return a*U(c)}function Ra(d,c,a,b){var g,e,k,f,x,h,z;a===b?x=f=0:(f=a.x,x=a.y);g=1;e=f=h=b.x+f;k=x=z=b.y+x;ga(d,c,a,b,e+Pa(a,b.a1,b.l1),k+Qa(a,b.a1,b.l1),
e,k);for(b.x!==p&&b.y!==p&&c.moveTo(e,k);u;)if(e=b["a"+g],k=b["l"+g],e!==p&&k!==p)f=h,x=z,h+=Pa(a,e,k),z+=Qa(a,e,k),c.lineTo(h,z),g+=1;else break;ha(d,c,a,b,f,x,h,z)}function ta(d,c,a){isNaN(oa(a.fontSize))||(a.fontSize+="px");c.font=a.fontStyle+" "+a.fontSize+" "+a.fontFamily}function ua(d,c,a,b){var g,e;g=ca.propCache;if(g.text===a.text&&g.fontStyle===a.fontStyle&&g.fontSize===a.fontSize&&g.fontFamily===a.fontFamily&&g.maxWidth===a.maxWidth&&g.lineHeight===a.lineHeight)a.width=g.width,a.height=
g.height;else{a.width=c.measureText(b[0]).width;for(e=1;e<b.length;e+=1)g=c.measureText(b[e]).width,g>a.width&&(a.width=g);c=d.style.fontSize;d.style.fontSize=a.fontSize;a.height=Y(f.css(d,"fontSize"))*b.length*a.lineHeight;d.style.fontSize=c}}function Sa(d,c){var a=c.maxWidth,b=c.text.split("\n"),g=[],e,k,f,h,w;for(f=0;f<b.length;f+=1){h=b[f];w=h.split(" ");e=[];k="";if(1===w.length||d.measureText(h).width<a)e=[h];else{for(h=0;h<w.length;h+=1)d.measureText(k+w[h]).width>a&&(""!==k&&e.push(k),k=""),
k+=w[h],h!==w.length-1&&(k+=" ");e.push(k)}g=g.concat(e.join("\n").replace(/( (\n))|( $)/gi,"$2").split("\n"))}return g}var Ia=L.document,Ta=L.Image,bb=L.getComputedStyle,ea=L.Math,oa=L.Number,Y=L.parseFloat,u=!0,A=!1,h=null,p=void 0,ma,aa=f.extend,ia=f.inArray,ba=function(d){return Object.prototype.toString.call(d).slice(8,-1).toLowerCase()},da=f.isFunction,Ga=f.isPlainObject,D=ea.PI,Ya=ea.round,cb=ea.abs,U=ea.sin,P=ea.cos,ab=ea.atan2,va=L.Array.prototype.slice,db=f.event.fix,X={},ca={dataCache:{},
propCache:{},imageCache:{}},pa={rotate:0,scaleX:1,scaleY:1,translateX:0,translateY:0,masks:[]},V={},Va="mousedown mousemove mouseup mouseover mouseout touchstart touchmove touchend".split(" "),Z={events:{},eventHooks:{},future:{}};na.baseDefaults={align:"center",arrowAngle:90,arrowRadius:0,autosave:u,baseline:"middle",bringToFront:A,ccw:A,closed:A,compositing:"source-over",concavity:0,cornerRadius:0,count:1,cropFromCenter:u,crossOrigin:h,cursors:h,disableEvents:A,draggable:A,dragGroups:h,groups:h,
data:h,dx:h,dy:h,end:360,eventX:h,eventY:h,fillStyle:"transparent",fontStyle:"normal",fontSize:"12pt",fontFamily:"sans-serif",fromCenter:u,height:h,imageSmoothing:u,inDegrees:u,intangible:A,index:h,letterSpacing:h,lineHeight:1,layer:A,mask:A,maxWidth:h,miterLimit:10,name:h,opacity:1,r1:h,r2:h,radius:0,repeat:"repeat",respectAlign:A,rotate:0,rounded:A,scale:1,scaleX:1,scaleY:1,shadowBlur:0,shadowColor:"transparent",shadowStroke:A,shadowX:0,shadowY:0,sHeight:h,sides:0,source:"",spread:0,start:0,strokeCap:"butt",
strokeDash:h,strokeDashOffset:0,strokeJoin:"miter",strokeStyle:"transparent",strokeWidth:1,sWidth:h,sx:h,sy:h,text:"",translate:0,translateX:0,translateY:0,type:h,visible:u,width:h,x:0,y:0};ma=new na;G.prototype=ma;Z.extend=function(d){d.name&&(d.props&&aa(ma,d.props),f.fn[d.name]=function a(b){var g,e,k,f;for(e=0;e<this.length;e+=1)if(g=this[e],k=K(g))f=new G(b),O(g,f,b,a),S(g,k,f),d.fn.call(g,k,f);return this},d.type&&(X.drawings[d.type]=d.name));return f.fn[d.name]};f.fn.getEventHooks=function(){var d;
d={};0!==this.length&&(d=this[0],d=N(d),d=d.eventHooks);return d};f.fn.setEventHooks=function(d){var c,a;for(c=0;c<this.length;c+=1)f(this[c]),a=N(this[c]),aa(a.eventHooks,d);return this};f.fn.getLayers=function(d){var c,a,b,g,e=[];if(0!==this.length)if(c=this[0],a=N(c),a=a.layers,da(d))for(g=0;g<a.length;g+=1)b=a[g],d.call(c,b)&&e.push(b);else e=a;return e};f.fn.getLayer=function(d){var c,a,b,g;if(0!==this.length)if(c=this[0],a=N(c),c=a.layers,g=ba(d),d&&d.layer)b=d;else if("number"===g)0>d&&(d=
c.length+d),b=c[d];else if("regexp"===g)for(a=0;a<c.length;a+=1){if(ja(c[a].name)&&c[a].name.match(d)){b=c[a];break}}else b=a.layer.names[d];return b};f.fn.getLayerGroup=function(d){var c,a,b,g=ba(d);if(0!==this.length)if(c=this[0],"array"===g)b=d;else if("regexp"===g)for(a in c=N(c),c=c.layer.groups,c){if(a.match(d)){b=c[a];break}}else c=N(c),b=c.layer.groups[d];return b};f.fn.getLayerIndex=function(d){var c=this.getLayers();d=this.getLayer(d);return ia(d,c)};f.fn.setLayer=function(d,c){var a,b,
g,e,k,h,x;for(b=0;b<this.length;b+=1)if(a=f(this[b]),g=N(this[b]),e=f(this[b]).getLayer(d)){qa(a,g,e,c);ra(a,g,e,c);ka(c);for(k in c)c.hasOwnProperty(k)&&(h=c[k],x=ba(h),"object"===x&&Ga(h)?(e[k]=aa({},h),ka(e[k])):"array"===x?e[k]=h.slice(0):"string"===x?0===h.indexOf("+=")?e[k]+=Y(h.substr(2)):0===h.indexOf("-=")?e[k]-=Y(h.substr(2)):isNaN(h)||isNaN(oa(h))||isNaN(Y(h))?e[k]=h:e[k]=Y(h):e[k]=h);Ca(a,g,e);Ea(a,g,e);f.isEmptyObject(c)===A&&Q(a,g,e,"change",c)}return this};f.fn.setLayers=function(d,
c){var a,b,g,e;for(b=0;b<this.length;b+=1)for(a=f(this[b]),g=a.getLayers(c),e=0;e<g.length;e+=1)a.setLayer(g[e],d);return this};f.fn.setLayerGroup=function(d,c){var a,b,g,e;for(b=0;b<this.length;b+=1)if(a=f(this[b]),g=a.getLayerGroup(d))for(e=0;e<g.length;e+=1)a.setLayer(g[e],c);return this};f.fn.moveLayer=function(d,c){var a,b,g,e,k;for(b=0;b<this.length;b+=1)if(a=f(this[b]),g=N(this[b]),e=g.layers,k=a.getLayer(d))k.index=ia(k,e),e.splice(k.index,1),e.splice(c,0,k),0>c&&(c=e.length+c),k.index=c,
Q(a,g,k,"move");return this};f.fn.removeLayer=function(d){var c,a,b,g,e;for(a=0;a<this.length;a+=1)if(c=f(this[a]),b=N(this[a]),g=c.getLayers(),e=c.getLayer(d))e.index=ia(e,g),g.splice(e.index,1),delete e._layer,qa(c,b,e,{name:h}),ra(c,b,e,{groups:h}),Q(c,b,e,"remove");return this};f.fn.removeLayers=function(d){var c,a,b,g,e,k;for(a=0;a<this.length;a+=1){c=f(this[a]);b=N(this[a]);g=c.getLayers(d);for(k=0;k<g.length;k+=1)e=g[k],c.removeLayer(e),k-=1;b.layer.names={};b.layer.groups={}}return this};
f.fn.removeLayerGroup=function(d){var c,a,b,g;if(d!==p)for(a=0;a<this.length;a+=1)if(c=f(this[a]),N(this[a]),c.getLayers(),b=c.getLayerGroup(d))for(b=b.slice(0),g=0;g<b.length;g+=1)c.removeLayer(b[g]);return this};f.fn.addLayerToGroup=function(d,c){var a,b,g,e=[c];for(b=0;b<this.length;b+=1)a=f(this[b]),g=a.getLayer(d),g.groups&&(e=g.groups.slice(0),-1===ia(c,g.groups)&&e.push(c)),a.setLayer(g,{groups:e});return this};f.fn.removeLayerFromGroup=function(d,c){var a,b,g,e=[],k;for(b=0;b<this.length;b+=
1)a=f(this[b]),g=a.getLayer(d),g.groups&&(k=ia(c,g.groups),-1!==k&&(e=g.groups.slice(0),e.splice(k,1),a.setLayer(g,{groups:e})));return this};V.cursors=["grab","grabbing","zoom-in","zoom-out"];V.prefix=function(){var d=bb(Ia.documentElement,"");return"-"+(va.call(d).join("").match(/-(moz|webkit|ms)-/)||""===d.OLink&&["","o"])[1]+"-"}();f.fn.triggerLayerEvent=function(d,c){var a,b,g;for(b=0;b<this.length;b+=1)a=f(this[b]),g=N(this[b]),(d=a.getLayer(d))&&Q(a,g,d,c);return this};f.fn.drawLayer=function(d){var c,
a,b;for(c=0;c<this.length;c+=1)b=f(this[c]),(a=K(this[c]))&&(a=b.getLayer(d))&&a.visible&&a._method&&(a._next=h,a._method.call(b,a));return this};f.fn.drawLayers=function(d){var c,a,b=d||{},g,e,k,p,x,w,z,J;(p=b.index)||(p=0);for(c=0;c<this.length;c+=1)if(d=f(this[c]),a=K(this[c])){x=N(this[c]);b.clear!==A&&d.clearCanvas();a=x.layers;for(k=p;k<a.length;k+=1)if(g=a[k],g.index=k,b.resetFire&&(g._fired=A),w=d,z=g,e=k+1,z&&z.visible&&z._method&&(z._next=e?e:h,z._method.call(w,z)),g._masks=x.transforms.masks.slice(0),
g._method===f.fn.drawImage&&g.visible){J=!0;break}if(J)break;g=x;var y=e=z=w=void 0;w=h;for(z=g.intersecting.length-1;0<=z;z-=1)if(w=g.intersecting[z],w._masks){for(y=w._masks.length-1;0<=y;y-=1)if(e=w._masks[y],!e.intersects){w.intersects=A;break}if(w.intersects&&!w.intangible)break}w&&w.intangible&&(w=h);g=w;w=x.event;z=w.type;if(x.drag.layer){e=d;var y=x,H=z,t=void 0,q=void 0,m=void 0,B=m=void 0,F=void 0,m=t=t=m=void 0,m=y.drag,B=(q=m.layer)&&q.dragGroups||[],t=y.layers;if("mousemove"===H||"touchmove"===
H){if(m.dragging||(m.dragging=u,q.dragging=u,q.bringToFront&&(t.splice(q.index,1),q.index=t.push(q)),q._startX=q.x,q._startY=q.y,q._endX=q._eventX,q._endY=q._eventY,Q(e,y,q,"dragstart")),m.dragging)for(t=q._eventX-(q._endX-q._startX),m=q._eventY-(q._endY-q._startY),q.dx=t-q.x,q.dy=m-q.y,q.x=t,q.y=m,Q(e,y,q,"drag"),t=0;t<B.length;t+=1)if(m=B[t],F=y.layer.groups[m],q.groups&&F)for(m=0;m<F.length;m+=1)F[m]!==q&&(F[m].x+=q.dx,F[m].y+=q.dy)}else if("mouseup"===H||"touchend"===H)m.dragging&&(q.dragging=
A,m.dragging=A,Q(e,y,q,"dragstop")),y.drag={}}e=x.lastIntersected;e===h||g===e||!e._hovered||e._fired||x.drag.dragging||(x.lastIntersected=h,e._fired=u,e._hovered=A,Q(d,x,e,"mouseout"),d.css({cursor:x.cursor}));g&&(g[z]||X.mouseEvents[z]&&(z=X.mouseEvents[z]),g._event&&g.intersects&&(x.lastIntersected=g,!(g.mouseover||g.mouseout||g.cursors)||x.drag.dragging||g._hovered||g._fired||(g._fired=u,g._hovered=u,Q(d,x,g,"mouseover")),g._fired||(g._fired=u,w.type=h,Q(d,x,g,z)),!g.draggable||g.disableEvents||
"mousedown"!==z&&"touchstart"!==z||(x.drag.layer=g)));g!==h||x.drag.dragging||d.css({cursor:x.cursor});k===a.length&&(x.intersecting.length=0,x.transforms=la(pa),x.savedTransforms.length=0)}return this};f.fn.addLayer=function(d){var c,a;for(c=0;c<this.length;c+=1)if(a=K(this[c]))a=new G(d),a.layer=u,O(this[c],a,d);return this};V.props=["width","height","opacity","lineHeight"];V.propsObj={};f.fn.animateLayer=function(){function d(a,b,c){return function(){var d,g;for(g=0;g<V.props.length;g+=1)d=V.props[g],
c[d]=c["_"+d];for(var k in c)c.hasOwnProperty(k)&&-1!==k.indexOf(".")&&delete c[k];b.animating&&b.animated!==c||a.drawLayers();c._animating=A;b.animating=A;b.animated=h;e[4]&&e[4].call(a[0],c);Q(a,b,c,"animateend")}}function c(a,b,c){return function(d,g){var k,f,h=!1;"_"===g.prop[0]&&(h=!0,g.prop=g.prop.replace("_",""),c[g.prop]=c["_"+g.prop]);-1!==g.prop.indexOf(".")&&(k=g.prop.split("."),f=k[0],k=k[1],c[f]&&(c[f][k]=g.now));c._pos!==g.pos&&(c._pos=g.pos,c._animating||b.animating||(c._animating=
u,b.animating=u,b.animated=c),b.animating&&b.animated!==c||a.drawLayers());e[5]&&e[5].call(a[0],d,g,c);Q(a,b,c,"animate",g);h&&(g.prop="_"+g.prop)}}var a,b,g,e=va.call(arguments,0),k,G;"object"===ba(e[2])?(e.splice(2,0,e[2].duration||h),e.splice(3,0,e[3].easing||h),e.splice(4,0,e[4].complete||h),e.splice(5,0,e[5].step||h)):(e[2]===p?(e.splice(2,0,h),e.splice(3,0,h),e.splice(4,0,h)):da(e[2])&&(e.splice(2,0,h),e.splice(3,0,h)),e[3]===p?(e[3]=h,e.splice(4,0,h)):da(e[3])&&e.splice(3,0,h));for(b=0;b<this.length;b+=
1)if(a=f(this[b]),g=K(this[b]))g=N(this[b]),(k=a.getLayer(e[0]))&&k._method!==f.fn.draw&&(G=aa({},e[1]),G=Wa(this[b],k,G),Fa(G,u),Fa(k),k.style=V.propsObj,f(k).animate(G,{duration:e[2],easing:f.easing[e[3]]?e[3]:h,complete:d(a,g,k),step:c(a,g,k)}),Q(a,g,k,"animatestart"));return this};f.fn.animateLayerGroup=function(d){var c,a,b=va.call(arguments,0),g,e;for(a=0;a<this.length;a+=1)if(c=f(this[a]),g=c.getLayerGroup(d))for(e=0;e<g.length;e+=1)b[0]=g[e],c.animateLayer.apply(c,b);return this};f.fn.delayLayer=
function(d,c){var a,b,g,e;c=c||0;for(b=0;b<this.length;b+=1)if(a=f(this[b]),g=N(this[b]),e=a.getLayer(d))f(e).delay(c),Q(a,g,e,"delay");return this};f.fn.delayLayerGroup=function(d,c){var a,b,g,e,k;c=c||0;for(b=0;b<this.length;b+=1)if(a=f(this[b]),g=a.getLayerGroup(d))for(k=0;k<g.length;k+=1)e=g[k],a.delayLayer(e,c);return this};f.fn.stopLayer=function(d,c){var a,b,g,e;for(b=0;b<this.length;b+=1)if(a=f(this[b]),g=N(this[b]),e=a.getLayer(d))f(e).stop(c),Q(a,g,e,"stop");return this};f.fn.stopLayerGroup=
function(d,c){var a,b,g,e,k;for(b=0;b<this.length;b+=1)if(a=f(this[b]),g=a.getLayerGroup(d))for(k=0;k<g.length;k+=1)e=g[k],a.stopLayer(e,c);return this};(function(d){var c;for(c=0;c<d.length;c+=1)f.fx.step[d[c]]=Xa})("color backgroundColor borderColor borderTopColor borderRightColor borderBottomColor borderLeftColor fillStyle outlineColor strokeStyle shadowColor".split(" "));X.touchEvents={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"};X.mouseEvents={touchstart:"mousedown",touchend:"mouseup",
touchmove:"mousemove"};(function(d){var c;for(c=0;c<d.length;c+=1)$a(d[c])})("click dblclick mousedown mouseup mousemove mouseover mouseout touchstart touchmove touchend contextmenu".split(" "));f.event.fix=function(d){var c,a;d=db.call(f.event,d);if(c=d.originalEvent)if(a=c.changedTouches,d.pageX!==p&&d.offsetX===p){if(c=f(d.currentTarget).offset())d.offsetX=d.pageX-c.left,d.offsetY=d.pageY-c.top}else a&&(c=f(d.currentTarget).offset())&&(d.offsetX=a[0].pageX-c.left,d.offsetY=a[0].pageY-c.top);return d};
X.drawings={arc:"drawArc",bezier:"drawBezier",ellipse:"drawEllipse","function":"draw",image:"drawImage",line:"drawLine",path:"drawPath",polygon:"drawPolygon",slice:"drawSlice",quadratic:"drawQuadratic",rectangle:"drawRect",text:"drawText",vector:"drawVector",save:"saveCanvas",restore:"restoreCanvas",rotate:"rotateCanvas",scale:"scaleCanvas",translate:"translateCanvas"};f.fn.draw=function c(a){var b,g,e=new G(a);if(X.drawings[e.type]&&"function"!==e.type)this[X.drawings[e.type]](a);else for(b=0;b<
this.length;b+=1)if(f(this[b]),g=K(this[b]))e=new G(a),O(this[b],e,a,c),e.visible&&e.fn&&e.fn.call(this[b],g,e);return this};f.fn.clearCanvas=function a(b){var g,e,k=new G(b);for(g=0;g<this.length;g+=1)if(e=K(this[g]))k.width===h||k.height===h?(e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,this[g].width,this[g].height),e.restore()):(O(this[g],k,b,a),R(this[g],e,k,k.width,k.height),e.clearRect(k.x-k.width/2,k.y-k.height/2,k.width,k.height),k._transformed&&e.restore());return this};f.fn.saveCanvas=
function b(g){var e,k,f,h,w;for(e=0;e<this.length;e+=1)if(k=K(this[e]))for(h=N(this[e]),f=new G(g),O(this[e],f,g,b),w=0;w<f.count;w+=1)fa(k,h);return this};f.fn.restoreCanvas=function g(e){var k,f,h,w,z;for(k=0;k<this.length;k+=1)if(f=K(this[k]))for(w=N(this[k]),h=new G(e),O(this[k],h,e,g),z=0;z<h.count;z+=1){var J=f,y=w;0===y.savedTransforms.length?y.transforms=la(pa):(J.restore(),y.transforms=y.savedTransforms.pop())}return this};f.fn.rotateCanvas=function e(k){var f,h,w,z;for(f=0;f<this.length;f+=
1)if(h=K(this[f]))z=N(this[f]),w=new G(k),O(this[f],w,k,e),w.autosave&&fa(h,z),za(h,w,z.transforms);return this};f.fn.scaleCanvas=function k(f){var h,w,z,J;for(h=0;h<this.length;h+=1)if(w=K(this[h]))J=N(this[h]),z=new G(f),O(this[h],z,f,k),z.autosave&&fa(w,J),Aa(w,z,J.transforms);return this};f.fn.translateCanvas=function Ua(f){var h,z,J,y;for(h=0;h<this.length;h+=1)if(z=K(this[h]))y=N(this[h]),J=new G(f),O(this[h],J,f,Ua),J.autosave&&fa(z,y),Ba(z,J,y.transforms);return this};f.fn.drawRect=function x(f){var h,
J,y,H,t,q,m,B,F;for(h=0;h<this.length;h+=1)if(J=K(this[h]))y=new G(f),O(this[h],y,f,x),y.visible&&(S(this[h],J,y),R(this[h],J,y,y.width,y.height),J.beginPath(),y.width&&y.height&&(H=y.x-y.width/2,t=y.y-y.height/2,(B=cb(y.cornerRadius))?(q=y.x+y.width/2,m=y.y+y.height/2,0>y.width&&(F=H,H=q,q=F),0>y.height&&(F=t,t=m,m=F),0>q-H-2*B&&(B=(q-H)/2),0>m-t-2*B&&(B=(m-t)/2),J.moveTo(H+B,t),J.lineTo(q-B,t),J.arc(q-B,t+B,B,3*D/2,2*D,A),J.lineTo(q,m-B),J.arc(q-B,m-B,B,0,D/2,A),J.lineTo(H+B,m),J.arc(H+B,m-B,B,
D/2,D,A),J.lineTo(H,t+B),J.arc(H+B,t+B,B,D,3*D/2,A),y.closed=u):J.rect(H,t,y.width,y.height)),T(this[h],J,y),W(this[h],J,y));return this};f.fn.drawArc=function w(f){var h,y,H;for(h=0;h<this.length;h+=1)if(y=K(this[h]))H=new G(f),O(this[h],H,f,w),H.visible&&(S(this[h],y,H),R(this[h],y,H,2*H.radius),y.beginPath(),Ka(this[h],y,H,H),T(this[h],y,H),W(this[h],y,H));return this};f.fn.drawEllipse=function z(f){var h,H,t,q,m;for(h=0;h<this.length;h+=1)if(H=K(this[h]))t=new G(f),O(this[h],t,f,z),t.visible&&
(S(this[h],H,t),R(this[h],H,t,t.width,t.height),q=4/3*t.width,m=t.height,H.beginPath(),H.moveTo(t.x,t.y-m/2),H.bezierCurveTo(t.x-q/2,t.y-m/2,t.x-q/2,t.y+m/2,t.x,t.y+m/2),H.bezierCurveTo(t.x+q/2,t.y+m/2,t.x+q/2,t.y-m/2,t.x,t.y-m/2),T(this[h],H,t),t.closed=u,W(this[h],H,t));return this};f.fn.drawPolygon=function J(f){var h,t,q,m,B,F,M,v,n,l;for(h=0;h<this.length;h+=1)if(t=K(this[h]))if(q=new G(f),O(this[h],q,f,J),q.visible){S(this[h],t,q);R(this[h],t,q,2*q.radius);B=2*D/q.sides;F=B/2;m=F+D/2;M=q.radius*
P(F);t.beginPath();for(l=0;l<q.sides;l+=1)v=q.x+q.radius*P(m),n=q.y+q.radius*U(m),t.lineTo(v,n),q.concavity&&(v=q.x+(M+-M*q.concavity)*P(m+F),n=q.y+(M+-M*q.concavity)*U(m+F),t.lineTo(v,n)),m+=B;T(this[h],t,q);q.closed=u;W(this[h],t,q)}return this};f.fn.drawSlice=function y(h){var t,q,m,B,F;for(t=0;t<this.length;t+=1)if(f(this[t]),q=K(this[t]))m=new G(h),O(this[t],m,h,y),m.visible&&(S(this[t],q,m),R(this[t],q,m,2*m.radius),m.start*=m._toRad,m.end*=m._toRad,m.start-=D/2,m.end-=D/2,m.start=Ja(m.start),
m.end=Ja(m.end),m.end<m.start&&(m.end+=2*D),B=(m.start+m.end)/2,F=m.radius*m.spread*P(B),B=m.radius*m.spread*U(B),m.x+=F,m.y+=B,q.beginPath(),q.arc(m.x,m.y,m.radius,m.start,m.end,m.ccw),q.lineTo(m.x,m.y),T(this[t],q,m),m.closed=u,W(this[t],q,m));return this};f.fn.drawLine=function H(h){var f,m,B;for(f=0;f<this.length;f+=1)if(m=K(this[f]))B=new G(h),O(this[f],B,h,H),B.visible&&(S(this[f],m,B),R(this[f],m,B),m.beginPath(),Ma(this[f],m,B,B),T(this[f],m,B),W(this[f],m,B));return this};f.fn.drawQuadratic=
function t(f){var h,B,F;for(h=0;h<this.length;h+=1)if(B=K(this[h]))F=new G(f),O(this[h],F,f,t),F.visible&&(S(this[h],B,F),R(this[h],B,F),B.beginPath(),Na(this[h],B,F,F),T(this[h],B,F),W(this[h],B,F));return this};f.fn.drawBezier=function q(h){var f,F,M;for(f=0;f<this.length;f+=1)if(F=K(this[f]))M=new G(h),O(this[f],M,h,q),M.visible&&(S(this[f],F,M),R(this[f],F,M),F.beginPath(),Oa(this[f],F,M,M),T(this[f],F,M),W(this[f],F,M));return this};f.fn.drawVector=function m(f){var h,M,v;for(h=0;h<this.length;h+=
1)if(M=K(this[h]))v=new G(f),O(this[h],v,f,m),v.visible&&(S(this[h],M,v),R(this[h],M,v),M.beginPath(),Ra(this[h],M,v,v),T(this[h],M,v),W(this[h],M,v));return this};f.fn.drawPath=function B(h){var f,v,n,l,C;for(f=0;f<this.length;f+=1)if(v=K(this[f]))if(n=new G(h),O(this[f],n,h,B),n.visible){S(this[f],v,n);R(this[f],v,n);v.beginPath();for(l=1;u;)if(C=n["p"+l],C!==p)C=new G(C),"line"===C.type?Ma(this[f],v,n,C):"quadratic"===C.type?Na(this[f],v,n,C):"bezier"===C.type?Oa(this[f],v,n,C):"vector"===C.type?
Ra(this[f],v,n,C):"arc"===C.type&&Ka(this[f],v,n,C),l+=1;else break;T(this[f],v,n);W(this[f],v,n)}return this};f.fn.drawText=function F(M){var v,n,l,C,$,s,E,p,u,A;for(v=0;v<this.length;v+=1)if(f(this[v]),n=K(this[v]))if(l=new G(M),C=O(this[v],l,M,F),l.visible){S(this[v],n,l);n.textBaseline=l.baseline;n.textAlign=l.align;ta(this[v],n,l);$=l.maxWidth!==h?Sa(n,l):l.text.toString().split("\n");ua(this[v],n,l,$);C&&(C.width=l.width,C.height=l.height);R(this[v],n,l,l.width,l.height);E=l.x;"left"===l.align?
l.respectAlign?l.x+=l.width/2:E-=l.width/2:"right"===l.align&&(l.respectAlign?l.x-=l.width/2:E+=l.width/2);if(l.radius)for(E=Y(l.fontSize),l.letterSpacing===h&&(l.letterSpacing=E/500),s=0;s<$.length;s+=1){n.save();n.translate(l.x,l.y);C=$[s];p=C.length;n.rotate(-(D*l.letterSpacing*(p-1))/2);for(A=0;A<p;A+=1)u=C[A],0!==A&&n.rotate(D*l.letterSpacing),n.save(),n.translate(0,-l.radius),n.fillText(u,0,0),n.restore();l.radius-=E;l.letterSpacing+=E/(1E3*D);n.restore()}else for(s=0;s<$.length;s+=1)C=$[s],
p=l.y+s*l.height/$.length-($.length-1)*l.height/$.length/2,n.shadowColor=l.shadowColor,n.fillText(C,E,p),"transparent"!==l.fillStyle&&(n.shadowColor="transparent"),0!==l.strokeWidth&&n.strokeText(C,E,p);p=0;"top"===l.baseline?p+=l.height/2:"bottom"===l.baseline&&(p-=l.height/2);l._event&&(n.beginPath(),n.rect(l.x-l.width/2,l.y-l.height/2+p,l.width,l.height),T(this[v],n,l),n.closePath());l._transformed&&n.restore()}ca.propCache=l;return this};f.fn.measureText=function(f){var h,v;h=this.getLayer(f);
if(!h||h&&!h._layer)h=new G(f);if(f=K(this[0]))ta(this[0],f,h),v=Sa(f,h),ua(this[0],f,h,v);return h};f.fn.drawImage=function M(v){function n(l,n,s,r,v){return function(){var C=f(l);S(l,n,r);r.width===h&&r.sWidth===h&&(r.width=r.sWidth=I.width);r.height===h&&r.sHeight===h&&(r.height=r.sHeight=I.height);v&&(v.width=r.width,v.height=r.height);r.sWidth!==h&&r.sHeight!==h&&r.sx!==h&&r.sy!==h?(r.width===h&&(r.width=r.sWidth),r.height===h&&(r.height=r.sHeight),r.cropFromCenter&&(r.sx+=r.sWidth/2,r.sy+=r.sHeight/
2),0>r.sy-r.sHeight/2&&(r.sy=r.sHeight/2),r.sy+r.sHeight/2>I.height&&(r.sy=I.height-r.sHeight/2),0>r.sx-r.sWidth/2&&(r.sx=r.sWidth/2),r.sx+r.sWidth/2>I.width&&(r.sx=I.width-r.sWidth/2),R(l,n,r,r.width,r.height),n.drawImage(I,r.sx-r.sWidth/2,r.sy-r.sHeight/2,r.sWidth,r.sHeight,r.x-r.width/2,r.y-r.height/2,r.width,r.height)):(R(l,n,r,r.width,r.height),n.drawImage(I,r.x-r.width/2,r.y-r.height/2,r.width,r.height));n.beginPath();n.rect(r.x-r.width/2,r.y-r.height/2,r.width,r.height);T(l,n,r);n.closePath();
r._transformed&&n.restore();ya(n,s,r);r.layer?Q(C,s,v,"load"):r.load&&r.load.call(C[0],v);r.layer&&(v._masks=s.transforms.masks.slice(0),r._next&&C.drawLayers({clear:A,resetFire:u,index:r._next}))}}var l,C,p,s,E,D,I,wa,L,P=ca.imageCache;for(C=0;C<this.length;C+=1)if(l=this[C],p=K(this[C]))s=N(this[C]),E=new G(v),D=O(this[C],E,v,M),E.visible&&(L=E.source,wa=L.getContext,L.src||wa?I=L:L&&(P[L]&&P[L].complete?I=P[L]:(I=new Ta,L.match(/^data:/i)||(I.crossOrigin=E.crossOrigin),I.src=L,P[L]=I)),I&&(I.complete||
wa?n(l,p,s,E,D)():(I.onload=n(l,p,s,E,D),I.src=I.src)));return this};f.fn.createPattern=function(p){function v(){s=l.createPattern(u,C.repeat);C.load&&C.load.call(n[0],s)}var n=this,l,C,u,s,E;(l=K(n[0]))?(C=new G(p),E=C.source,da(E)?(u=f("<canvas />")[0],u.width=C.width,u.height=C.height,p=K(u),E.call(u,p),v()):(p=E.getContext,E.src||p?u=E:(u=new Ta,E.match(/^data:/i)||(u.crossOrigin=C.crossOrigin),u.src=E),u.complete||p?v():(u.onload=v(),u.src=u.src))):s=h;return s};f.fn.createGradient=function(f){var v,
n=[],l,C,u,s,E,A,I;f=new G(f);if(v=K(this[0])){f.x1=f.x1||0;f.y1=f.y1||0;f.x2=f.x2||0;f.y2=f.y2||0;v=f.r1!==h&&f.r2!==h?v.createRadialGradient(f.x1,f.y1,f.r1,f.x2,f.y2,f.r2):v.createLinearGradient(f.x1,f.y1,f.x2,f.y2);for(s=1;f["c"+s]!==p;s+=1)f["s"+s]!==p?n.push(f["s"+s]):n.push(h);l=n.length;n[0]===h&&(n[0]=0);n[l-1]===h&&(n[l-1]=1);for(s=0;s<l;s+=1){if(n[s]!==h){A=1;I=0;C=n[s];for(E=s+1;E<l;E+=1)if(n[E]!==h){u=n[E];break}else A+=1;C>u&&(n[E]=n[s])}else n[s]===h&&(I+=1,n[s]=C+(u-C)/A*I);v.addColorStop(n[s],
f["c"+(s+1)])}}else v=h;return v};f.fn.setPixels=function v(f){var l,p,u,s,E,A,I,D,L;for(p=0;p<this.length;p+=1)if(l=this[p],u=K(l)){s=new G(f);O(l,s,f,v);R(this[p],u,s,s.width,s.height);if(s.width===h||s.height===h)s.width=l.width,s.height=l.height,s.x=s.width/2,s.y=s.height/2;if(0!==s.width&&0!==s.height){A=u.getImageData(s.x-s.width/2,s.y-s.height/2,s.width,s.height);I=A.data;L=I.length;if(s.each)for(D=0;D<L;D+=4)E={r:I[D],g:I[D+1],b:I[D+2],a:I[D+3]},s.each.call(l,E,s),I[D]=E.r,I[D+1]=E.g,I[D+
2]=E.b,I[D+3]=E.a;u.putImageData(A,s.x-s.width/2,s.y-s.height/2);u.restore()}}return this};f.fn.getCanvasImage=function(f,n){var l,u=h;0!==this.length&&(l=this[0],l.toDataURL&&(n===p&&(n=1),u=l.toDataURL("image/"+f,n)));return u};f.fn.detectPixelRatio=function(h){var n,l,p,A,s,E,D;for(l=0;l<this.length;l+=1)n=this[l],f(this[l]),p=K(n),D=N(this[l]),D.scaled||(A=L.devicePixelRatio||1,s=p.webkitBackingStorePixelRatio||p.mozBackingStorePixelRatio||p.msBackingStorePixelRatio||p.oBackingStorePixelRatio||
p.backingStorePixelRatio||1,A/=s,1!==A&&(s=n.width,E=n.height,n.width=s*A,n.height=E*A,n.style.width=s+"px",n.style.height=E+"px",p.scale(A,A)),D.pixelRatio=A,D.scaled=u,h&&h.call(n,A));return this};Z.clearCache=function(){for(var f in ca)ca.hasOwnProperty(f)&&(ca[f]={})};f.support.canvas=f("<canvas />")[0].getContext!==p;aa(Z,{defaults:ma,setGlobalProps:S,transformShape:R,detectEvents:T,closePath:W,setCanvasFont:ta,measureText:ua});f.jCanvas=Z;f.jCanvasObject=G});
/*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),
a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:X.test(a)?JSON.parse(a):a)}function $(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=Z(c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),$(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=$(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=V.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var _=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,aa=new RegExp("^(?:([+-])=|)("+_+")([a-z%]*)$","i"),ba=["Top","Right","Bottom","Left"],ca=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function ea(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&aa.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var fa={};function ga(a){var b,c=a.ownerDocument,d=a.nodeName,e=fa[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),fa[d]=e,e)}function ha(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ca(d)&&(e[f]=ga(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ha(this,!0)},hide:function(){return ha(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ca(this)?r(this).show():r(this).hide()})}});var ia=/^(?:checkbox|radio)$/i,ja=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var oa=/<|&#?\w+;/;function pa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(oa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ja.exec(f)||["",""])[1].toLowerCase(),i=la[h]||la._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!("click"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==wa()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===wa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&r.nodeName(this,"input"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ua:va,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:va,isPropagationStopped:va,isImmediatePropagationStopped:va,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ua,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ua,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ua,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&ra.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&sa.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return xa(this,a,b,c,d)},one:function(a,b,c,d){return xa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=va),this.each(function(){r.event.remove(this,a,c,b)})}});var ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/<script|<style|<link/i,Aa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ba=/^true\/(.*)/,Ca=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Da(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ha(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ia.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ia(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,"script"),Ea),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,ma(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Fa),l=0;l<i;l++)j=h[l],ka.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ca,""),k))}return a}function Ja(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(ma(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&na(ma(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(ya,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);if(b)if(c)for(f=f||ma(a),g=g||ma(h),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);else Ga(a,h);return g=ma(h,"script"),g.length>0&&na(g,!i&&ma(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!za.test(a)&&!la[(ja.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(ma(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ia(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(ma(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ka=/^margin/,La=new RegExp("^("+_+")(?!px)[a-z%]+$","i"),Ma=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",qa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,qa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Na(a,b,c){var d,e,f,g,h=a.style;return c=c||Ma(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&La.test(g)&&Ka.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Oa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Pa=/^(none|table(?!-c[ea]).+)/,Qa={position:"absolute",visibility:"hidden",display:"block"},Ra={letterSpacing:"0",fontWeight:"400"},Sa=["Webkit","Moz","ms"],Ta=d.createElement("div").style;function Ua(a){if(a in Ta)return a;var b=a[0].toUpperCase()+a.slice(1),c=Sa.length;while(c--)if(a=Sa[c]+b,a in Ta)return a}function Va(a,b,c){var d=aa.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Wa(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+ba[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+ba[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+ba[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ba[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+ba[f]+"Width",!0,e)));return g}function Xa(a,b,c){var d,e=!0,f=Ma(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Na(a,b,f),(d<0||null==d)&&(d=a.style[b]),La.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Wa(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Na(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=aa.exec(c))&&e[1]&&(c=ea(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Na(a,b,d)),"normal"===e&&b in Ra&&(e=Ra[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Pa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Xa(a,b,d):da(a,Qa,function(){return Xa(a,b,d)})},set:function(a,c,d){var e,f=d&&Ma(a),g=d&&Wa(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=aa.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Va(a,c,g)}}}),r.cssHooks.marginLeft=Oa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Na(a,"marginLeft"))||a.getBoundingClientRect().left-da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+ba[d]+b]=f[d]||f[d-2]||f[0];return e}},Ka.test(a)||(r.cssHooks[a+b].set=Va)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=Ma(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Ya(a,b,c,d,e){return new Ya.prototype.init(a,b,c,d,e)}r.Tween=Ya,Ya.prototype={constructor:Ya,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Ya.propHooks[this.prop];return a&&a.get?a.get(this):Ya.propHooks._default.get(this)},run:function(a){var b,c=Ya.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ya.propHooks._default.set(this),this}},Ya.prototype.init.prototype=Ya.prototype,Ya.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Ya.propHooks.scrollTop=Ya.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Ya.prototype.init,r.fx.step={};var Za,$a,_a=/^(?:toggle|show|hide)$/,ab=/queueHooks$/;function bb(){$a&&(a.requestAnimationFrame(bb),r.fx.tick())}function cb(){return a.setTimeout(function(){Za=void 0}),Za=r.now()}function db(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ba[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function eb(a,b,c){for(var d,e=(hb.tweeners[b]||[]).concat(hb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function fb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ca(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],_a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ha([a],!0),j=a.style.display||j,k=r.css(a,"display"),ha([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ha([a],!0),m.done(function(){p||ha([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=eb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function gb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function hb(a,b,c){var d,e,f=0,g=hb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Za||cb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Za||cb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(gb(k,j.opts.specialEasing);f<g;f++)if(d=hb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,eb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}r.Animation=r.extend(hb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return ea(c.elem,a,aa.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;d<e;d++)c=a[d],hb.tweeners[c]=hb.tweeners[c]||[],hb.tweeners[c].unshift(b)},prefilters:[fb],prefilter:function(a,b){b?hb.prefilters.unshift(a):hb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:"number"!=typeof e.duration&&(e.duration in r.fx.speeds?e.duration=r.fx.speeds[e.duration]:e.duration=r.fx.speeds._default),null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ca).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=hb(this,r.extend({},a),f);(e||V.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&ab.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(db(b,!0),a,d,e)}}),r.each({slideDown:db("show"),slideUp:db("hide"),slideToggle:db("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Za=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),Za=void 0},r.fx.timer=function(a){r.timers.push(a),a()?r.fx.start():r.timers.pop()},r.fx.interval=13,r.fx.start=function(){$a||($a=a.requestAnimationFrame?a.requestAnimationFrame(bb):a.setInterval(r.fx.tick,r.fx.interval))},r.fx.stop=function(){a.cancelAnimationFrame?a.cancelAnimationFrame($a):a.clearInterval($a),$a=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var ib,jb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?ib:void 0)),
void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),ib={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||r.find.attr;jb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=jb[g],jb[g]=e,e=null!=c(a,b,d)?g:null,jb[g]=f),e}});var kb=/^(?:input|select|textarea|button)$/i,lb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):kb.test(a.nodeName)||lb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function mb(a){var b=a.match(K)||[];return b.join(" ")}function nb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,nb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,nb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,nb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=nb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(nb(c))+" ").indexOf(b)>-1)return!0;return!1}});var ob=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ob,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:mb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,"$1"),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Qb=[],Rb=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Qb.pop()||r.expando+"_"+rb++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Rb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rb.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Rb,"$1"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Qb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=pa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=mb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length};function Sb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=Sb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||qa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=Sb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Oa(o.pixelPosition,function(a,c){if(c)return c=Na(a,b),La.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Tb=a.jQuery,Ub=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Ub),b&&a.jQuery===r&&(a.jQuery=Tb),r},b||(a.jQuery=a.$=r),r});
/**
* @file jquery-jp4.js
* @brief a jquery plugin to convert jp4/jp46 into human viewable format
* @copyright Copyright (C) 2016 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/
(function ( $ ) {
//https://gist.github.com/leolux/c794fc63d9c362013448
var JP4 = function(element,options){
var elem = $(element);
var obj = this;
var settings = $.extend({
port: "",
image: "test.jp4",
refresh: false,
mosaic: [["Gr","R"],["B" ,"Gb"]],
fast: false,
precise: false,
width: 600,
channel: "all",
diff: false,
chn1: "red",
chn2: "green",
ndvi: false,
callback: function(){
console.log("callback");
}
},options);
var BAYER = settings.mosaic;
var FLIPV = 0;
var FLIPH = 0;
var IMAGE_FORMAT = "JPEG";
var SATURATION = [0,0,0,0];
var PIXELS = [];
var cnv_working = $("<canvas>",{id:"working"});
var cnv_display = $("<canvas>",{id:"display"});
// hide working canvas
cnv_working.css({display:"none"});
elem.append(cnv_working);
elem.append(cnv_display);
get_image();
//end
function get_image(){
var canvas = cnv_working;
//reset format
IMAGE_FORMAT = "JPEG";
var http = new XMLHttpRequest();
var rq = "";
if (settings.port!=""){
rq = "get-image.php?port="+settings.port+"&rel=bimg&ts="+Date.now();
settings.refresh = true;
}else{
rq = settings.image;
}
http.open("GET", rq, true);
http.responseType = "blob";
http.onload = function(e) {
if (this.status === 200) {
var heavyImage = new Image();
heavyImage.onload = function(){
EXIF.getData(this, function() {
//update canvas size
canvas.attr("width",this.width);
canvas.attr("height",this.height);
parseEXIFMakerNote(this);
canvas.drawImage({
x:0, y:0,
source: heavyImage,
load: redraw,
fromCenter: false
});
});
};
heavyImage.src = URL.createObjectURL(http.response);
}
};
http.send();
}
var T0;
function redraw(){
$(this).draw({
fn: function(ctx){
T0 = Date.now();
if ((IMAGE_FORMAT=="JP4")||(IMAGE_FORMAT=="JP46")){
if (settings.fast){
quickestPreview(ctx);
}/*else{
Elphel.reorderJP4Blocks(ctx,"JP4");
if (settings.precise){
PIXELS = Elphel.pixelsToArrayLinear(ctx);
Elphel.demosaicBilinear(ctx,PIXELS,settings.mosaic,true);
PIXELS = Elphel.pixelsToArray(ctx);
}else{
PIXELS = Elphel.pixelsToArray(ctx);
Elphel.demosaicBilinear(ctx,PIXELS,settings.mosaic,false);
PIXELS = Elphel.pixelsToArray(ctx);
}
if (settings.channel!="all"){
Elphel.showSingleColorChannel(ctx,settings.channel);
}
if (settings.diff){
Elphel.diffColorChannels(PIXELS,settings.chn1,settings.chn2,1);
Elphel.drawImageData(ctx,PIXELS);
}
if (settings.ndvi){
console.log(PIXELS[0]+" "+PIXELS[1]+" "+PIXELS[2]+" "+PIXELS[3]+" ");
PIXELS = Elphel.someIndex(PIXELS);
console.log(PIXELS[0]+" "+PIXELS[1]+" "+PIXELS[2]+" "+PIXELS[3]+" ");
Elphel.drawImageData(ctx,PIXELS);
}
}
*/
// RGB -> YCbCr x SATURATION -> RGB
// Taking SATURATION[0] = 1/GAMMA[0] (green pixel of GR-line)
//saturation(ctx,SATURATION[0]);
}
//console.log("#"+elem.attr("id")+", time: "+(Date.now()-t0)/1000+" s");
// custom event
//$(this).trigger("canvas_ready");
//console.log($(this));
if (settings.refresh) get_image();
}
});
}
function quickestPreview(ctx){
var worker = new Worker('js/webworker.js');
var width = ctx.canvas.width;
var height = ctx.canvas.height;
var image = ctx.getImageData(0,0,width,height);
var pixels = image.data;
worker.postMessage({
mosaic: settings.mosaic,
format: IMAGE_FORMAT,
width:ctx.canvas.width,
height:ctx.canvas.height,
pixels:pixels.buffer,
settings: {
fast: settings.fast,
channel: settings.channel,
diff: settings.diff,
ndvi: settings.ndvi
},
},[pixels.buffer]);
worker.onmessage = function(e){
var pixels = new Uint8Array(e.data.pixels);
var working_context = cnv_working[0].getContext('2d');
var width = e.data.width;
var height = e.data.height;
Elphel.Canvas.putImageData(working_context,pixels,width,height);
Elphel.Canvas.drawScaled(cnv_working,cnv_display,settings.width);
console.log("#"+elem.attr("id")+", time: "+(Date.now()-T0)/1000+" s");
//trigger here
cnv_working.trigger("canvas_ready");
}
}
/**
* plugin globals get changed
* @FLIPV - not used
* @FLIPH - not used
* @BAYER - not used
* @IMAGE_FORMAT - used
* @SATURATION[i] - not used
*/
function parseEXIFMakerNote(src){
var exif_orientation = EXIF.getTag(src,"Orientation");
//console.log("Exif:Orientation: "+exif_orientation);
var MakerNote = EXIF.getTag(src,"MakerNote");
//FLIPH & FLIPV
if (typeof MakerNote !== 'undefined'){
FLIPH = (MakerNote[10] )&0x1;
FLIPV = (MakerNote[10]>>1)&0x1;
var tmpBAYER = Array();
for (var i=0;i<BAYER.length;i++){tmpBAYER[i] = BAYER[i].slice();}
if (FLIPV==1){
for(i=0;i<4;i++){BAYER[(i>>1)][(i%2)] = tmpBAYER[1-(i>>1)][(i%2)];}
for(i=0;i<BAYER.length;i++){tmpBAYER[i] = BAYER[i].slice();}
}
if (FLIPH==1){
for(i=0;i<4;i++){BAYER[(i>>1)][(i%2)] = tmpBAYER[(i>>1)][1-(i%2)];}
}
}
//console.log("MakerNote: Flips: V:"+FLIPV+" H:"+FLIPH);
//COLOR_MODE ----------------------------------------------------------------
var color_mode = 0;
if (typeof MakerNote !== 'undefined') color_mode=(MakerNote[10]>>4)&0x0f;
switch(color_mode){
case 2: IMAGE_FORMAT = "JP46"; break;
case 5: IMAGE_FORMAT = "JP4"; break;
//default:
}
//var gains = Array();
//var blacks = Array();
var gammas = Array();
//var gamma_scales = Array();
//var blacks256 = Array();
//var rgammas = Array();
//SATURATION ----------------------------------------------------------------
if (typeof MakerNote !== 'undefined'){
for(i=0;i<4;i++){
//gains[i]= MakerNote[i]/65536.0;
//blacks[i]=(MakerNote[i+4]>>24)/256.0;
gammas[i]=((MakerNote[i+4]>>16)&0xff)/100.0;
//gamma_scales[i]=MakerNote[i+4] & 0xffff;
}
/*
for (i=0;i<4;i++) {
rgammas[i]=elphel_gamma_calc(gammas[i], blacks[i], gamma_scales[i]);
}
console.log(rgammas);
//adjusting gains to have the result picture in the range 0..256
min_gain=2.0*gains[0];
for (i=0;i<4;i++){
if (min_gain > (gains[i]*(1.0-blacks[i]))) min_gain = gains[i]*(1.0-blacks[i]);
}
for (i=0;i<4;i++) gains[i]/=min_gain;
for (i=0;i<4;i++) blacks256[i]=256.0*blacks[i];
*/
for (i=0;i<4;i++) {
//SATURATION[i] = 1/gammas[i];
//SATURATION[i] = 1.75; // nightmarish time
SATURATION[i] = 2;
}
//console.log("MakerNote: Saturations: "+SATURATION[0]+" "+SATURATION[1]+" "+SATURATION[2]+" "+SATURATION[3]);
}
}
/*
function elphel_gamma_calc(gamma,black,gamma_scale){
gtable = Array();
rgtable = Array();
black256=black*256.0;
k=1.0/(256.0-black256);
if (gamma < 0.13) gamma=0.13;
if (gamma >10.0) gamma=10.0;
for (var i=0;i<257;i++) {
x=k*(i-black256);
if (x<0.0) x=0.0;
ig = 0.5+65535.0*Math.pow(x,gamma);
ig = (ig*gamma_scale)/0x400;
if (ig>0xffff) ig=0xffff;
gtable[i]=ig;
}
// now gtable[] is the same as was used in the camera
// FPGA was using linear interpolation between elements of the gamma table, so now we'll reverse that process
indx=0;
for (i=0;i<256;i++) {
outValue=128+(i<<8);
while ((gtable[indx+1]<outValue) && (indx<256)) indx++;
if (indx>=256) rgtable[i]=65535.0/256;
else if (gtable[indx+1]==gtable[indx])
rgtable[i]=i;
else
rgtable[i]=indx+(1.0*(outValue-gtable[indx]))/(gtable[indx+1] - gtable[indx]);
}
return rgtable;
}
*/
};
$.fn.jp4 = function(options){
var element = $(this);
// Return early if this element already has a plugin instance
if (element.data('jp4')) return element.data('jp4');
var jp4 = new JP4(this,options);
element.data('jp4',jp4);
var res = new Object();
res.cnv = element;
res.data = jp4;
return res;
};
}(jQuery));
function jquery_list(list, msg) {
var selectBoxContainer = $("#"+list);
//add the header box <div> to the list
selectBoxContainer.append("<div></div>");
//assign the default message to the list header
var selectBox = selectBoxContainer.find('div');
selectBox.html(msg);
selectBoxContainer.attr('value',msg);
//process the list
var dropDown = selectBoxContainer.find('ul');
selectBoxContainer.append(dropDown.hide());
dropDown.bind('show',function(){
if(dropDown.is(':animated')){
return false;
}
selectBox.addClass('expanded');
dropDown.slideDown();
}).bind('hide',function(){
if(dropDown.is(':animated')){
return false;
}
selectBox.removeClass('expanded');
dropDown.slideUp();
}).bind('toggle',function(){
if(selectBox.hasClass('expanded')){
dropDown.trigger('hide');
}
else dropDown.trigger('show');
});
selectBox.click(function(){
dropDown.trigger('toggle');
return false;
});
$(document).click(function(){
dropDown.trigger('hide');
});
//process all the list elements
dropDown.find('li').each(function(i) {
var li = $(this);
li.click(function(){
selectBox.html(li.html());
selectBoxContainer.attr('value',li.html());
dropDown.trigger('hide');
return false;
});
});
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/* required styles */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
image-rendering: -webkit-optimize-contrast;
}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
width: 1600px;
height: 1600px;
-webkit-transform-origin: 0 0;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
display: block;
}
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg,
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer {
max-width: none !important;
}
.leaflet-container.leaflet-touch-zoom {
-ms-touch-action: pan-x pan-y;
touch-action: pan-x pan-y;
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-drag {
-ms-touch-action: none;
touch-action: none;
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: inherit;
}
.leaflet-zoom-box {
width: 0;
height: 0;
-moz-box-sizing: border-box;
box-sizing: border-box;
z-index: 800;
}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
-moz-user-select: none;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-vml-shape {
width: 1px;
height: 1px;
}
.lvml {
behavior: url(#default#VML);
display: inline-block;
position: absolute;
}
/* control positioning */
.leaflet-control {
position: relative;
z-index: 800;
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
position: absolute;
z-index: 1000;
pointer-events: none;
}
.leaflet-top {
top: 0;
}
.leaflet-right {
right: 0;
}
.leaflet-bottom {
bottom: 0;
}
.leaflet-left {
left: 0;
}
.leaflet-control {
float: left;
clear: both;
}
.leaflet-right .leaflet-control {
float: right;
}
.leaflet-top .leaflet-control {
margin-top: 10px;
}
.leaflet-bottom .leaflet-control {
margin-bottom: 10px;
}
.leaflet-left .leaflet-control {
margin-left: 10px;
}
.leaflet-right .leaflet-control {
margin-right: 10px;
}
/* zoom and fade animations */
.leaflet-fade-anim .leaflet-tile {
will-change: opacity;
}
.leaflet-fade-anim .leaflet-popup {
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
opacity: 1;
}
.leaflet-zoom-animated {
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
will-change: transform;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
-o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
.leaflet-zoom-anim .leaflet-zoom-hide {
visibility: hidden;
}
/* cursors */
.leaflet-interactive {
cursor: pointer;
}
.leaflet-grab {
cursor: -webkit-grab;
cursor: -moz-grab;
}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
cursor: crosshair;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
}
/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
pointer-events: none;
}
.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive {
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
/* visual tweaks */
.leaflet-container {
background: #ddd;
outline: 0;
}
.leaflet-container a {
color: #0078A8;
}
.leaflet-container a.leaflet-active {
outline: 2px solid orange;
}
.leaflet-zoom-box {
border: 2px dotted #38f;
background: rgba(255,255,255,0.5);
}
/* general typography */
.leaflet-container {
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 4px;
}
.leaflet-bar a,
.leaflet-bar a:hover {
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar a,
.leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.leaflet-bar a:hover {
background-color: #f4f4f4;
}
.leaflet-bar a:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar a:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar a.leaflet-disabled {
cursor: default;
background-color: #f4f4f4;
color: #bbb;
}
.leaflet-touch .leaflet-bar a {
width: 30px;
height: 30px;
line-height: 30px;
}
/* zoom control */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-control-zoom-out {
font-size: 20px;
}
.leaflet-touch .leaflet-control-zoom-in {
font-size: 22px;
}
.leaflet-touch .leaflet-control-zoom-out {
font-size: 24px;
}
/* layers control */
.leaflet-control-layers {
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
background: #fff;
border-radius: 5px;
}
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-retina .leaflet-control-layers-toggle {
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
}
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
display: block;
position: relative;
}
.leaflet-control-layers-expanded {
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
}
.leaflet-control-layers-scrollbar {
overflow-y: scroll;
padding-right: 5px;
}
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
}
.leaflet-control-layers label {
display: block;
}
.leaflet-control-layers-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
/* Default icon URLs */
.leaflet-default-icon-path {
background-image: url(images/marker-icon.png);
}
/* attribution and scale controls */
.leaflet-container .leaflet-control-attribution {
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
}
.leaflet-control-attribution,
.leaflet-control-scale-line {
padding: 0 5px;
color: #333;
}
.leaflet-control-attribution a {
text-decoration: none;
}
.leaflet-control-attribution a:hover {
text-decoration: underline;
}
.leaflet-container .leaflet-control-attribution,
.leaflet-container .leaflet-control-scale {
font-size: 11px;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
}
.leaflet-bottom .leaflet-control-scale {
margin-bottom: 5px;
}
.leaflet-control-scale-line {
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777;
}
.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
box-shadow: none;
}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
}
/* popup */
.leaflet-popup {
position: absolute;
text-align: center;
margin-bottom: 20px;
}
.leaflet-popup-content-wrapper {
padding: 1px;
text-align: left;
border-radius: 12px;
}
.leaflet-popup-content {
margin: 13px 19px;
line-height: 1.4;
}
.leaflet-popup-content p {
margin: 18px 0;
}
.leaflet-popup-tip-container {
width: 40px;
height: 20px;
position: absolute;
left: 50%;
margin-left: -20px;
overflow: hidden;
pointer-events: none;
}
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: white;
color: #333;
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
border: none;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #999;
}
.leaflet-popup-scrolled {
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
.leaflet-oldie .leaflet-popup-content-wrapper {
zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}
.leaflet-oldie .leaflet-popup-tip-container {
margin-top: -1px;
}
.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
border: 1px solid #999;
}
/* div icon */
.leaflet-div-icon {
background: #fff;
border: 1px solid #666;
}
/* Tooltip */
/* Base styles for the element that has a tooltip */
.leaflet-tooltip {
position: absolute;
padding: 6px;
background-color: #fff;
border: 1px solid #fff;
border-radius: 3px;
color: #222;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.leaflet-tooltip.leaflet-clickable {
cursor: pointer;
pointer-events: auto;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
position: absolute;
pointer-events: none;
border: 6px solid transparent;
background: transparent;
content: "";
}
/* Directions */
.leaflet-tooltip-bottom {
margin-top: 6px;
}
.leaflet-tooltip-top {
margin-top: -6px;
}
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-top:before {
left: 50%;
margin-left: -6px;
}
.leaflet-tooltip-top:before {
bottom: 0;
margin-bottom: -12px;
border-top-color: #fff;
}
.leaflet-tooltip-bottom:before {
top: 0;
margin-top: -12px;
margin-left: -6px;
border-bottom-color: #fff;
}
.leaflet-tooltip-left {
margin-left: -6px;
}
.leaflet-tooltip-right {
margin-left: 6px;
}
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
top: 50%;
margin-top: -6px;
}
.leaflet-tooltip-left:before {
right: 0;
margin-right: -12px;
border-left-color: #fff;
}
.leaflet-tooltip-right:before {
left: 0;
margin-left: -12px;
border-right-color: #fff;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
.list
{
width: 260px;
height: 25px;
line-height: 25px; /*should be the same as height*/
font-size: 12px;
}
.list li
{
list-style-type: none;
display: block;
position: relative;
top: 20px;
left: -30px;
border: 1px dotted #eaeaea;
background: white;
z-index: 100;
padding-left: 5px;
}
.list li:hover
{
background: rgba(128,200,128,1);
}
.list div
{
position:absolute;
width: 100%;
height: 100%;
text-align:center;
color: rgba(256,256,256,1);
background: #66aa66;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
}
.list div:hover
{
background: #66aa66;
color:rgba(220,220,256,1);
}
\ No newline at end of file
function get_kml_records_list(file) {
$.ajax({
url: "./get_kml.php?kml="+file,
success: function(data){
map_points = parse_kml($(data).find("PhotoOverlay"));
osm_place_points(map_points);
set_image_number(0);
}
});
}
function parse_kml(xml){
var points = new Array();
for (i=0;i<xml.length;i++) {
points[i] = new Array();
points[i].longitude=xml[i].getElementsByTagName("longitude")[0].firstChild.nodeValue;
points[i].latitude =xml[i].getElementsByTagName("latitude")[0].firstChild.nodeValue;
points[i].href =xml[i].getElementsByTagName("href")[0].firstChild.nodeValue;
points[i].thisnode = i;
}
return points;
}
/*!***************************************************************************
*! FILE NAME : os_map.js
*! DESCRIPTION: functions for OpenLayers Open Street Map API
*! Copyright (C) 2011 Elphel, Inc
*! -----------------------------------------------------------------------------**
*!
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*!
*! $Log: os_map.js,v $
*!
*/
var osmap;
var osm_points = new Array();
var osm_CurrentMarker;
var zoom=18;
var icon_eyesis4pi;
var icon_dot_green;
var icon_dot_blue;
function osm_init(){
icon_eyesis4pi = L.icon({
iconUrl: "icons/eyesis4pi_icon.png",
iconSize: [30,70],
iconAnchor: [15,70]
});
icon_dot_green = L.icon({
iconUrl: "icons/small_dot.png",
iconSize: [12,12],
iconAnchor: [6,6]
});
icon_dot_blue = L.icon({
iconUrl: "icons/small_dot_blue.png",
iconSize: [12,12],
iconAnchor: [6,6]
});
osmap = L.map('osmap').setView([40.723407, -111.932970], 12);
L.tileLayer('http://a.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data and images &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
maxZoom: zoom,
}).addTo(osmap);
/*
L.marker([40.723407, -111.932970],{icon:icon_eyesis4pi}).addTo(osmap).on("click",function(e){
console.log("Youclicked "+e.latlng);
this.setIcon(icon_dot_green);
});
*/
}
function osm_place_points(){
for (var i=map_points.length-1;i>=0;i--) {
osm_place_point(map_points[i],i);
}
osm_CurrentMarker = map_points[0];
}
function osm_place_point(mark,n) {
var icon;
if (n==0) {
osmap.setView([mark.latitude, mark.longitude]);
}
if (n==0) var icon = icon_eyesis4pi;
else var icon = icon_dot_green;
osm_create_marker(mark,icon);
}
function osm_create_marker(mark,icon) {
var point = L.marker([mark.latitude, mark.longitude],{icon:icon});
$(point).attr("index",mark.thisnode);
point.on("click",function(){
//clearInterval(intvl);
osm_set_current_position(mark);
set_image_number(mark.thisnode);
});
point.on("mouseover",function(){
if (mark.href!=osm_CurrentMarker.href) this.setIcon(icon_dot_blue);
});
point.on("mouseout",function(){
if (mark.href!=osm_CurrentMarker.href) this.setIcon(icon_dot_green);
});
point.addTo(osmap);
osm_points[mark.thisnode] = point;
}
function osm_set_current_position(mark) {
osm_set_icon(osm_CurrentMarker,icon_dot_green);
osm_set_icon(mark,icon_eyesis4pi);
osm_CurrentMarker = mark;
}
function osm_remove_marker(i) {
map.removeLayer(osm_points[i]);
}
function osm_set_icon(mark,icon) {
osm_points[mark.thisnode].setIcon(icon);
}
function osm_remove_points(){
for (i=0;i<map_points.length;i++) {
osm_remove_marker(i);
}
}
#camerawindow {
position: absolute;
top: 5px;
left: 5px;
width:1170px;
height:585px;
padding:5px;
background:#99ff99;
}
.invisible_element {
position:absolute;
display:none;
visibility:hidden;
}
.round_borders {
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
#input_image_number {
width:45px;
height: 25px;
border: 1px solid #808080;
text-align: right;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
#sign_div { position: absolute; top: 420px; left: 0px; width: 2700px; height: 20px; padding:3px 3px 3px 3px;}
#left_div { position : absolute; top: 0px; left: 600px; width: 300px; text-align: center; font-weight: bold;}
#front_div { position : absolute; top: 0px; left: 1200px; width: 300px; text-align: center; font-weight: bold;}
#right_div { position : absolute; top: 0px; left: 1800px; width: 300px; text-align: center; font-weight: bold;}
#rear_div { position : absolute; top: 0px; left: 2400px; width: 300px; text-align: center; font-weight: bold;}
#larger_preview {
position: absolute;
top: 625px;
left: 430px;
}
#options {
position: absolute;
top: 660px;
left: 430px;
}
#input_date_list {
position: absolute;
top: 695px;
left: 430px;
}
#status_div {
position: absolute;
top: 860px;
left: 430px;
width: 300px;
height: 50px;
font-size: 20px;
font-weight: bold;
}
#status {
position: absolute;
top: 0px;
left: 100px;
font-size: 40px;
}
#copy_button_div {
position: absolute;
top: 820px;
left: 430px;
}
#input_text_div {
position: absolute;
top: 735px;
left: 430px;
}
#filename_div {
position: absolute;
top: 780px;
left: 430px;
}
#filename {
position: absolute;
top: 0px;
left: 120px;
font-size: 20px;
font-weight: bold;
}
#osmap_wrap {
position:absolute;
top: 625px;
left: 10px;
width: 400px;
height: 300px;
background: black;
padding: 3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
overflow: hidden;
}
#osmap {
width: 400px;
height: 300px;
overflow: hidden;
}
a.button {
font-size:12px;
color:#fff;
display:inline-block;
text-align:center;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
background:#66aa66;
}
a.button:hover {
color:#fff;
background:#66bb66;
}
a.button:active {
background:#4195dd;
background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#003C82), to(#4195dd));
background:-moz-linear-gradient(0% 90% 90deg, #4195dd, #003C82);
}
#button1,
#button2
{
font-size:14px;
font-weight: bold;
width: 25px;
height: 25px;
line-height: 25px;
/*line-height: 15px; /*should be the same as height*/*/
}
#copy_button{
width: 60px;
height: 25px;
line-height: 25px;
}
#copy_all_button {
width: 60px;
height: 25px;
line-height: 25px;
}
#copy_path {
width: 220px;
height: 25px;
border: 1px solid #808080;
text-align: left;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
#panos_number {
width:45px;
height: 25px;
border: 1px solid #808080;
text-align: right;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
/*!*******************************************************************************
*! FILE NAME : panorama_preview.js
*! DESCRIPTION : panorama previewer's js functions
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
var baseWidth = 194;
var baseHeight = 146;
var W = 2592;
var H = 1944;
var load_counter = 0;
var settings_file = "settings.xml";
// sort
var cams = [
{"ip":"192.168.0.161","port":2326,"channel":3,"master":0,"logger":0,"index":4},
{"ip":"192.168.0.161","port":2325,"channel":2,"master":0,"logger":0,"index":3},
{"ip":"192.168.0.161","port":2323,"channel":0,"master":0,"logger":1,"index":1},
{"ip":"192.168.0.161","port":2324,"channel":1,"master":0,"logger":0,"index":2},
{"ip":"192.168.0.162","port":2326,"channel":3,"master":0,"logger":0,"index":8},
{"ip":"192.168.0.162","port":2325,"channel":2,"master":0,"logger":0,"index":7},
{"ip":"192.168.0.162","port":2323,"channel":0,"master":0,"logger":0,"index":5},
{"ip":"192.168.0.162","port":2324,"channel":1,"master":0,"logger":0,"index":6},
{"ip":"192.168.0.163","port":2325,"channel":2,"master":1,"logger":0,"index":9},
{"ip":"192.168.0.163","port":2326,"channel":3,"master":0,"logger":0,"index":10}
];
var cnv;
var cContext;
var refresh_counter=0;
var CurrentImageNumber=0;
var image_name = new Array(8);
// globals for map
var osm_markers = new Array();
var kml_response;
var map_points = new Array();
var N=0;
$(function(){
get_dates();
osm_init();
// init canvas
cnv = document.getElementById('canvas');
cContext = cnv.getContext('2d');
cnv.setAttribute('width',baseHeight*8);cnv.setAttribute('height',baseWidth*3);
// init hidden canvases
for(var i=0;i<cams.length;i++){
append_hidden_div(i);
}
//rewriteURL();
//read_settings();
});
function append_hidden_div(index){
el = $("<div>",{
id: "div_"+index
}).css({
//position: "absolute",
//top: "1000px",
//left: (index*200)+"px",
display: "none"
});
el.attr("index",index);
el.on("canvas_ready",function(){
//can draw on main canvas
var cnv = $(this).find("#display")[0];
var index = $(this).attr("index");
draw_image(cnv,index);
load_counter++;
if (load_counter==8){
//clear
clearInterval(intvl);
document.getElementById('status').innerHTML= "Done.";
}
});
$("body").append(el);
}
function remove_hidden_div(index){
$("#div_"+index).off("canvas_ready");
$("#div_"+index).remove();
}
function draw_image(img,index){
var w = baseWidth;
var h = baseHeight;
index = +index;
cContext.rotate(90*Math.PI/180);
if (index%2==0) {
cContext.drawImage(img, 0,0*h,w,h, 0*w,-1*h*(index+1),w,h);
cContext.drawImage(img, 0,1*h,w,h, 1*w,-1*h*(index+1),w,h);
cContext.scale(-1,1);
cContext.drawImage(img, 0,2*h,w,h, -3*w, -1*h*(index+1), w, h);
cContext.scale(-1,1);
}else{
cContext.scale(1,-1); //mirror is needed
cContext.drawImage(img, 0,0*h,w,h, 0*w,index*h,w,h);
cContext.drawImage(img, 0,1*h,w,h, 1*w,index*h,w,h);
cContext.scale(-1,1);
cContext.drawImage(img, 0,2*h,w,h, -3*w,h*(index),w,h);
cContext.scale(-1,1);
cContext.scale(1,-1);
}
cContext.rotate(-90*Math.PI/180);
}
function refresh_images(){
refresh_counter=0;
intvl=setInterval("refresh_time()",500);
image_full_name($('#input_date_list').attr('value'),$("#input_image_number").val());
}
function refresh_time() {
refresh_counter++;
if (refresh_counter%3==1) document.getElementById('status').innerHTML = "Working.";
else if (refresh_counter%3==2) document.getElementById('status').innerHTML = "Working..";
else document.getElementById('status').innerHTML = "Working...";
if (refresh_counter==120) {
clearInterval(intvl);
refresh_counter=0;
document.getElementById('status').innerHTML = "Timeout.";
}
}
var images_list;
function image_full_name(folder, image_number) {
$.ajax({
url: "./panorama_preview.php?type=jp4&folder=/data/footage/"+folder,
success: function(data){
images_list = $(data).find("f");
var mode = "jp4";
if ($("#jpeg_mode").attr("checked")) mode = "jpeg";
for (var i=0;i<8;i++) {
var tmp_string = images_list[+image_number].firstChild.data;
tmp_string = tmp_string.substring(0,tmp_string.lastIndexOf("_")+1)+(i+1)+tmp_string.substring(tmp_string.indexOf("."),tmp_string.length);
image_name[i] = "./jp4-proxy.php?n=tmp/"+i+"&url=/data/footage/"+folder+"/"+tmp_string+"&mode="+mode;
}
var tmp_smth = images_list[+image_number].firstChild.data;
var tmp_smth_part1 = tmp_smth.substring(0,tmp_smth.lastIndexOf("/"));
var tmp_smth_part2 = tmp_smth.substring(tmp_smth.lastIndexOf("/")+1);
$("#filename").html(tmp_smth);
//form a link
tmp_string = "./fullsize_canvas.php?settings="+settings_file+"&width=2592&height=1944&path=/data/footage/"+folder+"/"+tmp_smth_part1+"&name="+tmp_smth_part2;
$("#larger_preview").html("<a href='"+tmp_string+"'>Full size preview</a>");
$("#canvas_link").attr("href",tmp_string);
$("#canvas_link").attr("title","Click for a full size preview");
load_counter = 0;
for (var i=0;i<8;i++){
remove_hidden_div(i);
append_hidden_div(i);
$("#div_"+i).jp4({image:image_name[cams[i].index-1],width:200,fast:true});
}
}
});
}
function set_image_number(k) {
old_number = document.getElementById('input_image_number').value;
image_change(k-old_number);
}
function refresh_map() {
new_number = document.getElementById('input_image_number').value;
image_change(new_number-CurrentImageNumber);
}
function image_change(delta) {
old_number = CurrentImageNumber;//document.getElementById('input_image_number').value;
new_number = +old_number + delta;
//if (new_number==0) new_number = 1;
document.getElementById('input_image_number').value=new_number;
CurrentImageNumber = new_number;
//set_icon(old_number,icon_dot);
//set_icon(new_number,icon_eyesis);
osm_set_current_position(map_points[new_number]);
refresh_images();
}
function get_dates() {
//get_folder_list("",'input_date_list');
get_folder_list_request("/data/footage/","","input_date_list");
}
function folder_list_fill(folder_list,element_id){
var list = "<ul>";
for(var i=0; i<folder_list.length; i++) {
list = list + "<li>"+folder_list[i].firstChild.data+"</li>";
}
list = list + "</ul>";
document.getElementById(element_id).innerHTML= list;
// init list
jquery_list("input_date_list","Choose Date");
// extra click bind
var list_elements=$('#input_date_list').find('li');
list_elements.each(function(i) {
var li = $(this);
li.click(function(){
//get_folders();
osm_remove_points();
get_kml_records_list("/data/footage/"+$(this).html()+"/map_points.kml");
//map_points = parse_kml(kml_response);
//console.log(map_points);
//osm_set_current_position(mark);
//refresh_images();
//return false;
});
});
}
function get_folder_list_request(some_folder,type,element_id,mode) {
$.ajax({
url: "./panorama_preview.php?type="+type+"&folder="+some_folder,
success: function(data){
folder_list_fill($(data).find("f"),element_id);
}
});
}
function new_item_selected() {
set_image_number(0);
}
function copy_files() {
var panos_number = $("#panos_number").val();
var src_folder="/data/footage/"+$('#input_date_list').attr('value')+"/";
var image_number = $('#input_image_number').val();
var dest_path= $('#copy_path').val();
for (var i=0; i<panos_number; i++) {
var src_file = images_list[+image_number+i].firstChild.data;
request = "./copy.php?folder="+src_folder+"&file="+src_file+"&dest_path="+dest_path+"&imagej=/data/post-processing/imagej_processed";
$.ajax({
url: request,
async: true,
});
}
}
var intvl2;
function copy_all(){
intvl2=setInterval("refresh_time_2('Copying')",500);
$.ajax({
url: "copy_all.php?src=/data/footage/"+$('#input_date_list').attr('value')+"&dest="+$('#copy_path').val()+"&imagej=/data/post-processing/imagej_processed",
async: true,
success: function(){
clearInterval(invl2);
$('#status').html("Done.");
}
});
}
function rewriteURL(){
var parameters=location.href.replace(/\?/ig,"&").split("&");
for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("=");
for (var i=1;i<parameters.length;i++) {
switch (parameters[i][0]) {
case "settings": settings_file = parameters[i][1];break;
}
}
if (location.href.lastIndexOf("?")==-1) {
baseURL = location.href;
}else{
baseURL = location.href.substring(0,location.href.lastIndexOf("?"));
}
newURL="?settings="+settings_file;
window.history.pushState('index.html', 'Title', baseURL+newURL);
}
importScripts('elphel.js');
self.onmessage = function(e) {
var W = e.data.width;
var H = e.data.height;
var Mosaic = e.data.mosaic;
var Format = e.data.format;
var settings = e.data.settings;
var Pixels = new Uint8Array(e.data.pixels);
var reorderedPixels = Elphel.Pixels.reorderBlocksJPx(Pixels,W,H,Format,Mosaic,settings.fast);
//reorder first then downscale
if (settings.fast){
W = W/2;
H = H/2;
}
Elphel.Pixels.applySaturation(reorderedPixels,W,H,2);
postMessage({
width: W,
height: H,
pixels: reorderedPixels.buffer
},[reorderedPixels.buffer]);
//Elphel.test();
};
\ No newline at end of file
<?php
/*!*******************************************************************************
*! FILE NAME : panorama_preview.php
*! DESCRIPTION : gets the file list
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
$url = $_GET["folder"];
$type = $_GET["type"];
$filelist = scandir($url);
$i=0;
$pre_res_xml="";
//echo "<pre>";
foreach ($filelist as $value) {
//printf($value."\n");
process_folder($value,$type);
}
flush_xml($pre_res_xml);
function process_folder($file,$type) {
global $pre_res_xml;
global $url;
$ext=get_file_extension($file);
// exclude "." & ".."
if (substr($file,0,1)!=".") {
if ($ext=="") {
if (is_dir($url."/".$file)) {
//echo $url." ".$file."\n";
if ($type=="") {
$pre_res_xml .= "<f>$file</f>\n";
//echo "<f>$file</f>\n";
}
else {
$list = scandir($url."/".$file);
foreach($list as $elem){
if (get_file_extension($url."/".$file."/".$elem)==$type) {
if (strstr($elem,"_1.")) $pre_res_xml .= "<f>$file/$elem</f>\n";
//echo "<f>$elem</f>\n";
}
}
}
}
}else{
//if (($type=="jp4") && strstr($file,"_1.")) $pre_res_xml .= "<f>$file</f>\n";
}
}
}
function get_file_extension($filename) {
//return substr(strrchr($filename, '.'), 1);
return pathinfo($filename, PATHINFO_EXTENSION);
}
function flush_xml($pre_res_xml) {
$res_xml = "<?xml version='1.0' standalone='yes'?>\n";
$res_xml .="<folder_list>\n";
$res_xml .= $pre_res_xml;
$res_xml .="</folder_list>\n";
header("Content-Type: text/xml");
header("Content-Length: ".strlen($res_xml)."\n");
header("Pragma: no-cache\n");
printf("%s", $res_xml);
flush();
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment