diff --git a/app/Http/Controllers/Admin/DefaultController.php b/app/Http/Controllers/Admin/DefaultController.php index f7db8bd..9d75ae4 100644 --- a/app/Http/Controllers/Admin/DefaultController.php +++ b/app/Http/Controllers/Admin/DefaultController.php @@ -15,6 +15,7 @@ use App\Http\Requests\SaveSettingsRequest; use App\Label; use App\Mail\TestMailConfig; use App\Photo; +use App\Services\GithubService; use App\Services\PhotoService; use App\Storage; use App\User; @@ -33,6 +34,48 @@ class DefaultController extends Controller View::share('is_admin', true); } + public function about() + { + return Theme::render('admin.about', [ + 'current_version' => config('app.version'), + 'licence_text' => file_get_contents(sprintf('%s/LICENSE', dirname(dirname(dirname(dirname(__DIR__)))))) + ]); + } + + public function aboutLatestRelease() + { + try + { + $githubService = new GithubService(); + $releaseInfo = $githubService->checkForLatestRelease(); + + // Convert the publish date so we can re-format it with the user's settings + $publishDate = \DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $releaseInfo->published_at); + + // HTML-ify the body text + $body = nl2br($releaseInfo->body); + $body = preg_replace('/\*\*(.+)\*\*/', '$1', $body); + + // Remove the "v" from the release name + $version = substr($releaseInfo->name, 1); + + // Determine if we can upgrade + $canUpgrade = version_compare($version, config('app.version')) > 0; + + return response()->json([ + 'can_upgrade' => $canUpgrade, + 'body' => $body, + 'name' => $version, + 'publish_date' => $publishDate->format(UserConfig::get('date_format')), + 'url' => $releaseInfo->html_url + ]); + } + catch (\Exception $ex) + { + return response()->json(['error' => $ex->getMessage()]); + } + } + public function metadataUpgrade() { $albums = DbHelper::getAlbumsForCurrentUser(); diff --git a/app/Services/GithubService.php b/app/Services/GithubService.php new file mode 100644 index 0000000..4c36159 --- /dev/null +++ b/app/Services/GithubService.php @@ -0,0 +1,100 @@ +config = config('services.github'); + $this->cacheFile = storage_path('app/github_cache.txt'); + } + + public function checkForLatestRelease() + { + $releaseInfo = []; + $etag = ''; + + if ($this->doesCacheExist()) + { + // Get the etag from the cache + $cacheData = $this->getCacheData(); + $etag = $cacheData->latest_release->etag; + $releaseInfo = $cacheData->latest_release->release_info; + } + + // Lookup and store the version information + $statusCode = -1; + $result = $this->getLatestReleaseFromGithub($etag, $statusCode); + + if ($statusCode == 200) + { + // Store the etag (in HTTP headers) for future reference + $matches = []; + $etag = ''; + if (preg_match('/^etag: "(.+)"/mi', $result[0], $matches)) + { + $etag = $matches[1]; + } + + $releaseInfo = json_decode($result[1]); + } + + if (!empty($etag)) + { + $this->setCacheData([ + 'latest_release' => [ + 'etag' => $etag, + 'release_info' => $releaseInfo + ] + ]); + } + + return $releaseInfo; + } + + private function doesCacheExist() + { + return file_exists($this->cacheFile); + } + + private function getCacheData() + { + return json_decode(file_get_contents($this->cacheFile)); + } + + private function getLatestReleaseFromGithub($etag = '', &$statusCode) + { + $httpHeaders = [ + sprintf('User-Agent: pandy06269/blue-twilight (v%s)', config('app.version')) + ]; + + if (!empty($etag)) + { + $httpHeaders[] = sprintf('If-None-Match: "%s"', $etag); + } + + $ch = curl_init($this->config['latest_release_url']); + curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders); + curl_setopt($ch, CURLOPT_HEADER, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $result = curl_exec($ch); + + if ($result === false) + { + throw new \Exception(sprintf('Error from Github: %s', curl_error($ch))); + } + + $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + return explode("\r\n\r\n", $result, 2); + } + + private function setCacheData(array $data) + { + file_put_contents($this->cacheFile, json_encode($data)); + } +} \ No newline at end of file diff --git a/config/services.php b/config/services.php index 37d7599..091aafe 100644 --- a/config/services.php +++ b/config/services.php @@ -14,6 +14,10 @@ return [ | */ + 'github' => [ + 'latest_release_url' => 'https://api.github.com/repos/pandy06269/blue-twilight/releases/latest' + ], + 'recaptcha' => [ 'verify_url' => 'https://www.google.com/recaptcha/api/siteverify' ] diff --git a/public/css/blue-twilight.css b/public/css/blue-twilight.css index 6105dea..ddd77e2 100644 --- a/public/css/blue-twilight.css +++ b/public/css/blue-twilight.css @@ -7,6 +7,11 @@ margin-top: 5px; } +.meta-label, +.meta-value { + vertical-align: middle !important; +} + .photo .loading { background-color: #ffffff; display: none; @@ -23,6 +28,14 @@ .photo .loading img { margin-top: 40px; } + +.text-red { + color: #ff0000; +} + +[v-cloak] { + display: none; +} .album-slideshow-container #image-preview { height: 600px; max-width: 100%; diff --git a/public/css/blue-twilight.min.css b/public/css/blue-twilight.min.css index 9bbbc54..673f9ce 100644 --- a/public/css/blue-twilight.min.css +++ b/public/css/blue-twilight.min.css @@ -1,4 +1,4 @@ -.admin-sidebar-card{margin-bottom:15px}.album-expand-handle{cursor:pointer;margin-top:5px}.photo .loading{background-color:#fff;display:none;height:100%;left:0;opacity:.8;position:absolute;text-align:center;top:0;width:100%;z-index:1000}.photo .loading img{margin-top:40px}.album-slideshow-container #image-preview{height:600px;max-width:100%;width:800px}.album-slideshow-container #image-preview img{max-width:100%}.album-slideshow-container .thumbnails{overflow-x:scroll;overflow-y:hidden;white-space:nowrap;width:auto}.stats-table .icon-col{font-size:1.4em;width:20%;vertical-align:middle}.stats-table .stat-col{font-size:1.8em;font-weight:bold;width:40%}.stats-table .text-col{font-size:1.2em;vertical-align:middle;width:40%}html{font-size:14px !important}button,input,optgroup,select,textarea{cursor:pointer;font-family:inherit !important}.album-photo-cards .card{margin-bottom:15px}.container,.container-fluid{margin-top:20px}.hidden{display:none}.tab-content{border:solid 1px #ddd;border-top:0;padding:20px}.tether-element,.tether-element:after,.tether-element:before,.tether-element *,.tether-element *:after,.tether-element *:before{box-sizing:border-box}.tether-element{position:absolute;display:none}.tether-element.tether-open{display:block}.tether-element.tether-theme-basic{max-width:100%;max-height:100%}.tether-element.tether-theme-basic .tether-content{border-radius:5px;box-shadow:0 2px 8px rgba(0,0,0,0.2);font-family:inherit;background:#fff;color:inherit;padding:1em;font-size:1.1em;line-height:1.5em}.tether-element,.tether-element:after,.tether-element:before,.tether-element *,.tether-element *:after,.tether-element *:before{box-sizing:border-box}.tether-element{position:absolute;display:none}.tether-element.tether-open{display:block}.tt-query{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.tt-hint{color:#999}.tt-menu{width:422px;margin-top:4px;padding:4px 0;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.tt-suggestion{padding:3px 20px;line-height:24px}.tt-suggestion.tt-cursor,.tt-suggestion:hover{color:#fff;background-color:#0097cf}.tt-suggestion p{margin:0}/*! +.admin-sidebar-card{margin-bottom:15px}.album-expand-handle{cursor:pointer;margin-top:5px}.meta-label,.meta-value{vertical-align:middle !important}.photo .loading{background-color:#fff;display:none;height:100%;left:0;opacity:.8;position:absolute;text-align:center;top:0;width:100%;z-index:1000}.photo .loading img{margin-top:40px}.text-red{color:red}[v-cloak]{display:none}.album-slideshow-container #image-preview{height:600px;max-width:100%;width:800px}.album-slideshow-container #image-preview img{max-width:100%}.album-slideshow-container .thumbnails{overflow-x:scroll;overflow-y:hidden;white-space:nowrap;width:auto}.stats-table .icon-col{font-size:1.4em;width:20%;vertical-align:middle}.stats-table .stat-col{font-size:1.8em;font-weight:bold;width:40%}.stats-table .text-col{font-size:1.2em;vertical-align:middle;width:40%}html{font-size:14px !important}button,input,optgroup,select,textarea{cursor:pointer;font-family:inherit !important}.album-photo-cards .card{margin-bottom:15px}.container,.container-fluid{margin-top:20px}.hidden{display:none}.tab-content{border:solid 1px #ddd;border-top:0;padding:20px}.tether-element,.tether-element:after,.tether-element:before,.tether-element *,.tether-element *:after,.tether-element *:before{box-sizing:border-box}.tether-element{position:absolute;display:none}.tether-element.tether-open{display:block}.tether-element.tether-theme-basic{max-width:100%;max-height:100%}.tether-element.tether-theme-basic .tether-content{border-radius:5px;box-shadow:0 2px 8px rgba(0,0,0,0.2);font-family:inherit;background:#fff;color:inherit;padding:1em;font-size:1.1em;line-height:1.5em}.tether-element,.tether-element:after,.tether-element:before,.tether-element *,.tether-element *:after,.tether-element *:before{box-sizing:border-box}.tether-element{position:absolute;display:none}.tether-element.tether-open{display:block}.tt-query{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.tt-hint{color:#999}.tt-menu{width:422px;margin-top:4px;padding:4px 0;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.tt-suggestion{padding:3px 20px;line-height:24px}.tt-suggestion.tt-cursor,.tt-suggestion:hover{color:#fff;background-color:#0097cf}.tt-suggestion p{margin:0}/*! * Bootstrap v4.0.0-beta (https://getbootstrap.com) * Copyright 2011-2017 The Bootstrap Authors * Copyright 2011-2017 Twitter, Inc. diff --git a/public/js/blue-twilight.js b/public/js/blue-twilight.js index 86c2068..81604fc 100644 --- a/public/js/blue-twilight.js +++ b/public/js/blue-twilight.js @@ -22198,6 +22198,53 @@ return Tether; })); +/** + * This model is used by admin/about.blade.php, to perform a version check against Github. + * @constructor + */ +function AboutViewModel(urls) { + this.el = '#about-app'; + + this.data = { + can_upgrade: false, + is_loading: true, + version_body: '', + version_date: '', + version_name: '', + version_url: '' + }; + + this.computed = { + }; + + this.methods = { + init: function () { + var self = this; + + $.ajax( + urls.latest_release_url, + { + complete: function() { + self.is_loading = false; + }, + dataType: 'json', + error: function (xhr, textStatus, errorThrown) { + }, + method: 'GET', + success: function (data) { + self.version_body = data.body; + self.version_date = data.publish_date; + self.version_name = data.name; + self.version_url = data.url; + + // Set this last so any watchers on this property execute after all version data has been set + self.can_upgrade = data.can_upgrade; + } + } + ); + } + }; +} /** * This model is used by admin/analyse_album.blade.php, to analyse all images. * @constructor diff --git a/public/js/blue-twilight.min.js b/public/js/blue-twilight.min.js index e6adfdf..c5bf630 100644 --- a/public/js/blue-twilight.min.js +++ b/public/js/blue-twilight.min.js @@ -1 +1 @@ -function AnalyseAlbumViewModel(){this.el="#analyse-album",this.data={imagesFailed:[],imagesToAnalyse:[],imagesInProgress:[],imagesRecentlyCompleted:[],numberSuccessful:0,numberFailed:0},this.computed={failedPercentage:function(){var t=0;return this.numberTotal>0&&(t=this.numberFailed/this.numberTotal*100),t.toFixed(2)+"%"},isCompleted:function(){return this.numberTotal>0&&this.numberSuccessful+this.numberFailed>=this.numberTotal},latestCompletedImages:function(){var t=this.imagesRecentlyCompleted.length-3<0?0:this.imagesRecentlyCompleted.length-3,e=t+3;return this.imagesRecentlyCompleted.slice(t,e)},numberTotal:function(){return this.imagesToAnalyse.length},successfulPercentage:function(){var t=0;return this.numberTotal>0&&(t=this.numberSuccessful/this.numberTotal*100),t.toFixed(2)+"%"}},this.methods={analyseImage:function(t){var e=this;this.imagesToAnalyse.push(t),$.ajax(t.url,{beforeSend:function(){e.imagesInProgress.push(t)},dataType:"json",error:function(n,i,r){e.numberFailed++,e.imagesFailed.push({name:t.name,reason:i}),t.isSuccessful=!1,t.isPending=!1},method:"POST",success:function(n){if(n.is_successful){e.numberSuccessful++,t.isSuccessful=!0,t.isPending=!1,e.imagesRecentlyCompleted.push(t);var i=e.imagesInProgress.indexOf(t);i>-1&&e.imagesInProgress.splice(i,1)}else e.numberFailed++,e.imagesFailed.push({name:t.name,reason:n.message}),t.isSuccessful=!1,t.isPending=!1}})}}}function AnalyseImageViewModel(t){this.isPending=!0,this.isSuccessful=!1,this.name=t.name,this.photoID=t.photo_id,this.url=t.url}function EditPhotosViewModel(t,e,n){this.el="#photos-tab",this.data={albums:[],bulkModifyMethod:"",isSubmitting:!1,photoIDs:[],photoIDsAvailable:[],selectAllInAlbum:0},this.methods={bulkModifySelected:function(t){if(this.isSubmitting)return!0;var n=this,i=$(t.target).closest("form");return"change_album"===this.bulkModifyMethod?(this.promptForNewAlbum(function(t){var e=$("select",t).val();$('input[name="new-album-id"]',i).val(e),n.isSubmitting=!0,$('button[name="bulk-apply"]',i).click(),_bt_showLoadingModal()}),t.preventDefault(),!1):"delete"!==this.bulkModifyMethod||(bootbox.dialog({message:e.delete_bulk_confirm_message,title:e.delete_bulk_confirm_title,buttons:{cancel:{label:e.action_cancel,className:"btn-secondary"},confirm:{label:e.action_delete,className:"btn-danger",callback:function(){n.isSubmitting=!0,$('button[name="bulk-apply"]',i).click(),_bt_showLoadingModal()}}}}),t.preventDefault(),!1)},changeAlbum:function(t){this.selectPhotoSingle(t.target);var e=this.photoIDs[0];return this.photoIDs=[],this.promptForNewAlbum(function(t){var i=$("select",t).val();$.post(n.move_photo.replace(/\/0$/,"/"+e),{new_album_id:i},function(){window.location.reload()})}),t.preventDefault(),!1},deletePhoto:function(t){var i=this;this.selectPhotoSingle(t.target);var r=i.photoIDs[0];return this.photoIDs=[],bootbox.dialog({message:e.delete_confirm_message,title:e.delete_confirm_title,buttons:{cancel:{label:e.action_cancel,className:"btn-secondary"},confirm:{label:e.action_delete,className:"btn-danger",callback:function(){var t=n.delete_photo;t=t.replace(/\/0$/,"/"+r),$(".loading",parent).show(),$.post(t,{_method:"DELETE"},function(t){window.location.reload()})}}}}),t.preventDefault(),!1},flip:function(t,e,i){var r=n.flip_photo;r=r.replace("/0/","/"+this.photoIDs[0]+"/"),r=t?r.replace(/\/-1\//,"/1/"):r.replace(/\/-1\//,"/0/"),r=e?r.replace(/\/-2$/,"/1"):r.replace(/\/-2$/,"/0"),$(".loading",i).show(),$.post(r,function(){var t=$("img.photo-thumbnail",i),e=t.data("original-src");t.attr("src",e+"&_="+(new Date).getTime()),$(".loading",i).hide()}),this.photoIDs=[]},flipBoth:function(t){return this.selectPhotoSingle(t.target),this.flip(!0,!0,$(t.target).closest(".photo")),t.preventDefault(),!1},flipHorizontal:function(t){return this.selectPhotoSingle(t.target),this.flip(!0,!1,$(t.target).closest(".photo")),t.preventDefault(),!1},flipVertical:function(t){return this.selectPhotoSingle(t.target),this.flip(!1,!0,$(t.target).closest(".photo")),t.preventDefault(),!1},isPhotoSelected:function(t){return this.photoIDs.indexOf(t)>-1?"checked":""},promptForNewAlbum:function(n){for(var i=this.albums,r=$("",t.querySelectorAll("[msallowcapture^='']").length&&P.push("[*^$]="+tt+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||P.push("\\["+tt+"*(?:value|"+Z+")"),t.querySelectorAll("[id~="+$+"-]").length||P.push("~="),t.querySelectorAll(":checked").length||P.push(":checked"),t.querySelectorAll("a#"+$+"+*").length||P.push(".#.+[+~]")}),r(function(t){t.innerHTML="";var e=I.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&P.push("name"+tt+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&P.push(":enabled",":disabled"),M.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&P.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),P.push(",.*:")})),(_.matchesSelector=pt.test(F=M.matches||M.webkitMatchesSelector||M.mozMatchesSelector||M.oMatchesSelector||M.msMatchesSelector))&&r(function(t){_.disconnectedMatch=F.call(t,"*"),F.call(t,"[s!='']:x"),L.push("!=",it)}),P=P.length&&new RegExp(P.join("|")),L=L.length&&new RegExp(L.join("|")),e=pt.test(M.compareDocumentPosition),R=e||pt.test(M.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},q=e?function(t,e){if(t===e)return D=!0,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n||(1&(n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!_.sortDetached&&e.compareDocumentPosition(t)===n?t===I||t.ownerDocument===j&&R(j,t)?-1:e===I||e.ownerDocument===j&&R(j,e)?1:A?J(A,t)-J(A,e):0:4&n?-1:1)}:function(t,e){if(t===e)return D=!0,0;var n,i=0,r=t.parentNode,o=e.parentNode,s=[t],l=[e];if(!r||!o)return t===I?-1:e===I?1:r?-1:o?1:A?J(A,t)-J(A,e):0;if(r===o)return a(t,e);for(n=t;n=n.parentNode;)s.unshift(n);for(n=e;n=n.parentNode;)l.unshift(n);for(;s[i]===l[i];)i++;return i?a(s[i],l[i]):s[i]===j?-1:l[i]===j?1:0},I):I},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==I&&E(t),n=n.replace(lt,"='$1']"),_.matchesSelector&&N&&!z[n+" "]&&(!L||!L.test(n))&&(!P||!P.test(n)))try{var i=F.call(t,n);if(i||_.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){}return e(n,I,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==I&&E(t),R(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==I&&E(t);var n=x.attrHandle[e.toLowerCase()],i=n&&U.call(x.attrHandle,e.toLowerCase())?n(t,e,!N):void 0;return void 0!==i?i:_.attributes||!N?t.getAttribute(e):(i=t.getAttributeNode(e))&&i.specified?i.value:null},e.escape=function(t){return(t+"").replace(bt,_t)},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,n=[],i=0,r=0;if(D=!_.detectDuplicates,A=!_.sortStable&&t.slice(0),t.sort(q),D){for(;e=t[r++];)e===t[r]&&(i=n.push(r));for(;i--;)t.splice(n[i],1)}return A=null,t},w=e.getText=function(t){var e,n="",i=0,r=t.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=w(t)}else if(3===r||4===r)return t.nodeValue}else for(;e=t[i++];)n+=w(e);return n},(x=e.selectors={cacheLength:50,createPseudo:i,match:dt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(vt,yt),t[3]=(t[3]||t[4]||t[5]||"").replace(vt,yt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return dt.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&ut.test(n)&&(e=S(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(vt,yt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=B[t+" "];return e||(e=new RegExp("(^|"+tt+")"+t+"("+tt+"|$)"))&&B(t,function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,n,i){return function(r){var o=e.attr(r,t);return null==o?"!="===n:!n||(o+="","="===n?o===i:"!="===n?o!==i:"^="===n?i&&0===o.indexOf(i):"*="===n?i&&o.indexOf(i)>-1:"$="===n?i&&o.slice(-i.length)===i:"~="===n?(" "+o.replace(rt," ")+" ").indexOf(i)>-1:"|="===n&&(o===i||o.slice(0,i.length+1)===i+"-"))}},CHILD:function(t,e,n,i,r){var o="nth"!==t.slice(0,3),a="last"!==t.slice(-4),s="of-type"===e;return 1===i&&0===r?function(t){return!!t.parentNode}:function(e,n,l){var u,c,d,f,h,p,g=o!==a?"nextSibling":"previousSibling",m=e.parentNode,v=s&&e.nodeName.toLowerCase(),y=!l&&!s,b=!1;if(m){if(o){for(;g;){for(f=e;f=f[g];)if(s?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;p=g="only"===t&&!p&&"nextSibling"}return!0}if(p=[a?m.firstChild:m.lastChild],a&&y){for(b=(h=(u=(c=(d=(f=m)[$]||(f[$]={}))[f.uniqueID]||(d[f.uniqueID]={}))[t]||[])[0]===H&&u[1])&&u[2],f=h&&m.childNodes[h];f=++h&&f&&f[g]||(b=h=0)||p.pop();)if(1===f.nodeType&&++b&&f===e){c[t]=[H,h,b];break}}else if(y&&(b=h=(u=(c=(d=(f=e)[$]||(f[$]={}))[f.uniqueID]||(d[f.uniqueID]={}))[t]||[])[0]===H&&u[1]),!1===b)for(;(f=++h&&f&&f[g]||(b=h=0)||p.pop())&&((s?f.nodeName.toLowerCase()!==v:1!==f.nodeType)||!++b||(y&&((c=(d=f[$]||(f[$]={}))[f.uniqueID]||(d[f.uniqueID]={}))[t]=[H,b]),f!==e)););return(b-=r)===i||b%i==0&&b/i>=0}}},PSEUDO:function(t,n){var r,o=x.pseudos[t]||x.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return o[$]?o(n):o.length>1?(r=[t,t,"",n],x.setFilters.hasOwnProperty(t.toLowerCase())?i(function(t,e){for(var i,r=o(t,n),a=r.length;a--;)t[i=J(t,r[a])]=!(e[i]=r[a])}):function(t){return o(t,0,r)}):o}},pseudos:{not:i(function(t){var e=[],n=[],r=k(t.replace(ot,"$1"));return r[$]?i(function(t,e,n,i){for(var o,a=r(t,null,i,[]),s=t.length;s--;)(o=a[s])&&(t[s]=!(e[s]=o))}):function(t,i,o){return e[0]=t,r(e,null,o,n),e[0]=null,!n.pop()}}),has:i(function(t){return function(n){return e(t,n).length>0}}),contains:i(function(t){return t=t.replace(vt,yt),function(e){return(e.textContent||e.innerText||w(e)).indexOf(t)>-1}}),lang:i(function(t){return ct.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(vt,yt).toLowerCase(),function(e){var n;do{if(n=N?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===M},focus:function(t){return t===I.activeElement&&(!I.hasFocus||I.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:s(!1),disabled:s(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!x.pseudos.empty(t)},header:function(t){return ht.test(t.nodeName)},input:function(t){return ft.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:l(function(){return[0]}),last:l(function(t,e){return[e-1]}),eq:l(function(t,e,n){return[n<0?n+e:n]}),even:l(function(t,e){for(var n=0;n=0;)t.push(i);return t}),gt:l(function(t,e,n){for(var i=n<0?n+e:n;++i2&&"ID"===(a=o[0]).type&&9===e.nodeType&&N&&x.relative[o[1].type]){if(!(e=(x.find.ID(a.matches[0].replace(vt,yt),e)||[])[0]))return n;c&&(e=e.parentNode),t=t.slice(o.shift().value.length)}for(r=dt.needsContext.test(t)?0:o.length;r--&&(a=o[r],!x.relative[s=a.type]);)if((l=x.find[s])&&(i=l(a.matches[0].replace(vt,yt),mt.test(o[0].type)&&u(e.parentNode)||e))){if(o.splice(r,1),!(t=i.length&&d(o)))return Q.apply(n,i),n;break}}return(c||k(t,f))(i,e,!N,n,!e||mt.test(t)&&u(e.parentNode)||e),n},_.sortStable=$.split("").sort(q).join("")===$,_.detectDuplicates=!!D,E(),_.sortDetached=r(function(t){return 1&t.compareDocumentPosition(I.createElement("fieldset"))}),r(function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")})||o("type|href|height|width",function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),_.attributes&&r(function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||o("value",function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue}),r(function(t){return null==t.getAttribute("disabled")})||o(Z,function(t,e,n){var i;if(!n)return!0===t[e]?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.value:null}),e}(t);ht.find=yt,ht.expr=yt.selectors,ht.expr[":"]=ht.expr.pseudos,ht.uniqueSort=ht.unique=yt.uniqueSort,ht.text=yt.getText,ht.isXMLDoc=yt.isXML,ht.contains=yt.contains,ht.escapeSelector=yt.escape;var bt=function(t,e,n){for(var i=[],r=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(r&&ht(t).is(n))break;i.push(t)}return i},_t=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},xt=ht.expr.match.needsContext,wt=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Ct=/^.[^:#\[\.,]*$/;ht.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?ht.find.matchesSelector(i,t)?[i]:[]:ht.find.matches(t,ht.grep(e,function(t){return 1===t.nodeType}))},ht.fn.extend({find:function(t){var e,n,i=this.length,r=this;if("string"!=typeof t)return this.pushStack(ht(t).filter(function(){for(e=0;e1?ht.uniqueSort(n):n},filter:function(t){return this.pushStack(o(this,t||[],!1))},not:function(t){return this.pushStack(o(this,t||[],!0))},is:function(t){return!!o(this,"string"==typeof t&&xt.test(t)?ht(t):t||[],!1).length}});var St,kt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ht.fn.init=function(t,e,n){var i,r;if(!t)return this;if(n=n||St,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:kt.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof ht?e[0]:e,ht.merge(this,ht.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:et,!0)),wt.test(i[1])&&ht.isPlainObject(e))for(i in e)ht.isFunction(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(r=et.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):ht.isFunction(t)?void 0!==n.ready?n.ready(t):t(ht):ht.makeArray(t,this)}).prototype=ht.fn,St=ht(et);var Tt=/^(?:parents|prev(?:Until|All))/,Ot={children:!0,contents:!0,next:!0,prev:!0};ht.fn.extend({has:function(t){var e=ht(t,this),n=e.length;return this.filter(function(){for(var t=0;t-1:1===n.nodeType&&ht.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?ht.uniqueSort(o):o)},index:function(t){return t?"string"==typeof t?at.call(ht(t),this[0]):at.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(ht.uniqueSort(ht.merge(this.get(),ht(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),ht.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return bt(t,"parentNode")},parentsUntil:function(t,e,n){return bt(t,"parentNode",n)},next:function(t){return a(t,"nextSibling")},prev:function(t){return a(t,"previousSibling")},nextAll:function(t){return bt(t,"nextSibling")},prevAll:function(t){return bt(t,"previousSibling")},nextUntil:function(t,e,n){return bt(t,"nextSibling",n)},prevUntil:function(t,e,n){return bt(t,"previousSibling",n)},siblings:function(t){return _t((t.parentNode||{}).firstChild,t)},children:function(t){return _t(t.firstChild)},contents:function(t){return r(t,"iframe")?t.contentDocument:(r(t,"template")&&(t=t.content||t),ht.merge([],t.childNodes))}},function(t,e){ht.fn[t]=function(n,i){var r=ht.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=ht.filter(i,r)),this.length>1&&(Ot[t]||ht.uniqueSort(r),Tt.test(t)&&r.reverse()),this.pushStack(r)}});var At=/[^\x20\t\r\n\f]+/g;ht.Callbacks=function(t){t="string"==typeof t?s(t):ht.extend({},t);var e,n,i,r,o=[],a=[],l=-1,u=function(){for(r=r||t.once,i=e=!0;a.length;l=-1)for(n=a.shift();++l-1;)o.splice(n,1),n<=l&&l--}),this},has:function(t){return t?ht.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return r=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return r=a=[],n||e||(o=n=""),this},locked:function(){return!!r},fireWith:function(t,n){return r||(n=[t,(n=n||[]).slice?n.slice():n],a.push(n),e||u()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!i}};return c},ht.extend({Deferred:function(e){var n=[["notify","progress",ht.Callbacks("memory"),ht.Callbacks("memory"),2],["resolve","done",ht.Callbacks("once memory"),ht.Callbacks("once memory"),0,"resolved"],["reject","fail",ht.Callbacks("once memory"),ht.Callbacks("once memory"),1,"rejected"]],i="pending",r={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return r.then(null,t)},pipe:function(){var t=arguments;return ht.Deferred(function(e){ht.each(n,function(n,i){var r=ht.isFunction(t[i[4]])&&t[i[4]];o[i[1]](function(){var t=r&&r.apply(this,arguments);t&&ht.isFunction(t.promise)?t.promise().progress(e.notify).done(e.resolve).fail(e.reject):e[i[0]+"With"](this,r?[t]:arguments)})}),t=null}).promise()},then:function(e,i,r){function o(e,n,i,r){return function(){var s=this,c=arguments,d=function(){var t,d;if(!(e=a&&(i!==u&&(s=void 0,c=[t]),n.rejectWith(s,c))}};e?f():(ht.Deferred.getStackHook&&(f.stackTrace=ht.Deferred.getStackHook()),t.setTimeout(f))}}var a=0;return ht.Deferred(function(t){n[0][3].add(o(0,t,ht.isFunction(r)?r:l,t.notifyWith)),n[1][3].add(o(0,t,ht.isFunction(e)?e:l)),n[2][3].add(o(0,t,ht.isFunction(i)?i:u))}).promise()},promise:function(t){return null!=t?ht.extend(t,r):r}},o={};return ht.each(n,function(t,e){var a=e[2],s=e[5];r[e[1]]=a.add,s&&a.add(function(){i=s},n[3-t][2].disable,n[0][2].lock),a.add(e[3].fire),o[e[0]]=function(){return o[e[0]+"With"](this===o?void 0:this,arguments),this},o[e[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(t){var e=arguments.length,n=e,i=Array(n),r=it.call(arguments),o=ht.Deferred(),a=function(t){return function(n){i[t]=this,r[t]=arguments.length>1?it.call(arguments):n,--e||o.resolveWith(i,r)}};if(e<=1&&(c(t,o.done(a(n)).resolve,o.reject,!e),"pending"===o.state()||ht.isFunction(r[n]&&r[n].then)))return o.then();for(;n--;)c(r[n],a(n),o.reject);return o.promise()}});var Dt=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ht.Deferred.exceptionHook=function(e,n){t.console&&t.console.warn&&e&&Dt.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,n)},ht.readyException=function(e){t.setTimeout(function(){throw e})};var Et=ht.Deferred();ht.fn.ready=function(t){return Et.then(t).catch(function(t){ht.readyException(t)}),this},ht.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--ht.readyWait:ht.isReady)||(ht.isReady=!0,!0!==t&&--ht.readyWait>0||Et.resolveWith(et,[ht]))}}),ht.ready.then=Et.then,"complete"===et.readyState||"loading"!==et.readyState&&!et.documentElement.doScroll?t.setTimeout(ht.ready):(et.addEventListener("DOMContentLoaded",d),t.addEventListener("load",d));var It=function(t,e,n,i,r,o,a){var s=0,l=t.length,u=null==n;if("object"===ht.type(n)){r=!0;for(s in n)It(t,e,s,n[s],!0,o,a)}else if(void 0!==i&&(r=!0,ht.isFunction(i)||(a=!0),u&&(a?(e.call(t,i),e=null):(u=e,e=function(t,e,n){return u.call(ht(t),n)})),e))for(;s1,null,!0)},removeData:function(t){return this.each(function(){Pt.remove(this,t)})}}),ht.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=Nt.get(t,e),n&&(!i||Array.isArray(n)?i=Nt.access(t,e,ht.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=ht.queue(t,e),i=n.length,r=n.shift(),o=ht._queueHooks(t,e);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===e&&n.unshift("inprogress"),delete o.stop,r.call(t,function(){ht.dequeue(t,e)},o)),!i&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return Nt.get(t,n)||Nt.access(t,n,{empty:ht.Callbacks("once memory").add(function(){Nt.remove(t,[e+"queue",n])})})}}),ht.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length\x20\t\r\n\f]+)/i,qt=/^$|\/(?:java|ecma)script/i,Ut={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Ut.optgroup=Ut.option,Ut.tbody=Ut.tfoot=Ut.colgroup=Ut.caption=Ut.thead,Ut.th=Ut.td;var Yt=/<|&#?\w+;/;!function(){var t=et.createDocumentFragment().appendChild(et.createElement("div")),e=et.createElement("input");e.setAttribute("type","radio"),e.setAttribute("checked","checked"),e.setAttribute("name","t"),t.appendChild(e),ft.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",ft.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Kt=et.documentElement,Gt=/^key/,Qt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Xt=/^([^.]*)(?:\.(.+)|)/;ht.event={global:{},add:function(t,e,n,i,r){var o,a,s,l,u,c,d,f,h,p,g,m=Nt.get(t);if(m)for(n.handler&&(n=(o=n).handler,r=o.selector),r&&ht.find.matchesSelector(Kt,r),n.guid||(n.guid=ht.guid++),(l=m.events)||(l=m.events={}),(a=m.handle)||(a=m.handle=function(e){return void 0!==ht&&ht.event.triggered!==e.type?ht.event.dispatch.apply(t,arguments):void 0}),u=(e=(e||"").match(At)||[""]).length;u--;)h=g=(s=Xt.exec(e[u])||[])[1],p=(s[2]||"").split(".").sort(),h&&(d=ht.event.special[h]||{},h=(r?d.delegateType:d.bindType)||h,d=ht.event.special[h]||{},c=ht.extend({type:h,origType:g,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&ht.expr.match.needsContext.test(r),namespace:p.join(".")},o),(f=l[h])||((f=l[h]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(t,i,p,a)||t.addEventListener&&t.addEventListener(h,a)),d.add&&(d.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),r?f.splice(f.delegateCount++,0,c):f.push(c),ht.event.global[h]=!0)},remove:function(t,e,n,i,r){var o,a,s,l,u,c,d,f,h,p,g,m=Nt.hasData(t)&&Nt.get(t);if(m&&(l=m.events)){for(u=(e=(e||"").match(At)||[""]).length;u--;)if(s=Xt.exec(e[u])||[],h=g=s[1],p=(s[2]||"").split(".").sort(),h){for(d=ht.event.special[h]||{},f=l[h=(i?d.delegateType:d.bindType)||h]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=f.length;o--;)c=f[o],!r&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||i&&i!==c.selector&&("**"!==i||!c.selector)||(f.splice(o,1),c.selector&&f.delegateCount--,d.remove&&d.remove.call(t,c));a&&!f.length&&(d.teardown&&!1!==d.teardown.call(t,p,m.handle)||ht.removeEvent(t,h,m.handle),delete l[h])}else for(h in l)ht.event.remove(t,h+e[u],n,i,!0);ht.isEmptyObject(l)&&Nt.remove(t,"handle events")}},dispatch:function(t){var e,n,i,r,o,a,s=ht.event.fix(t),l=new Array(arguments.length),u=(Nt.get(this,"events")||{})[s.type]||[],c=ht.event.special[s.type]||{};for(l[0]=s,e=1;e=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==t.type||!0!==u.disabled)){for(o=[],a={},n=0;n-1:ht.find(r,this,null,[u]).length),a[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return u=this,l\x20\t\r\n\f]*)[^>]*)\/>/gi,Zt=/\s*$/g;ht.extend({htmlPrefilter:function(t){return t.replace(Jt,"<$1>")},clone:function(t,e,n){var i,r,o,a,s=t.cloneNode(!0),l=ht.contains(t.ownerDocument,t);if(!(ft.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||ht.isXMLDoc(t)))for(a=y(s),i=0,r=(o=y(t)).length;i0&&b(a,!l&&y(t,"script")),s},cleanData:function(t){for(var e,n,i,r=ht.event.special,o=0;void 0!==(n=t[o]);o++)if(Mt(n)){if(e=n[Nt.expando]){if(e.events)for(i in e.events)r[i]?ht.event.remove(n,i):ht.removeEvent(n,i,e.handle);n[Nt.expando]=void 0}n[Pt.expando]&&(n[Pt.expando]=void 0)}}}),ht.fn.extend({detach:function(t){return I(this,t,!0)},remove:function(t){return I(this,t)},text:function(t){return It(this,function(t){return void 0===t?ht.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return E(this,arguments,function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||k(this,t).appendChild(t)})},prepend:function(){return E(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=k(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return E(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return E(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(ht.cleanData(y(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return ht.clone(this,t,e)})},html:function(t){return It(this,function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Zt.test(t)&&!Ut[(zt.exec(t)||["",""])[1].toLowerCase()]){t=ht.htmlPrefilter(t);try{for(;n1)}}),ht.Tween=j,j.prototype={constructor:j,init:function(t,e,n,i,r,o){this.elem=t,this.prop=n,this.easing=r||ht.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=o||(ht.cssNumber[n]?"":"px")},cur:function(){var t=j.propHooks[this.prop];return t&&t.get?t.get(this):j.propHooks._default.get(this)},run:function(t){var e,n=j.propHooks[this.prop];return this.options.duration?this.pos=e=ht.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):j.propHooks._default.set(this),this}},j.prototype.init.prototype=j.prototype,j.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=ht.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){ht.fx.step[t.prop]?ht.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[ht.cssProps[t.prop]]&&!ht.cssHooks[t.prop]?t.elem[t.prop]=t.now:ht.style(t.elem,t.prop,t.now+t.unit)}}},j.propHooks.scrollTop=j.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},ht.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},ht.fx=j.prototype.init,ht.fx.step={};var fe,he,pe=/^(?:toggle|show|hide)$/,ge=/queueHooks$/;ht.Animation=ht.extend(q,{tweeners:{"*":[function(t,e){var n=this.createTween(t,e);return g(n.elem,t,$t.exec(e),n),n}]},tweener:function(t,e){ht.isFunction(t)?(e=t,t=["*"]):t=t.match(At);for(var n,i=0,r=t.length;i1)},removeAttr:function(t){return this.each(function(){ht.removeAttr(this,t)})}}),ht.extend({attr:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===t.getAttribute?ht.prop(t,e,n):(1===o&&ht.isXMLDoc(t)||(r=ht.attrHooks[e.toLowerCase()]||(ht.expr.match.bool.test(e)?me:void 0)),void 0!==n?null===n?void ht.removeAttr(t,e):r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:(t.setAttribute(e,n+""),n):r&&"get"in r&&null!==(i=r.get(t,e))?i:null==(i=ht.find.attr(t,e))?void 0:i)},attrHooks:{type:{set:function(t,e){if(!ft.radioValue&&"radio"===e&&r(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,i=0,r=e&&e.match(At);if(r&&1===t.nodeType)for(;n=r[i++];)t.removeAttribute(n)}}),me={set:function(t,e,n){return!1===e?ht.removeAttr(t,n):t.setAttribute(n,n),n}},ht.each(ht.expr.match.bool.source.match(/\w+/g),function(t,e){var n=ve[e]||ht.find.attr;ve[e]=function(t,e,i){var r,o,a=e.toLowerCase();return i||(o=ve[a],ve[a]=r,r=null!=n(t,e,i)?a:null,ve[a]=o),r}});var ye=/^(?:input|select|textarea|button)$/i,be=/^(?:a|area)$/i;ht.fn.extend({prop:function(t,e){return It(this,ht.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[ht.propFix[t]||t]})}}),ht.extend({prop:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ht.isXMLDoc(t)||(e=ht.propFix[e]||e,r=ht.propHooks[e]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:t[e]=n:r&&"get"in r&&null!==(i=r.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=ht.find.attr(t,"tabindex");return e?parseInt(e,10):ye.test(t.nodeName)||be.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),ft.optSelected||(ht.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),ht.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ht.propFix[this.toLowerCase()]=this}),ht.fn.extend({addClass:function(t){var e,n,i,r,o,a,s,l=0;if(ht.isFunction(t))return this.each(function(e){ht(this).addClass(t.call(this,e,Y(this)))});if("string"==typeof t&&t)for(e=t.match(At)||[];n=this[l++];)if(r=Y(n),i=1===n.nodeType&&" "+U(r)+" "){for(a=0;o=e[a++];)i.indexOf(" "+o+" ")<0&&(i+=o+" ");r!==(s=U(i))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,i,r,o,a,s,l=0;if(ht.isFunction(t))return this.each(function(e){ht(this).removeClass(t.call(this,e,Y(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(At)||[];n=this[l++];)if(r=Y(n),i=1===n.nodeType&&" "+U(r)+" "){for(a=0;o=e[a++];)for(;i.indexOf(" "+o+" ")>-1;)i=i.replace(" "+o+" "," ");r!==(s=U(i))&&n.setAttribute("class",s)}return this},toggleClass:function(t,e){var n=typeof t;return"boolean"==typeof e&&"string"===n?e?this.addClass(t):this.removeClass(t):ht.isFunction(t)?this.each(function(n){ht(this).toggleClass(t.call(this,n,Y(this),e),e)}):this.each(function(){var e,i,r,o;if("string"===n)for(i=0,r=ht(this),o=t.match(At)||[];e=o[i++];)r.hasClass(e)?r.removeClass(e):r.addClass(e);else void 0!==t&&"boolean"!==n||((e=Y(this))&&Nt.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":Nt.get(this,"__className__")||""))})},hasClass:function(t){var e,n,i=0;for(e=" "+t+" ";n=this[i++];)if(1===n.nodeType&&(" "+U(Y(n))+" ").indexOf(e)>-1)return!0;return!1}});var _e=/\r/g;ht.fn.extend({val:function(t){var e,n,i,r=this[0];if(arguments.length)return i=ht.isFunction(t),this.each(function(n){var r;1===this.nodeType&&(null==(r=i?t.call(this,n,ht(this).val()):t)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=ht.map(r,function(t){return null==t?"":t+""})),(e=ht.valHooks[this.type]||ht.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,r,"value")||(this.value=r))});if(r)return(e=ht.valHooks[r.type]||ht.valHooks[r.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(_e,""):null==n?"":n}}),ht.extend({valHooks:{option:{get:function(t){var e=ht.find.attr(t,"value");return null!=e?e:U(ht.text(t))}},select:{get:function(t){var e,n,i,o=t.options,a=t.selectedIndex,s="select-one"===t.type,l=s?null:[],u=s?a+1:o.length;for(i=a<0?u:s?a:0;i-1)&&(n=!0);return n||(t.selectedIndex=-1),o}}}}),ht.each(["radio","checkbox"],function(){ht.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=ht.inArray(ht(t).val(),e)>-1}},ft.checkOn||(ht.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var xe=/^(?:focusinfocus|focusoutblur)$/;ht.extend(ht.event,{trigger:function(e,n,i,r){var o,a,s,l,u,c,d,f=[i||et],h=ut.call(e,"type")?e.type:e,p=ut.call(e,"namespace")?e.namespace.split("."):[];if(a=s=i=i||et,3!==i.nodeType&&8!==i.nodeType&&!xe.test(h+ht.event.triggered)&&(h.indexOf(".")>-1&&(h=(p=h.split(".")).shift(),p.sort()),u=h.indexOf(":")<0&&"on"+h,e=e[ht.expando]?e:new ht.Event(h,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),n=null==n?[e]:ht.makeArray(n,[e]),d=ht.event.special[h]||{},r||!d.trigger||!1!==d.trigger.apply(i,n))){if(!r&&!d.noBubble&&!ht.isWindow(i)){for(l=d.delegateType||h,xe.test(l+h)||(a=a.parentNode);a;a=a.parentNode)f.push(a),s=a;s===(i.ownerDocument||et)&&f.push(s.defaultView||s.parentWindow||t)}for(o=0;(a=f[o++])&&!e.isPropagationStopped();)e.type=o>1?l:d.bindType||h,(c=(Nt.get(a,"events")||{})[e.type]&&Nt.get(a,"handle"))&&c.apply(a,n),(c=u&&a[u])&&c.apply&&Mt(a)&&(e.result=c.apply(a,n),!1===e.result&&e.preventDefault());return e.type=h,r||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(f.pop(),n)||!Mt(i)||u&&ht.isFunction(i[h])&&!ht.isWindow(i)&&((s=i[u])&&(i[u]=null),ht.event.triggered=h,i[h](),ht.event.triggered=void 0,s&&(i[u]=s)),e.result}},simulate:function(t,e,n){var i=ht.extend(new ht.Event,n,{type:t,isSimulated:!0});ht.event.trigger(i,null,e)}}),ht.fn.extend({trigger:function(t,e){return this.each(function(){ht.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];if(n)return ht.event.trigger(t,e,n,!0)}}),ht.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(t,e){ht.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}}),ht.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),ft.focusin="onfocusin"in t,ft.focusin||ht.each({focus:"focusin",blur:"focusout"},function(t,e){var n=function(t){ht.event.simulate(e,t.target,ht.event.fix(t))};ht.event.special[e]={setup:function(){var i=this.ownerDocument||this,r=Nt.access(i,e);r||i.addEventListener(t,n,!0),Nt.access(i,e,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this,r=Nt.access(i,e)-1;r?Nt.access(i,e,r):(i.removeEventListener(t,n,!0),Nt.remove(i,e))}}});var we=t.location,Ce=ht.now(),Se=/\?/;ht.parseXML=function(e){var n;if(!e||"string"!=typeof e)return null;try{n=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||ht.error("Invalid XML: "+e),n};var ke=/\[\]$/,Te=/\r?\n/g,Oe=/^(?:submit|button|image|reset|file)$/i,Ae=/^(?:input|select|textarea|keygen)/i;ht.param=function(t,e){var n,i=[],r=function(t,e){var n=ht.isFunction(e)?e():e;i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(t)||t.jquery&&!ht.isPlainObject(t))ht.each(t,function(){r(this.name,this.value)});else for(n in t)K(n,t[n],e,r);return i.join("&")},ht.fn.extend({serialize:function(){return ht.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=ht.prop(this,"elements");return t?ht.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!ht(this).is(":disabled")&&Ae.test(this.nodeName)&&!Oe.test(t)&&(this.checked||!Vt.test(t))}).map(function(t,e){var n=ht(this).val();return null==n?null:Array.isArray(n)?ht.map(n,function(t){return{name:e.name,value:t.replace(Te,"\r\n")}}):{name:e.name,value:n.replace(Te,"\r\n")}}).get()}});var De=/%20/g,Ee=/#.*$/,Ie=/([?&])_=[^&]*/,Me=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ne=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Pe=/^(?:GET|HEAD)$/,Le=/^\/\//,Fe={},Re={},$e="*/".concat("*"),je=et.createElement("a");je.href=we.href,ht.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:we.href,type:"GET",isLocal:Ne.test(we.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$e,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":ht.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?X(X(t,ht.ajaxSettings),e):X(ht.ajaxSettings,t)},ajaxPrefilter:G(Fe),ajaxTransport:G(Re),ajax:function(e,n){function i(e,n,i,s){var u,f,h,_,x,w=n;c||(c=!0,l&&t.clearTimeout(l),r=void 0,a=s||"",C.readyState=e>0?4:0,u=e>=200&&e<300||304===e,i&&(_=J(p,C,i)),_=Z(p,_,C,u),u?(p.ifModified&&((x=C.getResponseHeader("Last-Modified"))&&(ht.lastModified[o]=x),(x=C.getResponseHeader("etag"))&&(ht.etag[o]=x)),204===e||"HEAD"===p.type?w="nocontent":304===e?w="notmodified":(w=_.state,f=_.data,u=!(h=_.error))):(h=w,!e&&w||(w="error",e<0&&(e=0))),C.status=e,C.statusText=(n||w)+"",u?v.resolveWith(g,[f,w,C]):v.rejectWith(g,[C,w,h]),C.statusCode(b),b=void 0,d&&m.trigger(u?"ajaxSuccess":"ajaxError",[C,p,u?f:h]),y.fireWith(g,[C,w]),d&&(m.trigger("ajaxComplete",[C,p]),--ht.active||ht.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=void 0),n=n||{};var r,o,a,s,l,u,c,d,f,h,p=ht.ajaxSetup({},n),g=p.context||p,m=p.context&&(g.nodeType||g.jquery)?ht(g):ht.event,v=ht.Deferred(),y=ht.Callbacks("once memory"),b=p.statusCode||{},_={},x={},w="canceled",C={readyState:0,getResponseHeader:function(t){var e;if(c){if(!s)for(s={};e=Me.exec(a);)s[e[1].toLowerCase()]=e[2];e=s[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(t,e){return null==c&&(t=x[t.toLowerCase()]=x[t.toLowerCase()]||t,_[t]=e),this},overrideMimeType:function(t){return null==c&&(p.mimeType=t),this},statusCode:function(t){var e;if(t)if(c)C.always(t[C.status]);else for(e in t)b[e]=[b[e],t[e]];return this},abort:function(t){var e=t||w;return r&&r.abort(e),i(0,e),this}};if(v.promise(C),p.url=((e||p.url||we.href)+"").replace(Le,we.protocol+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(At)||[""],null==p.crossDomain){u=et.createElement("a");try{u.href=p.url,u.href=u.href,p.crossDomain=je.protocol+"//"+je.host!=u.protocol+"//"+u.host}catch(t){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=ht.param(p.data,p.traditional)),Q(Fe,p,n,C),c)return C;(d=ht.event&&p.global)&&0==ht.active++&&ht.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Pe.test(p.type),o=p.url.replace(Ee,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(De,"+")):(h=p.url.slice(o.length),p.data&&(o+=(Se.test(o)?"&":"?")+p.data,delete p.data),!1===p.cache&&(o=o.replace(Ie,"$1"),h=(Se.test(o)?"&":"?")+"_="+Ce+++h),p.url=o+h),p.ifModified&&(ht.lastModified[o]&&C.setRequestHeader("If-Modified-Since",ht.lastModified[o]),ht.etag[o]&&C.setRequestHeader("If-None-Match",ht.etag[o])),(p.data&&p.hasContent&&!1!==p.contentType||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+$e+"; q=0.01":""):p.accepts["*"]);for(f in p.headers)C.setRequestHeader(f,p.headers[f]);if(p.beforeSend&&(!1===p.beforeSend.call(g,C,p)||c))return C.abort();if(w="abort",y.add(p.complete),C.done(p.success),C.fail(p.error),r=Q(Re,p,n,C)){if(C.readyState=1,d&&m.trigger("ajaxSend",[C,p]),c)return C;p.async&&p.timeout>0&&(l=t.setTimeout(function(){C.abort("timeout")},p.timeout));try{c=!1,r.send(_,i)}catch(t){if(c)throw t;i(-1,t)}}else i(-1,"No Transport");return C},getJSON:function(t,e,n){return ht.get(t,e,n,"json")},getScript:function(t,e){return ht.get(t,void 0,e,"script")}}),ht.each(["get","post"],function(t,e){ht[e]=function(t,n,i,r){return ht.isFunction(n)&&(r=r||i,i=n,n=void 0),ht.ajax(ht.extend({url:t,type:e,dataType:r,data:n,success:i},ht.isPlainObject(t)&&t))}}),ht._evalUrl=function(t){return ht.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},ht.fn.extend({wrapAll:function(t){var e;return this[0]&&(ht.isFunction(t)&&(t=t.call(this[0])),e=ht(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return ht.isFunction(t)?this.each(function(e){ht(this).wrapInner(t.call(this,e))}):this.each(function(){var e=ht(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=ht.isFunction(t);return this.each(function(n){ht(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(t){return this.parent(t).not("body").each(function(){ht(this).replaceWith(this.childNodes)}),this}}),ht.expr.pseudos.hidden=function(t){return!ht.expr.pseudos.visible(t)},ht.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},ht.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var He={0:200,1223:204},We=ht.ajaxSettings.xhr();ft.cors=!!We&&"withCredentials"in We,ft.ajax=We=!!We,ht.ajaxTransport(function(e){var n,i;if(ft.cors||We&&!e.crossDomain)return{send:function(r,o){var a,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(a in r)s.setRequestHeader(a,r[a]);n=function(t){return function(){n&&(n=i=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===t?s.abort():"error"===t?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(He[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),i=s.onerror=n("error"),void 0!==s.onabort?s.onabort=i:s.onreadystatechange=function(){4===s.readyState&&t.setTimeout(function(){n&&i()})},n=n("abort");try{s.send(e.hasContent&&e.data||null)}catch(t){if(n)throw t}},abort:function(){n&&n()}}}),ht.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=!1)}),ht.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return ht.globalEval(t),t}}}),ht.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),ht.ajaxTransport("script",function(t){if(t.crossDomain){var e,n;return{send:function(i,r){e=ht("